cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [6/9] cxf git commit: Need to get field initialized on Jetty 9.3
Date Thu, 12 Nov 2015 15:23:32 GMT
Need to get  field initialized on Jetty 9.3


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/033815a0
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/033815a0
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/033815a0

Branch: refs/heads/3.1.x-fixes
Commit: 033815a0e180b8e1abfcc0c1acdbeb0219ad256d
Parents: 29a9b9e
Author: Daniel Kulp <dkulp@apache.org>
Authored: Wed Nov 11 10:48:25 2015 -0500
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Thu Nov 12 10:23:04 2015 -0500

----------------------------------------------------------------------
 .../websocket/jetty9/Jetty9WebSocketDestination.java      | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/033815a0/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty9/Jetty9WebSocketDestination.java
----------------------------------------------------------------------
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty9/Jetty9WebSocketDestination.java
b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty9/Jetty9WebSocketDestination.java
index 3f51712..bb94430 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty9/Jetty9WebSocketDestination.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/jetty9/Jetty9WebSocketDestination.java
@@ -22,6 +22,7 @@ package org.apache.cxf.transport.websocket.jetty9;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Field;
 import java.nio.ByteBuffer;
 import java.security.Principal;
 import java.util.Enumeration;
@@ -82,10 +83,19 @@ public class Jetty9WebSocketDestination extends JettyHTTPDestination implements
             webSocketFactory = (WebSocketServletFactory)ClassLoaderUtils
                 .loadClass("org.eclipse.jetty.websocket.server.WebSocketServerFactory",
                            WebSocketServletFactory.class).newInstance();
+            
         } catch (InstantiationException | IllegalAccessException | ClassNotFoundException
e) {
             throw new RuntimeException(e);
         }
         webSocketFactory.setCreator(new Creator());
+        
+        try {
+            Field f = webSocketFactory.getClass().getDeclaredField("objectFactory");
+            f.setAccessible(true);
+            f.set(webSocketFactory, f.getType().newInstance());
+        } catch (Throwable t) {
+            //ignore, on Jetty <=9.2 this field doesn't exist
+        }
         executor = bus.getExtension(WorkQueueManager.class).getAutomaticWorkQueue();
     }
     


Mime
View raw message