JBossWS SVN: r12831 - framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2529.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2010-08-23 05:15:37 -0400 (Mon, 23 Aug 2010)
New Revision: 12831
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2529/JBWS2529TestCase.java
Log:
[JBWS-3110]:Fixed the relevant test
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2529/JBWS2529TestCase.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2529/JBWS2529TestCase.java 2010-08-22 11:12:45 UTC (rev 12830)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2529/JBWS2529TestCase.java 2010-08-23 09:15:37 UTC (rev 12831)
@@ -86,7 +86,7 @@
String command = JBOSS_HOME + FS + "bin" + FS + "wsprovide" + EXT + " -k -w -o " + absOutput + " --classpath " + CLASSES_DIR + " " + ENDPOINT_CLASS;
executeCommand(command, "wsprovide");
- File wsdl = new File(destDir, isIntegrationMetro() ? "JBWS2529EndpointService_schema1.xsd" : "JBWS2529EndpointService.wsdl");
+ File wsdl = new File(destDir, isIntegrationMetro() || isIntegrationCXF() ? "JBWS2529EndpointService_schema1.xsd" : "JBWS2529EndpointService.wsdl");
Element root = DOMUtils.parse(new FileInputStream(wsdl));
QName schemaQName = new QName(XML_SCHEMA_NS,"schema");
Element schema = null;
13 years, 8 months
JBossWS SVN: r12830 - in projects: jaxws-httpserver-httpspi and 14 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2010-08-22 07:12:45 -0400 (Sun, 22 Aug 2010)
New Revision: 12830
Added:
projects/jaxws-httpserver-httpspi/
projects/jaxws-httpserver-httpspi/branches/
projects/jaxws-httpserver-httpspi/tags/
projects/jaxws-httpserver-httpspi/trunk/
projects/jaxws-httpserver-httpspi/trunk/pom.xml
projects/jaxws-httpserver-httpspi/trunk/src/
projects/jaxws-httpserver-httpspi/trunk/src/main/
projects/jaxws-httpserver-httpspi/trunk/src/main/java/
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/AbstractWrappedOutputStream.java
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpContextDelegate.java
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpExchangeDelegate.java
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpHandlerDelegate.java
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpServerContextFactory.java
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/PathUtils.java
projects/jaxws-httpserver-httpspi/trunk/src/main/resources/
projects/jaxws-httpserver-httpspi/trunk/src/test/
projects/jaxws-httpserver-httpspi/trunk/src/test/java/
projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/
projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/
projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/
projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/
projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/DHRequest.java
projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/DHResponse.java
projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointAPITest.java
projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointBean.java
projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointInterface.java
projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/PathUtilsTest.java
projects/jaxws-httpserver-httpspi/trunk/src/test/resources/
Log:
Adding external project for JAXWS 2.2 HTTP SPI bridge to JDK6 httpserver
Property changes on: projects/jaxws-httpserver-httpspi/trunk
___________________________________________________________________
Name: svn:ignore
+ .project
.classpath
.settings
target
Added: projects/jaxws-httpserver-httpspi/trunk/pom.xml
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/pom.xml (rev 0)
+++ projects/jaxws-httpserver-httpspi/trunk/pom.xml 2010-08-22 11:12:45 UTC (rev 12830)
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBoss JDK6 httpserver to JAXWS 2.2 HTTP SPI bridge</name>
+ <groupId>org.jboss.ws.projects</groupId>
+ <artifactId>jaxws-httpserver-httpspi</artifactId>
+ <packaging>jar</packaging>
+
+ <version>1.0.0-SNAPSHOT</version>
+
+ <!-- Source Control Management -->
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossws/projects/jaxws-httpserver-...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossws/projects/jaxws-httpserver-htt...</developerConnection>
+ <url>http://fisheye.jboss.com/viewrep/JBossWS/projects/jaxws-httpserver-httpsp...</url>
+ </scm>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-parent</artifactId>
+ <version>1.0.8.GA</version>
+ </parent>
+
+ <!-- Properties -->
+ <properties>
+ <jaxws.version>1.0.0.Beta1</jaxws.version>
+ <junit.version>4.8.1</junit.version>
+ <cxf.version>2.3.0-SNAPSHOT</cxf.version>
+ <servlet-api.version>1.0.0.Beta2</servlet-api.version>
+ </properties>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.spec.javax.xml.ws</groupId>
+ <artifactId>jboss-jaxws-api_2.2_spec</artifactId>
+ <version>${jaxws.version}</version>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ <version>${cxf.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.spec.javax.servlet</groupId>
+ <artifactId>jboss-servlet-api_3.0_spec</artifactId>
+ <version>${servlet-api.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>create-endorsed-dir</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jboss.spec.javax.xml.ws</groupId>
+ <artifactId>jboss-jaxws-api_2.2_spec</artifactId>
+ <outputDirectory>${basedir}/target/endorsed</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=${basedir}/target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <compilerArguments>
+ <endorseddirs>${basedir}/target/endorsed</endorseddirs>
+ </compilerArguments>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
Added: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/AbstractWrappedOutputStream.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/AbstractWrappedOutputStream.java (rev 0)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/AbstractWrappedOutputStream.java 2010-08-22 11:12:45 UTC (rev 12830)
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.jboss.ws.httpserver_httpspi;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Provides a convenient hook onFirstWrite() for those needing
+ * to wrap an output stream.
+ *
+ */
+public abstract class AbstractWrappedOutputStream extends OutputStream {
+
+ protected OutputStream wrappedStream;
+ protected boolean written;
+
+ protected AbstractWrappedOutputStream() {
+ super();
+ }
+
+ @Override
+ public void write(byte[] b, int off, int len) throws IOException {
+ if (!written) {
+ onFirstWrite();
+ written = true;
+ }
+ if (wrappedStream != null) {
+ wrappedStream.write(b, off, len);
+ }
+ }
+
+ protected void onFirstWrite() throws IOException {
+ }
+
+ @Override
+ public void write(byte[] b) throws IOException {
+ write(b, 0, b.length);
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ if (!written) {
+ onFirstWrite();
+ written = true;
+ }
+ if (wrappedStream != null) {
+ wrappedStream.write(b);
+ }
+ }
+
+ @Override
+ public void close() throws IOException {
+ if (wrappedStream != null) {
+ wrappedStream.close();
+ }
+ }
+
+ @Override
+ public void flush() throws IOException {
+ if (written && wrappedStream != null) {
+ wrappedStream.flush();
+ }
+ }
+}
+
Added: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpContextDelegate.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpContextDelegate.java (rev 0)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpContextDelegate.java 2010-08-22 11:12:45 UTC (rev 12830)
@@ -0,0 +1,83 @@
+/*
+ * 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.ws.httpserver_httpspi;
+
+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 that delegates
+ * to a com.sun.net.httpserver.HttpContext instance.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 22-Aug-2010
+ *
+ */
+@SuppressWarnings("restriction")
+public class HttpContextDelegate extends HttpContext
+{
+ private com.sun.net.httpserver.HttpContext delegate;
+ private String path;
+
+ public HttpContextDelegate(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);
+ }
+ else
+ {
+ delegate.setHandler(new HttpHandlerDelegate(handler));
+ }
+ }
+
+}
Added: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpExchangeDelegate.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpExchangeDelegate.java (rev 0)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpExchangeDelegate.java 2010-08-22 11:12:45 UTC (rev 12830)
@@ -0,0 +1,226 @@
+/*
+ * 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.ws.httpserver_httpspi;
+
+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 com.sun.net.httpserver.HttpServer;
+import com.sun.net.httpserver.HttpsServer;
+
+/**
+ * A javax.xml.ws.spi.http.HttpExchange that delegates
+ * to a com.sun.net.httpserver.HttpExchange instance.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 22-Aug-2010
+ *
+ */
+@SuppressWarnings("restriction")
+public class HttpExchangeDelegate extends HttpExchange
+{
+ private com.sun.net.httpserver.HttpExchange delegate;
+ private HttpContextDelegate contextDelegate;
+ private OutputStream wrappeddOutputStream;
+ private int status;
+
+ public HttpExchangeDelegate(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 (contextDelegate == null)
+ {
+ contextDelegate = new HttpContextDelegate(delegate.getHttpContext(), PathUtils.getPath(delegate.getRequestURI()));
+ }
+ return contextDelegate;
+ }
+
+ @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;
+ }
+}
Added: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpHandlerDelegate.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpHandlerDelegate.java (rev 0)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpHandlerDelegate.java 2010-08-22 11:12:45 UTC (rev 12830)
@@ -0,0 +1,71 @@
+/*
+ * 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.ws.httpserver_httpspi;
+
+import java.io.IOException;
+
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+
+/**
+ * A com.sun.net.httpserver.HttpHandler delegating
+ * to a javax.xml.ws.spi.http.HttpHandler instance.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @sine 22-Aug-2010
+ *
+ */
+@SuppressWarnings("restriction")
+public class HttpHandlerDelegate implements HttpHandler {
+
+ private javax.xml.ws.spi.http.HttpHandler delegate;
+
+ public HttpHandlerDelegate(javax.xml.ws.spi.http.HttpHandler delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ @Override
+ public void handle(HttpExchange ex) throws IOException
+ {
+ try
+ {
+ delegate.handle(new HttpExchangeDelegate(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
Added: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpServerContextFactory.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpServerContextFactory.java (rev 0)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpServerContextFactory.java 2010-08-22 11:12:45 UTC (rev 12830)
@@ -0,0 +1,41 @@
+/*
+ * 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.ws.httpserver_httpspi;
+
+import com.sun.net.httpserver.HttpServer;
+import javax.xml.ws.spi.http.HttpContext;
+
+/**
+ * A factory for building JDK6 httpserver' flavor of
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 22-Aug-2010
+ *
+ */
+@SuppressWarnings("restriction")
+public class HttpServerContextFactory
+{
+ public static HttpContext createHttpContext(HttpServer server, String contextPath, String path)
+ {
+ return new HttpContextDelegate(server.createContext(contextPath), path);
+ }
+}
Added: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/PathUtils.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/PathUtils.java (rev 0)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/PathUtils.java 2010-08-22 11:12:45 UTC (rev 12830)
@@ -0,0 +1,108 @@
+/*
+ * 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.ws.httpserver_httpspi;
+
+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;
+ }
+
+}
Added: projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/DHRequest.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/DHRequest.java (rev 0)
+++ projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/DHRequest.java 2010-08-22 11:12:45 UTC (rev 12830)
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jboss.ws.httpserver_httpspi;
+
+import javax.activation.DataHandler;
+import javax.xml.bind.annotation.XmlMimeType;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "dataRequest", namespace = "http://org.apache.cxf/jaxws/endpoint/")
+public class DHRequest {
+
+ private DataHandler dataHandler;
+
+ public DHRequest() {
+ }
+
+ public DHRequest(DataHandler dataHandler) {
+ this.dataHandler = dataHandler;
+ }
+
+ @XmlMimeType("text/plain")
+ public DataHandler getDataHandler() {
+ return dataHandler;
+ }
+
+ public void setDataHandler(DataHandler dataHandler) {
+ this.dataHandler = dataHandler;
+ }
+
+}
Added: projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/DHResponse.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/DHResponse.java (rev 0)
+++ projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/DHResponse.java 2010-08-22 11:12:45 UTC (rev 12830)
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jboss.ws.httpserver_httpspi;
+
+import javax.activation.DataHandler;
+import javax.xml.bind.annotation.XmlMimeType;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "dataResponse", namespace = "http://org.apache.cxf/jaxws/endpoint/")
+public class DHResponse {
+
+ private DataHandler dataHandler;
+
+ public DHResponse() {
+ }
+
+ public DHResponse(DataHandler dataHandler) {
+ this.dataHandler = dataHandler;
+ }
+
+ @XmlMimeType("text/plain")
+ public DataHandler getDataHandler() {
+ return dataHandler;
+ }
+
+ public void setDataHandler(DataHandler dataHandler) {
+ this.dataHandler = dataHandler;
+ }
+}
Added: projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointAPITest.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointAPITest.java (rev 0)
+++ projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointAPITest.java 2010-08-22 11:12:45 UTC (rev 12830)
@@ -0,0 +1,206 @@
+/*
+ * 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.ws.httpserver_httpspi;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.net.URL;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.Service;
+import javax.xml.ws.soap.MTOMFeature;
+import javax.xml.ws.spi.http.HttpContext;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * A JAXWS 2.2 Endoint.publish(HttpContext context) API test
+ * using the JDK6 httpsever as underlying http container
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 22-Aug-2010
+ *
+ */
+@SuppressWarnings("restriction")
+public class EndpointAPITest extends Assert
+{
+
+ private static int currentPort = 9876;
+
+ private com.sun.net.httpserver.HttpServer server;
+
+ @Before
+ public void setUp() throws IOException
+ {
+ currentPort++;
+ server = com.sun.net.httpserver.HttpServer.create(new InetSocketAddress(currentPort), 0);
+ }
+
+ @After
+ public void tearDown()
+ {
+ server.stop(0);
+ server = null;
+ }
+
+ @Test
+ public void testSingleEndpoint() throws Exception
+ {
+
+ String contextPath = "/ctxt";
+ String path = "/echo";
+ String address = "http://localhost:" + currentPort + contextPath + path;
+
+ HttpContext context = HttpServerContextFactory.createHttpContext(server, contextPath, path);
+
+ Endpoint endpoint = Endpoint.create(new EndpointBean());
+ endpoint.publish(context); // Use httpserver context for publishing
+
+ server.start();
+
+ invokeEndpoint(address);
+
+ endpoint.stop();
+ }
+
+ @Test
+ public void testMultiplePublishSameAddress() throws Exception
+ {
+ server.start();
+ String contextPath = "/ctxt";
+ String path = "/echo";
+ for (int i = 0; i < 3; i++)
+ {
+ HttpContext ctx = HttpServerContextFactory.createHttpContext(server, contextPath, path);
+ String address = "http://localhost:" + currentPort + contextPath + path;
+
+ Endpoint endpoint = Endpoint.create(new EndpointBean());
+ endpoint.publish(ctx); // Use httpserver context for publishing
+
+ invokeEndpoint(address);
+
+ endpoint.stop();
+ server.removeContext(contextPath);
+ }
+ }
+
+ @Test
+ public void testMultipleEndpointsDifferentContexts() throws Exception
+ {
+ server.start();
+ String contextPath = "/ctxt";
+ String path = "/echo";
+ int k = 3;
+ Endpoint[] endpoints = new Endpoint[k];
+ HttpContext[] contexts = new HttpContext[k];
+ String[] addresses = new String[k];
+ for (int i = 0; i < k; i++)
+ {
+ addresses[i] = "http://localhost:" + currentPort + contextPath + i + path;
+ contexts[i] = HttpServerContextFactory.createHttpContext(server, contextPath + i, path);
+ endpoints[i] = Endpoint.create(new EndpointBean());
+ endpoints[i].publish(contexts[i]);
+ }
+ for (int i = 0; i < k; i++)
+ {
+ invokeEndpoint(addresses[i]);
+ }
+ for (int i = 0; i < k; i++)
+ {
+ endpoints[i].stop();
+ }
+ }
+
+ private void invokeEndpoint(String publishURL) throws Exception
+ {
+ URL wsdlURL = new URL(publishURL + "?wsdl");
+ QName qname = new QName("http://org.apache.cxf/jaxws/endpoint/", "EndpointService");
+ Service service = Service.create(wsdlURL, qname);
+ checkBasicInvocations(service);
+ checkMTOMInvocation(service);
+ }
+
+ private static void checkBasicInvocations(Service service)
+ {
+ EndpointInterface port = (EndpointInterface) service.getPort(EndpointInterface.class);
+ String helloWorld = "Hello world!";
+ assertEquals(0, port.getCount());
+ Object retObj = port.echo(helloWorld);
+ assertEquals(helloWorld, retObj);
+ assertEquals(1, port.getCount());
+ port.echo(helloWorld);
+ assertEquals(2, port.getCount());
+ try
+ {
+ port.getException();
+ fail("Exception expected!");
+ }
+ catch (Exception e)
+ {
+ assertEquals("Ooops", e.getMessage());
+ }
+ }
+
+ private static void checkMTOMInvocation(Service service) throws IOException
+ {
+ DataSource ds = new DataSource()
+ {
+ public String getContentType()
+ {
+ return "text/plain";
+ }
+
+ public InputStream getInputStream() throws IOException
+ {
+ return new ByteArrayInputStream("some string".getBytes());
+ }
+
+ public String getName()
+ {
+ return "none";
+ }
+
+ public OutputStream getOutputStream() throws IOException
+ {
+ return null;
+ }
+ };
+ EndpointInterface port = (EndpointInterface) service.getPort(EndpointInterface.class, new MTOMFeature(true));
+ DataHandler dh = new DataHandler(ds);
+ DHResponse response = port.echoDataHandler(new DHRequest(dh));
+ assertNotNull(response);
+ Object content = response.getDataHandler().getContent();
+ assertEquals("Server data", content);
+ String contentType = response.getDataHandler().getContentType();
+ assertEquals("text/plain", contentType);
+ }
+
+}
Added: projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointBean.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointBean.java (rev 0)
+++ projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointBean.java 2010-08-22 11:12:45 UTC (rev 12830)
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jboss.ws.httpserver_httpspi;
+
+import java.io.IOException;
+
+import javax.activation.DataHandler;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.MTOM;
+
+@WebService(serviceName = "EndpointService",
+ endpointInterface = "org.jboss.ws.httpserver_httpspi.EndpointInterface",
+ targetNamespace = "http://org.apache.cxf/jaxws/endpoint/")
+@MTOM
+public class EndpointBean implements EndpointInterface {
+
+ private int count;
+ private boolean initialized;
+
+ public String echo(String input) {
+ count++;
+ return input;
+ }
+
+ @PostConstruct
+ public void init() {
+ this.initialized = true;
+ }
+
+ @PreDestroy
+ public void destroy() {
+ // nothing to do
+ }
+
+ public int getCount() {
+ this.ensureInit();
+ return count;
+ }
+
+ public void getException() {
+ this.ensureInit();
+ throw new WebServiceException("Ooops");
+ }
+
+ public DHResponse echoDataHandler(DHRequest request) {
+ this.ensureInit();
+ DataHandler dataHandler = request.getDataHandler();
+
+ try {
+ if (!dataHandler.getContentType().equals("text/plain")) {
+ throw new WebServiceException("Wrong content type");
+ }
+ if (!dataHandler.getContent().equals("some string")) {
+ throw new WebServiceException("Wrong data");
+ }
+ } catch (IOException e) {
+ throw new WebServiceException(e);
+ }
+
+ DataHandler responseData = new DataHandler("Server data", "text/plain");
+ return new DHResponse(responseData);
+ }
+
+ private void ensureInit() {
+ if (!this.initialized) {
+ throw new IllegalStateException();
+ }
+ }
+
+}
Added: projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointInterface.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointInterface.java (rev 0)
+++ projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointInterface.java 2010-08-22 11:12:45 UTC (rev 12830)
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jboss.ws.httpserver_httpspi;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService(targetNamespace = "http://org.apache.cxf/jaxws/endpoint/")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface EndpointInterface {
+
+ String echo(String input);
+
+ int getCount();
+
+ void getException();
+
+ DHResponse echoDataHandler(DHRequest request);
+
+}
Added: projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/PathUtilsTest.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/PathUtilsTest.java (rev 0)
+++ projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/PathUtilsTest.java 2010-08-22 11:12:45 UTC (rev 12830)
@@ -0,0 +1,86 @@
+/*
+ * 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.ws.httpserver_httpspi;
+
+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", "", "")));
+ }
+}
13 years, 8 months
JBossWS SVN: r12829 - stack/cxf/branches/cxf-2.3/modules/testsuite.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2010-08-22 05:15:21 -0400 (Sun, 22 Aug 2010)
New Revision: 12829
Modified:
stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss501.txt
stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss510.txt
stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss600.txt
stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss601.txt
Log:
[JBWS-3079] Enabling tests
Modified: stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss501.txt
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss501.txt 2010-08-22 09:14:37 UTC (rev 12828)
+++ stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss501.txt 2010-08-22 09:15:21 UTC (rev 12829)
@@ -39,7 +39,6 @@
org/jboss/test/ws/jaxrpc/**
# [JBWS-2945] JAX-WS 2.2 implementation not yet available for CXF stack
-org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.*
org/jboss/test/ws/jaxws/jbws2960/**
org/jboss/test/ws/jaxws/jbws2991/**
org/jboss/test/ws/jaxws/jbws3008/**
Modified: stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss510.txt
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss510.txt 2010-08-22 09:14:37 UTC (rev 12828)
+++ stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss510.txt 2010-08-22 09:15:21 UTC (rev 12829)
@@ -39,7 +39,6 @@
org/jboss/test/ws/jaxrpc/**
# [JBWS-2945] JAX-WS 2.2 implementation not yet available for CXF stack
-org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.*
org/jboss/test/ws/jaxws/jbws2960/**
org/jboss/test/ws/jaxws/jbws2991/**
org/jboss/test/ws/jaxws/jbws3008/**
Modified: stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss600.txt
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss600.txt 2010-08-22 09:14:37 UTC (rev 12828)
+++ stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss600.txt 2010-08-22 09:15:21 UTC (rev 12829)
@@ -30,7 +30,6 @@
org/jboss/test/ws/jaxws/jbws1797/**
# [JBWS-2945] JAX-WS 2.2 implementation not yet available for CXF stack
-org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.*
org/jboss/test/ws/jaxws/jbws2937/**
org/jboss/test/ws/jaxws/jbws2942/**
org/jboss/test/ws/jaxws/jbws2960/**
Modified: stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss601.txt
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss601.txt 2010-08-22 09:14:37 UTC (rev 12828)
+++ stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss601.txt 2010-08-22 09:15:21 UTC (rev 12829)
@@ -30,7 +30,6 @@
org/jboss/test/ws/jaxws/jbws1797/**
# [JBWS-2945] JAX-WS 2.2 implementation not yet available for CXF stack
-org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.*
org/jboss/test/ws/jaxws/jbws2937/**
org/jboss/test/ws/jaxws/jbws2942/**
org/jboss/test/ws/jaxws/jbws2960/**
13 years, 8 months
JBossWS SVN: r12828 - stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2010-08-22 05:14:37 -0400 (Sun, 22 Aug 2010)
New Revision: 12828
Modified:
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpExchangeAdaptor.java
Log:
[JBWS-3079] Removing dependency on commons-lang
Modified: 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-22 09:07:58 UTC (rev 12827)
+++ 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-22 09:14:37 UTC (rev 12828)
@@ -34,7 +34,6 @@
import javax.xml.ws.spi.http.HttpContext;
import javax.xml.ws.spi.http.HttpExchange;
-import org.apache.commons.lang.NotImplementedException;
import org.apache.cxf.io.AbstractWrappedOutputStream;
import com.sun.net.httpserver.HttpServer;
@@ -212,9 +211,7 @@
@Override
public Set<String> getAttributeNames()
{
- NotImplementedException e = new NotImplementedException();
- e.printStackTrace();
- throw e;
+ throw new UnsupportedOperationException();
}
@Override
13 years, 8 months
JBossWS SVN: r12827 - framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2010-08-22 05:07:58 -0400 (Sun, 22 Aug 2010)
New Revision: 12827
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointInterface.java
Log:
[JBWS-3107] Manually force the wsdl part names through @WebParam / @WebResult, given the test uses local copy of the wsdl on client side and send a pre-built message string...
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointInterface.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointInterface.java 2010-08-21 08:17:28 UTC (rev 12826)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointInterface.java 2010-08-22 09:07:58 UTC (rev 12827)
@@ -24,6 +24,8 @@
import java.rmi.Remote;
import java.rmi.RemoteException;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
@@ -38,5 +40,6 @@
@SOAPBinding(style = SOAPBinding.Style.RPC)
public interface EndpointInterface extends Remote
{
- String echo(String input) throws RemoteException;
+ @WebResult(partName = "result")
+ String echo(@WebParam(partName = "String_1") String input) throws RemoteException;
}
13 years, 8 months
JBossWS SVN: r12826 - stack/cxf/branches/cxf-2.3/modules/testsuite.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2010-08-21 04:17:28 -0400 (Sat, 21 Aug 2010)
New Revision: 12826
Modified:
stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss501.txt
stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss510.txt
stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss600.txt
stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss601.txt
Log:
[JBWS-3079] Enabling some tests
Modified: stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss501.txt
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss501.txt 2010-08-21 08:12:52 UTC (rev 12825)
+++ stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss501.txt 2010-08-21 08:17:28 UTC (rev 12826)
@@ -39,7 +39,7 @@
org/jboss/test/ws/jaxrpc/**
# [JBWS-2945] JAX-WS 2.2 implementation not yet available for CXF stack
-org/jboss/test/ws/jaxws/endpoint/**
+org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.*
org/jboss/test/ws/jaxws/jbws2960/**
org/jboss/test/ws/jaxws/jbws2991/**
org/jboss/test/ws/jaxws/jbws3008/**
Modified: stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss510.txt
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss510.txt 2010-08-21 08:12:52 UTC (rev 12825)
+++ stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss510.txt 2010-08-21 08:17:28 UTC (rev 12826)
@@ -39,7 +39,7 @@
org/jboss/test/ws/jaxrpc/**
# [JBWS-2945] JAX-WS 2.2 implementation not yet available for CXF stack
-org/jboss/test/ws/jaxws/endpoint/**
+org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.*
org/jboss/test/ws/jaxws/jbws2960/**
org/jboss/test/ws/jaxws/jbws2991/**
org/jboss/test/ws/jaxws/jbws3008/**
Modified: stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss600.txt
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss600.txt 2010-08-21 08:12:52 UTC (rev 12825)
+++ stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss600.txt 2010-08-21 08:17:28 UTC (rev 12826)
@@ -30,7 +30,7 @@
org/jboss/test/ws/jaxws/jbws1797/**
# [JBWS-2945] JAX-WS 2.2 implementation not yet available for CXF stack
-org/jboss/test/ws/jaxws/endpoint/**
+org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.*
org/jboss/test/ws/jaxws/jbws2937/**
org/jboss/test/ws/jaxws/jbws2942/**
org/jboss/test/ws/jaxws/jbws2960/**
Modified: stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss601.txt
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss601.txt 2010-08-21 08:12:52 UTC (rev 12825)
+++ stack/cxf/branches/cxf-2.3/modules/testsuite/test-excludes-jboss601.txt 2010-08-21 08:17:28 UTC (rev 12826)
@@ -30,7 +30,7 @@
org/jboss/test/ws/jaxws/jbws1797/**
# [JBWS-2945] JAX-WS 2.2 implementation not yet available for CXF stack
-org/jboss/test/ws/jaxws/endpoint/**
+org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.*
org/jboss/test/ws/jaxws/jbws2937/**
org/jboss/test/ws/jaxws/jbws2942/**
org/jboss/test/ws/jaxws/jbws2960/**
13 years, 8 months
JBossWS SVN: r12825 - framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2010-08-21 04:12:52 -0400 (Sat, 21 Aug 2010)
New Revision: 12825
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/UsecasesTestCase.java
Log:
[JBWS-3079] Some updates on test
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/UsecasesTestCase.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/UsecasesTestCase.java 2010-08-21 08:10:36 UTC (rev 12824)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/UsecasesTestCase.java 2010-08-21 08:12:52 UTC (rev 12825)
@@ -78,7 +78,15 @@
Endpoint endpoint2 = publishEndpoint2(new Endpoint1Impl(), publishURL2);
invokeEndpoint1(publishURL1);
- invokeEndpoint1(publishURL2);
+ if (isIntegrationCXF())
+ {
+ //sun.net.www.protocol.http.HttpURLConnection barfs on addresses like http://localhost:8872?wsdl
+ invokeEndpoint1(publishURL2.replace(String.valueOf(port2), port2 + "/"));
+ }
+ else
+ {
+ invokeEndpoint1(publishURL2);
+ }
endpoint1.stop();
endpoint2.stop();
@@ -101,6 +109,11 @@
public void testSamePortsAndAlmostIdenticalLongPaths() throws Exception
{
+ if (isIntegrationCXF())
+ {
+ System.out.println("[JBWS-3079] FIXME: fix context path retrieval");
+ return;
+ }
String publishURL1 = "http://" + getServerHost() + ":" + port1 + "/jaxws-endpoint/endpoint/number1/";
Endpoint endpoint1 = publishEndpoint2(new Endpoint1Impl(), publishURL1);
13 years, 8 months
JBossWS SVN: r12824 - in stack/cxf/branches/cxf-2.3: modules and 33 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2010-08-21 04:10:36 -0400 (Sat, 21 Aug 2010)
New Revision: 12824
Added:
stack/cxf/branches/cxf-2.3/modules/addons/
stack/cxf/branches/cxf-2.3/modules/addons/pom.xml
stack/cxf/branches/cxf-2.3/modules/addons/transports/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/
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/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/
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/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/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerTransportFactory.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/main/resources/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/resources/META-INF/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/bus-extensions.xml
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf-extension-httpserver.xml
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf.extension
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/jboss/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/addons/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/
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/PathUtilsTest.java
stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/test/resources/
Modified:
stack/cxf/branches/cxf-2.3/modules/client/pom.xml
stack/cxf/branches/cxf-2.3/modules/client/src/main/resources/META-INF/bus-extensions.xml
stack/cxf/branches/cxf-2.3/modules/client/src/main/resources/META-INF/cxf/cxf-extension-jbossws.xml
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] Adding new module for CXF httpserver transport
Property changes on: stack/cxf/branches/cxf-2.3/modules/addons
___________________________________________________________________
Name: svn:ignore
+ target
.project
.classpath
.settings
Added: stack/cxf/branches/cxf-2.3/modules/addons/pom.xml
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/addons/pom.xml (rev 0)
+++ stack/cxf/branches/cxf-2.3/modules/addons/pom.xml 2010-08-21 08:10:36 UTC (rev 12824)
@@ -0,0 +1,22 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBoss Web Services - Stack CXF Add-ons</name>
+ <artifactId>jbossws-cxf-addons</artifactId>
+ <packaging>pom</packaging>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.ws.cxf</groupId>
+ <artifactId>jbossws-cxf</artifactId>
+ <version>3.4.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <!-- Modules -->
+ <modules>
+ <module>transports/http/httpserver</module>
+ </modules>
+
+</project>
Property changes on: stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver
___________________________________________________________________
Name: svn:ignore
+ target
.project
.classpath
.settings
Added: 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 (rev 0)
+++ stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/pom.xml 2010-08-21 08:10:36 UTC (rev 12824)
@@ -0,0 +1,131 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBoss Web Services - Stack CXF httpserver transport</name>
+ <artifactId>jbossws-cxf-transports-httpserver</artifactId>
+ <packaging>jar</packaging>
+
+ <parent>
+ <groupId>org.jboss.ws.cxf</groupId>
+ <artifactId>jbossws-cxf-addons</artifactId>
+ <version>3.4.0-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
+ </parent>
+
+ <!-- Dependencies -->
+ <dependencies>
+
+ <!-- CXF dependencies -->
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ </dependency>
+
+ <!-- Spring -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-asm</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-expression</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jms</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ </dependency>
+
+ <!--
+ useStrictFiltering requires dependency in all included modules
+ http://jira.codehaus.org/browse/MASSEMBLY-317
+ -->
+
+ <dependency>
+ <groupId>org.jboss.spec.javax.xml.ws</groupId>
+ <artifactId>jboss-jaxws-api_2.2_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.spec.javax.servlet</groupId>
+ <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>
Added: 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 (rev 0)
+++ 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-21 08:10:36 UTC (rev 12824)
@@ -0,0 +1,80 @@
+/*
+ * 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(a)jboss.com
+ * @since 19-Aug-2010
+ *
+ */
+@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);
+ }
+
+}
Added: 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 (rev 0)
+++ 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-21 08:10:36 UTC (rev 12824)
@@ -0,0 +1,231 @@
+/*
+ * 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.commons.lang.NotImplementedException;
+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(a)jboss.com
+ * @since 19-Aug-2010
+ *
+ */
+@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()
+ {
+ NotImplementedException e = new NotImplementedException();
+ e.printStackTrace();
+ throw e;
+ }
+
+ @Override
+ public Principal getUserPrincipal()
+ {
+ return delegate.getPrincipal();
+ }
+
+ @Override
+ public boolean isUserInRole(String role)
+ {
+ return false;
+ }
+}
Added: 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 (rev 0)
+++ 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-21 08:10:36 UTC (rev 12824)
@@ -0,0 +1,72 @@
+/*
+ * 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(a)jboss.com
+ * @sine 19-Aug-2010
+ *
+ */
+@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
Added: 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 (rev 0)
+++ 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-21 08:10:36 UTC (rev 12824)
@@ -0,0 +1,112 @@
+/*
+ * 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.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.cxf.Bus;
+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.JAXWSHttpSpiDestination;
+
+/**
+ * HTTP destination to be used with the JDK6 httpserver; this extends the
+ * basic JAXWSHttpSpiDestination with all the mechanisms for properly
+ * handling destination and factory life-cycles.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 19-Aug-2010
+ *
+ */
+public class HttpServerDestination extends JAXWSHttpSpiDestination
+{
+ static final Logger LOG = LogUtils.getL7dLogger(HttpServerDestination.class);
+
+ private static final long serialVersionUID = 1L;
+
+ private HttpServerTransportFactory factory;
+ private HttpServerEngineFactory serverEngineFactory;
+ private HttpServerEngine engine;
+ private URL url;
+
+ public HttpServerDestination(Bus b, HttpServerTransportFactory factory, EndpointInfo ei) throws IOException
+ {
+ super(b, ei);
+ this.factory = factory;
+ this.serverEngineFactory = factory.getServerEngineFactory();
+ this.url = new URL(ei.getAddress());
+ }
+
+ @Override
+ protected Logger getLogger()
+ {
+ return LOG;
+ }
+
+ public void finalizeConfig() throws IOException
+ {
+ engine = serverEngineFactory.retrieveHttpServerEngine(url.getPort());
+ if (engine == null)
+ {
+ engine = serverEngineFactory.createHttpServerEngine(url.getHost(), url.getPort(), url.getProtocol());
+ }
+ if (!url.getProtocol().equals(engine.getProtocol()))
+ {
+ throw new IllegalStateException("Port " + engine.getPort() + " is configured with wrong protocol \""
+ + 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));
+ }
+
+ /**
+ * Deactivate receipt of incoming messages.
+ */
+ protected void deactivate() {
+ LOG.log(Level.FINE, "Deactivating receipt of incoming messages");
+ engine.removeHandler(endpointInfo.getAddress());
+ }
+
+ @Override
+ public void shutdown()
+ {
+ factory.removeDestination(endpointInfo);
+ super.shutdown();
+ }
+
+}
Added: 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 (rev 0)
+++ 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-21 08:10:36 UTC (rev 12824)
@@ -0,0 +1,136 @@
+/*
+ * 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.net.InetSocketAddress;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.logging.LogUtils;
+
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpServer;
+
+/**
+ * A server engine that internally uses the JDK6 httpserver
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 19-Aug-2010
+ *
+ */
+@SuppressWarnings("restriction")
+public class HttpServerEngine
+{
+ private static final Logger LOG = LogUtils.getL7dLogger(HttpServerEngine.class);
+ private static final int DELAY = Integer.getInteger(System.getProperty(HttpServerEngineFactory.class.getName() + ".STOP_DELAY"), 1);
+ private static final int BACKLOG = 0;
+
+ private Bus bus;
+ private HttpServerEngineFactory factory;
+ private String host;
+ private int port;
+ private int handlerCount;
+ private String protocol = "http";
+ private HttpServer server;
+
+ public HttpServerEngine(HttpServerEngineFactory fac, Bus bus, String host, int port)
+ {
+ this.bus = bus;
+ this.factory = fac;
+ this.host = host;
+ this.port = port;
+ }
+
+ public Bus getBus()
+ {
+ return bus;
+ }
+
+ public String getProtocol()
+ {
+ return protocol;
+ }
+
+ public int getPort()
+ {
+ return port;
+ }
+
+ public String getHost()
+ {
+ return host;
+ }
+
+ public synchronized void addHandler(String address, HttpHandler handler)
+ {
+ if (server == null) //start the server on first call
+ {
+ InetSocketAddress isa = host != null ? new InetSocketAddress(host, port) : new InetSocketAddress(port);
+ try
+ {
+ server = HttpServer.create(isa, BACKLOG);
+ server.start();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ server.createContext(PathUtils.getContextPath(address), handler);
+ handlerCount++;
+ }
+
+ public synchronized void removeHandler(String address)
+ {
+ server.removeContext(PathUtils.getContextPath(address));
+ handlerCount--;
+ }
+
+ /**
+ * This method is called by the ServerEngine Factory to destroy the server
+ */
+ protected void stop() throws Exception
+ {
+ if (server != null)
+ {
+ server.stop(DELAY);
+ }
+ }
+
+ /**
+ * This method will shut down the server engine and
+ * remove it from the factory's cache.
+ */
+ public void shutdown()
+ {
+ if (factory != null && handlerCount == 0)
+ {
+ factory.destroyForPort(port);
+ }
+ else
+ {
+ LOG.log(Level.WARNING, "FAILED_TO_SHUTDOWN_ENGINE_MSG", port);
+ }
+ }
+}
Added: stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java (rev 0)
+++ stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java 2010-08-21 08:10:36 UTC (rev 12824)
@@ -0,0 +1,151 @@
+/*
+ * 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.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.annotation.Resource;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.buslifecycle.BusLifeCycleListener;
+import org.apache.cxf.buslifecycle.BusLifeCycleManager;
+import org.apache.cxf.common.logging.LogUtils;
+
+/**
+ * A server engine factory for the JDK6-based httpserver engine
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 19-Aug-2010
+ *
+ */
+public class HttpServerEngineFactory implements BusLifeCycleListener
+{
+ private static final Logger LOG = LogUtils.getL7dLogger(HttpServerEngineFactory.class);
+ private static Map<Integer, HttpServerEngine> portMap = new HashMap<Integer, HttpServerEngine>();
+
+ private BusLifeCycleManager lifeCycleManager;
+ private Bus bus;
+
+ public HttpServerEngineFactory(Bus b)
+ {
+ setBus(b);
+ }
+
+ /**
+ * This call is used to set the bus. It should only be called once.
+ * @param bus
+ */
+ @Resource(name = "cxf")
+ public final void setBus(Bus bus)
+ {
+ assert this.bus == null || this.bus == bus;
+ this.bus = bus;
+ if (bus != null)
+ {
+ bus.setExtension(this, HttpServerEngineFactory.class);
+ lifeCycleManager = bus.getExtension(BusLifeCycleManager.class);
+ if (null != lifeCycleManager)
+ {
+ lifeCycleManager.registerLifeCycleListener(this);
+ }
+ }
+ }
+
+ public Bus getBus()
+ {
+ return bus;
+ }
+
+ /**
+ * Retrieve a previously configured HttpServerEngine for the
+ * given port. If none exists, this call returns null.
+ */
+ public synchronized HttpServerEngine retrieveHttpServerEngine(int port)
+ {
+ return portMap.get(port);
+ }
+
+ public synchronized HttpServerEngine createHttpServerEngine(String host, int port, String protocol)
+ throws IOException
+ {
+ LOG.fine("Creating HttpServer Engine for port " + port + ".");
+ HttpServerEngine ref = retrieveHttpServerEngine(port);
+ if (null == ref)
+ {
+ ref = new HttpServerEngine(this, bus, host, port);
+ portMap.put(port, ref);
+ }
+ // checking the protocol
+ if (!protocol.equals(ref.getProtocol()))
+ {
+ throw new IOException("Protocol mismatch for port " + port + ": " + "engine's protocol is "
+ + ref.getProtocol() + ", the url protocol is " + protocol);
+ }
+ return ref;
+ }
+
+ /**
+ * This method removes the Server Engine from the port map and stops it.
+ */
+ public synchronized void destroyForPort(int port)
+ {
+ HttpServerEngine ref = portMap.remove(port);
+ if (ref != null)
+ {
+ LOG.fine("Stopping HttpServer Engine on port " + port + ".");
+ try
+ {
+ ref.stop();
+ }
+ catch (Exception e)
+ {
+ LOG.log(Level.WARNING, "", e);
+ }
+ }
+ }
+
+ public void initComplete()
+ {
+ // do nothing here
+ }
+
+ public void postShutdown()
+ {
+ // shut down the httpserver in the portMap
+ // To avoid the CurrentModificationException,
+ // do not use portMap.vaules directly
+ HttpServerEngine[] engines = portMap.values().toArray(new HttpServerEngine[0]);
+ for (HttpServerEngine engine : engines)
+ {
+ engine.shutdown();
+ }
+ }
+
+ public void preShutdown()
+ {
+ // do nothing here
+ }
+}
Added: stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerTransportFactory.java
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerTransportFactory.java (rev 0)
+++ stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerTransportFactory.java 2010-08-21 08:10:36 UTC (rev 12824)
@@ -0,0 +1,118 @@
+/*
+ * 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.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.DestinationFactory;
+import org.apache.cxf.transport.http.AbstractHTTPTransportFactory;
+
+/**
+ * A Destination/Transport factory for the JDK6 httpserver
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 19-Aug-2010
+ *
+ */
+public class HttpServerTransportFactory extends AbstractHTTPTransportFactory implements DestinationFactory
+{
+ private Map<String, HttpServerDestination> destinations = new ConcurrentHashMap<String, HttpServerDestination>();
+
+ public HttpServerTransportFactory()
+ {
+ super();
+ }
+
+ @Resource
+ public void setBus(Bus b)
+ {
+ super.setBus(b);
+ }
+
+ @PostConstruct
+ public void finalizeConfig()
+ {
+ if (null == bus)
+ {
+ return;
+ }
+ // This call will register the server engine factory
+ // with the Bus.
+ getServerEngineFactory();
+ }
+
+ protected HttpServerEngineFactory getServerEngineFactory()
+ {
+ HttpServerEngineFactory serverEngineFactory = getBus().getExtension(HttpServerEngineFactory.class);
+ // If it's not there, then create it and register it.
+ // Spring may override it later, but we need it here for default
+ // with no spring configuration.
+ if (serverEngineFactory == null)
+ {
+ serverEngineFactory = new HttpServerEngineFactory(bus);
+ serverEngineFactory.setBus(getBus());
+ }
+ return serverEngineFactory;
+ }
+
+ public Destination getDestination(EndpointInfo endpointInfo) throws IOException
+ {
+ String addr = endpointInfo.getAddress();
+ HttpServerDestination destination = addr == null ? null : destinations.get(addr);
+ if (destination == null)
+ {
+ destination = createDestination(endpointInfo);
+ }
+ return destination;
+ }
+
+ private synchronized HttpServerDestination createDestination(EndpointInfo endpointInfo) throws IOException
+ {
+ String addr = endpointInfo.getAddress();
+ HttpServerDestination destination = addr == null ? null : destinations.get(addr);
+ if (destination == null)
+ {
+ destination = new HttpServerDestination(getBus(), this, endpointInfo);
+ destinations.put(endpointInfo.getAddress(), destination);
+ configure(destination);
+ destination.finalizeConfig();
+ }
+ return destination;
+ }
+
+ /**
+ * This function removes the destination for a particular endpoint.
+ */
+ void removeDestination(EndpointInfo ei)
+ {
+ destinations.remove(ei.getAddress());
+ }
+
+}
Added: 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 (rev 0)
+++ 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-21 08:10:36 UTC (rev 12824)
@@ -0,0 +1,108 @@
+/*
+ * 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;
+ }
+
+}
Added: stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/bus-extensions.xml
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/bus-extensions.xml (rev 0)
+++ stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/bus-extensions.xml 2010-08-21 08:10:36 UTC (rev 12824)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<extensions xmlns="http://cxf.apache.org/bus/extension">
+
+ <extension class="org.jboss.wsf.stack.cxf.addons.transports.httpserver.HttpServerTransportFactory" deferred="false">
+ <namespace>http://cxf.apache.org/transports/http</namespace>
+ <namespace>http://cxf.apache.org/transports/http/configuration</namespace>
+ <namespace>http://schemas.xmlsoap.org/wsdl/http</namespace>
+ <namespace>http://schemas.xmlsoap.org/wsdl/http/</namespace>
+ </extension>
+</extensions>
Added: stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf-extension-httpserver.xml
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf-extension-httpserver.xml (rev 0)
+++ stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf-extension-httpserver.xml 2010-08-21 08:10:36 UTC (rev 12824)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:foo="http://cxf.apache.org/configuration/foo"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+
+ <bean class="org.jboss.wsf.stack.cxf.addons.transports.httpserver.HttpServerTransportFactory"
+ id="org.jboss.wsf.stack.cxf.addons.transports.httpserver.HttpServerTransportFactory"
+ lazy-init="true">
+ <property name="bus" ref="cxf"/>
+ <property name="transportIds">
+ <list>
+ <value>http://cxf.apache.org/transports/http</value>
+ <value>http://cxf.apache.org/transports/http/configuration</value>
+ <value>http://schemas.xmlsoap.org/wsdl/http</value>
+ <value>http://schemas.xmlsoap.org/wsdl/http/</value>
+ </list>
+ </property>
+ </bean>
+
+</beans>
Added: stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf.extension
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf.extension (rev 0)
+++ stack/cxf/branches/cxf-2.3/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf.extension 2010-08-21 08:10:36 UTC (rev 12824)
@@ -0,0 +1 @@
+META-INF/cxf/cxf-extension-httpserver.xml
\ No newline at end of file
Added: 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 (rev 0)
+++ 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-21 08:10:36 UTC (rev 12824)
@@ -0,0 +1,144 @@
+/*
+ * 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.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import javax.xml.ws.spi.http.HttpExchange;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.configuration.spring.ConfigurerImpl;
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
+
+/**
+ * Tests for HttpServerEngine
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 20-Aug-2010
+ *
+ */
+public class HttpServerEngineTest extends TestCase {
+
+ private Bus bus;
+ private IMocksControl control;
+ private HttpServerEngineFactory factory;
+
+
+ public void setUp() throws Exception
+ {
+ control = EasyMock.createNiceControl();
+ bus = control.createMock(Bus.class);
+ Configurer configurer = new ConfigurerImpl();
+ bus.getExtension(Configurer.class);
+ EasyMock.expectLastCall().andReturn(configurer).anyTimes();
+ }
+
+ public void testEngineRetrieval() throws Exception
+ {
+ control.replay();
+ factory = new HttpServerEngineFactory(bus);
+ HttpServerEngine engine = factory.createHttpServerEngine("localhost", 9234, "http");
+ assertTrue(engine == factory.retrieveHttpServerEngine(9234));
+ factory.destroyForPort(1234);
+ control.verify();
+ }
+
+ public void testHttpAndHttps() throws Exception
+ {
+ control.replay();
+ factory = new HttpServerEngineFactory(bus);
+ HttpServerEngine engine = factory.createHttpServerEngine("localhost", 9234, "http");
+ assertTrue("http".equals(engine.getProtocol()));
+ System.out.println("[JBWS-3079] FIXME: Add support for https protocol");
+// HttpServerEngine engine2 = factory.createHttpServerEngine("localhost", 9235, "https");
+// assertTrue("https".equals(engine2.getProtocol()));
+ factory.destroyForPort(9234);
+// factory.destroyForPort(9235);
+
+ control.verify();
+ }
+
+ public void testHandler() throws Exception
+ {
+ MyTestHandler handler1 = new MyTestHandler();
+ MyTestHandler handler2 = new MyTestHandler();
+ control.replay();
+ factory = new HttpServerEngineFactory(bus);
+ String urlStr1 = "http://localhost:9234/hello/test";
+ String urlStr2 = "http://localhost:9234/hello233/test";
+ HttpServerEngine engine = factory.createHttpServerEngine("localhost", 9234, "http");
+ engine.addHandler(urlStr1, handler1);
+ engine.addHandler(urlStr2, handler2);
+ pingServer(new URL(urlStr1));
+ pingServer(new URL(urlStr2));
+ assertEquals(1, handler1.count);
+ assertEquals(1, handler2.count);
+ engine.removeHandler(urlStr1);
+ engine.removeHandler(urlStr2);
+ engine.shutdown();
+ factory.destroyForPort(9234);
+
+ control.verify();
+ }
+
+ private void pingServer(URL url)
+ {
+ try
+ {
+ HttpURLConnection connection1 = (HttpURLConnection) url.openConnection();
+ connection1.getInputStream();
+ connection1.disconnect();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private class MyTestHandler extends HttpHandlerAdaptor
+ {
+ volatile int count;
+
+ public MyTestHandler()
+ {
+ super(null);
+ }
+
+ @Override
+ public void handle(HttpExchange exchange) throws IOException {
+ count++;
+ exchange.setStatus(200);
+ OutputStream os = exchange.getResponseBody();
+ os.write("Hello".getBytes());
+ os.flush();
+ exchange.close();
+ }
+ }
+
+}
Added: 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 (rev 0)
+++ 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-21 08:10:36 UTC (rev 12824)
@@ -0,0 +1,86 @@
+/*
+ * 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/client/pom.xml
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/client/pom.xml 2010-08-20 10:09:09 UTC (rev 12823)
+++ stack/cxf/branches/cxf-2.3/modules/client/pom.xml 2010-08-21 08:10:36 UTC (rev 12824)
@@ -29,6 +29,11 @@
<artifactId>jbossws-cxf-factories</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.ws.cxf</groupId>
+ <artifactId>jbossws-cxf-transports-httpserver</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!-- CXF dependencies -->
<dependency>
Modified: stack/cxf/branches/cxf-2.3/modules/client/src/main/resources/META-INF/bus-extensions.xml
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/client/src/main/resources/META-INF/bus-extensions.xml 2010-08-20 10:09:09 UTC (rev 12823)
+++ stack/cxf/branches/cxf-2.3/modules/client/src/main/resources/META-INF/bus-extensions.xml 2010-08-21 08:10:36 UTC (rev 12824)
@@ -20,12 +20,5 @@
<extensions xmlns="http://cxf.apache.org/bus/extension">
<extension class="org.apache.cxf.endpoint.ServerLifeCycleManagerImpl" interface="org.apache.cxf.endpoint.ServerLifeCycleManager" />
<extension class="org.apache.cxf.endpoint.ClientLifeCycleManagerImpl" interface="org.apache.cxf.endpoint.ClientLifeCycleManager" />
- <!-- The following is to be removed when providing a http transport factory implementation (for instance, using Jetty, see cxf-rt-transports-http-jetty.jar) -->
- <extension class="org.apache.cxf.transport.servlet.ServletTransportFactory" deferred="false">
- <namespace>http://cxf.apache.org/transports/http</namespace>
- <namespace>http://cxf.apache.org/transports/http/configuration</namespace>
- <namespace>http://schemas.xmlsoap.org/wsdl/http</namespace>
- <namespace>http://schemas.xmlsoap.org/wsdl/http/</namespace>
- </extension>
</extensions>
Modified: stack/cxf/branches/cxf-2.3/modules/client/src/main/resources/META-INF/cxf/cxf-extension-jbossws.xml
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/client/src/main/resources/META-INF/cxf/cxf-extension-jbossws.xml 2010-08-20 10:09:09 UTC (rev 12823)
+++ stack/cxf/branches/cxf-2.3/modules/client/src/main/resources/META-INF/cxf/cxf-extension-jbossws.xml 2010-08-21 08:10:36 UTC (rev 12824)
@@ -18,19 +18,4 @@
</cxf:bus>
-->
- <!-- The following is to be removed when providing a http transport factory implementation (for instance, using Jetty, see cxf-rt-transports-http-jetty.jar) -->
- <bean class="org.apache.cxf.transport.servlet.ServletTransportFactory"
- id="org.apache.cxf.transport.servlet.ServletTransportFactory"
- lazy-init="true">
- <property name="bus" ref="cxf"/>
- <property name="transportIds">
- <list>
- <value>http://cxf.apache.org/transports/http</value>
- <value>http://cxf.apache.org/transports/http/configuration</value>
- <value>http://schemas.xmlsoap.org/wsdl/http</value>
- <value>http://schemas.xmlsoap.org/wsdl/http/</value>
- </list>
- </property>
- </bean>
-
</beans>
\ No newline at end of file
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-20 10:09:09 UTC (rev 12823)
+++ stack/cxf/branches/cxf-2.3/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2010-08-21 08:10:36 UTC (rev 12824)
@@ -39,6 +39,7 @@
<include name="**/jbossws-cxf-client*.jar"/>
<include name="**/jbossws-framework.jar"/>
<include name="**/jbossws-spi.jar"/>
+ <include name="**/jbossws-cxf-transports-httpserver.jar"/>
<include name="**/jdom.jar"/>
<include name="**/jetty*.jar"/>
<include name="**/neethi.jar"/>
@@ -87,6 +88,7 @@
</patternset>
<patternset id="jbossws.service.lib.patternset">
+ <include name="**/jbossws-cxf-transports-httpserver.jar"/>
<include name="**/jbossws-cxf-client*.jar"/>
<include name="**/jbossws-cxf-factories.jar"/>
<include name="**/jbossws-cxf-server*.jar"/>
Modified: stack/cxf/branches/cxf-2.3/pom.xml
===================================================================
--- stack/cxf/branches/cxf-2.3/pom.xml 2010-08-20 10:09:09 UTC (rev 12823)
+++ stack/cxf/branches/cxf-2.3/pom.xml 2010-08-21 08:10:36 UTC (rev 12824)
@@ -41,6 +41,7 @@
<module>modules/endorsed</module>
<module>modules/management</module>
<module>modules/resources</module>
+ <module>modules/addons</module>
</modules>
<!-- Properties -->
@@ -312,6 +313,10 @@
</exclusion>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-javamail_1.4_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jaxws_2.1_spec</artifactId>
</exclusion>
<exclusion>
@@ -1161,6 +1166,11 @@
<artifactId>jboss-jms-api_1.1_spec</artifactId>
<version>${jms.api.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <version>2.4</version>
+ </dependency>
</dependencies>
</dependencyManagement>
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-20 10:09:09 UTC (rev 12823)
+++ stack/cxf/branches/cxf-2.3/src/main/scripts/assembly-deploy-artifacts.xml 2010-08-21 08:10:36 UTC (rev 12824)
@@ -23,6 +23,7 @@
<useStrictFiltering>true</useStrictFiltering>
<includes>
<include>org.jboss.ws.cxf:jbossws-cxf-factories:jar</include>
+ <include>org.jboss.ws.cxf:jbossws-cxf-transports-httpserver:jar</include>
<include>org.apache.cxf:cxf-*</include>
<include>org.apache.cxf.xjcplugins:cxf-*</include>
<include>com.sun.xml.bind:jaxb-impl:jar</include>
13 years, 8 months
JBossWS SVN: r12823 - stack/cxf/branches/cxf-2.3/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2010-08-20 06:09:09 -0400 (Fri, 20 Aug 2010)
New Revision: 12823
Modified:
stack/cxf/branches/cxf-2.3/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.java
Log:
[JBWS-3110]:Added '-createxsdimports' flag to cxf wsprovider tool
Modified: stack/cxf/branches/cxf-2.3/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.java
===================================================================
--- stack/cxf/branches/cxf-2.3/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.java 2010-08-20 10:08:44 UTC (rev 12822)
+++ stack/cxf/branches/cxf-2.3/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.java 2010-08-20 10:09:09 UTC (rev 12823)
@@ -180,6 +180,8 @@
}
args.add("-wrapperbean");
+
+ args.add("-createxsdimports");
// the SEI
args.add(endpointClass.getCanonicalName());
13 years, 8 months
JBossWS SVN: r12822 - stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2010-08-20 06:08:44 -0400 (Fri, 20 Aug 2010)
New Revision: 12822
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.java
Log:
[JBWS-3110]:Added '-createxsdimports' flag to cxf wsprovider tool
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.java 2010-08-18 17:45:55 UTC (rev 12821)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.java 2010-08-20 10:08:44 UTC (rev 12822)
@@ -180,6 +180,8 @@
}
args.add("-wrapperbean");
+
+ args.add("-createxsdimports");
// the SEI
args.add(endpointClass.getCanonicalName());
13 years, 8 months