456209 - Bad ContextClassLoader in WebSocket onMessage

+ Sets the class loader on an incoming frame to the
  class loader that loaded the web socket session

Also-by: Michael MacFadden <michael@macfadden.org>
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2014-12-29 12:10:55 -07:00
parent e8c88cfd9c
commit a79b154d1b
1 changed files with 12 additions and 3 deletions

View File

@ -303,10 +303,19 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc
@Override
public void incomingFrame(Frame frame)
{
if (connection.getIOState().isInputAvailable())
ClassLoader old = Thread.currentThread().getContextClassLoader();
try
{
// Forward Frames Through Extension List
incomingHandler.incomingFrame(frame);
Thread.currentThread().setContextClassLoader(classLoader);
if (connection.getIOState().isInputAvailable())
{
// Forward Frames Through Extension List
incomingHandler.incomingFrame(frame);
}
}
finally
{
Thread.currentThread().setContextClassLoader(old);
}
}