JBossWS SVN: r5854 - stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-02-28 14:06:49 -0500 (Thu, 28 Feb 2008)
New Revision: 5854
Modified:
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java
Log:
Enforce EndpointAssociation within RequestHandler
Modified: stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java
===================================================================
--- stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java 2008-02-28 19:04:24 UTC (rev 5853)
+++ stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java 2008-02-28 19:06:49 UTC (rev 5854)
@@ -61,20 +61,29 @@
ServletAdapter target = endpoint.getAttachment(ServletAdapter.class);
if(null == target)
throw new IllegalArgumentException("Cannot obtain ServletAdapter");
-
- String method = req.getMethod();
- if (method.equals("POST"))
+
+
+ EndpointAssociation.setEndpoint(endpoint);
+ try
{
- doPost(target, context, req, res);
+ String method = req.getMethod();
+ if (method.equals("POST"))
+ {
+ doPost(target, context, req, res);
+ }
+ else if(method.equals("GET"))
+ {
+ doGet(target, req, context, res);
+ }
+ else
+ {
+ throw new WebServiceException("Unsupported method: " + method);
+ }
}
- else if(method.equals("GET"))
+ finally
{
- doGet(target, req, context, res);
+ EndpointAssociation.removeEndpoint();
}
- else
- {
- throw new WebServiceException("Unsupported method: " + method);
- }
}
private void doGet(ServletAdapter target, HttpServletRequest req, ServletContext context, HttpServletResponse res)
@@ -160,7 +169,7 @@
for(Object o : props.keySet())
{
String key = (String)o;
- streamContext.getRequestContext().put(key, props.getProperty(key));
+ streamContext.getRequestContext().put(key, props.getProperty(key));
}
}
@@ -173,7 +182,7 @@
}
finally
{
- EndpointAssociation.setEndpoint(null);
+ EndpointAssociation.removeEndpoint();
}
}
16 years, 10 months
JBossWS SVN: r5853 - stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-02-28 14:04:24 -0500 (Thu, 28 Feb 2008)
New Revision: 5853
Modified:
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/InvokerJSE.java
Log:
InvokerJSE: Add precondition assertion
Modified: stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/InvokerJSE.java
===================================================================
--- stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/InvokerJSE.java 2008-02-28 19:01:39 UTC (rev 5852)
+++ stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/InvokerJSE.java 2008-02-28 19:04:24 UTC (rev 5853)
@@ -83,6 +83,9 @@
public Object invoke(Packet p, Method m, Object... args) throws InvocationTargetException, IllegalAccessException
{
Endpoint ep = EndpointAssociation.getEndpoint();
+ if(null == ep)
+ throw new IllegalArgumentException("EndpointAssociation.getEndpoint() may not be null");
+
InvocationHandler invHandler = ep.getInvocationHandler();
Invocation inv = invHandler.createInvocation();
16 years, 10 months
JBossWS SVN: r5852 - in stack/metro/trunk: ant-import-tests and 8 other directories.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-02-28 14:01:39 -0500 (Thu, 28 Feb 2008)
New Revision: 5852
Added:
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/MessageStreamAdapter.java
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/MessageStreamConnectionImpl.java
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/MessageStreamContext.java
stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/
stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/DelegationServlet.java
stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/JBWS1869Endpoint.java
stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/JBWS1869EndpointImpl.java
stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/JBWS1869TestCase.java
stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/jaxws/
stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/jaxws/Echo.java
stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/jaxws/EchoResponse.java
stack/metro/trunk/src/test/resources/jaxws/jbws1869/
stack/metro/trunk/src/test/resources/jaxws/jbws1869/WEB-INF/
stack/metro/trunk/src/test/resources/jaxws/jbws1869/WEB-INF/web.xml
Modified:
stack/metro/trunk/ant-import-tests/build-jars-jaxws.xml
stack/metro/trunk/metro-trunk.iml
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java
stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/metadata/RuntimeModelDeploymentAspect.java
Log:
Fix JBWS-1869: Support stream based invocations through RequestHandler
Modified: stack/metro/trunk/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- stack/metro/trunk/ant-import-tests/build-jars-jaxws.xml 2008-02-28 16:32:23 UTC (rev 5851)
+++ stack/metro/trunk/ant-import-tests/build-jars-jaxws.xml 2008-02-28 19:01:39 UTC (rev 5852)
@@ -9,43 +9,54 @@
<!-- $Id$ -->
<project>
-
- <description>JBossWS test archive builder</description>
-
- <!-- ================================================================== -->
- <!-- Building -->
- <!-- ================================================================== -->
-
- <target name="build-jars-jaxws" description="Build the deployments.">
-
- <mkdir dir="${tests.output.dir}/libs"/>
- <!-- jbws1871 -->
- <war warfile="${tests.output.dir}/libs/jaxws-jbws1871.war"
- webxml="${tests.output.dir}/resources/jaxws/jbws1871/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/classes">
- <include name="org/jboss/test/ws/jaxws/jbws1871/**/*"/>
- </classes>
- <webinf dir="${tests.output.dir}/resources/jaxws/jbws1871/WEB-INF">
- <include name="**/*"/>
- </webinf>
- </war>
+ <description>JBossWS test archive builder</description>
- <!-- wsit-rm -->
- <war warfile="${tests.output.dir}/libs/wsit-rm.war" webxml="${tests.output.dir}/resources/wsit/rm/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/classes">
- <include name="org/jboss/test/ws/wsit/rm/CalculatorWSImpl.class"/>
- <include name="org/jboss/test/ws/wsit/rm/CalculatorWS.class"/>
- <include name="org/jboss/test/ws/wsit/rm/Add.class"/>
- <include name="org/jboss/test/ws/wsit/rm/AddResponse.class"/>
- </classes>
- <webinf dir="${tests.output.dir}/resources/wsit/rm/WEB-INF">
- <include name="sun-web.xml"/>
- <include name="web.xml"/>
- <include name="wsit-org.jboss.test.ws.wsit.rm.CalculatorWSImpl.xml"/>
- </webinf>
- </war>
+ <!-- ================================================================== -->
+ <!-- Building -->
+ <!-- ================================================================== -->
- </target>
-
+ <target name="build-jars-jaxws" description="Build the deployments.">
+
+ <mkdir dir="${tests.output.dir}/libs"/>
+
+ <!-- jbws1869 -->
+ <war warfile="${tests.output.dir}/libs/jaxws-jbws1869.war"
+ webxml="${tests.output.dir}/resources/jaxws/jbws1869/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/jbws1869/**/*"/>
+ </classes>
+ <webinf dir="${tests.output.dir}/resources/jaxws/jbws1869/WEB-INF">
+ <include name="**/*"/>
+ </webinf>
+ </war>
+
+ <!-- jbws1871 -->
+ <war warfile="${tests.output.dir}/libs/jaxws-jbws1871.war"
+ webxml="${tests.output.dir}/resources/jaxws/jbws1871/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/jbws1871/**/*"/>
+ </classes>
+ <webinf dir="${tests.output.dir}/resources/jaxws/jbws1871/WEB-INF">
+ <include name="**/*"/>
+ </webinf>
+ </war>
+
+ <!-- wsit-rm -->
+ <war warfile="${tests.output.dir}/libs/wsit-rm.war" webxml="${tests.output.dir}/resources/wsit/rm/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/wsit/rm/CalculatorWSImpl.class"/>
+ <include name="org/jboss/test/ws/wsit/rm/CalculatorWS.class"/>
+ <include name="org/jboss/test/ws/wsit/rm/Add.class"/>
+ <include name="org/jboss/test/ws/wsit/rm/AddResponse.class"/>
+ </classes>
+ <webinf dir="${tests.output.dir}/resources/wsit/rm/WEB-INF">
+ <include name="sun-web.xml"/>
+ <include name="web.xml"/>
+ <include name="wsit-org.jboss.test.ws.wsit.rm.CalculatorWSImpl.xml"/>
+ </webinf>
+ </war>
+
+ </target>
+
</project>
Modified: stack/metro/trunk/metro-trunk.iml
===================================================================
--- stack/metro/trunk/metro-trunk.iml 2008-02-28 16:32:23 UTC (rev 5851)
+++ stack/metro/trunk/metro-trunk.iml 2008-02-28 19:01:39 UTC (rev 5852)
@@ -184,15 +184,6 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/thirdparty/jaxws-rt.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
<root url="jar://$MODULE_DIR$/thirdparty/jaxws-api.jar!/" />
</CLASSES>
<JAVADOC />
@@ -388,6 +379,7 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module" module-name="jaxws-2.1.3-src" />
<orderEntryProperties />
</component>
</module>
Added: stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/MessageStreamAdapter.java
===================================================================
--- stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/MessageStreamAdapter.java (rev 0)
+++ stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/MessageStreamAdapter.java 2008-02-28 19:01:39 UTC (rev 5852)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.metro;
+
+import com.sun.xml.ws.api.message.Packet;
+import com.sun.xml.ws.api.server.Adapter;
+import com.sun.xml.ws.api.server.TransportBackChannel;
+import com.sun.xml.ws.api.server.WSEndpoint;
+import com.sun.xml.ws.transport.http.DeploymentDescriptorParser.AdapterFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Heiko Braun
+ */
+public class MessageStreamAdapter extends Adapter<MessageStreamAdapter.StreamToolkit> {
+
+ final String name;
+
+ public MessageStreamAdapter(String name, WSEndpoint endpoint)
+ {
+ super(endpoint);
+ this.name = name;
+ }
+
+ public void handle(MessageStreamContext context, InputStream in, OutputStream out) throws IOException
+ {
+ MessageStreamConnectionImpl connection = new MessageStreamConnectionImpl(context, in, out);
+
+ StreamToolkit tk = pool.take();
+ try {
+ tk.handle(connection);
+ connection.flush();
+ } finally {
+ pool.recycle(tk);
+ connection.close();
+ }
+ }
+
+ protected StreamToolkit createToolkit() {
+ return new StreamToolkit();
+ }
+
+ class StreamToolkit extends Adapter.Toolkit implements TransportBackChannel {
+
+ private MessageStreamConnectionImpl connection;
+
+ private void handle(MessageStreamConnectionImpl connection) throws IOException {
+ this.connection = connection;
+
+ String contentTypeStr = connection.getRequestHeader(MessageStreamContext.CONTENT_TYPE);
+ InputStream in = connection.getInputStream();
+ Packet packet = new Packet();
+
+ codec.decode(in, contentTypeStr, packet);
+
+ try
+ {
+ packet = head.process(packet, connection, this);
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ writeInternalServerError(connection);
+ return;
+ }
+
+ contentTypeStr = codec.getStaticContentType(packet).getContentType();
+ if (contentTypeStr == null)
+ {
+ throw new UnsupportedOperationException();
+ }
+ else
+ {
+ Map<String, String> headers = new HashMap();
+ headers.put(MessageStreamContext.CONTENT_TYPE, contentTypeStr);
+ connection.setResponseHeaders(headers);
+
+ codec.encode(packet, connection.getOutputStream());
+ }
+
+ }
+
+ private void writeInternalServerError(MessageStreamConnectionImpl connection) {
+ connection.setStatus(MessageStreamContext.STATUS_INTERNAL_SERVER_ERROR);
+ }
+
+ public void close() {
+ connection.close();
+ }
+
+ }
+
+ public static final AdapterFactory<MessageStreamAdapter> FACTORY = new AdapterFactory<MessageStreamAdapter>()
+ {
+ public MessageStreamAdapter createAdapter(String name, String urlPattern, WSEndpoint<?> endpoint)
+ {
+ return new MessageStreamAdapter(name, endpoint);
+ }
+ };
+}
Property changes on: stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/MessageStreamAdapter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/MessageStreamConnectionImpl.java
===================================================================
--- stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/MessageStreamConnectionImpl.java (rev 0)
+++ stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/MessageStreamConnectionImpl.java 2008-02-28 19:01:39 UTC (rev 5852)
@@ -0,0 +1,164 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.metro;
+
+import com.sun.istack.NotNull;
+import com.sun.xml.ws.api.message.Packet;
+import com.sun.xml.ws.api.server.WSEndpoint;
+import com.sun.xml.ws.api.server.WebServiceContextDelegate;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.Principal;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Heiko Braun
+ */
+public class MessageStreamConnectionImpl implements WebServiceContextDelegate {
+
+ private MessageStreamContext messageContext;
+ private InputStream inputStream;
+ private OutputStream outputStream;
+
+ private int status;
+
+ private boolean isClosed;
+
+ private Map<String, String> requestHeaders;
+ private Map<String, String> responseHeaders;
+
+ public MessageStreamConnectionImpl(MessageStreamContext context, InputStream in, OutputStream out)
+ {
+ outputStream = out;
+ inputStream = in;
+ messageContext = context;
+
+ populateRequestHeaders();
+ }
+
+ public int getStatus() {
+ return status;
+ }
+
+ public void setStatus(int statusCode) {
+ this.status = statusCode;
+ }
+
+ public Map<String, String> getRequestHeaders() {
+ return requestHeaders;
+ }
+
+ public void setRequestHeaders(Map<String, String> requestHeaders) {
+ this.requestHeaders = requestHeaders;
+ }
+
+ public String getRequestHeader(String name) {
+ return requestHeaders.get(name);
+ }
+
+ public Map<String, String> getResponseHeaders() {
+ return responseHeaders;
+ }
+
+ public void setResponseHeaders(Map<String, String> responseHeaders) {
+ this.responseHeaders = responseHeaders;
+ }
+
+ public InputStream getInputStream() {
+ return inputStream;
+ }
+
+ public OutputStream getOutputStream() {
+ return outputStream;
+ }
+
+ public void closeInput() {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException ex) {
+ }
+
+ inputStream = null;
+ }
+ }
+
+ public void closeOutput() {
+ if (outputStream != null) {
+ try {
+ outputStream.close();
+ } catch (IOException ex) {
+ }
+
+ outputStream = null;
+ }
+ }
+
+ public void close() {
+ if (!isClosed) {
+ synchronized (this) {
+ if (!isClosed) {
+ isClosed = true;
+
+ closeInput();
+ closeOutput();
+ }
+ }
+ }
+ }
+
+ // Not supported
+ public Principal getUserPrincipal(Packet request) {
+ return null;
+ }
+
+ // Not supported
+ public boolean isUserInRole(Packet request, String role) {
+ return false;
+ }
+
+ public @NotNull String getEPRAddress(@NotNull Packet request, @NotNull WSEndpoint endpoint) {
+ return null;
+ }
+
+ public String getWSDLAddress(@NotNull Packet request, @NotNull WSEndpoint endpoint) {
+ return null;
+ }
+
+ public void flush() throws IOException {
+ if (outputStream != null) {
+ outputStream.flush();
+ }
+ }
+
+ private void populateRequestHeaders() {
+ requestHeaders = new HashMap();
+
+ for(String s : messageContext.getRequestContext().keySet())
+ {
+ requestHeaders.put(s, messageContext.getRequestContext().get(s));
+ }
+ }
+}
Property changes on: stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/MessageStreamConnectionImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/MessageStreamContext.java
===================================================================
--- stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/MessageStreamContext.java (rev 0)
+++ stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/MessageStreamContext.java 2008-02-28 19:01:39 UTC (rev 5852)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.metro;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author Heiko Braun
+ */
+public class MessageStreamContext
+{
+
+ public static final int STATUS_INTERNAL_SERVER_ERROR = 500;
+ public final static String CONTENT_TYPE = "Content-Type";
+
+ private Map<String, String> requestContext = new HashMap<String, String>();
+ private Map<String, String> responseContext = new HashMap<String, String>();
+
+ public Map<String, String> getRequestContext()
+ {
+ return requestContext;
+ }
+
+ public void setRequestContext(Map<String, String> requestContext)
+ {
+ this.requestContext = requestContext;
+ }
+
+ public Map<String, String> getResponseContext()
+ {
+ return responseContext;
+ }
+
+ public void setResponseContext(Map<String, String> responseContext)
+ {
+ this.responseContext = responseContext;
+ }
+}
Property changes on: stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/MessageStreamContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java
===================================================================
--- stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java 2008-02-28 16:32:23 UTC (rev 5851)
+++ stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/RequestHandlerImpl.java 2008-02-28 19:01:39 UTC (rev 5852)
@@ -28,6 +28,7 @@
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.invocation.InvocationContext;
import org.jboss.wsf.spi.invocation.RequestHandler;
+import org.jboss.wsf.spi.invocation.EndpointAssociation;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@@ -38,6 +39,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Writer;
+import java.util.Properties;
/**
* A request handler
@@ -59,7 +61,7 @@
ServletAdapter target = endpoint.getAttachment(ServletAdapter.class);
if(null == target)
throw new IllegalArgumentException("Cannot obtain ServletAdapter");
-
+
String method = req.getMethod();
if (method.equals("POST"))
{
@@ -128,11 +130,59 @@
}
}
+ /**
+ * The InvocationContext accepts a {@link Properties} attachment that can carry request properies.<br/>
+ * Property keys are derived from {@link org.jboss.wsf.stack.metro.MessageStreamContext}
+ * <p/>
+ * Required propeties are:
+ *
+ * <ul>
+ * <li><tt>Content-Type</tt> ({@link org.jboss.wsf.stack.metro.MessageStreamContext#CONTENT_TYPE})
+ * </ul>
+ * @param endpoint
+ * @param inStream
+ * @param outStream
+ * @param context
+ */
+ public void handleRequest(Endpoint endpoint, InputStream inStream, OutputStream outStream, InvocationContext context)
+ {
+ MessageStreamAdapter adapter = endpoint.getAttachment(MessageStreamAdapter.class);
+ if(null == adapter)
+ throw new IllegalArgumentException("Cannot obtain MessageStreamAdapter");
+ try
+ {
+ MessageStreamContext streamContext = new MessageStreamContext();
- public void handleRequest(Endpoint endpoint, InputStream inStream, OutputStream outStream, InvocationContext context)
- {
- throw new IllegalArgumentException("JBWS-1869: Not implemented");
+ if(context!=null && context.getAttachment(Properties.class)!=null)
+ {
+ Properties props = context.getAttachment(Properties.class);
+ for(Object o : props.keySet())
+ {
+ String key = (String)o;
+ streamContext.getRequestContext().put(key, props.getProperty(key));
+ }
+ }
+
+ // Hacky, but the InvokerJSE requires it.
+ // However it's bette to do it here then outside the RequestHandler...
+ EndpointAssociation.setEndpoint(endpoint);
+ try
+ {
+ adapter.handle(streamContext, inStream, outStream );
+ }
+ finally
+ {
+ EndpointAssociation.setEndpoint(null);
+ }
+
+ }
+ catch (IOException e)
+ {
+ throw new WebServiceException("Failed to process request: " + e.getMessage(), e);
+
+ }
+
}
public void handleWSDLRequest(Endpoint endpoint, OutputStream outStream, InvocationContext context)
Modified: stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/metadata/RuntimeModelDeploymentAspect.java
===================================================================
--- stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/metadata/RuntimeModelDeploymentAspect.java 2008-02-28 16:32:23 UTC (rev 5851)
+++ stack/metro/trunk/src/main/java/org/jboss/wsf/stack/metro/metadata/RuntimeModelDeploymentAspect.java 2008-02-28 19:01:39 UTC (rev 5852)
@@ -37,6 +37,7 @@
import org.jboss.wsf.stack.metro.DeploymentDescriptorParserExt;
import org.jboss.wsf.stack.metro.DeploymentDescriptorParserJBWS;
import org.jboss.wsf.stack.metro.FakeServletContext;
+import org.jboss.wsf.stack.metro.MessageStreamAdapter;
import org.jboss.wsf.stack.metro.log.MessageLogPipelineHook;
import javax.xml.ws.WebServiceException;
@@ -110,7 +111,7 @@
List<ServletAdapter> adapters = parser.parse(sunJaxWsXml.toExternalForm(), sunJaxWsXml.openStream());
for(ServletAdapter adapter : adapters)
- {
+ {
for(Endpoint ep : deployment.getService().getEndpoints() )
{
// TODO matching need to be improved
@@ -118,6 +119,12 @@
ep.getTargetBeanClass().equals(adapter.getEndpoint().getImplementationClass()))
{
ep.addAttachment(ServletAdapter.class, adapter);
+
+ // JBWS-1869: Support stream based RequestHandler API
+ ep.addAttachment(
+ MessageStreamAdapter.class,
+ MessageStreamAdapter.FACTORY.createAdapter(adapter.getName(), null, adapter.getEndpoint())
+ );
break;
}
}
Added: stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/DelegationServlet.java
===================================================================
--- stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/DelegationServlet.java (rev 0)
+++ stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/DelegationServlet.java 2008-02-28 19:01:39 UTC (rev 5852)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.ws.jaxws.jbws1869;
+
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+import org.jboss.wsf.spi.management.EndpointRegistry;
+import org.jboss.wsf.spi.management.EndpointRegistryFactory;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Properties;
+
+/**
+ * Reads a SOAP message from HTTP body and invokes an
+ * Endpoint through {@link org.jboss.wsf.spi.invocation.RequestHandler#handleRequest(org.jboss.wsf.spi.deployment.Endpoint, java.io.InputStream, java.io.OutputStream, org.jboss.wsf.spi.invocation.InvocationContext)}
+ */
+public class DelegationServlet extends HttpServlet
+{
+
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+ ObjectName EP_NAME = null;
+ try
+ {
+ EP_NAME = new ObjectName("jboss.ws:context=jaxws-jbws1869,endpoint=Endpoint");
+ }
+ catch (MalformedObjectNameException e) {}
+
+ // EndpointRegistry access
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ EndpointRegistryFactory registryFactory = spiProvider.getSPI(EndpointRegistryFactory.class);
+ EndpointRegistry reg = registryFactory.getEndpointRegistry();
+
+ Endpoint endpoint = reg.getEndpoint(EP_NAME);
+ ServletInputStream inputStream = request.getInputStream();
+ OutputStream outputStream = response.getOutputStream();
+
+ try
+ {
+ InvocationContext invocationContext = new InvocationContext();
+ Properties props = new Properties();
+ props.put("Content-Type", request.getContentType());
+ invocationContext.addAttachment(Properties.class, props);
+
+ endpoint.getRequestHandler().handleRequest(endpoint, inputStream, outputStream, invocationContext);
+ }
+ catch(Exception e)
+ {
+ throw new ServletException("Failed to invoke endpoint", e);
+ }
+ finally
+ {
+ if(inputStream!=null) inputStream.close();
+ if(outputStream!=null) outputStream.close();
+ }
+
+ }
+}
Property changes on: stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/DelegationServlet.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/JBWS1869Endpoint.java
===================================================================
--- stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/JBWS1869Endpoint.java (rev 0)
+++ stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/JBWS1869Endpoint.java 2008-02-28 19:01:39 UTC (rev 5852)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.ws.jaxws.jbws1869;
+
+import javax.jws.WebService;
+
+@WebService
+public interface JBWS1869Endpoint
+{
+ public String echo(String msg);
+}
Property changes on: stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/JBWS1869Endpoint.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/JBWS1869EndpointImpl.java
===================================================================
--- stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/JBWS1869EndpointImpl.java (rev 0)
+++ stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/JBWS1869EndpointImpl.java 2008-02-28 19:01:39 UTC (rev 5852)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.ws.jaxws.jbws1869;
+
+import javax.jws.WebService;
+
+@WebService
+public class JBWS1869EndpointImpl implements JBWS1869Endpoint
+{
+
+ public String echo(String msg)
+ {
+ System.out.println(msg);
+ return msg;
+ }
+}
Property changes on: stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/JBWS1869EndpointImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/JBWS1869TestCase.java
===================================================================
--- stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/JBWS1869TestCase.java (rev 0)
+++ stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/JBWS1869TestCase.java 2008-02-28 19:01:39 UTC (rev 5852)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.ws.jaxws.jbws1869;
+
+import junit.framework.Test;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.HttpURLConnection;
+import java.io.OutputStreamWriter;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+
+/**
+ * Support stream based RequestHandler API
+ */
+public class JBWS1869TestCase extends JBossWSTest
+{
+ private final static String TNS = "http://jbws1869.jaxws.ws.test.jboss.org/";
+ private final static QName portName = new QName(TNS, "JBWS1869EndpointImplPort");
+ private final static QName serviceName = new QName(TNS, "JBWS1869EndpointImplService");
+
+ private final static String REQUEST = "<?xml version=\"1.0\" ?><S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Body><ns2:echo xmlns:ns2=\"http://jbws1869.jaxws.ws.test.jboss.org/\"><arg0>StreamBasedInvocation</arg0></ns2:echo></S:Body></S:Envelope>";
+ private final static String RESPONSE = "<?xml version=\"1.0\" ?><S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Body><ns2:echoResponse xmlns:ns2=\"http://jbws1869.jaxws.ws.test.jboss.org/\"><return>StreamBasedInvocation</return></ns2:echoResponse></S:Body></S:Envelope>";
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(JBWS1869TestCase.class, "jaxws-jbws1869.war");
+ }
+
+ /**
+ * Go through {@link org.jboss.wsf.spi.invocation.RequestHandler#handleHttpRequest(org.jboss.wsf.spi.deployment.Endpoint, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.ServletContext)}
+ * @throws Exception
+ */
+ public void testServletInvocation() throws Exception
+ {
+ Service service = Service.create(
+ new URL("http://"+getServerHost()+":8080/jaxws-jbws1869?wsdl"), serviceName
+ );
+ JBWS1869Endpoint port = service.getPort(portName, JBWS1869Endpoint .class);
+
+ String res = port.echo("ServletInvocation");
+ assertEquals(res, "ServletInvocation");
+ }
+
+ /**
+ * Go through {@link org.jboss.wsf.spi.invocation.RequestHandler#handleRequest(org.jboss.wsf.spi.deployment.Endpoint, java.io.InputStream, java.io.OutputStream, org.jboss.wsf.spi.invocation.InvocationContext)}
+ * @throws Exception
+ */
+ public void testStreamBasedInvocation() throws Exception
+ {
+ // Send data
+ URL url = new URL("http://"+getServerHost()+":8080/jaxws-jbws1869/delegate");
+ HttpURLConnection conn = (HttpURLConnection)url.openConnection();
+ conn.setDoOutput(true);
+ conn.setRequestProperty("Content-Type", "text/xml");
+
+
+ OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
+ wr.write(REQUEST);
+ wr.flush();
+
+ // Get the response
+ StringBuffer sb = new StringBuffer();
+ BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+ String line;
+ while ((line = rd.readLine()) != null)
+ {
+ sb.append(line);
+ }
+ wr.close();
+ rd.close();
+
+ // response assertion
+ assertEquals(RESPONSE, sb.toString());
+ }
+}
Property changes on: stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/JBWS1869TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/jaxws/Echo.java
===================================================================
--- stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/jaxws/Echo.java (rev 0)
+++ stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/jaxws/Echo.java 2008-02-28 19:01:39 UTC (rev 5852)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.ws.jaxws.jbws1869.jaxws;
+
+import javax.xml.bind.annotation.*;
+
+@XmlRootElement(name = "echo", namespace = "http://jbws1869.jaxws.ws.test.jboss.org/")
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "echo", namespace = "http://jbws1869.jaxws.ws.test.jboss.org/")
+public class Echo
+{
+
+ @XmlElement(name = "arg0", namespace = "")
+ private String arg0;
+
+ /**
+ *
+ * @return
+ * returns String
+ */
+ public String getArg0() {
+ return this.arg0;
+ }
+
+ /**
+ *
+ * @param arg0
+ * the value for the arg0 property
+ */
+ public void setArg0(String arg0) {
+ this.arg0 = arg0;
+ }
+
+}
Property changes on: stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/jaxws/Echo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/jaxws/EchoResponse.java
===================================================================
--- stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/jaxws/EchoResponse.java (rev 0)
+++ stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/jaxws/EchoResponse.java 2008-02-28 19:01:39 UTC (rev 5852)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.ws.jaxws.jbws1869.jaxws;
+
+import javax.xml.bind.annotation.*;
+
+@XmlRootElement(name = "echoResponse", namespace = "http://jbws1869.jaxws.ws.test.jboss.org/")
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "echoResponse", namespace = "http://jbws1869.jaxws.ws.test.jboss.org/")
+public class EchoResponse
+{
+
+ @XmlElement(name = "return", namespace = "")
+ private String _return;
+
+ /**
+ *
+ * @return
+ * returns String
+ */
+ public String getReturn() {
+ return this._return;
+ }
+
+ /**
+ *
+ * @param _return
+ * the value for the _return property
+ */
+ public void setReturn(String _return) {
+ this._return = _return;
+ }
+
+}
Property changes on: stack/metro/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1869/jaxws/EchoResponse.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/metro/trunk/src/test/resources/jaxws/jbws1869/WEB-INF/web.xml
===================================================================
--- stack/metro/trunk/src/test/resources/jaxws/jbws1869/WEB-INF/web.xml (rev 0)
+++ stack/metro/trunk/src/test/resources/jaxws/jbws1869/WEB-INF/web.xml 2008-02-28 19:01:39 UTC (rev 5852)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <servlet>
+ <servlet-name>Endpoint</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.jbws1869.JBWS1869EndpointImpl</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Endpoint</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>Delegate</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.jbws1869.DelegationServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Delegate</servlet-name>
+ <url-pattern>/delegate</url-pattern>
+ </servlet-mapping>
+</web-app>
Property changes on: stack/metro/trunk/src/test/resources/jaxws/jbws1869/WEB-INF/web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
16 years, 10 months
JBossWS SVN: r5851 - in stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm: jaxws and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-02-28 11:32:23 -0500 (Thu, 28 Feb 2008)
New Revision: 5851
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMConstant.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMFault.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMFaultCode.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerAbstractBase.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerHelper.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMServerHandler.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java
Log:
preparation steps for RM faults serialization
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMConstant.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMConstant.java 2008-02-28 15:17:44 UTC (rev 5850)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMConstant.java 2008-02-28 16:32:23 UTC (rev 5851)
@@ -23,6 +23,7 @@
public static final String REQUEST_CONTEXT = PREFIX + ".requestContext";
public static final String RESPONSE_CONTEXT = PREFIX + ".responseContext";
public static final String SEQUENCE_REFERENCE = PREFIX + ".sequenceReference";
+ public static final String FAULT_REFERENCE = PREFIX + ".faultReference";
public static final String PROTOCOL_MESSAGES = PREFIX + ".protocolMessages";
public static final String PROTOCOL_MESSAGES_MAPPING = PREFIX + ".protocolMessagesMapping";
public static final String WSA_MESSAGE_ID = PREFIX + ".wsaMessageId";
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMFault.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMFault.java 2008-02-28 15:17:44 UTC (rev 5850)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMFault.java 2008-02-28 16:32:23 UTC (rev 5851)
@@ -79,4 +79,10 @@
return this.details;
}
+ @Override
+ public String getMessage()
+ {
+ return faultCode.getSubcode() + ": " + faultCode.getReason();
+ }
+
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMFaultCode.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMFaultCode.java 2008-02-28 15:17:44 UTC (rev 5850)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMFaultCode.java 2008-02-28 16:32:23 UTC (rev 5851)
@@ -21,6 +21,8 @@
*/
package org.jboss.ws.extensions.wsrm;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceFaultCode;
+
/**
* RM fault constants
*
@@ -32,7 +34,7 @@
public final class RMFaultCode
{
- private final String subcode;
+ private final RMSequenceFaultCode subcode;
private final String reason;
/**
@@ -47,8 +49,8 @@
* </p>
*/
public static final RMFaultCode SEQUENCE_TERMINATED = new RMFaultCode(
- "SequenceTerminated",
- "The Sequence has been terminated due to an unrecoverable error."
+ RMSequenceFaultCode.SEQUENCE_TERMINATED,
+ "The Sequence has been terminated due to an unrecoverable error."
);
/**
@@ -64,8 +66,8 @@
* </p>
*/
public static final RMFaultCode UNKNOWN_SEQUENCE = new RMFaultCode(
- "UnknownSequence",
- "The value of wsrm:Identifier is not a known Sequence identifier."
+ RMSequenceFaultCode.UNKNOWN_SEQUENCE,
+ "The value of wsrm:Identifier is not a known Sequence identifier."
);
/**
@@ -82,13 +84,14 @@
* </p>
*/
public static final RMFaultCode INVALID_ACKNOWLEDGEMENT = new RMFaultCode(
- "InvalidAcknowledgement",
- "The SequenceAcknowledgement violates the cumulative Acknowledgement invariant."
+ RMSequenceFaultCode.INVALID_ACKNOWLEDGEMENT,
+ "The SequenceAcknowledgement violates the cumulative Acknowledgement invariant."
);
/**
* Message number in /wsrm:Sequence/wsrm:MessageNumber of a Received
- * message exceeds the internal limitations of an RM Destination
+ * message exceeds the internal limitations of an RM Destination.
+ * It is an unrecoverable error and terminates the Sequence.
* <p>
* <table>
* <tr><td>[Code]</td><td>Sender</td></tr>
@@ -103,8 +106,8 @@
* </p>
*/
public static final RMFaultCode MESSAGE_NUMBER_ROLLOVER = new RMFaultCode(
- "MessageNumberRollover",
- "The maximum value for wsrm:MessageNumber has been exceeded."
+ RMSequenceFaultCode.MESSAGE_NUMBER_ROLLOVER,
+ "The maximum value for wsrm:MessageNumber has been exceeded."
);
/**
@@ -120,8 +123,8 @@
* </p>
*/
public static final RMFaultCode CREATE_SEQUENCE_REFUSED = new RMFaultCode(
- "CreateSequenceRefused",
- "The Create Sequence request has been refused by the RM Destination."
+ RMSequenceFaultCode.CREATE_SEQUENCE_REFUSED,
+ "The Create Sequence request has been refused by the RM Destination."
);
/**
@@ -139,15 +142,14 @@
* </p>
*/
public static final RMFaultCode SEQUENCE_CLOSED = new RMFaultCode(
- "SequenceClosed",
- "The Sequence is closed and cannot accept new messages."
+ RMSequenceFaultCode.SEQUENCE_CLOSED,
+ "The Sequence is closed and cannot accept new messages."
);
/**
* If an RM Destination requires the use of WS-RM,
* this fault is generated when it Receives an incoming
* message that did not use this protocol.
- *
* <p>
* <table>
* <tr><td>[Code]</td><td>Sender</td></tr>
@@ -158,16 +160,35 @@
* </p>
*/
public static final RMFaultCode WSRM_REQUIRED = new RMFaultCode(
- "WSRMRequired",
- "The RM Destination requires the use of WSRM"
+ RMSequenceFaultCode.WSRM_REQUIRED,
+ "The RM Destination requires the use of WSRM"
);
+
+ /**
+ * This fault is sent by an RM Destination to indicate that it has received a message that
+ * has a <MessageNumber> within a Sequence that exceeds the value of the
+ * <MessageNumber> element that accompanied a <LastMessage> element for the
+ * Sequence. This is an unrecoverable error and terminates the Sequence.
+ * <p>
+ * <table>
+ * <tr><td>[Code]</td><td>Sender</td></tr>
+ * <tr><td>[Subcode]</td><td>wsrm:LastMessageNumberExceeded</td></tr>
+ * <tr><td>[Reason]</td><td>The value for wsrm:MessageNumber exceeds the value of the MessageNumber accompanying a LastMessage element in this Sequence.</td></tr>
+ * <tr><td>[Detail]</td><td><wsrm:Identifier...> xs:anyURI </wsrm:Identifier></td></tr>
+ * </table>
+ * </p>
+ */
+ public static final RMFaultCode LAST_MESSAGE_NUMBER_EXCEEDED = new RMFaultCode(
+ RMSequenceFaultCode.LAST_MESSAGE_NUMBER_EXCEEDED,
+ "The value for wsrm:MessageNumber exceeds the value of the MessageNumber accompanying a LastMessage element in this Sequence"
+ );
/**
* Hidden constructor
* @param subcode the subcode
* @param reason message
*/
- private RMFaultCode(String subcode, String reason)
+ private RMFaultCode(RMSequenceFaultCode subcode, String reason)
{
super();
this.subcode = subcode;
@@ -178,7 +199,7 @@
* Gets subcode
* @return subcode
*/
- public final String getSubcode()
+ public final RMSequenceFaultCode getSubcode()
{
return this.subcode;
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerAbstractBase.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerAbstractBase.java 2008-02-28 15:17:44 UTC (rev 5850)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerAbstractBase.java 2008-02-28 16:32:23 UTC (rev 5851)
@@ -31,6 +31,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler;
import org.jboss.ws.extensions.wsrm.RMConstant;
+import org.jboss.ws.extensions.wsrm.RMFault;
import org.jboss.ws.extensions.wsrm.RMSequence;
import org.jboss.ws.extensions.wsrm.api.RMException;
import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable;
@@ -78,4 +79,15 @@
catch (RMException ignore) {}
}
+ protected final void serialize(QName msgQN, List<QName> outMsgs, Map<QName, RMSerializable> data, SOAPMessage soapMessage, RMFault fault)
+ {
+ RMSerializable msg = RMHandlerHelper.prepareData(msgQN, outMsgs, fault);
+ if (msg != null)
+ {
+ msg.serializeTo(soapMessage);
+ data.put(msgQN, msg);
+ log.debug(msgQN.getLocalPart() + " WSRM message was serialized to payload");
+ }
+ }
+
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerHelper.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerHelper.java 2008-02-28 15:17:44 UTC (rev 5850)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerHelper.java 2008-02-28 16:32:23 UTC (rev 5851)
@@ -26,6 +26,7 @@
import javax.xml.namespace.QName;
+import org.jboss.ws.extensions.wsrm.RMFault;
import org.jboss.ws.extensions.wsrm.RMSequence;
import org.jboss.ws.extensions.wsrm.common.RMHelper;
import org.jboss.ws.extensions.wsrm.spi.RMConstants;
@@ -37,6 +38,7 @@
import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequence;
import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequenceResponse;
import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceAcknowledgement;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceFault;
import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable;
import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequence;
import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequenceResponse;
@@ -143,6 +145,29 @@
return null;
}
+ public static RMSerializable prepareData(QName msgQN, List<QName> outMsgs, RMFault fault)
+ {
+ if (outMsgs.contains(msgQN))
+ {
+ if (rmConstants.getSequenceFaultQName().equals(msgQN))
+ {
+ return newSequenceFault(fault);
+ }
+
+ throw new IllegalArgumentException(msgQN.toString());
+ }
+
+ return null;
+ }
+
+ private static RMSerializable newSequenceFault(RMFault fault)
+ {
+ RMSequenceFault sequenceFault = rmFactory.newSequenceFault();
+ sequenceFault.setDetail(fault);
+ sequenceFault.setFaultCode(fault.getFaultCode().getSubcode());
+ return sequenceFault;
+ }
+
private static RMSerializable newCreateSequence(RMSequence seq)
{
RMCreateSequence createSequence = rmFactory.newCreateSequence();
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMServerHandler.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMServerHandler.java 2008-02-28 15:17:44 UTC (rev 5850)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMServerHandler.java 2008-02-28 16:32:23 UTC (rev 5851)
@@ -36,8 +36,8 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.extensions.wsrm.RMConstant;
+import org.jboss.ws.extensions.wsrm.RMFault;
import org.jboss.ws.extensions.wsrm.RMSequence;
-import org.jboss.ws.extensions.wsrm.api.RMException;
import org.jboss.ws.extensions.wsrm.spi.RMConstants;
import org.jboss.ws.extensions.wsrm.spi.RMProvider;
import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable;
@@ -88,10 +88,8 @@
serialize(rmConstants.getSequenceAcknowledgementQName(), outMsgs, data, soapMessage, sequenceImpl);
if ((outMsgs.size() != 0) && (data.size() == 0))
- throw new RMException("RM handler have not serialized WS-RM message to the payload");
+ throw new IllegalStateException("RM handler have not serialized WS-RM message to the payload");
- // TODO: implement SequenceFault serialization
-
return true;
}
@@ -127,7 +125,7 @@
deserialize(rmConstants.getTerminateSequenceQName(), soapMessage, messages, data);
if (data.size() == 0)
- throw new RMException("RM handler was not able to find WS-RM message in the payload");
+ throw new IllegalStateException("RM handler was not able to find WS-RM message in the payload");
// propagate RM response context to higher layers
msgContext.put(RMConstant.REQUEST_CONTEXT, rmResponseContext);
@@ -136,4 +134,28 @@
return true;
}
+ @Override
+ public boolean handleFault(MessageContext msgContext)
+ {
+ log.debug("handling fault message");
+ CommonMessageContext commonMsgContext = (CommonMessageContext)msgContext;
+ SOAPAddressingProperties addrProps = (SOAPAddressingProperties)commonMsgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
+ Map<String, Object> rmOutboundContext = (Map<String, Object>)commonMsgContext.get(RMConstant.RESPONSE_CONTEXT);
+ List<QName> outMsgs = (List<QName>)rmOutboundContext.get(RMConstant.PROTOCOL_MESSAGES);
+ Map<QName, RMSerializable> data = new HashMap<QName, RMSerializable>();
+ String optionalMessageId = (addrProps.getMessageID() != null) ? addrProps.getMessageID().getURI().toString() : null;
+ rmOutboundContext.put(RMConstant.WSA_MESSAGE_ID, optionalMessageId);
+ rmOutboundContext.put(RMConstant.PROTOCOL_MESSAGES_MAPPING, data);
+ SOAPMessage soapMessage = ((SOAPMessageContext)commonMsgContext).getMessage();
+ RMFault sequenceFault = (RMFault)rmOutboundContext.get(RMConstant.FAULT_REFERENCE);
+
+ // try to serialize SequenceFault to message
+ serialize(rmConstants.getSequenceFaultQName(), outMsgs, data, soapMessage, sequenceFault);
+
+ if ((outMsgs.size() != 0) && (data.size() == 0))
+ throw new IllegalStateException("RM handler have not serialized WS-RM message to the payload");
+
+ return true;
+ }
+
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java 2008-02-28 15:17:44 UTC (rev 5850)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java 2008-02-28 16:32:23 UTC (rev 5851)
@@ -293,7 +293,22 @@
@Override
public final void invoke(Endpoint ep, Invocation inv) throws Exception
{
- Map<String, Object> rmResponseContext = prepareResponseContext(ep, inv, this.dataDir);
+ Map<String, Object> rmResponseContext = null;
+ try
+ {
+ rmResponseContext = prepareResponseContext(ep, inv, this.dataDir);
+ }
+ catch (RMFault fault)
+ {
+ rmResponseContext = new HashMap<String, Object>();
+ List<QName> protocolMessages = new LinkedList<QName>();
+ protocolMessages.add(rmConstants.getSequenceFaultQName());
+ rmResponseContext.put(RMConstant.PROTOCOL_MESSAGES, protocolMessages);
+ rmResponseContext.put(RMConstant.FAULT_REFERENCE, fault);
+ CommonMessageContext msgCtx = MessageContextAssociation.peekMessageContext();
+ msgCtx.put(RMConstant.RESPONSE_CONTEXT, rmResponseContext);
+ throw fault; // rethrow
+ }
if (inv.getJavaMethod() != null)
{
16 years, 10 months
JBossWS SVN: r5850 - common/trunk/src/main/java/org/jboss/wsf/common.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2008-02-28 10:17:44 -0500 (Thu, 28 Feb 2008)
New Revision: 5850
Modified:
common/trunk/src/main/java/org/jboss/wsf/common/DOMWriter.java
Log:
[JBWS-2011] converting \r to its xml form (
) when normalizing strings in DOMWriter
Modified: common/trunk/src/main/java/org/jboss/wsf/common/DOMWriter.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/DOMWriter.java 2008-02-28 14:42:59 UTC (rev 5849)
+++ common/trunk/src/main/java/org/jboss/wsf/common/DOMWriter.java 2008-02-28 15:17:44 UTC (rev 5850)
@@ -67,6 +67,7 @@
import java.util.Iterator;
import java.util.Map;
+import org.jboss.logging.Logger;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@@ -587,6 +588,10 @@
break;
}
case '\r':
+ {
+ str.append("
");
+ break;
+ }
case '\n':
{
if (canonical)
16 years, 10 months
JBossWS SVN: r5849 - stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2008-02-28 09:42:59 -0500 (Thu, 28 Feb 2008)
New Revision: 5849
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleSignTestCase.java
Log:
[JBWS-2011] Adding test case
Modified: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleSignTestCase.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleSignTestCase.java 2008-02-28 14:27:47 UTC (rev 5848)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleSignTestCase.java 2008-02-28 14:42:59 UTC (rev 5849)
@@ -54,11 +54,23 @@
public void testEndpoint() throws Exception
{
Hello hello = getPort();
-
+ performTest(hello, "Kermit");
+ }
+
+ public void testEndpointWithCRLFs() throws Exception
+ {
+ Hello hello = getPort();
+ performTest(hello, "Kermit\nmy friend");
+ performTest(hello, "Kermit\rmy friend");
+ performTest(hello, "Kermit\r\nmy friend");
+ }
+
+ private void performTest(Hello hello, String msg) throws Exception
+ {
UserType in0 = new UserType();
- in0.setMsg("Kermit");
+ in0.setMsg(msg);
UserType retObj = hello.echoUserType(in0);
- assertEquals("Kermit", retObj.getMsg());
+ assertEquals(msg, retObj.getMsg());
}
private Hello getPort() throws Exception
16 years, 10 months
JBossWS SVN: r5848 - stack/native/trunk/src/main/java/org/jboss/ws/core/soap.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2008-02-28 09:27:47 -0500 (Thu, 28 Feb 2008)
New Revision: 5848
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java
Log:
[JBWS-1974] Overriding siblings retrieval methods in SOAPContentElement to correctly transit the model to DOM_VALID when using the DOMWriter
Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java 2008-02-28 14:19:53 UTC (rev 5847)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java 2008-02-28 14:27:47 UTC (rev 5848)
@@ -518,8 +518,22 @@
return super.hasAttributes();
}
+ public org.w3c.dom.Node getPreviousSibling()
+ {
+ log.trace("getPreviousSibling");
+ expandToDOM();
+ return super.getPreviousSibling();
+ }
+
+ public org.w3c.dom.Node getNextSibling()
+ {
+ log.trace("getNextSibling");
+ expandToDOM();
+ return super.getNextSibling();
+ }
+
// END Node interface ***********************************************************************************************
-
+
public void writeElement(Writer writer) throws IOException
{
if (soapContent instanceof DOMContent)
16 years, 10 months
JBossWS SVN: r5847 - in stack/native/trunk/src: test/java/org/jboss/test/ws/jaxws/jbws1857 and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-02-28 09:19:53 -0500 (Thu, 28 Feb 2008)
New Revision: 5847
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1857/JBWS1857TestCase.java
Log:
[JBWS-1857] JAXBContext created for every wrapper type
Count created jaxb contextes
Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java 2008-02-28 14:00:01 UTC (rev 5846)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java 2008-02-28 14:19:53 UTC (rev 5847)
@@ -21,18 +21,22 @@
*/
package org.jboss.ws.core.jaxws;
-import com.sun.xml.bind.api.JAXBRIContext;
-import com.sun.xml.bind.api.TypeReference;
-import com.sun.xml.bind.v2.model.annotation.RuntimeAnnotationReader;
+// $Id$
+
+import java.util.Collection;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.wsf.spi.binding.BindingCustomization;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.invocation.EndpointAssociation;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import java.util.Collection;
+import com.sun.xml.bind.api.JAXBRIContext;
+import com.sun.xml.bind.api.TypeReference;
+import com.sun.xml.bind.v2.model.annotation.RuntimeAnnotationReader;
/**
* The default factory checks if a {@link JAXBBindingCustomization} exists
@@ -57,64 +61,65 @@
public JAXBContext createContext(Class clazz) throws WSException
{
- return createContext(new Class[] {clazz});
+ return createContext(new Class[] { clazz });
}
public JAXBContext createContext(Class[] clazzes) throws WSException
{
try
{
- BindingCustomization customization = getCustomization();
+ BindingCustomization bcust = getCustomization();
- JAXBContext jaxbCtx;
- if(null == customization)
+ JAXBContext jaxbCtx;
+ if (null == bcust)
jaxbCtx = JAXBContext.newInstance(clazzes);
else
- jaxbCtx = createContext(clazzes, customization);
+ jaxbCtx = createContext(clazzes, bcust);
+ incrementContextCount();
return jaxbCtx;
}
- catch (JAXBException e) {
+ catch (JAXBException e)
+ {
throw new WSException("Failed to create JAXBContext", e);
}
}
- public JAXBContext createContext(Class[] clazzes, BindingCustomization bindingCustomization) throws WSException
+ public JAXBContext createContext(Class[] clazzes, BindingCustomization bcust) throws WSException
{
try
{
- return JAXBContext.newInstance(clazzes, bindingCustomization);
+ JAXBContext jaxbCtx = JAXBContext.newInstance(clazzes, bcust);
+ incrementContextCount();
+ return jaxbCtx;
}
- catch (JAXBException e) {
+ catch (JAXBException e)
+ {
throw new WSException("Failed to create JAXBContext", e);
}
}
- public JAXBRIContext createContext(
- Class[] classes, Collection<TypeReference> typeReferences,
- String defaultNamespaceRemap, boolean c14nSupport, BindingCustomization bindingCustomization)
+ public JAXBRIContext createContext(Class[] classes, Collection<TypeReference> refs, String defaultNS, boolean c14n, BindingCustomization bcust)
{
try
{
- RuntimeAnnotationReader runtimeAnnotations = bindingCustomization!=null ?
- (RuntimeAnnotationReader)bindingCustomization.get(JAXBRIContext.ANNOTATION_READER) : null;
+ RuntimeAnnotationReader anReader = null;
+ if (bcust != null)
+ anReader = (RuntimeAnnotationReader)bcust.get(JAXBRIContext.ANNOTATION_READER);
- return JAXBRIContext.newInstance(
- classes, typeReferences,
- null,
- defaultNamespaceRemap, c14nSupport ,
- runtimeAnnotations
- );
-
+ JAXBRIContext jaxbCtx = JAXBRIContext.newInstance(classes, refs, null, defaultNS, c14n, anReader);
+ incrementContextCount();
+ return jaxbCtx;
}
- catch (JAXBException e) {
+ catch (JAXBException e)
+ {
throw new WSException("Failed to create JAXBContext", e);
}
}
private BindingCustomization getCustomization()
{
- Endpoint threadLocal = EndpointAssociation.getEndpoint();
- return threadLocal!=null ? threadLocal.getAttachment(BindingCustomization.class):null;
+ Endpoint ep = EndpointAssociation.getEndpoint();
+ return ep != null ? ep.getAttachment(BindingCustomization.class) : null;
}
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java 2008-02-28 14:00:01 UTC (rev 5846)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java 2008-02-28 14:19:53 UTC (rev 5847)
@@ -21,26 +21,30 @@
*/
package org.jboss.ws.core.jaxws;
+// $Id$
+
+import java.util.Collection;
+
+import javax.xml.bind.JAXBContext;
+
import org.jboss.ws.WSException;
+import org.jboss.wsf.spi.binding.BindingCustomization;
import org.jboss.wsf.spi.util.ServiceLoader;
-import org.jboss.wsf.spi.binding.BindingCustomization;
-import javax.xml.bind.JAXBContext;
-
+import com.sun.xml.bind.api.JAXBRIContext;
import com.sun.xml.bind.api.TypeReference;
-import com.sun.xml.bind.api.JAXBRIContext;
-import java.util.Collection;
-
/**
* Creates JAXBContext's.<p>
*
* @author Heiko.Braun(a)jboss.com
* Created: Jun 26, 2007
*/
-public abstract class JAXBContextFactory {
-
+public abstract class JAXBContextFactory
+{
public final static String DEFAULT_JAXB_CONTEXT_FACTORY = "org.jboss.ws.core.jaxws.CustomizableJAXBContextFactory";
+
+ private static ThreadLocal threadContextCount = new ThreadLocal();
public abstract JAXBContext createContext(Class[] clazzes, BindingCustomization bindingCustomization) throws WSException;
@@ -48,10 +52,29 @@
public abstract JAXBContext createContext(Class clazz) throws WSException;
- public abstract JAXBRIContext createContext(
- Class[] classes, Collection<TypeReference> typeReferences,
- String defaultNamespaceRemap, boolean c14nSupport, BindingCustomization bindingCustomization);
+ public abstract JAXBRIContext createContext(Class[] classes, Collection<TypeReference> typeReferences, String defaultNamespaceRemap, boolean c14nSupport,
+ BindingCustomization bindingCustomization);
+ protected void incrementContextCount()
+ {
+ Integer count = getContextCount();
+ threadContextCount.set(new Integer(count + 1));
+ }
+
+ public static Integer getContextCount()
+ {
+ Integer count = (Integer)threadContextCount.get();
+ if (count == null)
+ count = new Integer(0);
+
+ return count;
+ }
+
+ public static void resetContextCount()
+ {
+ threadContextCount.set(new Integer(0));
+ }
+
/**
* Retrieve JAXBContextFactory instance through the {@link org.jboss.wsf.spi.util.ServiceLoader}.
* Defaults to {@link CustomizableJAXBContextFactory}
@@ -59,9 +82,6 @@
*/
public static JAXBContextFactory newInstance()
{
- return (JAXBContextFactory)ServiceLoader.loadService(
- JAXBContextFactory.class.getName(),
- DEFAULT_JAXB_CONTEXT_FACTORY
- );
+ return (JAXBContextFactory)ServiceLoader.loadService(JAXBContextFactory.class.getName(), DEFAULT_JAXB_CONTEXT_FACTORY);
}
}
Modified: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1857/JBWS1857TestCase.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1857/JBWS1857TestCase.java 2008-02-28 14:00:01 UTC (rev 5846)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1857/JBWS1857TestCase.java 2008-02-28 14:19:53 UTC (rev 5847)
@@ -27,6 +27,7 @@
import javax.xml.ws.Service;
import org.jboss.test.ws.jaxws.jbws1857.types.Stammdaten;
+import org.jboss.ws.core.jaxws.JAXBContextFactory;
import org.jboss.wsf.test.JBossWSTest;
/**
@@ -39,17 +40,14 @@
*/
public class JBWS1857TestCase extends JBossWSTest
{
-
public void testPortCreation() throws Exception
{
File wsdlFile = new File("resources/jaxws/jbws1857/StammdatenService.wsdl");
QName serviceName = new QName("http://example.com", "StammdatenService");
Service service = Service.create(wsdlFile.toURL(), serviceName);
- long start = System.currentTimeMillis();
service.getPort(Stammdaten.class);
- long time = start - System.currentTimeMillis();
-
- assertTrue("Creation of the port took too long", time < 20000);
+ Integer ctxCount = JAXBContextFactory.getContextCount();
+ assertTrue("Too many JAXB context: " + ctxCount, ctxCount < 3);
}
}
16 years, 10 months
JBossWS SVN: r5846 - stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1857.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-02-28 09:00:01 -0500 (Thu, 28 Feb 2008)
New Revision: 5846
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1857/JBWS1857TestCase.java
Log:
javadoc
Modified: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1857/JBWS1857TestCase.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1857/JBWS1857TestCase.java 2008-02-28 13:53:13 UTC (rev 5845)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1857/JBWS1857TestCase.java 2008-02-28 14:00:01 UTC (rev 5846)
@@ -30,7 +30,7 @@
import org.jboss.wsf.test.JBossWSTest;
/**
- * [JBWS-1857] JAXBContext created for every invokation of service.getPort()
+ * [JBWS-1857] JAXBContext created for every wrapper type
*
* http://jira.jboss.org/jira/browse/JBWS-1857
*
@@ -43,13 +43,11 @@
public void testPortCreation() throws Exception
{
File wsdlFile = new File("resources/jaxws/jbws1857/StammdatenService.wsdl");
- assertTrue(wsdlFile.exists());
-
QName serviceName = new QName("http://example.com", "StammdatenService");
Service service = Service.create(wsdlFile.toURL(), serviceName);
long start = System.currentTimeMillis();
- Stammdaten port = service.getPort(Stammdaten.class);
+ service.getPort(Stammdaten.class);
long time = start - System.currentTimeMillis();
assertTrue("Creation of the port took too long", time < 20000);
16 years, 10 months
JBossWS SVN: r5845 - in stack/native/trunk/src: main/java/org/jboss/ws/metadata/umdm and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-02-28 08:53:13 -0500 (Thu, 28 Feb 2008)
New Revision: 5845
Added:
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/InitalizableMetaData.java
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/metadata/accessor/JAXBAccessorFactoryCreator.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaData.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1857/JBWS1857TestCase.java
Log:
[JBWS-1857] JAXBContext created for every wrapper type
Modified: stack/native/trunk/src/main/java/org/jboss/ws/metadata/accessor/JAXBAccessorFactoryCreator.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/metadata/accessor/JAXBAccessorFactoryCreator.java 2008-02-28 12:13:05 UTC (rev 5844)
+++ stack/native/trunk/src/main/java/org/jboss/ws/metadata/accessor/JAXBAccessorFactoryCreator.java 2008-02-28 13:53:13 UTC (rev 5845)
@@ -23,7 +23,6 @@
//$Id$
-import org.jboss.ws.core.jaxws.JAXBContextFactory;
import org.jboss.ws.metadata.umdm.FaultMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
@@ -31,17 +30,24 @@
public class JAXBAccessorFactoryCreator implements AccessorFactoryCreator
{
+ private JAXBRIContext ctx;
+
+ public void setJAXBContext(JAXBRIContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
public AccessorFactory create(ParameterMetaData parameter)
{
- Class clazz = parameter.getJavaType();
- JAXBRIContext ctx = (JAXBRIContext)JAXBContextFactory.newInstance().createContext(clazz);
- return new JAXBAccessorFactory(clazz, ctx);
+ if (ctx == null)
+ throw new IllegalStateException("JAXBContext not available");
+ return new JAXBAccessorFactory(parameter.getJavaType(), ctx);
}
public AccessorFactory create(FaultMetaData fault)
{
- Class clazz = fault.getFaultBean();
- JAXBRIContext ctx = (JAXBRIContext)JAXBContextFactory.newInstance().createContext(clazz);
- return new JAXBAccessorFactory(clazz, ctx);
+ if (ctx == null)
+ throw new IllegalStateException("JAXBContext not available");
+ return new JAXBAccessorFactory(fault.getFaultBean(), ctx);
}
}
\ No newline at end of file
Modified: stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2008-02-28 12:13:05 UTC (rev 5844)
+++ stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2008-02-28 13:53:13 UTC (rev 5845)
@@ -23,8 +23,8 @@
// $Id$
+import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
-import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -34,9 +34,9 @@
import java.util.List;
import java.util.Map;
import java.util.Observable;
+import java.util.Observer;
import java.util.Properties;
import java.util.Set;
-import java.util.Observer;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import javax.xml.namespace.QName;
@@ -54,6 +54,7 @@
import org.jboss.ws.core.jaxrpc.binding.SOAPArrayDeserializerFactory;
import org.jboss.ws.core.jaxrpc.binding.SOAPArraySerializerFactory;
import org.jboss.ws.core.jaxws.JAXBContextCache;
+import org.jboss.ws.core.jaxws.JAXBContextFactory;
import org.jboss.ws.core.jaxws.JAXBDeserializerFactory;
import org.jboss.ws.core.jaxws.JAXBSerializerFactory;
import org.jboss.ws.core.jaxws.client.DispatchBinding;
@@ -61,6 +62,9 @@
import org.jboss.ws.core.soap.Use;
import org.jboss.ws.extensions.wsrm.config.RMConfig;
import org.jboss.ws.extensions.wsrm.config.RMPortConfig;
+import org.jboss.ws.metadata.accessor.AccessorFactory;
+import org.jboss.ws.metadata.accessor.AccessorFactoryCreator;
+import org.jboss.ws.metadata.accessor.JAXBAccessorFactoryCreator;
import org.jboss.ws.metadata.config.CommonConfig;
import org.jboss.ws.metadata.config.Configurable;
import org.jboss.ws.metadata.config.ConfigurationProvider;
@@ -72,13 +76,15 @@
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
+import com.sun.xml.bind.api.JAXBRIContext;
+
/**
* A Service component describes a set of endpoints.
*
* @author Thomas.Diesler(a)jboss.org
* @since 12-May-2005
*/
-public abstract class EndpointMetaData extends ExtensibleMetaData implements ConfigurationProvider
+public abstract class EndpointMetaData extends ExtensibleMetaData implements ConfigurationProvider, InitalizableMetaData
{
// provide logging
private static Logger log = Logger.getLogger(EndpointMetaData.class);
@@ -524,6 +530,7 @@
eagerInitializeOperations();
eagerInitializeTypes();
+ eagerInitializeAccessors();
}
private void eagerInitializeOperations()
@@ -610,6 +617,53 @@
}
}
+ private void eagerInitializeAccessors()
+ {
+ // Collect the list of all used types
+ List<Class> types = new ArrayList<Class>();
+ for (OperationMetaData opMetaData : operations)
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ types.add(paramMetaData.getJavaType());
+ }
+
+ ParameterMetaData retParam = opMetaData.getReturnParameter();
+ if (retParam != null)
+ types.add(retParam.getJavaType());
+ }
+
+ // Create a JAXBContext for those types
+ Class[] typeArr = new Class[types.size()];
+ JAXBRIContext jaxbCtx = (JAXBRIContext)JAXBContextFactory.newInstance().createContext(types.toArray(typeArr));
+
+ // Create the accessors using a shared JAXBContext
+ for (OperationMetaData opMetaData : operations)
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ createAccessor(paramMetaData, jaxbCtx);
+ }
+
+ ParameterMetaData retParam = opMetaData.getReturnParameter();
+ if (retParam != null)
+ createAccessor(retParam, jaxbCtx);
+ }
+ }
+
+ private void createAccessor(ParameterMetaData paramMetaData, JAXBRIContext jaxbCtx)
+ {
+ AccessorFactoryCreator factoryCreator = paramMetaData.getAccessorFactoryCreator();
+ if (factoryCreator instanceof JAXBAccessorFactoryCreator)
+ {
+ ((JAXBAccessorFactoryCreator)factoryCreator).setJAXBContext(jaxbCtx);
+ AccessorFactory factory = factoryCreator.create(paramMetaData);
+ for (WrappedParameter wrapped : paramMetaData.getWrappedParameters())
+ wrapped.setAccessor(factory.create(wrapped));
+ }
+ }
+
+
// ---------------------------------------------------------------
// Configuration provider impl
Modified: stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java 2008-02-28 12:13:05 UTC (rev 5844)
+++ stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java 2008-02-28 13:53:13 UTC (rev 5845)
@@ -52,7 +52,7 @@
* @author jason.greene(a)jboss.com
* @since 12-May-2005
*/
-public class FaultMetaData
+public class FaultMetaData implements InitalizableMetaData
{
// provide logging
private final Logger log = Logger.getLogger(FaultMetaData.class);
Modified: stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaData.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaData.java 2008-02-28 12:13:05 UTC (rev 5844)
+++ stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/HandlerMetaData.java 2008-02-28 13:53:13 UTC (rev 5845)
@@ -42,7 +42,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 05-May-2006
*/
-public abstract class HandlerMetaData implements Serializable
+public abstract class HandlerMetaData implements InitalizableMetaData, Serializable
{
// provide logging
private final Logger log = Logger.getLogger(HandlerMetaData.class);
Added: stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/InitalizableMetaData.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/InitalizableMetaData.java (rev 0)
+++ stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/InitalizableMetaData.java 2008-02-28 13:53:13 UTC (rev 5845)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.metadata.umdm;
+
+// $Id$
+
+
+/**
+ * Metadata that is Inizializable
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 28-Feb-2008
+ */
+public interface InitalizableMetaData
+{
+ void eagerInitialize();
+}
Property changes on: stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/InitalizableMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java 2008-02-28 12:13:05 UTC (rev 5844)
+++ stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/OperationMetaData.java 2008-02-28 13:53:13 UTC (rev 5845)
@@ -34,6 +34,7 @@
import javax.xml.rpc.ParameterMode;
import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
import org.jboss.ws.core.soap.Style;
import org.jboss.ws.core.soap.Use;
@@ -48,7 +49,7 @@
* @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
* @since 12-May-2004
*/
-public class OperationMetaData extends ExtensibleMetaData
+public class OperationMetaData extends ExtensibleMetaData implements InitalizableMetaData
{
// provide logging
private final Logger log = Logger.getLogger(OperationMetaData.class);
@@ -446,6 +447,12 @@
fault.validate();
}
+ public void eagerInitialize()
+ {
+ // Call eagerInitialize(List<Method> unsynchronizedMethods) instead
+ throw new NotImplementedException();
+ }
+
/**
* @see UnifiedMetaData#eagerInitialize()
*/
Modified: stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java 2008-02-28 12:13:05 UTC (rev 5844)
+++ stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java 2008-02-28 13:53:13 UTC (rev 5845)
@@ -55,7 +55,7 @@
* @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
* @since 12-May-2005
*/
-public class ParameterMetaData
+public class ParameterMetaData implements InitalizableMetaData
{
// provide logging
private final Logger log = Logger.getLogger(ParameterMetaData.class);
@@ -211,7 +211,8 @@
// Remove potential prefix
if (xmlType.getNamespaceURI().length() > 0)
this.xmlType = new QName(xmlType.getNamespaceURI(), xmlType.getLocalPart());
- else this.xmlType = xmlType;
+ else
+ this.xmlType = xmlType;
// Special case to identify attachments
if (Constants.NS_ATTACHMENT_MIME_TYPE.equals(xmlType.getNamespaceURI()))
@@ -294,7 +295,8 @@
setMode(ParameterMode.INOUT);
else if ("OUT".equals(mode))
setMode(ParameterMode.OUT);
- else throw new IllegalArgumentException("Invalid mode: " + mode);
+ else
+ throw new IllegalArgumentException("Invalid mode: " + mode);
}
public void setMode(ParameterMode mode)
@@ -381,7 +383,6 @@
this.soapArrayCompType = compXmlType;
}
-
@Deprecated
// FIXME This hack should be removed
public boolean isMessageType()
@@ -468,18 +469,13 @@
Type epType = getOperationMetaData().getEndpointMetaData().getType();
if (getOperationMetaData().isDocumentWrapped() && !isInHeader() && !isSwA() && !isMessageType())
{
- if (loadWrapperBean() == null)
- {
- if (epType == EndpointMetaData.Type.JAXRPC)
- throw new WSException("Autogeneration of wrapper beans not supported with JAXRPC");
+ if (loadWrapperBean() == null)
+ {
+ if (epType == EndpointMetaData.Type.JAXRPC)
+ throw new WSException("Autogeneration of wrapper beans not supported with JAXRPC");
- new DynamicWrapperGenerator( getClassLoader() ).generate(this);
- }
-
- // Initialize accessors
- AccessorFactory factory = accessorFactoryCreator.create(this);
- for (WrappedParameter wrapped : wrappedParameters)
- wrapped.setAccessor(factory.create(wrapped));
+ new DynamicWrapperGenerator(getClassLoader()).generate(this);
+ }
}
javaType = getJavaType();
@@ -504,8 +500,9 @@
AttachmentScanResult scanResult = scanner.scanBean(javaType);
if (scanResult != null)
{
- if(log.isDebugEnabled()) log.debug("Identified attachment reference: " + xmlName + ", type="+scanResult.getType());
- if(scanResult.getType() == AttachmentScanResult.Type.XOP)
+ if (log.isDebugEnabled())
+ log.debug("Identified attachment reference: " + xmlName + ", type=" + scanResult.getType());
+ if (scanResult.getType() == AttachmentScanResult.Type.XOP)
setXOP(true);
else
setSwaRef(true);
@@ -546,7 +543,8 @@
}
catch (Exception ex)
{
- if(log.isDebugEnabled()) log.debug("Invalid wrapper type:" + typeName, ex);
+ if (log.isDebugEnabled())
+ log.debug("Invalid wrapper type:" + typeName, ex);
return false;
}
}
@@ -554,6 +552,11 @@
return true;
}
+ public AccessorFactoryCreator getAccessorFactoryCreator()
+ {
+ return accessorFactoryCreator;
+ }
+
public void setAccessorFactoryCreator(AccessorFactoryCreator accessorFactoryCreator)
{
this.accessorFactoryCreator = accessorFactoryCreator;
Modified: stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2008-02-28 12:13:05 UTC (rev 5844)
+++ stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2008-02-28 13:53:13 UTC (rev 5845)
@@ -60,7 +60,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 12-May-2005
*/
-public class ServiceMetaData
+public class ServiceMetaData implements InitalizableMetaData
{
// provide logging
private static final Logger log = Logger.getLogger(ServiceMetaData.class);
Modified: stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java 2008-02-28 12:13:05 UTC (rev 5844)
+++ stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/UnifiedMetaData.java 2008-02-28 13:53:13 UTC (rev 5845)
@@ -48,7 +48,7 @@
* @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
* @since 12-May-2005
*/
-public class UnifiedMetaData
+public class UnifiedMetaData implements InitalizableMetaData
{
// provide logging
private static Logger log = Logger.getLogger(UnifiedMetaData.class);
Modified: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1857/JBWS1857TestCase.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1857/JBWS1857TestCase.java 2008-02-28 12:13:05 UTC (rev 5844)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1857/JBWS1857TestCase.java 2008-02-28 13:53:13 UTC (rev 5845)
@@ -47,6 +47,11 @@
QName serviceName = new QName("http://example.com", "StammdatenService");
Service service = Service.create(wsdlFile.toURL(), serviceName);
+
+ long start = System.currentTimeMillis();
Stammdaten port = service.getPort(Stammdaten.class);
+ long time = start - System.currentTimeMillis();
+
+ assertTrue("Creation of the port took too long", time < 20000);
}
}
16 years, 10 months