cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject git commit: More updates to get more of the jaxrs tests passing with Jetty 9
Date Fri, 08 Aug 2014 19:59:57 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 52663125a -> bb1edc5dd


More updates to get more of the jaxrs tests passing with Jetty 9


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

Branch: refs/heads/master
Commit: bb1edc5dd96c50ed2c3294f6834310e0a6d4381e
Parents: 5266312
Author: Daniel Kulp <dkulp@apache.org>
Authored: Fri Aug 8 15:58:50 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Fri Aug 8 15:58:50 2014 -0400

----------------------------------------------------------------------
 rt/frontend/jaxrs/pom.xml                       |  5 +--
 .../jaxrs/impl/ServletOutputStreamFilter.java   |  9 ++++++
 .../impl/tl/ThreadLocalHttpServletRequest.java  | 13 ++++++++
 .../impl/tl/ThreadLocalHttpServletResponse.java |  5 +++
 .../impl/tl/ThreadLocalServletContext.java      |  5 +++
 .../http_jetty/JettyHTTPDestination.java        | 33 ++++++++++----------
 .../transport/servlet/AbstractHTTPServlet.java  | 11 +++++--
 .../transport/servlet/ServletDestination.java   | 11 ++++++-
 .../websocket/WebSocketDestinationFactory.java  | 12 +++++--
 .../WebSocketVirtualServletRequest.java         | 16 +++++-----
 .../jetty9/Jetty9WebSocketDestination.java      | 32 +++++++++----------
 .../jaxrs/JAXRSClientServerStreamingTest.java   |  2 +-
 .../jaxrs/websocket/WebSocketTestClient.java    | 11 +++++--
 13 files changed, 113 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/bb1edc5d/rt/frontend/jaxrs/pom.xml
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/pom.xml b/rt/frontend/jaxrs/pom.xml
index 4c9078c..b387539 100644
--- a/rt/frontend/jaxrs/pom.xml
+++ b/rt/frontend/jaxrs/pom.xml
@@ -99,8 +99,9 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>${cxf.servlet-api.group}</groupId>
-            <artifactId>${cxf.servlet-api.artifact}</artifactId>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <version>3.1.0</version>
             <scope>provided</scope>
             <optional>true</optional>
         </dependency>

http://git-wip-us.apache.org/repos/asf/cxf/blob/bb1edc5d/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ServletOutputStreamFilter.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ServletOutputStreamFilter.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ServletOutputStreamFilter.java
index 13ddc44..31d6606 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ServletOutputStreamFilter.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ServletOutputStreamFilter.java
@@ -22,6 +22,7 @@ package org.apache.cxf.jaxrs.impl;
 import java.io.IOException;
 
 import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
 
 import org.apache.cxf.message.Message;
 import org.apache.cxf.transport.http.AbstractHTTPDestination;
@@ -57,4 +58,12 @@ public class ServletOutputStreamFilter extends ServletOutputStream {
     private void setComittedStatus() {
         m.getExchange().put(AbstractHTTPDestination.RESPONSE_COMMITED, Boolean.TRUE);
     }
+
+    //Servlet 3.1 additions
+    public boolean isReady() {
+        return os.isReady();
+    }
+    public void setWriteListener(WriteListener writeListener) {
+        os.setWriteListener(writeListener);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/bb1edc5d/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java
index 2444fc1..7f013d6 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java
@@ -40,6 +40,7 @@ import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpUpgradeHandler;
 import javax.servlet.http.Part;
 
 public class ThreadLocalHttpServletRequest extends AbstractThreadLocalProxy<HttpServletRequest>

@@ -313,4 +314,16 @@ public class ThreadLocalHttpServletRequest extends AbstractThreadLocalProxy<Http
     public void logout() throws ServletException {
         get().logout();
     }
+
+    //Servlet 3.1 additions
+    public long getContentLengthLong() {
+        return get().getContentLengthLong();
+    }
+    public String changeSessionId() {
+        return get().changeSessionId();
+    }
+    public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws
IOException,
+        ServletException {
+        return get().upgrade(handlerClass);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/bb1edc5d/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletResponse.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletResponse.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletResponse.java
index 62ef786..b973db8 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletResponse.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletResponse.java
@@ -191,6 +191,11 @@ public class ThreadLocalHttpServletResponse extends AbstractThreadLocalProxy<Htt
         return get().getStatus();
     }
 
+    //Servlet 3.1 additions
+    public void setContentLengthLong(long len) {
+        get().setContentLengthLong(len);
+    }
+
     
 
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/bb1edc5d/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalServletContext.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalServletContext.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalServletContext.java
index 54734c3..8df7e30 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalServletContext.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalServletContext.java
@@ -260,4 +260,9 @@ public class ThreadLocalServletContext extends AbstractThreadLocalProxy<ServletC
         return get().getJspConfigDescriptor();
     }
 
+    //Servlet 3.1 additions
+    public String getVirtualServerName() {
+        return get().getVirtualServerName();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/bb1edc5d/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
index 8b8f680..b2b22c0 100644
--- a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
+++ b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
@@ -43,20 +43,19 @@ import org.apache.cxf.configuration.jsse.TLSServerParameters;
 import org.apache.cxf.configuration.security.CertificateConstraintsType;
 import org.apache.cxf.continuations.ContinuationProvider;
 import org.apache.cxf.helpers.IOUtils;
-import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.io.CopyingOutputStream;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.transport.http.AbstractHTTPDestination;
 import org.apache.cxf.transport.http.DestinationRegistry;
 import org.apache.cxf.transport.http_jetty.continuations.JettyContinuationProvider;
 import org.apache.cxf.transport.https.CertConstraintsJaxBUtils;
+import org.apache.cxf.transport.servlet.ServletDestination;
 import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
 import org.eclipse.jetty.server.HttpOutput;
 import org.eclipse.jetty.server.Request;
 
 
-public class JettyHTTPDestination extends AbstractHTTPDestination {
+public class JettyHTTPDestination extends ServletDestination {
     
     private static final Logger LOG =
         LogUtils.getL7dLogger(JettyHTTPDestination.class);
@@ -93,7 +92,9 @@ public class JettyHTTPDestination extends AbstractHTTPDestination {
         //Add the default port if the address is missing it
         super(bus, registry, ei, getAddressValue(ei, true).getAddress(), true);
         this.serverEngineFactory = serverEngineFactory;
-        nurl = new URL(getAddress(endpointInfo));
+        if (serverEngineFactory != null) {
+            nurl = new URL(getAddress(endpointInfo));
+        }
         loader = bus.getExtension(ClassLoader.class);
     }
 
@@ -111,7 +112,9 @@ public class JettyHTTPDestination extends AbstractHTTPDestination {
     protected void retrieveEngine()
         throws GeneralSecurityException, 
                IOException {
-        
+        if (serverEngineFactory == null) {
+            return;
+        }
         engine = 
             serverEngineFactory.retrieveJettyHTTPServerEngine(nurl.getPort());
         if (engine == null) {
@@ -165,16 +168,12 @@ public class JettyHTTPDestination extends AbstractHTTPDestination {
     protected void activate() {
         super.activate();
         LOG.log(Level.FINE, "Activating receipt of incoming messages");
-        URL url = null;
-        try {
-            url = new URL(getAddress(endpointInfo));
-        } catch (Exception e) {
-            throw new Fault(e);
-        }
         // pick the handler supporting websocket if jetty-websocket is available otherwise
pick the default handler.
-        JettyHTTPHandler jhd = createJettyHTTPHandler(this, contextMatchOnExact());
-        engine.addServant(url, jhd);
-
+        
+        if (engine != null) {
+            JettyHTTPHandler jhd = createJettyHTTPHandler(this, contextMatchOnExact());
+            engine.addServant(nurl, jhd);
+        }
     }
 
     protected JettyHTTPHandler createJettyHTTPHandler(JettyHTTPDestination jhd,
@@ -188,7 +187,9 @@ public class JettyHTTPDestination extends AbstractHTTPDestination {
     protected void deactivate() {
         super.deactivate();
         LOG.log(Level.FINE, "Deactivating receipt of incoming messages");
-        engine.removeServant(nurl);   
+        if (engine != null) {
+            engine.removeServant(nurl);
+        }
     }   
      
 
@@ -366,7 +367,7 @@ public class JettyHTTPDestination extends AbstractHTTPDestination {
     protected void setupContinuation(Message inMessage,
                       final HttpServletRequest req, 
                       final HttpServletResponse resp) {
-        if (engine.getContinuationsEnabled()) {
+        if (engine != null && engine.getContinuationsEnabled()) {
             inMessage.put(ContinuationProvider.class.getName(), 
                       new JettyContinuationProvider(req, resp, inMessage));
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/bb1edc5d/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
index fa10aae..cf34de1 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
@@ -361,7 +361,7 @@ public abstract class AbstractHTTPServlet extends HttpServlet implements
Filter
                 new HttpServletRequestFilter(request, pathInfo, theServletPath, customServletPath);
             rd.forward(servletRequest, response);
         } catch (Throwable ex) {
-            throw new ServletException("RequestDispatcher for path " + pathInfo + " has failed");
+            throw new ServletException("RequestDispatcher for path " + pathInfo + " has failed",
ex);
         }   
     }
     
@@ -381,8 +381,13 @@ public abstract class AbstractHTTPServlet extends HttpServlet implements
Filter
             super(request);
             this.pathInfo = pathInfo;
             this.servletPath = servletPath;
-            if (pathInfo != null && "/".equals(this.servletPath) && !customServletPath)
{
-                this.servletPath = "";
+            if ("/".equals(this.servletPath) && !customServletPath) {
+                if (this.pathInfo == null) {
+                    this.pathInfo = "/";
+                    this.servletPath = "";                    
+                } else {
+                    this.servletPath = "";
+                }
             }
         }
         

http://git-wip-us.apache.org/repos/asf/cxf/blob/bb1edc5d/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
index 041f83a..6c9c2bc 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
@@ -51,7 +51,16 @@ public class ServletDestination extends AbstractHTTPDestination {
         // would add the default port to the address
         super(b, registry, ei, path, false);
     }
-    
+    public ServletDestination(Bus b,
+                              DestinationRegistry registry,
+                              EndpointInfo ei,
+                              String path,
+                              boolean dp)
+        throws IOException {
+        // would add the default port to the address
+        super(b, registry, ei, path, dp);
+    }
+        
     protected Logger getLogger() {
         return LOG;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/bb1edc5d/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
----------------------------------------------------------------------
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
index 1d07a57..8cdf745 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
@@ -68,9 +68,15 @@ public class WebSocketDestinationFactory implements HttpDestinationFactory
{
                 return new AtmosphereWebSocketServletDestination(bus, registry,
                                                                  endpointInfo, endpointInfo.getAddress());
             } else {
-                // use jetty-websocket
-                return new JettyWebSocketServletDestination(bus, registry,
-                                                            endpointInfo, endpointInfo.getAddress());
+                JettyHTTPServerEngineFactory serverEngineFactory = bus
+                    .getExtension(JettyHTTPServerEngineFactory.class);
+                if (serverEngineFactory.isJetty8()) { 
+                    // use jetty-websocket
+                    return new JettyWebSocketServletDestination(bus, registry,
+                                                                endpointInfo, endpointInfo.getAddress());
+                } else { 
+                    return new Jetty9WebSocketDestination(bus, registry, endpointInfo, null);
+                }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/bb1edc5d/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketVirtualServletRequest.java
----------------------------------------------------------------------
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketVirtualServletRequest.java
b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketVirtualServletRequest.java
index fabe28c..b4fa397 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketVirtualServletRequest.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketVirtualServletRequest.java
@@ -89,7 +89,7 @@ public class WebSocketVirtualServletRequest implements HttpServletRequest
{
     @Override
     public Object getAttribute(String name) {
         if (LOG.isLoggable(Level.INFO)) {
-            LOG.log(Level.INFO, "getAttribute({0})", name);
+            LOG.log(Level.INFO, "getAttribute({0}) -> {1}", new Object[] {name , attributes.get(name)});
         }
         return attributes.get(name);
     }
@@ -333,7 +333,7 @@ public class WebSocketVirtualServletRequest implements HttpServletRequest
{
 
     @Override
     public String getContextPath() {
-        LOG.log(Level.INFO, "getContextPath");
+        LOG.log(Level.INFO, "getContextPath -> " + webSocketHolder.getContextPath());
         return webSocketHolder.getContextPath();
     }
 
@@ -395,9 +395,9 @@ public class WebSocketVirtualServletRequest implements HttpServletRequest
{
 
     @Override
     public String getPathInfo() {
-        LOG.log(Level.INFO, "getPathInfo");
         String uri = requestHeaders.get(WebSocketUtils.URI_KEY);
-        String servletpath = webSocketHolder.getServletPath();
+        String servletpath = webSocketHolder.getServletPath();       
+        LOG.log(Level.INFO, "getPathInfo " + servletpath + " " + uri);
         //TODO remove the query string part
         //REVISIT may cache this value in requstHeaders?
         return uri.substring(servletpath.length());
@@ -405,7 +405,6 @@ public class WebSocketVirtualServletRequest implements HttpServletRequest
{
 
     @Override
     public String getPathTranslated() {
-        LOG.log(Level.INFO, "getPathTranslated");
         String path = getPathInfo();
         String opathtrans = webSocketHolder.getPathTranslated();
         // some container may choose not to return this value
@@ -413,6 +412,7 @@ public class WebSocketVirtualServletRequest implements HttpServletRequest
{
             return null;
         }
         String opathinfo = webSocketHolder.getPathInfo();
+        LOG.log(Level.INFO, "getPathTranslated " + path + " " + opathinfo);
         int pos = opathtrans.indexOf(opathinfo);
         //REVISIT may cache this value in requstHeaders?
         return new StringBuilder().append(opathtrans.substring(0, pos)).append(path).toString();
@@ -432,17 +432,17 @@ public class WebSocketVirtualServletRequest implements HttpServletRequest
{
 
     @Override
     public String getRequestURI() {
-        LOG.log(Level.INFO, "getRequestURI");
+        LOG.log(Level.INFO, "getRequestURI " + requestHeaders.get(WebSocketUtils.URI_KEY));
         return requestHeaders.get(WebSocketUtils.URI_KEY);
     }
 
     @Override
     public StringBuffer getRequestURL() {
-        LOG.log(Level.INFO, "getRequestURL");
         StringBuffer sb = webSocketHolder.getRequestURL();
         String ouri = webSocketHolder.getRequestURI();
         String uri = getRequestURI();
         sb.append(uri.substring(ouri.length()));
+        LOG.log(Level.INFO, "getRequestURL " + uri);
         return sb;
     }
 
@@ -454,7 +454,7 @@ public class WebSocketVirtualServletRequest implements HttpServletRequest
{
 
     @Override
     public String getServletPath() {
-        LOG.log(Level.INFO, "getServletPath");
+        LOG.log(Level.INFO, "getServletPath " + webSocketHolder.getServletPath());
         return webSocketHolder.getServletPath();
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/bb1edc5d/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 54644fd..0139479 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,7 +22,6 @@ package org.apache.cxf.transport.websocket.jetty9;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
-import java.net.URL;
 import java.nio.ByteBuffer;
 import java.security.Principal;
 import java.util.Enumeration;
@@ -38,7 +37,6 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.http.DestinationRegistry;
 import org.apache.cxf.transport.http_jetty.JettyHTTPDestination;
@@ -51,6 +49,7 @@ import org.apache.cxf.transport.websocket.WebSocketServletHolder;
 import org.apache.cxf.transport.websocket.WebSocketVirtualServletRequest;
 import org.apache.cxf.transport.websocket.WebSocketVirtualServletResponse;
 import org.apache.cxf.workqueue.WorkQueueManager;
+import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.websocket.api.Session;
 import org.eclipse.jetty.websocket.api.WebSocketAdapter;
 import org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest;
@@ -90,7 +89,17 @@ public class Jetty9WebSocketDestination extends JettyHTTPDestination implements
                                HttpServletResponse resp) throws IOException {
         super.invoke(config, context, req, resp);
     }
-
+    public void invoke(final ServletConfig config, 
+                       final ServletContext context, 
+                       final HttpServletRequest request, 
+                       final HttpServletResponse response) throws IOException {
+        if (webSocketFactory.isUpgradeRequest(request, response)
+            && webSocketFactory.acceptWebSocket(request, response)) {
+            ((Request)request).setHandled(true);
+            return;
+        }
+        super.invoke(config, context, request, response);
+    }
     @Override
     protected String getAddress(EndpointInfo endpointInfo) {
         String address = endpointInfo.getAddress();
@@ -99,16 +108,7 @@ public class Jetty9WebSocketDestination extends JettyHTTPDestination implements
         }
         return address;
     }
-
-
-    @Override
-    protected String getBasePath(String contextPath) throws IOException {
-        if (StringUtils.isEmpty(endpointInfo.getAddress())) {
-            return "";
-        }
-        return new URL(getAddress(endpointInfo)).getPath();
-    }
-    
+        
     @Override
     protected JettyHTTPHandler createJettyHTTPHandler(JettyHTTPDestination jhd, boolean cmExact)
{
         return new JettyWebSocketHandler(jhd, cmExact, webSocketFactory);
@@ -207,7 +207,7 @@ public class Jetty9WebSocketDestination extends JettyHTTPDestination implements
             return null;
         }
         public String getContextPath() {
-            return null;
+            return ((ServletUpgradeRequest)session.getUpgradeRequest()).getHttpServletRequest().getContextPath();
         }
         public String getLocalAddr() {
             return null;
@@ -261,7 +261,7 @@ public class Jetty9WebSocketDestination extends JettyHTTPDestination implements
             return null;
         }
         public String getServletPath() {
-            return "/";
+            return "";
         }
         public ServletContext getServletContext() {
             return null;
@@ -273,7 +273,7 @@ public class Jetty9WebSocketDestination extends JettyHTTPDestination implements
             return null;
         }
         public Object getAttribute(String name) {
-            return session.getUpgradeRequest().getHeader(name);
+            return ((ServletUpgradeRequest)session.getUpgradeRequest()).getHttpServletRequest().getAttribute(name);
         }
         @Override
         public void write(byte[] data, int offset, int length) throws IOException {

http://git-wip-us.apache.org/repos/asf/cxf/blob/bb1edc5d/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerStreamingTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerStreamingTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerStreamingTest.java
index f2a88f6..ac940d0 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerStreamingTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerStreamingTest.java
@@ -114,7 +114,7 @@ public class JAXRSClientServerStreamingTest extends AbstractBusClientServerTestB
     public void testGetBook123Fail() throws Exception {
         WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstore/books/text/xml/123");
         wc.accept("text/xml");
-        wc.header("fail-write", "");
+        wc.header("fail-write", "yes");
         Response r = wc.get();
         assertEquals(500, r.getStatus());
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/bb1edc5d/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/WebSocketTestClient.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/WebSocketTestClient.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/WebSocketTestClient.java
index 7e45544..cfe73a5 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/WebSocketTestClient.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/WebSocketTestClient.java
@@ -69,6 +69,9 @@ class WebSocketTestClient {
     public void connect() throws InterruptedException, ExecutionException, IOException {
         websocket = client.prepareGet(url).execute(
             new WebSocketUpgradeHandler.Builder().addWebSocketListener(new WsSocketListener()).build()).get();
+        if (websocket == null) {
+            throw new NullPointerException("websocket is null");
+        }
     }
 
     public void sendTextMessage(String message) {
@@ -102,8 +105,12 @@ class WebSocketTestClient {
     }
     
     public void close() {
-        websocket.close();
-        client.close();
+        if (websocket != null) {
+            websocket.close();
+        }
+        if (client != null) {
+            client.close();
+        }
     }
 
     class WsSocketListener implements WebSocketTextListener, WebSocketByteListener {


Mime
View raw message