[jbossws-commits] JBossWS SVN: r12845 - in stack/cxf/branches/cxf-2.3: modules/addons/transports/http/httpserver and 4 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Tue Aug 24 11:21:58 EDT 2010


Author: alessio.soldano at jboss.com
Date: 2010-08-24 11:21:57 -0400 (Tue, 24 Aug 2010)
New Revision: 12845

Removed:
   stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpContextAdaptor.java
   stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpExchangeAdaptor.java
   stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpHandlerAdaptor.java
   stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/PathUtils.java
   stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/PathUtilsTest.java
Modified:
   stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/pom.xml
   stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerDestination.java
   stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java
   stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineTest.java
   stack/cxf/branches/cxf-2.3/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
   stack/cxf/branches/cxf-2.3/pom.xml
   stack/cxf/branches/cxf-2.3/src/main/scripts/assembly-deploy-artifacts.xml
Log:
[JBWS-3079] Use jaxws-httpserver-httpspi project


Modified: stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/pom.xml
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/pom.xml	2010-08-24 15:18:20 UTC (rev 12844)
+++ stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/pom.xml	2010-08-24 15:21:57 UTC (rev 12845)
@@ -15,6 +15,11 @@
   <!-- Dependencies -->
   <dependencies>
     
+    <dependency>
+      <groupId>org.jboss.ws.projects</groupId>
+      <artifactId>jaxws-httpserver-httpspi</artifactId>
+    </dependency>
+    
     <!-- CXF dependencies -->
     <dependency>
       <groupId>org.apache.cxf</groupId>
@@ -80,52 +85,6 @@
       <artifactId>jboss-servlet-api_3.0_spec</artifactId>
       <scope>test</scope>
     </dependency>
-    
   </dependencies>
 
-  <profiles>
-    <!--
-    Name:  enforce
-    Descr: Enforce artifact dependencies
-    -->
-    <profile>
-      <id>enforce</id>
-      <activation>
-        <property>
-          <name>!skip-enforce</name>
-        </property>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-enforcer-plugin</artifactId>
-            <executions>
-              <execution>
-                <id>ban-bad-dependencies</id>
-                <goals>
-                  <goal>enforce</goal>
-                </goals>
-                <configuration>
-                  <rules>
-                    <bannedDependencies>
-                      <searchTransitive>true</searchTransitive>
-                      <excludes>
-                        <exclude>org.apache.cxf:cxf-rt-bindings-corba</exclude>
-                        <exclude>org.apache.cxf:cxf-rt-javascript</exclude>
-                        <exclude>org.apache.geronimo.specs</exclude>
-                        <exclude>org.codehaus.jra:jra</exclude>
-                        <exclude>org.slf4j:slf4j-jdk14</exclude>
-                      </excludes>
-                    </bannedDependencies>
-                  </rules>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-  </profiles>
-  
 </project>

Deleted: stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpContextAdaptor.java
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpContextAdaptor.java	2010-08-24 15:18:20 UTC (rev 12844)
+++ stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpContextAdaptor.java	2010-08-24 15:21:57 UTC (rev 12845)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.cxf.addons.transports.httpserver;
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.ws.spi.http.HttpContext;
-import javax.xml.ws.spi.http.HttpHandler;
-
-/**
- * A javax.xml.ws.spi.http.HttpContext adaptor delegating
- * to a com.sun.net.httpserver.HttpContext instance.
- * 
- * @author alessio.soldano at jboss.com
- * @since 19-Aug-2010
- *
- */
- at SuppressWarnings("restriction")
-public class HttpContextAdaptor extends HttpContext
-{
-   private com.sun.net.httpserver.HttpContext delegate;
-   private String path;
-
-   public HttpContextAdaptor(com.sun.net.httpserver.HttpContext delegate, String path)
-   {
-      this.delegate = delegate;
-      this.path = path;
-   }
-
-   @Override
-   public String getPath()
-   {
-      return path;
-   }
-
-   @Override
-   public Object getAttribute(String name)
-   {
-      Map<String, Object> map = delegate.getAttributes();
-      return map != null ? map.get(name) : null;
-   }
-
-   @Override
-   public Set<String> getAttributeNames()
-   {
-      Map<String, Object> map = delegate.getAttributes();
-      return map != null ? map.keySet() : null;
-   }
-
-   @Override
-   public void setHandler(HttpHandler handler)
-   {
-      if (handler instanceof com.sun.net.httpserver.HttpHandler)
-      {
-         delegate.setHandler((com.sun.net.httpserver.HttpHandler) handler);
-      }
-      super.setHandler(handler);
-   }
-
-}

Deleted: stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpExchangeAdaptor.java
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpExchangeAdaptor.java	2010-08-24 15:18:20 UTC (rev 12844)
+++ stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpExchangeAdaptor.java	2010-08-24 15:21:57 UTC (rev 12845)
@@ -1,228 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.cxf.addons.transports.httpserver;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.InetSocketAddress;
-import java.security.Principal;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.ws.spi.http.HttpContext;
-import javax.xml.ws.spi.http.HttpExchange;
-
-import org.apache.cxf.io.AbstractWrappedOutputStream;
-
-import com.sun.net.httpserver.HttpServer;
-import com.sun.net.httpserver.HttpsServer;
-
-/**
- * A javax.xml.ws.spi.http.HttpContext adaptor delegating
- * to a com.sun.net.httpserver.HttpContext instance.
- * 
- * @author alessio.soldano at jboss.com
- * @since 19-Aug-2010
- *
- */
- at SuppressWarnings("restriction")
-public class HttpExchangeAdaptor extends HttpExchange
-{
-   private com.sun.net.httpserver.HttpExchange delegate;
-   private HttpContextAdaptor contextAdaptor;
-   private OutputStream wrappeddOutputStream;
-   private int status;
-
-   public HttpExchangeAdaptor(com.sun.net.httpserver.HttpExchange delegate)
-   {
-      this.delegate = delegate;
-   }
-
-   @Override
-   public Map<String, List<String>> getRequestHeaders()
-   {
-      return delegate.getRequestHeaders();
-   }
-
-   @Override
-   public String getRequestHeader(String name)
-   {
-      return delegate.getRequestHeaders().getFirst(name);
-   }
-
-   @Override
-   public Map<String, List<String>> getResponseHeaders()
-   {
-      return delegate.getResponseHeaders();
-   }
-
-   @Override
-   public void addResponseHeader(String name, String value)
-   {
-      delegate.getResponseHeaders().add(name, value);
-   }
-
-   @Override
-   public String getRequestURI()
-   {
-      return delegate.getRequestURI().toString();
-   }
-
-   @Override
-   public String getContextPath()
-   {
-      return PathUtils.getContextPath(delegate.getRequestURI());
-   }
-
-   @Override
-   public String getRequestMethod()
-   {
-      return delegate.getRequestMethod();
-   }
-
-   @Override
-   public HttpContext getHttpContext()
-   {
-      if (contextAdaptor == null)
-      {
-         contextAdaptor = new HttpContextAdaptor(delegate.getHttpContext(), PathUtils.getPath(delegate.getRequestURI()));
-      }
-      return contextAdaptor;
-   }
-
-   @Override
-   public void close() throws IOException
-   {
-      delegate.close();
-   }
-   
-   @Override
-   public InputStream getRequestBody() throws IOException
-   {
-      return delegate.getRequestBody();
-   }
-
-   @Override
-   public OutputStream getResponseBody() throws IOException
-   {
-      if (wrappeddOutputStream == null)
-      {
-         wrappeddOutputStream = new AbstractWrappedOutputStream()
-         {
-            /**
-             * On first write we need to send the response headers and
-             * the status as that won't be possible after getting the
-             * response body stream from the delegate
-             */
-            @Override
-            protected void onFirstWrite() throws IOException
-            {
-               if (status == 0) //assume no status -> 200 OK
-               {
-                  status = HttpURLConnection.HTTP_OK;
-               }
-               delegate.sendResponseHeaders(status, 0);
-               this.wrappedStream = delegate.getResponseBody();
-            }
-         };
-      }
-      return wrappeddOutputStream;
-   }
-
-   @Override
-   public void setStatus(int status)
-   {
-      //do not immediately set status to the delegate, as that would flush it to the
-      //client together with the headers, preventing other headers from being added
-      this.status = status;
-   }
-
-   @Override
-   public InetSocketAddress getRemoteAddress()
-   {
-      return delegate.getRemoteAddress();
-   }
-
-   @Override
-   public InetSocketAddress getLocalAddress()
-   {
-      return delegate.getLocalAddress();
-   }
-
-   @Override
-   public String getProtocol()
-   {
-      return delegate.getProtocol();
-   }
-
-   @Override
-   public String getScheme()
-   {
-      String scheme = delegate.getRequestURI().getScheme();
-      if (scheme == null)
-      {
-         //fallback for relative urls (e.g. "/foo/bar?wsdl") with no scheme provided by the container
-         HttpServer server = delegate.getHttpContext().getServer();
-         scheme = server instanceof HttpsServer ? "https" : "http";
-      }
-      return scheme;
-   }
-
-   @Override
-   public String getPathInfo()
-   {
-      return null;
-   }
-
-   @Override
-   public String getQueryString()
-   {
-      return delegate.getRequestURI().getQuery();
-   }
-
-   @Override
-   public Object getAttribute(String name)
-   {
-      return delegate.getAttribute(name);
-   }
-
-   @Override
-   public Set<String> getAttributeNames()
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   @Override
-   public Principal getUserPrincipal()
-   {
-      return delegate.getPrincipal();
-   }
-
-   @Override
-   public boolean isUserInRole(String role)
-   {
-      return false;
-   }
-}

Deleted: stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpHandlerAdaptor.java
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpHandlerAdaptor.java	2010-08-24 15:18:20 UTC (rev 12844)
+++ stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpHandlerAdaptor.java	2010-08-24 15:21:57 UTC (rev 12845)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.cxf.addons.transports.httpserver;
-
-import java.io.IOException;
-
-import org.apache.cxf.transport.http_jaxws_spi.HttpHandlerImpl;
-import org.apache.cxf.transport.http_jaxws_spi.JAXWSHttpSpiDestination;
-
-import com.sun.net.httpserver.HttpExchange;
-import com.sun.net.httpserver.HttpHandler;
-
-/**
- * A com.sun.net.httpserver.HttpHandler adapted to javax.xml.ws.spi.http.HttpHandler
- * through CXF org.apache.cxf.transport.http_jaxws_spi.HttpHandlerImpl.
- * 
- * @author alessio.soldano at jboss.com
- * @sine 19-Aug-2010
- *
- */
- at SuppressWarnings("restriction")
-public class HttpHandlerAdaptor extends HttpHandlerImpl implements HttpHandler {
-
-   public HttpHandlerAdaptor(JAXWSHttpSpiDestination destination)
-   {
-      super(destination);
-   }
-
-   @Override
-   public void handle(HttpExchange ex) throws IOException
-   {
-      try
-      {
-         this.handle(new HttpExchangeAdaptor(ex));
-      }
-      catch (IOException e)
-      {
-         e.printStackTrace();
-         throw e;
-      }
-      catch (RuntimeException e)
-      {
-         e.printStackTrace();
-         throw e;
-      }
-      catch (Exception e)
-      {
-         e.printStackTrace();
-         throw new RuntimeException(e);
-      }
-   }
-   
-}
\ No newline at end of file

Modified: stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerDestination.java
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerDestination.java	2010-08-24 15:18:20 UTC (rev 12844)
+++ stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerDestination.java	2010-08-24 15:21:57 UTC (rev 12845)
@@ -30,8 +30,13 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.http_jaxws_spi.HttpHandlerImpl;
 import org.apache.cxf.transport.http_jaxws_spi.JAXWSHttpSpiDestination;
+import org.jboss.ws.httpserver_httpspi.HttpExchangeDelegate;
 
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+
 /**
  * HTTP destination to be used with the JDK6 httpserver; this extends the
  * basic JAXWSHttpSpiDestination with all the mechanisms for properly
@@ -41,6 +46,7 @@
  * @since 19-Aug-2010
  *
  */
+ at SuppressWarnings("restriction")
 public class HttpServerDestination extends JAXWSHttpSpiDestination
 {
    static final Logger LOG = LogUtils.getL7dLogger(HttpServerDestination.class);
@@ -65,7 +71,7 @@
    {
       return LOG;
    }
-   
+
    public void finalizeConfig() throws IOException
    {
       engine = serverEngineFactory.retrieveHttpServerEngine(url.getPort());
@@ -79,28 +85,33 @@
                + engine.getProtocol() + "\" for \"" + url + "\"");
       }
    }
-   
+
    /**
     * Activate receipt of incoming messages.
     */
-   protected void activate() {
-       LOG.log(Level.FINE, "Activating receipt of incoming messages");
-       String addr = endpointInfo.getAddress();
-       try {
-           new URL(addr);
-       } catch (Exception e) {
-           throw new Fault(e);
-       }
-       engine.addHandler(addr, new HttpHandlerAdaptor(this));
+   protected void activate()
+   {
+      LOG.log(Level.FINE, "Activating receipt of incoming messages");
+      String addr = endpointInfo.getAddress();
+      try
+      {
+         new URL(addr);
+      }
+      catch (Exception e)
+      {
+         throw new Fault(e);
+      }
+      engine.addHandler(addr, new Handler(this));
    }
 
    /**
     * Deactivate receipt of incoming messages.
     */
-   protected void deactivate() {
-       LOG.log(Level.FINE, "Deactivating receipt of incoming messages");
-       engine.removeHandler(endpointInfo.getAddress());   
-   }  
+   protected void deactivate()
+   {
+      LOG.log(Level.FINE, "Deactivating receipt of incoming messages");
+      engine.removeHandler(endpointInfo.getAddress());
+   }
 
    @Override
    public void shutdown()
@@ -109,4 +120,34 @@
       super.shutdown();
    }
 
+   class Handler extends HttpHandlerImpl implements HttpHandler
+   {
+
+      public Handler(JAXWSHttpSpiDestination destination)
+      {
+         super(destination);
+      }
+
+      @Override
+      public void handle(HttpExchange ex) throws IOException
+      {
+         try
+         {
+            this.handle(new HttpExchangeDelegate(ex));
+         }
+         catch (Exception e)
+         {
+            LOG.throwing(Handler.class.getName(), "handle(com.sun.net.httpserver.HttpExchange ex)", e);
+            if (e instanceof IOException)
+            {
+               throw (IOException) e;
+            }
+            else
+            {
+               throw new RuntimeException(e);
+            }
+         }
+      }
+   }
+
 }

Modified: stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java	2010-08-24 15:18:20 UTC (rev 12844)
+++ stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java	2010-08-24 15:21:57 UTC (rev 12845)
@@ -28,6 +28,7 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
+import org.jboss.ws.httpserver_httpspi.PathUtils;
 
 import com.sun.net.httpserver.HttpHandler;
 import com.sun.net.httpserver.HttpServer;

Deleted: stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/PathUtils.java
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/PathUtils.java	2010-08-24 15:18:20 UTC (rev 12844)
+++ stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/PathUtils.java	2010-08-24 15:21:57 UTC (rev 12845)
@@ -1,108 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.cxf.addons.transports.httpserver;
-
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-
-public class PathUtils
-{
-   /**
-    * Get the final path section of an address (for servlet
-    * container, this is typically a url-pattern for an endpoint)
-    * 
-    * @param addr
-    * @return
-    */
-   public static String getPath(String addr)
-   {
-      return getPathInternal(getPathFromString(addr));
-   }
-   
-   public static String getPath(URI addr)
-   {
-      return getPathInternal(addr.getPath());
-   }
-   
-   private static String getPathInternal(String rawpath)
-   {
-      String path = removeTrailingSlash(rawpath);
-      if (path == null || path.length() == 0)
-      {
-         return path;
-      }
-      int idx = path.lastIndexOf("/");
-      return idx > 0 ? path.substring(path.lastIndexOf("/")) : "";
-   }
-   
-   /**
-    * Get the context path section of an address
-    * 
-    * @param addr
-    * @return
-    */
-   public static String getContextPath(String addr)
-   {
-      return getContextPathInternal(getPathFromString(addr));
-   }
-   
-   public static String getContextPath(URI addr)
-   {
-      return getContextPathInternal(addr.getPath());
-   }
-   
-   private static String getContextPathInternal(String rawpath)
-   {
-      String path = removeTrailingSlash(rawpath);
-      if (path == null || path.length() == 0)
-      {
-         return "/";
-      }
-      int idx = path.lastIndexOf("/");
-      return idx > 0 ? path.substring(0, idx) : path;
-   }
-   
-   private static String getPathFromString(String addr)
-   {
-      String path = null;
-      try
-      {
-         path = new URL(addr).getPath();
-      }
-      catch (MalformedURLException e)
-      {
-         //ignore
-      }
-      return path;
-   }
-   
-   private static String removeTrailingSlash(String path)
-   {
-      if (path != null && path.length() > 0 && path.lastIndexOf('/') == path.length() - 1)
-      {
-         path = path.substring(0, path.length() - 1);
-      }
-      return path;
-   }
-   
-}

Modified: stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineTest.java
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineTest.java	2010-08-24 15:18:20 UTC (rev 12844)
+++ stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineTest.java	2010-08-24 15:21:57 UTC (rev 12845)
@@ -26,8 +26,6 @@
 import java.net.HttpURLConnection;
 import java.net.URL;
 
-import javax.xml.ws.spi.http.HttpExchange;
-
 import junit.framework.TestCase;
 
 import org.apache.cxf.Bus;
@@ -121,19 +119,20 @@
       }
    }
 
-   private class MyTestHandler extends HttpHandlerAdaptor
+   @SuppressWarnings("restriction")
+   private class MyTestHandler implements com.sun.net.httpserver.HttpHandler
    {
       volatile int count;
 
       public MyTestHandler()
       {
-         super(null);
+         
       }
       
       @Override
-      public void handle(HttpExchange exchange) throws IOException {
+      public void handle(com.sun.net.httpserver.HttpExchange exchange) throws IOException {
          count++;
-         exchange.setStatus(200);
+         exchange.sendResponseHeaders(200, 0);
          OutputStream os = exchange.getResponseBody();
          os.write("Hello".getBytes());
          os.flush();

Deleted: stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/PathUtilsTest.java
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/PathUtilsTest.java	2010-08-24 15:18:20 UTC (rev 12844)
+++ stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/PathUtilsTest.java	2010-08-24 15:21:57 UTC (rev 12845)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.wsf.stack.cxf.addons.transports.httpserver;
-
-import java.net.URI;
-
-import junit.framework.TestCase;
-
-public class PathUtilsTest extends TestCase
-{
-   public void testPath() {
-      assertEquals("", PathUtils.getPath("http://localhost:8080"));
-      assertEquals("", PathUtils.getPath("http://localhost:8080/foo"));
-      assertEquals("", PathUtils.getPath("http://localhost:8080/foo/"));
-      assertEquals("/bar", PathUtils.getPath("http://localhost:8080/foo/bar"));
-      assertEquals("/bar", PathUtils.getPath("http://localhost:8080/foo/bar/"));
-      assertEquals("/bar", PathUtils.getPath("http://localhost:8080/foo/bar?wsdl"));
-      assertEquals("/bar", PathUtils.getPath("http://localhost:8080/foo/bar/?wsdl"));
-      assertEquals("/bar", PathUtils.getPath("http://localhost:8080/foo/fooagain/bar"));
-      assertEquals("/bar", PathUtils.getPath("http://localhost:8080/foo/fooagain/bar?wsdl"));
-      assertEquals("/bar", PathUtils.getPath("http://localhost:8080/foo/fooagain/bar?wsdl&xsd=ff"));
-      assertEquals("/bar", PathUtils.getPath("http://localhost/foo/bar"));
-      assertEquals("/bar", PathUtils.getPath("https://localhost/foo/bar"));
-      
-   }
-   
-   public void testContextPath() {
-      assertEquals("/", PathUtils.getContextPath("http://localhost:8080"));
-      assertEquals("/foo", PathUtils.getContextPath("http://localhost:8080/foo"));
-      assertEquals("/foo", PathUtils.getContextPath("http://localhost:8080/foo/"));
-      assertEquals("/foo", PathUtils.getContextPath("http://localhost:8080/foo/bar"));
-      assertEquals("/foo", PathUtils.getContextPath("http://localhost:8080/foo/bar/"));
-      assertEquals("/foo/bar", PathUtils.getContextPath("http://localhost:8080/foo/bar/baragain"));
-      assertEquals("/foo", PathUtils.getContextPath("http://localhost:8080/foo/bar?wsdl&xsd=kk"));
-      assertEquals("/foo", PathUtils.getContextPath("http://localhost:8080/foo/bar/?wsdl&xsd=kk"));
-      assertEquals("/foo", PathUtils.getContextPath("http://localhost/foo/bar"));
-      assertEquals("/foo", PathUtils.getContextPath("https://localhost/foo/bar"));
-   }
-   
-   public void testURIPath() throws Exception {
-      assertEquals("", PathUtils.getPath(new URI("http", "", "localhost", 8080, "", "", "")));
-      assertEquals("", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo", "", "")));
-      assertEquals("", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/", "", "")));
-      assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/bar", "", "")));
-      assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/bar/", "", "")));
-      assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/bar", "wsdl", "")));
-      assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/bar/", "wsdl", "")));
-      assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/fooagain/bar", "", "")));
-      assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/fooagain/bar", "wsdl", "")));
-      assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/fooagain/bar", "wsdl&xsd=ff", "")));
-      assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 0, "/foo/bar", "", "")));
-      assertEquals("/bar", PathUtils.getPath(new URI("https", "", "localhost", 0, "/foo/bar", "", "")));
-   }
-   
-   public void testURIContextPath() throws Exception {
-      assertEquals("/", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "", "", "")));
-      assertEquals("/foo", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "/foo", "", "")));
-      assertEquals("/foo", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "/foo/", "", "")));
-      assertEquals("/foo", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "/foo/bar", "", "")));
-      assertEquals("/foo", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "/foo/bar/", "", "")));
-      assertEquals("/foo/bar", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "/foo/bar/baragain", "", "")));
-      assertEquals("/foo", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "/foo/bar", "wsdl&xsd=kk", "")));
-      assertEquals("/foo", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "/foo/bar/", "wsdl&xsd=kk", "")));
-      assertEquals("/foo", PathUtils.getContextPath(new URI("http", "", "localhost", 0, "/foo/bar", "", "")));
-      assertEquals("/foo", PathUtils.getContextPath(new URI("https", "", "localhost", 0, "/foo/bar", "", "")));
-   }
-}

Modified: stack/cxf/branches/cxf-2.3/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml	2010-08-24 15:18:20 UTC (rev 12844)
+++ stack/cxf/branches/cxf-2.3/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml	2010-08-24 15:21:57 UTC (rev 12845)
@@ -34,6 +34,7 @@
     <include name="**/jaxb-xjc.jar"/>
     <include name="**/jaxrpc-api.jar"/>
     <include name="**/jaxws-api.jar"/>
+    <include name="**/jaxws-httpserver-httpspi.jar"/>
     <include name="**/jsr181-api.jar"/>
     <include name="**/jbossws-common.jar"/>
     <include name="**/jbossws-cxf-client*.jar"/>
@@ -73,6 +74,7 @@
     <include name="**/FastInfoset.jar"/>
     <include name="**/jaxrpc-api.jar"/>
     <include name="**/jaxws-api.jar"/>
+    <include name="**/jaxws-httpserver-httpspi.jar"/>
     <include name="**/jsr181-api.jar"/>
     <include name="**/jboss-jaxb-intros.jar"/>
     <include name="**/jbossws-common.jar"/>

Modified: stack/cxf/branches/cxf-2.3/pom.xml
===================================================================
--- stack/cxf/branches/cxf-2.3/pom.xml	2010-08-24 15:18:20 UTC (rev 12844)
+++ stack/cxf/branches/cxf-2.3/pom.xml	2010-08-24 15:21:57 UTC (rev 12845)
@@ -68,6 +68,7 @@
     <jboss.security.sx.version>2.0.4</jboss.security.sx.version>
     <jboss.xb.version>2.0.2.Beta7</jboss.xb.version>
     <picketbox.version>3.0.0.Beta5</picketbox.version>
+    <jaxws-httpserver-httpspi.version>1.0.0-SNAPSHOT</jaxws-httpserver-httpspi.version>
     <jaxb.api.version>1.0.0.Beta1</jaxb.api.version>
     <jaxb.impl.version>2.2</jaxb.impl.version>
     <jaxrpc.api.version>1.1</jaxrpc.api.version>
@@ -171,6 +172,11 @@
       </dependency>
       -->
       <!-- END -->
+      <dependency>
+        <groupId>org.jboss.ws.projects</groupId>
+        <artifactId>jaxws-httpserver-httpspi</artifactId>
+        <version>${jaxws-httpserver-httpspi.version}</version>
+      </dependency>
 
       <!-- provided apis -->
       <dependency>

Modified: stack/cxf/branches/cxf-2.3/src/main/scripts/assembly-deploy-artifacts.xml
===================================================================
--- stack/cxf/branches/cxf-2.3/src/main/scripts/assembly-deploy-artifacts.xml	2010-08-24 15:18:20 UTC (rev 12844)
+++ stack/cxf/branches/cxf-2.3/src/main/scripts/assembly-deploy-artifacts.xml	2010-08-24 15:21:57 UTC (rev 12845)
@@ -24,6 +24,7 @@
             <includes>
               <include>org.jboss.ws.cxf:jbossws-cxf-factories:jar</include>
               <include>org.jboss.ws.cxf:jbossws-cxf-transports-httpserver:jar</include>
+              <include>org.jboss.ws.projects:jaxws-httpserver-httpspi:jar</include>
               <include>org.apache.cxf:cxf-*</include>
               <include>org.apache.cxf.xjcplugins:cxf-*</include>
               <include>com.sun.xml.bind:jaxb-impl:jar</include>
@@ -44,7 +45,6 @@
               <include>commons-beanutils:commons-beanutils:jar</include>
               <include>commons-lang:commons-lang:jar</include>
               <include>jboss.jaxbintros:jboss-jaxb-intros</include>
-<!--               <include>org.mortbay.jetty:jetty*</include>  -->
               <include>stax:stax-api:jar</include>
               <include>javax.jws:jsr181-api:jar</include>
             </includes>



More information about the jbossws-commits mailing list