JBossWS SVN: r5081 - container/jboss40/tags/jbossws-jboss40-2.0.2.GA.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-11-20 12:10:08 -0500 (Tue, 20 Nov 2007)
New Revision: 5081
Modified:
container/jboss40/tags/jbossws-jboss40-2.0.2.GA/version.properties
Log:
Change version to 4.0.5.GA
Modified: container/jboss40/tags/jbossws-jboss40-2.0.2.GA/version.properties
===================================================================
--- container/jboss40/tags/jbossws-jboss40-2.0.2.GA/version.properties 2007-11-20 16:51:35 UTC (rev 5080)
+++ container/jboss40/tags/jbossws-jboss40-2.0.2.GA/version.properties 2007-11-20 17:10:08 UTC (rev 5081)
@@ -5,8 +5,8 @@
specification.vendor=JBoss (http://www.jboss.org)
specification.version=jbossws-2.0
-version.id=2.0.2.GA
-repository.id=2.0.2.GA
+version.id=4.0.5.GA
+repository.id=4.0.5.GA
implementation.title=JBoss Web Services - Integration JBoss40
implementation.url=http://www.jboss.org/products/jbossws
18 years, 5 months
JBossWS SVN: r5079 - framework/trunk/src/test/ant-import.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2007-11-20 11:47:33 -0500 (Tue, 20 Nov 2007)
New Revision: 5079
Modified:
framework/trunk/src/test/ant-import/build-testsuite.xml
Log:
specifying WS-RM backports server dependencies - HTTP server libraries
Modified: framework/trunk/src/test/ant-import/build-testsuite.xml
===================================================================
--- framework/trunk/src/test/ant-import/build-testsuite.xml 2007-11-20 16:44:29 UTC (rev 5078)
+++ framework/trunk/src/test/ant-import/build-testsuite.xml 2007-11-20 16:47:33 UTC (rev 5079)
@@ -93,6 +93,7 @@
<property name="jboss.server" value="${jboss.home}/server/${jboss.server.instance}"/>
<property name="jboss.server.lib" value="${jboss.server}/lib"/>
<property name="jboss.server.deploy" value="${jboss.server}/deploy"/>
+ <property name="jboss.server.deployers" value="${jboss.server}/deployers"/>
<!-- Java Endorsed -->
<condition property="endorsed.dirs" value="${jboss.home}/lib/endorsed">
@@ -171,6 +172,8 @@
<pathelement location="${jboss.server.deploy}/juddi-service.sar/juddi-saaj.jar"/>
<pathelement location="${jboss.server.deploy}/juddi-service.sar/scout.jar"/>
<pathelement location="${tools.jar}"/>
+ <!-- WS-RM backports server dependencies -->
+ <pathelement location="${jboss.server.deployers}/jbossweb.deployer/jbossweb.jar"/>
</path>
</target>
@@ -228,6 +231,8 @@
<pathelement location="${jboss.server.deploy}/juddi-service.sar/juddi-saaj.jar"/>
<pathelement location="${jboss.server.deploy}/juddi-service.sar/scout.jar"/>
<pathelement location="${tools.jar}"/>
+ <!-- WS-RM backports server dependencies -->
+ <pathelement location="${jboss.server.deploy}/jboss-web.deployer/jbossweb.jar"/>
</path>
</target>
@@ -271,6 +276,7 @@
<pathelement location="${jboss.client}/jboss-ejb3-client.jar"/>
<pathelement location="${jboss.client}/jboss-saaj.jar"/>
<pathelement location="${jboss.client}/jbossws-jboss40.jar"/>
+ <pathelement location="${jboss.client}/jboss-remoting.jar"/>
<pathelement location="${jboss.client}/jbossall-client.jar"/>
<pathelement location="${jboss.client}/log4j.jar"/>
<pathelement location="${jboss.client}/mail.jar"/>
@@ -281,6 +287,10 @@
<pathelement location="${jboss.server.deploy}/juddi-service.sar/juddi-saaj.jar"/>
<pathelement location="${jboss.server.deploy}/juddi-service.sar/scout.jar"/>
<pathelement location="${tools.jar}"/>
+ <!-- WS-RM backports server dependencies -->
+ <pathelement location="${jboss.server.deploy}/jbossweb-tomcat55.sar/tomcat-coyote.jar"/>
+ <pathelement location="${jboss.server.deploy}/jbossweb-tomcat55.sar/tomcat-http.jar"/>
+ <pathelement location="${jboss.server.deploy}/jbossweb-tomcat55.sar/tomcat-util.jar"/>
</path>
</target>
18 years, 5 months
JBossWS SVN: r5078 - in stack/native/trunk/src: main/java/org/jboss/ws/extensions/wsrm and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2007-11-20 11:44:29 -0500 (Tue, 20 Nov 2007)
New Revision: 5078
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsInvocationHandler.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsServer.java
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMChannelRequest.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMConstant.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMHelper.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMProvider.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMSequence.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/OneWayTestCase.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/ReqResTestCase.java
stack/native/trunk/src/test/resources/jaxws/wsrm/properties/OneWayTestCase.properties
stack/native/trunk/src/test/resources/jaxws/wsrm/properties/ReqResTestCase.properties
Log:
adding support for addressable clients + creating backports server (first prototype)
Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2007-11-20 15:55:19 UTC (rev 5077)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2007-11-20 16:44:29 UTC (rev 5078)
@@ -23,6 +23,7 @@
// $Id$
+import java.net.URI;
import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.HashSet;
@@ -39,6 +40,7 @@
import javax.xml.ws.BindingProvider;
import javax.xml.ws.EndpointReference;
import javax.xml.ws.WebServiceException;
+import javax.xml.ws.addressing.AddressingBuilder;
import javax.xml.ws.addressing.AddressingProperties;
import javax.xml.ws.addressing.JAXWSAConstants;
import javax.xml.ws.handler.Handler;
@@ -103,19 +105,19 @@
// WS-RM locking utility
private final Lock wsrmLock = new ReentrantLock();
// WS-RM sequence associated with the proxy
- private RMSequence wsrmSequence;
+ private RMSequenceImpl wsrmSequence;
public final Lock getWSRMLock()
{
return this.wsrmLock;
}
- public final void setWSRMSequence(RMSequence wsrmSequence)
+ public final void setWSRMSequence(RMSequenceImpl wsrmSequence)
{
this.wsrmSequence = wsrmSequence;
}
- public final RMSequence getWSRMSequence()
+ public final RMSequenceImpl getWSRMSequence()
{
return this.wsrmSequence;
}
@@ -277,6 +279,13 @@
{
if (RMConstant.PROTOCOL_OPERATION_QNAMES.contains(opName) == false)
{
+ if (this.wsrmSequence.getBackPort() != null)
+ {
+ // rewrite ReplyTo to use client addressable back port
+ Map<String, Object> requestContext = getBindingProvider().getRequestContext();
+ AddressingProperties addressingProps = (AddressingProperties)requestContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
+ addressingProps.setReplyTo(AddressingBuilder.getAddressingBuilder().newEndpointReference(this.wsrmSequence.getBackPort()));
+ }
Map<String, Object> rmRequestContext = new HashMap<String, Object>();
QName sequenceQName = Provider.get().getConstants().getSequenceQName();
rmRequestContext.put(RMConstant.OPERATION_QNAME, sequenceQName);
@@ -475,7 +484,7 @@
// WS-RM support //
///////////////////
@SuppressWarnings("unchecked")
- public RMSequence createSequence() throws RMException
+ public RMSequence createSequence(boolean addressableClient) throws RMException
{
this.getWSRMLock().lock();
try
@@ -488,7 +497,18 @@
// set up addressing data
String address = getEndpointMetaData().getEndpointAddress();
String action = RMConstant.CREATE_SEQUENCE_WSA_ACTION;
- AddressingProperties addressingProps = AddressingClientUtil.createAnonymousProps(action, address);
+ URI backPort = null;
+ AddressingProperties addressingProps = null;
+ if (addressableClient)
+ {
+ backPort = new URI("http://localhost:8888/packports/1234567890-1234567890/1234567890-1234567890"); // TODO: use generator
+ addressingProps = AddressingClientUtil.createDefaultProps(action, address);
+ addressingProps.setReplyTo(AddressingBuilder.getAddressingBuilder().newEndpointReference(backPort));
+ }
+ else
+ {
+ addressingProps = AddressingClientUtil.createAnonymousProps(action, address);
+ }
Map requestContext = getBindingProvider().getRequestContext();
requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addressingProps);
// set up wsrm request context
@@ -501,7 +521,7 @@
// read WSRM sequence id from response context
Map rmResponseContext = (Map)getBindingProvider().getResponseContext().get(RMConstant.RESPONSE_CONTEXT);
String id = ((CreateSequenceResponse)((List)rmResponseContext.get(RMConstant.DATA)).get(0)).getIdentifier();
- return this.wsrmSequence = new RMSequenceImpl(this, id);
+ return this.wsrmSequence = new RMSequenceImpl(this, id, backPort);
}
catch (Exception e)
{
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMChannelRequest.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMChannelRequest.java 2007-11-20 15:55:19 UTC (rev 5077)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMChannelRequest.java 2007-11-20 16:44:29 UTC (rev 5078)
@@ -21,13 +21,11 @@
*/
package org.jboss.ws.extensions.wsrm;
-import static org.jboss.ws.extensions.wsrm.RMConstant.INVOCATION_CONTEXT;
-import static org.jboss.ws.extensions.wsrm.RMConstant.ONE_WAY_OPERATION;
-import static org.jboss.ws.extensions.wsrm.RMConstant.REMOTING_CONFIGURATION_CONTEXT;
-import static org.jboss.ws.extensions.wsrm.RMConstant.REMOTING_INVOCATION_CONTEXT;
-import static org.jboss.ws.extensions.wsrm.RMConstant.TARGET_ADDRESS;
+import static org.jboss.ws.extensions.wsrm.RMConstant.*;
import java.net.MalformedURLException;
+import java.net.URI;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
@@ -35,6 +33,10 @@
import org.jboss.remoting.Client;
import org.jboss.remoting.InvokerLocator;
import org.jboss.ws.core.MessageTrace;
+import org.jboss.ws.extensions.wsrm.backchannel.RMBackPortsServer;
+import org.jboss.ws.extensions.wsrm.spi.Provider;
+import org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence;
+import org.jboss.ws.extensions.wsrm.spi.protocol.Serializable;
/**
* Represents request that goes to the RM channel
@@ -72,7 +74,15 @@
client.setMarshaller(RMMarshaller.getInstance());
- boolean oneWay = (Boolean)rmRequest.getMetadata().getContext(RMConstant.INVOCATION_CONTEXT).get(ONE_WAY_OPERATION);
+ URI backPort = RMHelper.getBackPortURI(rmRequest);
+ System.out.println("[WS-RM] backport URI is: " + backPort);
+
+ if (backPort != null)
+ {
+ RMBackPortsServer backPortsServer = RMBackPortsServer.getInstance(backPort.getScheme(), backPort.getHost(), backPort.getPort());
+ //backPortsServer.registerCallback(backPort.getPath(), this);
+ }
+ boolean oneWay = RMHelper.isOneWayOperation(rmRequest);
if (!oneWay)
client.setUnMarshaller(RMUnMarshaller.getInstance());
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 2007-11-20 15:55:19 UTC (rev 5077)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMConstant.java 2007-11-20 16:44:29 UTC (rev 5078)
@@ -5,6 +5,7 @@
import java.util.List;
import javax.xml.namespace.QName;
+import javax.xml.ws.addressing.AddressingBuilder;
import org.jboss.ws.extensions.wsrm.spi.Constants;
import org.jboss.ws.extensions.wsrm.spi.Provider;
@@ -27,10 +28,13 @@
public static final String DATA = PREFIX + ".data";
// WS-Addressing related actions
public static final String CREATE_SEQUENCE_WSA_ACTION;
+ public static final String CLOSE_SEQUENCE_WSA_ACTION;
public static final String TERMINATE_SEQUENCE_WSA_ACTION;
public static final List<QName> PROTOCOL_OPERATION_QNAMES;
+ public static final String WSA_ANONYMOUS_URI = AddressingBuilder.getAddressingBuilder().newAddressingConstants().getAnonymousURI();
+
static
{
LinkedList<QName> temp = new LinkedList<QName>();
@@ -46,6 +50,7 @@
temp.add(constants.getTerminateSequenceResponseQName());
PROTOCOL_OPERATION_QNAMES = Collections.unmodifiableList(temp);
CREATE_SEQUENCE_WSA_ACTION = Provider.get().getConstants().getNamespaceURI() + "/CreateSequence";
+ CLOSE_SEQUENCE_WSA_ACTION = Provider.get().getConstants().getNamespaceURI() + "/CloseSequence";
TERMINATE_SEQUENCE_WSA_ACTION = Provider.get().getConstants().getNamespaceURI() + "/TerminateSequence";
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMHelper.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMHelper.java 2007-11-20 15:55:19 UTC (rev 5077)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMHelper.java 2007-11-20 16:44:29 UTC (rev 5078)
@@ -1,9 +1,19 @@
package org.jboss.ws.extensions.wsrm;
+import static org.jboss.ws.extensions.wsrm.RMConstant.*;
+
+import java.net.URI;
+import java.util.List;
import java.util.Map;
+import org.jboss.logging.Logger;
+import org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence;
+import org.jboss.ws.extensions.wsrm.spi.protocol.Serializable;
+
public final class RMHelper
{
+ private static final Logger log = Logger.getLogger(RMHelper.class);
+
private RMHelper()
{
// no instances
@@ -11,6 +21,38 @@
public static boolean isRMMessage(Map<String, Object> ctx)
{
- return (ctx != null) && (ctx.containsKey(RMConstant.DATA));
+ return (ctx != null) && (ctx.containsKey(RMConstant.REQUEST_CONTEXT));
}
+
+ public static URI getBackPortURI(RMMessage rmRequest)
+ {
+ Map<String, Object> invocationCtx = (Map<String, Object>)rmRequest.getMetadata().getContext(INVOCATION_CONTEXT);
+ Map<String, Object> wsrmRequestCtx = (Map<String, Object>)invocationCtx.get(REQUEST_CONTEXT);
+ List<Serializable> wsrmMessages = (List<Serializable>)wsrmRequestCtx.get(DATA);
+ URI retVal = null;
+ if (wsrmMessages.get(0) instanceof CreateSequence)
+ {
+ CreateSequence cs = (CreateSequence)wsrmMessages.get(0);
+ try
+ {
+ retVal = RMConstant.WSA_ANONYMOUS_URI.equals(cs.getAcksTo()) ? null : new URI(cs.getAcksTo());;
+ }
+ catch (Exception e)
+ {
+ log.warn(e.getMessage(), e);
+ }
+ }
+ else
+ {
+ retVal = ((RMSequenceImpl)wsrmRequestCtx.get(SEQUENCE_REFERENCE)).getBackPort();
+ }
+
+ return retVal;
+ }
+
+ public static boolean isOneWayOperation(RMMessage rmRequest)
+ {
+ return (Boolean)rmRequest.getMetadata().getContext(RMConstant.INVOCATION_CONTEXT).get(ONE_WAY_OPERATION);
+ }
+
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java 2007-11-20 15:55:19 UTC (rev 5077)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java 2007-11-20 16:44:29 UTC (rev 5078)
@@ -21,6 +21,7 @@
*/
package org.jboss.ws.extensions.wsrm;
+import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@@ -29,6 +30,7 @@
import java.util.concurrent.locks.ReentrantLock;
import javax.xml.namespace.QName;
+import javax.xml.ws.addressing.AddressingBuilder;
import javax.xml.ws.addressing.AddressingProperties;
import javax.xml.ws.addressing.JAXWSAConstants;
@@ -50,6 +52,7 @@
public final class RMSequenceImpl implements RMSequence
{
private final String id;
+ private final URI backPort;
private final ClientImpl client;
// object states variables
private boolean terminated = false;
@@ -57,12 +60,18 @@
private AtomicLong messageNumber = new AtomicLong();
private final Lock objectLock = new ReentrantLock();
- public RMSequenceImpl(ClientImpl client, String id)
+ public RMSequenceImpl(ClientImpl client, String id, URI backPort)
{
super();
this.client = client;
this.id = id;
+ this.backPort = backPort;
}
+
+ public final URI getBackPort()
+ {
+ return this.backPort;
+ }
public final long newMessageNumber()
{
@@ -133,7 +142,16 @@
// set up addressing properties
String address = client.getEndpointMetaData().getEndpointAddress();
String action = RMConstant.TERMINATE_SEQUENCE_WSA_ACTION;
- AddressingProperties props = AddressingClientUtil.createAnonymousProps(action, address);
+ AddressingProperties props = null;
+ if (this.client.getWSRMSequence().getBackPort() != null)
+ {
+ props = AddressingClientUtil.createDefaultProps(action, address);
+ props.setReplyTo(AddressingBuilder.getAddressingBuilder().newEndpointReference(this.client.getWSRMSequence().getBackPort()));
+ }
+ else
+ {
+ props = AddressingClientUtil.createAnonymousProps(action, address);
+ }
// prepare WS-RM request context
QName terminateSequenceQN = Provider.get().getConstants().getTerminateSequenceQName();
Map rmRequestContext = new HashMap();
Added: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsInvocationHandler.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsInvocationHandler.java (rev 0)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsInvocationHandler.java 2007-11-20 16:44:29 UTC (rev 5078)
@@ -0,0 +1,84 @@
+/*
+ * 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.extensions.wsrm.backchannel;
+
+import javax.management.MBeanServer;
+
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.coyote.RequestMap;
+import org.jboss.remoting.transport.http.HTTPMetadataConstants;
+
+/**
+ * TODO: Add comment
+ *
+ * @author richard.opalka(a)jboss.com
+ *
+ * @since Nov 20, 2007
+ */
+public final class RMBackPortsInvocationHandler implements ServerInvocationHandler
+{
+ public RMBackPortsInvocationHandler()
+ {
+
+ }
+
+ public void addListener(InvokerCallbackHandler arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Object invoke(InvocationRequest arg0) throws Throwable
+ {
+ RequestMap rm = (RequestMap)arg0.getRequestPayload();
+ System.out.println("... locator ..." + arg0.getLocator());
+ System.out.println("... subsystem ..." + arg0.getSubsystem());
+ System.out.println("... parameter ..." + arg0.getParameter());
+ System.out.println("... parameter ..." + arg0.getParameter().getClass().getName());
+ System.out.println("... method ..." + rm.get(HTTPMetadataConstants.METHODTYPE));
+ System.out.println("... path ..." + rm.get(HTTPMetadataConstants.PATH));
+ System.out.println("return ..." + arg0.getReturnPayload());
+ return null;
+ }
+
+ public void removeListener(InvokerCallbackHandler arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setInvoker(ServerInvoker arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setMBeanServer(MBeanServer arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Property changes on: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsInvocationHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsServer.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsServer.java (rev 0)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsServer.java 2007-11-20 16:44:29 UTC (rev 5078)
@@ -0,0 +1,199 @@
+/*
+ * 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.extensions.wsrm.backchannel;
+
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.ws.extensions.wsrm.client_api.RMException;
+
+/**
+ * Back ports server used by addressable clients
+ *
+ * @author richard.opalka(a)jboss.com
+ *
+ * @since Nov 20, 2007
+ */
+public final class RMBackPortsServer implements Runnable
+{
+ private static final Logger LOG = Logger.getLogger(RMBackPortsServer.class);
+ private static final Lock CLASS_LOCK = new ReentrantLock();
+ private static final long WAIT_PERIOD = 100;
+ private static RMBackPortsServer INSTANCE;
+
+ private final Object instanceLock = new Object();
+ private final Connector connector;
+ private final String scheme;
+ private final String host;
+ private final int port;
+ private boolean started;
+ private boolean stopped;
+ private boolean terminated;
+
+ private RMBackPortsServer(String scheme, String host, int port)
+ throws RMException
+ {
+ super();
+ this.scheme = scheme;
+ this.host = host;
+ this.port = port;
+ try
+ {
+ InvokerLocator il = new InvokerLocator(this.scheme + "://" + this.host + ":" + this.port);
+ connector = new Connector();
+ connector.setInvokerLocator(il.getLocatorURI());
+ connector.create();
+
+ RMBackPortsInvocationHandler handler = new RMBackPortsInvocationHandler();
+ connector.addInvocationHandler("wsrmBackPortsHandler", handler);
+ connector.start();
+ LOG.debug("WS-RM Backports Server started on: " + il.getLocatorURI());
+ }
+ catch (Exception e)
+ {
+ LOG.warn(e.getMessage(), e);
+ throw new RMException(e.getMessage(), e);
+ }
+ }
+
+ public final String getScheme()
+ {
+ return this.scheme;
+ }
+
+ public final String getHost()
+ {
+ return this.host;
+ }
+
+ public final int getPort()
+ {
+ return this.port;
+ }
+
+ public final void run()
+ {
+ synchronized (this.instanceLock)
+ {
+ if (this.started)
+ return;
+
+ this.started = true;
+
+ while (this.stopped == false)
+ {
+ try
+ {
+ this.instanceLock.wait(WAIT_PERIOD);
+ LOG.debug("serving requests");
+ }
+ catch (InterruptedException ie)
+ {
+ LOG.warn(ie.getMessage(), ie);
+ }
+ }
+ try
+ {
+ connector.stop();
+ }
+ finally
+ {
+ LOG.debug("terminated");
+ this.terminated = true;
+ }
+ }
+ }
+
+ public final void terminate()
+ {
+ synchronized (this.instanceLock)
+ {
+ if (this.stopped == true)
+ return;
+
+ this.stopped = true;
+ LOG.debug("termination forced");
+ while (this.terminated == false)
+ {
+ try
+ {
+ LOG.debug("waiting for termination");
+ this.instanceLock.wait(WAIT_PERIOD);
+ }
+ catch (InterruptedException ie)
+ {
+ LOG.warn(ie.getMessage(), ie);
+ }
+ }
+ }
+ }
+
+ /**
+ * Starts back ports server on the background if method is called for the first time
+ * @param scheme protocol
+ * @param host hostname
+ * @param port port
+ * @return WS-RM back ports server
+ * @throws RMException
+ */
+ public static RMBackPortsServer getInstance(String scheme, String host, int port)
+ throws RMException
+ {
+ CLASS_LOCK.lock();
+ try
+ {
+ if (INSTANCE == null)
+ {
+ INSTANCE = new RMBackPortsServer(scheme, host, (port == -1) ? 80 : port);
+ // forking back ports server
+ Thread t = new Thread(INSTANCE);
+ t.setDaemon(true);
+ t.start();
+ // registering shutdown hook
+ final RMBackPortsServer server = INSTANCE;
+ Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
+ public void run()
+ {
+ server.terminate();
+ }
+ }, "RMBackPortsServerShutdownHook"));
+ }
+ else
+ {
+ boolean schemeEquals = INSTANCE.getScheme().equals(scheme);
+ boolean hostEquals = INSTANCE.getHost().equals(host);
+ boolean portEquals = INSTANCE.getPort() == ((port == -1) ? 80 : port);
+ if ((schemeEquals == false) || (hostEquals == false) || (portEquals == false))
+ throw new IllegalArgumentException();
+ }
+ return INSTANCE;
+ }
+ finally
+ {
+ CLASS_LOCK.unlock();
+ }
+ }
+
+}
Property changes on: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/backchannel/RMBackPortsServer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMProvider.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMProvider.java 2007-11-20 15:55:19 UTC (rev 5077)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMProvider.java 2007-11-20 16:44:29 UTC (rev 5078)
@@ -30,5 +30,11 @@
*/
public interface RMProvider
{
- RMSequence createSequence() throws RMException;
+ /**
+ * Creates new WS-RM sequence
+ * @param addressableClient
+ * @return created sequence
+ * @throws RMException
+ */
+ RMSequence createSequence(boolean addressableClient) throws RMException;
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMSequence.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMSequence.java 2007-11-20 15:55:19 UTC (rev 5077)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/client_api/RMSequence.java 2007-11-20 16:44:29 UTC (rev 5078)
@@ -25,11 +25,11 @@
public interface RMSequence
{
+ String getId() throws RMException;
void discard() throws RMException;
boolean isDiscarded() throws RMException;
void terminate() throws RMException;
boolean isTerminated() throws RMException;
- String getId() throws RMException;
boolean isCompleted() throws RMException;
boolean isCompleted(int timeAmount, TimeUnit timeUnit) throws RMException;
}
Modified: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/OneWayTestCase.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/OneWayTestCase.java 2007-11-20 15:55:19 UTC (rev 5077)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/OneWayTestCase.java 2007-11-20 16:44:29 UTC (rev 5078)
@@ -54,6 +54,7 @@
private String targetNS = "http://wsrm.jaxws.ws.test.jboss.org/";
private OneWayServiceIface proxy;
private final boolean emulatorOn = Boolean.parseBoolean((String)props.get("emulator"));
+ private final boolean addressable = Boolean.parseBoolean((String)props.get("addressable"));
private final String serviceURL = "http://" + getServerHost() + ":" + props.getProperty("port") + props.getProperty("path");
static
@@ -96,7 +97,7 @@
if (emulatorOn)
{
RMProvider wsrmProvider = (RMProvider)proxy;
- sequence = wsrmProvider.createSequence();
+ sequence = wsrmProvider.createSequence(addressable);
System.out.println("Created sequence with id=" + sequence.getId());
}
setAddrProps(proxy, "http://useless/action1", serviceURL);
Modified: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/ReqResTestCase.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/ReqResTestCase.java 2007-11-20 15:55:19 UTC (rev 5077)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/ReqResTestCase.java 2007-11-20 16:44:29 UTC (rev 5078)
@@ -33,7 +33,6 @@
import javax.xml.namespace.QName;
import javax.xml.ws.AsyncHandler;
-import javax.xml.ws.BindingProvider;
import javax.xml.ws.Response;
import javax.xml.ws.Service;
@@ -62,6 +61,7 @@
private boolean asyncHandlerCalled;
private ReqResServiceIface proxy;
private final boolean emulatorOn = Boolean.parseBoolean((String)props.get("emulator"));
+ private final boolean addressable = Boolean.parseBoolean((String)props.get("addressable"));
static
{
@@ -179,7 +179,7 @@
if (emulatorOn)
{
RMProvider wsrmProvider = (RMProvider)proxyObject;
- sequence = wsrmProvider.createSequence();
+ sequence = wsrmProvider.createSequence(addressable);
System.out.println("Created sequence with id=" + sequence.getId());
}
setAddrProps(proxy, "http://useless/action", serviceURL);
Modified: stack/native/trunk/src/test/resources/jaxws/wsrm/properties/OneWayTestCase.properties
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/wsrm/properties/OneWayTestCase.properties 2007-11-20 15:55:19 UTC (rev 5077)
+++ stack/native/trunk/src/test/resources/jaxws/wsrm/properties/OneWayTestCase.properties 2007-11-20 16:44:29 UTC (rev 5078)
@@ -4,3 +4,4 @@
#archives=jaxws-wsrm.war, jaxws-wsrm-client.jar
archives=jaxws-wsrm-one-way-emulator.war, jaxws-wsrm-client.jar
emulator=true
+addressable=true
\ No newline at end of file
Modified: stack/native/trunk/src/test/resources/jaxws/wsrm/properties/ReqResTestCase.properties
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/wsrm/properties/ReqResTestCase.properties 2007-11-20 15:55:19 UTC (rev 5077)
+++ stack/native/trunk/src/test/resources/jaxws/wsrm/properties/ReqResTestCase.properties 2007-11-20 16:44:29 UTC (rev 5078)
@@ -3,4 +3,5 @@
path=/jaxws-wsrm-req-res-emulator/ReqResService
#archives=jaxws-wsrm.war, jaxws-wsrm-client.jar
archives=jaxws-wsrm-req-res-emulator.war, jaxws-wsrm-client.jar
-emulator=true
\ No newline at end of file
+emulator=true
+addressable=true
\ No newline at end of file
18 years, 5 months
JBossWS SVN: r5077 - in framework: tags and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-11-20 10:55:19 -0500 (Tue, 20 Nov 2007)
New Revision: 5077
Added:
framework/tags/jbossws-framework-2.0.2.GA/
Removed:
framework/branches/jbossws-framework-2.0.2/
Log:
Release jbossws-2.0.2.GA
Copied: framework/tags/jbossws-framework-2.0.2.GA (from rev 5076, framework/branches/jbossws-framework-2.0.2)
18 years, 5 months
JBossWS SVN: r5076 - in stack/native: tags and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-11-20 10:54:15 -0500 (Tue, 20 Nov 2007)
New Revision: 5076
Added:
stack/native/tags/jbossws-native-2.0.2.GA/
Removed:
stack/native/branches/jbossws-native-2.0.2/
Log:
Release jbossws-2.0.2.GA
Copied: stack/native/tags/jbossws-native-2.0.2.GA (from rev 5075, stack/native/branches/jbossws-native-2.0.2)
18 years, 5 months
JBossWS SVN: r5075 - in stack/native/branches/rest: src/main/java/org/jboss/rs/deployment and 14 other directories.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-11-20 10:34:24 -0500 (Tue, 20 Nov 2007)
New Revision: 5075
Added:
stack/native/branches/rest/src/main/java/org/jboss/rs/media/xml/
stack/native/branches/rest/src/main/java/org/jboss/rs/media/xml/JAXBReader.java
stack/native/branches/rest/src/main/java/org/jboss/rs/media/xml/JAXBWriter.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/
stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/BookResource.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/BookStoreResource.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/MediaTypeTestCase.java
stack/native/branches/rest/src/test/resources/rs/media/
stack/native/branches/rest/src/test/resources/rs/media/jbossrs.xml
stack/native/branches/rest/src/test/resources/rs/media/web.xml
Modified:
stack/native/branches/rest/ant-import-tests/build-jars-jaxws.xml
stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/StatefulResourceResolver.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/JbossrsType.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ObjectFactory.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ResourceType.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/package-info.java
stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/InvocationMediator.java
stack/native/branches/rest/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java
stack/native/branches/rest/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
stack/native/branches/rest/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java
stack/native/branches/rest/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java
stack/native/branches/rest/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/JAXBIntroTestCase.java
Log:
Begin work on ProviderFactory
Modified: stack/native/branches/rest/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- stack/native/branches/rest/ant-import-tests/build-jars-jaxws.xml 2007-11-20 14:05:33 UTC (rev 5074)
+++ stack/native/branches/rest/ant-import-tests/build-jars-jaxws.xml 2007-11-20 15:34:24 UTC (rev 5075)
@@ -663,6 +663,16 @@
</webinf>
</war>
+ <war warfile="${tests.output.dir}/libs/jbossrs-mediatype.war" webxml="${tests.output.dir}/resources/rs/media/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/rs/media/BookResource.class"/>
+ <include name="org/jboss/test/rs/media/BookStoreResource.class"/>
+ </classes>
+ <webinf dir="${tests.output.dir}/resources/rs/media">
+ <include name="jbossrs.xml"/>
+ </webinf>
+ </war>
+
<!-- Please add alphabetically -->
<antcall target="build-interop-jars"/>
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java 2007-11-20 14:05:33 UTC (rev 5074)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/deployment/ResourceServlet.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -28,6 +28,7 @@
import org.jboss.rs.model.ResourceModel;
import org.jboss.rs.runtime.InvocationMediator;
import org.jboss.rs.runtime.RuntimeContext;
+import org.jboss.logging.Logger;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
@@ -46,7 +47,7 @@
*/
public class ResourceServlet extends HttpServlet
{
-
+ private static Logger log = Logger.getLogger(ResourceServlet.class);
private List<ResourceModel> rootResources = new ArrayList<ResourceModel>();
public void init(ServletConfig servletConfig) throws ServletException
@@ -131,6 +132,9 @@
private void serverError(int status, String message, HttpServletResponse res)
{
+
+ log.error(status + ":" + message);
+
try
{
res.setStatus(status);
Added: stack/native/branches/rest/src/main/java/org/jboss/rs/media/xml/JAXBReader.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/media/xml/JAXBReader.java (rev 0)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/media/xml/JAXBReader.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -0,0 +1,33 @@
+package org.jboss.rs.media;
+
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import java.io.InputStream;
+import java.io.IOException;
+
+public class JAXBReader implements MessageBodyReader
+{
+
+ public boolean isReadable(Class aClass)
+ {
+ return aClass.isAnnotationPresent(XmlRootElement.class);
+ }
+
+ public Object readFrom(Class aClass, MediaType mediaType, MultivaluedMap multivaluedMap, InputStream inputStream)
+ throws IOException
+ {
+ try
+ {
+ JAXBContext jaxb = JAXBContext.newInstance(aClass);
+ Object obj = jaxb.createUnmarshaller().unmarshal(inputStream);
+ return obj;
+ } catch (JAXBException e)
+ {
+ throw new IOException(e.getMessage());
+ }
+ }
+}
Property changes on: stack/native/branches/rest/src/main/java/org/jboss/rs/media/xml/JAXBReader.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/rest/src/main/java/org/jboss/rs/media/xml/JAXBWriter.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/media/xml/JAXBWriter.java (rev 0)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/media/xml/JAXBWriter.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -0,0 +1,37 @@
+package org.jboss.rs.media.xml;
+
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import java.io.OutputStream;
+import java.io.IOException;
+
+public class JAXBWriter implements MessageBodyWriter
+{
+
+ public boolean isWriteable(Class aClass)
+ {
+ return aClass.isAnnotationPresent(XmlRootElement.class);
+ }
+
+ public long getSize(Object o)
+ {
+ return -1;
+ }
+
+ public void writeTo(Object o, MediaType mediaType, MultivaluedMap multivaluedMap, OutputStream outputStream)
+ throws IOException
+ {
+ try
+ {
+ JAXBContext jaxb = JAXBContext.newInstance(o.getClass());
+ jaxb.createMarshaller().marshal(o, outputStream);
+ } catch (JAXBException e)
+ {
+ throw new IOException(e.getMessage());
+ }
+ }
+}
Property changes on: stack/native/branches/rest/src/main/java/org/jboss/rs/media/xml/JAXBWriter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/StatefulResourceResolver.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/StatefulResourceResolver.java 2007-11-20 14:05:33 UTC (rev 5074)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/StatefulResourceResolver.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -99,7 +99,7 @@
resourceMethod = dfsResourceMatch(rootResource);
}
- if(null == resourceMethod)
+ if(null == resourceMethod && visitedLocator.isEmpty())
throw new NoMethodException("No method matches URI '"+context.getPath());
// gotcha
@@ -141,36 +141,53 @@
throws NoResourceException
{
ResourceMatch<ResourceModel> match = null;
+ String uriToken = resourceMatch.qualifier.nextUriToken;
List<ResourceMatch<ResourceModel>> weightedResults = new ArrayList<ResourceMatch<ResourceModel>>();
Iterator<ResourceLocator> locators = resourceMatch.model.getResourceLocator().iterator();
while(locators.hasNext())
{
ResourceLocator bridge = locators.next();
- RegexQualifier qualifier = bridge.resolve(resourceMatch.qualifier.nextUriToken);
- if(qualifier!=null)
+ RegexQualifier qualifier = bridge.resolve(uriToken);
+
+ if(qualifier!=null && ! ("".equals(qualifier.nextUriToken) || "/".equals(qualifier.nextUriToken)))
+ {
+ // a subresource method is the target
weightedResults.add( new ResourceMatch<ResourceModel>( bridge.field(), qualifier) );
+ }
+ else if(qualifier!=null)
+ {
+ // the locator is the target itself
+ rememberLocator(bridge, uriToken);
+ }
}
if(!weightedResults.isEmpty())
{
Collections.sort(weightedResults);
match = weightedResults.get(0);
- }
- // TODO: cleanup locator matching after sort
- for(ResourceLocator loc : resourceMatch.model.getResourceLocator())
- {
- if(match.model == loc.field())
+ // for subresource methods we need to identify the locator after sorting
+ for(ResourceLocator loc : resourceMatch.model.getResourceLocator())
{
- visitedLocator.add(0, loc);
- locatorWorkingPath.put(loc, resourceMatch.qualifier.nextUriToken);
+ if(match.model == loc.field())
+ {
+ rememberLocator(loc, uriToken);
+ }
}
}
+
+
return match;
}
+ private void rememberLocator(ResourceLocator loc, String workingPath)
+ {
+ visitedLocator.add(0, loc);
+ locatorWorkingPath.put(loc, workingPath);
+ }
+
private ResourceMethod resolveResourceMethod(ResourceMatch<ResourceModel> methodTarget, String uriToken)
throws NoMethodException
{
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/JbossrsType.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/JbossrsType.java 2007-11-20 14:05:33 UTC (rev 5074)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/JbossrsType.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -1,6 +1,6 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// See <a href="http://java.sun.com/xml/xml">http://java.sun.com/xml/xml</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2007.11.06 at 02:11:05 PM CET
//
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ObjectFactory.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ObjectFactory.java 2007-11-20 14:05:33 UTC (rev 5074)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ObjectFactory.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -1,6 +1,6 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// See <a href="http://java.sun.com/xml/xml">http://java.sun.com/xml/xml</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2007.11.06 at 02:11:05 PM CET
//
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ResourceType.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ResourceType.java 2007-11-20 14:05:33 UTC (rev 5074)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ResourceType.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -1,6 +1,6 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// See <a href="http://java.sun.com/xml/xml">http://java.sun.com/xml/xml</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2007.11.06 at 02:11:05 PM CET
//
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/package-info.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/package-info.java 2007-11-20 14:05:33 UTC (rev 5074)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/package-info.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -1,6 +1,6 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// See <a href="http://java.sun.com/xml/xml">http://java.sun.com/xml/xml</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2007.11.06 at 02:11:05 PM CET
//
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/InvocationMediator.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/InvocationMediator.java 2007-11-20 14:05:33 UTC (rev 5074)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/InvocationMediator.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -24,6 +24,8 @@
public Object invoke() throws ResourceError
{
+ Object result = null;
+
StatefulResourceResolver resolver = StatefulResourceResolver.newInstance(runtimeContext);
ResourceMethod resourceMethod = resolver.resolve();
@@ -42,23 +44,26 @@
InvocationHandler bridgeInvoker = new DefaultInvocationHandler();
subResourceInstance = bridgeInvoker.invoke(locatorInvocation);
-
+ result = subResourceInstance; // best match
}
- // create an Invocation instance
- InvocationBuilder builder = new DefaultInvocationBuilder();
- runtimeContext.setWorkingPath(resolver.getMethodWorkingPath());
+ if(resourceMethod!=null)
+ {
+ // create an Invocation instance
+ InvocationBuilder builder = new DefaultInvocationBuilder();
+ runtimeContext.setWorkingPath(resolver.getMethodWorkingPath());
- if(subResourceInstance!=null)
- builder.addInvocationModel(new PresetInvocationTarget(subResourceInstance));
+ if(subResourceInstance!=null)
+ builder.addInvocationModel(new PresetInvocationTarget(subResourceInstance));
- builder.addInvocationModel( resourceMethod.getParameterBinding() );
- builder.addInvocationModel( resourceMethod.getOperationBinding() );
- Invocation invocation = builder.build(runtimeContext);
+ builder.addInvocationModel( resourceMethod.getParameterBinding() );
+ builder.addInvocationModel( resourceMethod.getOperationBinding() );
+ Invocation invocation = builder.build(runtimeContext);
- // invoke it
- InvocationHandler invoker = new DefaultInvocationHandler();
- Object result = invoker.invoke(invocation);
+ // invoke it
+ InvocationHandler invoker = new DefaultInvocationHandler();
+ result = invoker.invoke(invocation); // more fine grained match
+ }
return result;
}
Modified: stack/native/branches/rest/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2007-11-20 14:05:33 UTC (rev 5074)
+++ stack/native/branches/rest/src/main/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -128,7 +128,7 @@
if (desFactory == null)
throw new JAXRPCException("Cannot obtain deserializer factory for: " + xmlType);
- // Try jaxb deserialization
+ // Try xml deserialization
try
{
// http://jira.jboss.org/jira/browse/JBWS-955
Modified: stack/native/branches/rest/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2007-11-20 14:05:33 UTC (rev 5074)
+++ stack/native/branches/rest/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -118,7 +118,7 @@
}
}
- // Try jaxb deserialization
+ // Try xml deserialization
try
{
Class[] types = opMetaData.getEndpointMetaData().getRegisteredTypes().toArray(new Class[0]);
Modified: stack/native/branches/rest/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java 2007-11-20 14:05:33 UTC (rev 5074)
+++ stack/native/branches/rest/src/main/java/org/jboss/ws/metadata/umdm/FaultMetaData.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -314,7 +314,7 @@
private AccessorFactory getAccessorFactory(Class faultBean)
{
// This should catch all cases due to the constraints that JAX-WS puts on the fault bean
- // However, if issues arrise then switch this to a full jaxb reflection library
+ // However, if issues arrise then switch this to a full xml reflection library
XmlAccessorType type = (XmlAccessorType)faultBean.getAnnotation(XmlAccessorType.class);
if (type != null && type.value() == XmlAccessType.FIELD)
return ReflectiveFieldAccessor.FACTORY_CREATOR.create(this);
Modified: stack/native/branches/rest/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java 2007-11-20 14:05:33 UTC (rev 5074)
+++ stack/native/branches/rest/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -59,7 +59,7 @@
{
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
wsdlReader = wsdlFactory.newWSDLReader();
- // Allow unknown extensions (jaxws/jaxb binding elements)
+ // Allow unknown extensions (jaxws/xml binding elements)
wsdlReader.setExtensionRegistry(new ExtensionRegistry());
wsdlReader.setFeature(WSDL11DefinitionFactory.FEATURE_VERBOSE, false);
}
Added: stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/BookResource.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/BookResource.java (rev 0)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/BookResource.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -0,0 +1,62 @@
+package org.jboss.test.rs.media;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlElement;
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.UriTemplate;
+
+@XmlRootElement(name = "book")
+public class BookResource
+{
+ private String author;
+ private String ISBN;
+ private String title;
+
+ public BookResource()
+ {
+ }
+
+ public BookResource(String author, String ISBN, String title)
+ {
+ this.author = author;
+ this.ISBN = ISBN;
+ this.title = title;
+ }
+
+ @HttpMethod
+ @UriTemplate("author")
+ @XmlElement
+ public String getAuthor()
+ {
+ return author;
+ }
+
+ public void setAuthor(String author)
+ {
+ this.author = author;
+ }
+
+ @XmlElement
+ public String getISBN()
+ {
+ return ISBN;
+ }
+
+ public void setISBN(String ISBN)
+ {
+ this.ISBN = ISBN;
+ }
+
+ @HttpMethod
+ @UriTemplate("title")
+ @XmlElement
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+}
Property changes on: stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/BookResource.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/BookStoreResource.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/BookStoreResource.java (rev 0)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/BookStoreResource.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -0,0 +1,47 @@
+package org.jboss.test.rs.media;
+
+import javax.ws.rs.UriTemplate;
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.UriParam;
+import javax.ws.rs.ProduceMime;
+import java.util.List;
+import java.util.ArrayList;
+
+@UriTemplate("books")
+public class BookStoreResource
+{
+
+ private List<BookResource> availableBooks = new ArrayList<BookResource>();
+
+ public BookStoreResource()
+ {
+ availableBooks.add( new BookResource("Leonard Richardson", "596529260", "RESTful Web Services") );
+ availableBooks.add( new BookResource("Sam Ruby", "3897217279", "Web Services mit REST") );
+ }
+
+ @UriTemplate("{isbn}")
+ public BookResource getBookByISBN(
+ @UriParam("isbn")
+ String isbn)
+ {
+ BookResource match = null;
+
+ for(BookResource book : availableBooks)
+ {
+ if(book.getISBN().equals(isbn))
+ {
+ match = book;
+ break;
+ }
+ }
+
+ return match;
+ }
+
+ @HttpMethod
+ @ProduceMime("text/xml")
+ public List<BookResource> getAllBooks()
+ {
+ return availableBooks;
+ }
+}
Property changes on: stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/BookStoreResource.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/MediaTypeTestCase.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/MediaTypeTestCase.java (rev 0)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/MediaTypeTestCase.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -0,0 +1,68 @@
+package org.jboss.test.rs.media;
+
+import junit.framework.Test;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+import org.jboss.rs.media.JAXBReader;
+
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ * @version $Revision$
+ */
+public class MediaTypeTestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(MediaTypeTestCase.class, "jbossrs-mediatype.war");
+ }
+
+ /**
+ * Request a xml resource representation
+ *
+ * @throws Exception
+ */
+ public void testRequest1() throws Exception
+ {
+ URL url = new URL("http://localhost:8080/jbossrs-mediatype" +
+ "/books/3897217279");
+
+ Object response = doMediaRequest(url, null);
+ assertNotNull(response );
+ assertTrue( (response instanceof BookResource));
+ assertEquals( "Sam Ruby", ((BookResource)response ).getAuthor());
+ }
+
+ private Object doMediaRequest(URL url, Object data) throws Exception
+ {
+ HttpURLConnection conn = (HttpURLConnection)url.openConnection();
+ conn.setDoOutput( data!=null );
+ conn.setRequestProperty("accept", "text/xml");
+
+ if(data !=null)
+ {
+ OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
+
+ // TODO: resolve MessageBodyWriter
+
+ wr.flush();
+ wr.close();
+ }
+
+ // TODO: resolve MessageBodyReader
+
+ Object result = null;
+
+ JAXBReader reader = new JAXBReader();
+ if(reader.isReadable(BookResource.class))
+ {
+ result = reader.readFrom(BookResource.class, null, null, conn.getInputStream());
+ }
+
+
+ return result;
+ }
+}
Property changes on: stack/native/branches/rest/src/test/java/org/jboss/test/rs/media/MediaTypeTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/JAXBIntroTestCase.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/JAXBIntroTestCase.java 2007-11-20 14:05:33 UTC (rev 5074)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/JAXBIntroTestCase.java 2007-11-20 15:34:24 UTC (rev 5075)
@@ -41,7 +41,7 @@
/**
* Test the JAXBIntroduction features.
*
- * jaxb-intros.xml can reside under META-INF or WEB-INF and should be
+ * xml-intros.xml can reside under META-INF or WEB-INF and should be
* picked up by JAXBIntroduction deployment aspect.
*
* On the server side the default JAXBContextFactory takes it into consideration.
Added: stack/native/branches/rest/src/test/resources/rs/media/jbossrs.xml
===================================================================
--- stack/native/branches/rest/src/test/resources/rs/media/jbossrs.xml (rev 0)
+++ stack/native/branches/rest/src/test/resources/rs/media/jbossrs.xml 2007-11-20 15:34:24 UTC (rev 5075)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<jbossrs xmlns="http://org.jboss.rs/">
+ <resource>
+ <name>BookStore</name>
+ <implementation>org.jboss.test.rs.media.BookStoreResource</implementation>
+ </resource>
+</jbossrs>
Property changes on: stack/native/branches/rest/src/test/resources/rs/media/jbossrs.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/rest/src/test/resources/rs/media/web.xml
===================================================================
--- stack/native/branches/rest/src/test/resources/rs/media/web.xml (rev 0)
+++ stack/native/branches/rest/src/test/resources/rs/media/web.xml 2007-11-20 15:34:24 UTC (rev 5075)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <servlet>
+ <servlet-name>JBossRS</servlet-name>
+ <servlet-class>org.jboss.rs.deployment.ResourceServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>JBossRS</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+
Property changes on: stack/native/branches/rest/src/test/resources/rs/media/web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
18 years, 5 months
JBossWS SVN: r5074 - in stack/native/branches/rest: src/main/java/org/jboss/rs/media and 6 other directories.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-11-20 09:05:33 -0500 (Tue, 20 Nov 2007)
New Revision: 5074
Removed:
stack/native/branches/rest/src/main/java/org/jboss/rs/media/EntityProviderRegistry.java
stack/native/branches/rest/src/main/java/org/jboss/rs/media/JAXBEntityProvider.java
Modified:
stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java
stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/RuntimeContext.java
stack/native/branches/rest/src/main/java/org/jboss/rs/util/Convert.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/Specification.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/Widget.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/WidgetList.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ModelParserTestCase.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ResolverTestCase.java
stack/native/branches/rest/version.properties
Log:
Update to 0.5 API
Deleted: stack/native/branches/rest/src/main/java/org/jboss/rs/media/EntityProviderRegistry.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/media/EntityProviderRegistry.java 2007-11-20 12:59:52 UTC (rev 5073)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/media/EntityProviderRegistry.java 2007-11-20 14:05:33 UTC (rev 5074)
@@ -1,64 +0,0 @@
-/*
- * 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.rs.media;
-
-import javax.ws.rs.ext.EntityProvider;
-import javax.activation.MimeType;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * Register {@link javax.ws.rs.ext.EntityProvider} for MimeTypes
- *
- * @author Heiko.Braun(a)jboss.com
- * @version $Revision$
- */
-public class EntityProviderRegistry
-{
-
- private Map<MimeType, List<EntityProvider>> providers = new HashMap<MimeType, List<EntityProvider>>();
-
- public void addProvider(EntityProvider provider, MimeType... mimeTypes)
- {
- for(MimeType m : mimeTypes)
- {
- if(null == providers.get(m))
- providers.put(m, new ArrayList<EntityProvider>());
-
- providers.get(m).add(provider);
- }
- }
-
- public List<EntityProvider> getProviders(MimeType mime)
- {
- List<EntityProvider> match = new ArrayList<EntityProvider>();
-
- if(providers.get(mime)!=null)
- match = providers.get(mime);
-
- return match;
- }
-
-
-}
Deleted: stack/native/branches/rest/src/main/java/org/jboss/rs/media/JAXBEntityProvider.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/media/JAXBEntityProvider.java 2007-11-20 12:59:52 UTC (rev 5073)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/media/JAXBEntityProvider.java 2007-11-20 14:05:33 UTC (rev 5074)
@@ -1,83 +0,0 @@
-/*
- * 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.rs.media;
-
-import javax.ws.rs.ext.EntityProvider;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * TODO: Cache JAXBContext for better performance
- *
- * @author Heiko.Braun(a)jboss.com
- * @version $Revision$
- */
-public class JAXBEntityProvider implements EntityProvider
-{
-
- /**
- * Supports classes annotated with @XmlRootElement or JAXBElement's that wrap this infomration.
- * @param aClass
- * @return
- */
- public boolean supports(Class aClass)
- {
- return aClass.isAnnotationPresent(XmlRootElement.class) || (JAXBElement.class == aClass);
- }
-
- public Object readFrom(Class aClass, MediaType mediaType, MultivaluedMap multivaluedMap, InputStream inputStream) throws IOException
- {
- Object result = null;
- try
- {
- JAXBContext context = JAXBContext.newInstance(aClass);
- result = context.createUnmarshaller().unmarshal(inputStream);
- }
- catch (JAXBException e)
- {
- throw new IOException("Unmarshalling failed: " + e.getMessage());
- }
-
- return result;
-
- }
-
- public void writeTo(Object o, MediaType mediaType, MultivaluedMap multivaluedMap, OutputStream outputStream) throws IOException
- {
- try
- {
- JAXBContext context = JAXBContext.newInstance(o.getClass());
- context.createMarshaller().marshal(o, outputStream);
- }
- catch (JAXBException e)
- {
- throw new IOException("Marshalling failed: " + e.getMessage());
- }
- }
-}
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java 2007-11-20 12:59:52 UTC (rev 5073)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/ResourceModelParser.java 2007-11-20 14:05:33 UTC (rev 5074)
@@ -21,11 +21,12 @@
*/
package org.jboss.rs.model;
+import org.jboss.logging.Logger;
+import org.jboss.rs.MethodHTTP;
import org.jboss.rs.util.Convert;
-import org.jboss.logging.Logger;
+import javax.ws.rs.HttpMethod;
import javax.ws.rs.UriTemplate;
-import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
/**
@@ -85,22 +86,24 @@
ResourceMethod resourceMethod = null;
// subresource methods
- for(Class requestType : Convert.REQUEST_TYPES)
+
+ if(method.isAnnotationPresent(HttpMethod.class))
{
- if(method.isAnnotationPresent(requestType))
- {
- // sub resource method
- Annotation a = method.getAnnotation(requestType);
- resourceMethod = new ResourceMethod(
- parentResource,
- Convert.annotationToMethodHTTP(a), uri.value(), method
- );
+ // sub resource method
+ HttpMethod a = method.getAnnotation(HttpMethod.class);
+ MethodHTTP methodHttp = a.value().equals("") ?
+ Convert.prefixToMethodHTTP(method) : Convert.annotationToMethodHTTP(a);
- resourceMethod.freeze();
- parentResource.addSubResourceMethod(resourceMethod);
- }
+ resourceMethod = new ResourceMethod(
+ parentResource,
+ methodHttp, uri.value(), method
+ );
+
+ resourceMethod.freeze();
+ parentResource.addSubResourceMethod(resourceMethod);
}
+
// subresource locator
if(null == resourceMethod)
{
@@ -116,20 +119,20 @@
}
else
{
- for(Class requestType : Convert.REQUEST_TYPES)
+ if(method.isAnnotationPresent(HttpMethod.class))
{
- if(method.isAnnotationPresent(requestType))
- {
- // resource method
- Annotation a = method.getAnnotation(requestType);
- ResourceMethod resourceMethod = new ResourceMethod(
- parentResource,
- Convert.annotationToMethodHTTP(a), "", method
- );
+ // resource method
+ HttpMethod a = method.getAnnotation(HttpMethod.class);
+ MethodHTTP methodHttp = a.value().equals("") ?
+ Convert.prefixToMethodHTTP(method) : Convert.annotationToMethodHTTP(a);
- resourceMethod.freeze();
- parentResource.addResourceMethod(resourceMethod);
- }
+ ResourceMethod resourceMethod = new ResourceMethod(
+ parentResource,
+ methodHttp, "", method
+ );
+
+ resourceMethod.freeze();
+ parentResource.addResourceMethod(resourceMethod);
}
}
}
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/RuntimeContext.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/RuntimeContext.java 2007-11-20 12:59:52 UTC (rev 5073)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/runtime/RuntimeContext.java 2007-11-20 14:05:33 UTC (rev 5074)
@@ -132,7 +132,7 @@
public MimeType getProvideMimeType()
{
- if(! (requestMethod == MethodHTTP.POST) )
+ if(! (requestMethod == MethodHTTP.POST || requestMethod == MethodHTTP.PUT) )
throw new IllegalArgumentException(requestMethod + " does not provide a 'Content-Type header'");
assert provideMimeType !=null;
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/util/Convert.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/util/Convert.java 2007-11-20 12:59:52 UTC (rev 5073)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/util/Convert.java 2007-11-20 14:05:33 UTC (rev 5074)
@@ -23,15 +23,13 @@
import org.jboss.rs.MethodHTTP;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.DELETE;
+import javax.ws.rs.HttpMethod;
import javax.ws.rs.ConsumeMime;
import javax.ws.rs.ProduceMime;
import javax.activation.MimeType;
import javax.activation.MimeTypeParseException;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
import java.util.List;
import java.util.ArrayList;
import java.util.StringTokenizer;
@@ -42,8 +40,7 @@
*/
public class Convert
{
- public static Class[] REQUEST_TYPES = new Class[] { GET.class, POST.class, PUT.class, DELETE.class };
-
+
public static MimeType ANY_MIME;
static
@@ -58,21 +55,45 @@
}
}
- public static MethodHTTP annotationToMethodHTTP(Annotation a)
+ public static MethodHTTP prefixToMethodHTTP(Method m)
{
- MethodHTTP m = null;
+ MethodHTTP result = null;
- if(a instanceof GET)
- m = MethodHTTP.GET;
- else if(a instanceof POST)
- m = MethodHTTP.POST;
- else if(a instanceof PUT)
- m = MethodHTTP.PUT;
- else if(a instanceof DELETE)
- m = MethodHTTP.DELETE;
+ String methodName = m.getName();
+ if(methodName.startsWith("get"))
+ result = MethodHTTP.GET;
+ else if(methodName.startsWith("post"))
+ result = MethodHTTP.POST;
+ else if(methodName.startsWith("put"))
+ result = MethodHTTP.PUT;
+ else if(methodName.startsWith("delete"))
+ result = MethodHTTP.DELETE;
- return m;
+ if(null==result)
+ throw new IllegalArgumentException("Failed to match method by prefix: " + methodName);
+
+ return result;
+ }
+ public static MethodHTTP annotationToMethodHTTP(HttpMethod a)
+ {
+ HttpMethod hm = (HttpMethod)a;
+ MethodHTTP result = null;
+
+ if(hm.value() == HttpMethod.GET)
+ result = MethodHTTP.GET;
+ else if(hm.value() == HttpMethod.POST)
+ result = MethodHTTP.POST;
+ else if(hm.value() == HttpMethod.PUT)
+ result = MethodHTTP.PUT;
+ else if(hm.value() == HttpMethod.DELETE)
+ result = MethodHTTP.DELETE;
+
+ if(null==result)
+ throw new IllegalArgumentException("Failed to match method by value: " + hm.value());
+
+ return result;
+
}
public static List<MimeType> annotationToMimeType(ConsumeMime consumeMime)
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/Specification.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/Specification.java 2007-11-20 12:59:52 UTC (rev 5073)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/Specification.java 2007-11-20 14:05:33 UTC (rev 5074)
@@ -21,6 +21,8 @@
*/
package org.jboss.test.rs;
+import javax.ws.rs.HttpMethod;
+
/**
* @author Heiko.Braun(a)jboss.com
* @version $Revision$
@@ -37,4 +39,10 @@
{
this.name = name;
}
+
+ @HttpMethod
+ public String getName()
+ {
+ return name;
+ }
}
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/Widget.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/Widget.java 2007-11-20 12:59:52 UTC (rev 5073)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/Widget.java 2007-11-20 14:05:33 UTC (rev 5074)
@@ -21,7 +21,7 @@
*/
package org.jboss.test.rs;
-import javax.ws.rs.GET;
+import javax.ws.rs.HttpMethod;
import javax.ws.rs.UriParam;
import javax.ws.rs.UriTemplate;
import javax.ws.rs.ProduceMime;
@@ -44,14 +44,14 @@
this.id = id;
}
- @GET
+ @HttpMethod
@UriTemplate("id")
@ProduceMime("text/plain")
public String getId() {
return this.id;
}
- @GET
+ @HttpMethod
@UriTemplate("spec")
public List<Specification> getSpecifications() {
List<Specification> specs = new ArrayList<Specification>();
@@ -59,7 +59,7 @@
return specs;
}
- @GET
+ @HttpMethod
@UriTemplate("spec/{name}")
public Specification getSpecByName(@UriParam("name")String name)
{
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/WidgetList.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/WidgetList.java 2007-11-20 12:59:52 UTC (rev 5073)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/WidgetList.java 2007-11-20 14:05:33 UTC (rev 5074)
@@ -21,10 +21,9 @@
*/
package org.jboss.test.rs;
-import javax.ws.rs.GET;
+import javax.ws.rs.HttpMethod;
import javax.ws.rs.UriParam;
import javax.ws.rs.UriTemplate;
-import javax.ws.rs.POST;
import javax.ws.rs.ConsumeMime;
import javax.ws.rs.ProduceMime;
import javax.ws.rs.core.HttpContext;
@@ -33,22 +32,22 @@
@UriTemplate("widgets")
public class WidgetList
{
- @GET
+ @HttpMethod
@ProduceMime({"text/plain"})
public String getDescription() {
return "A widgetlist";
}
- @GET
+ @HttpMethod
@UriTemplate("offers")
public WidgetList getDiscounted() {
return null;
}
- @POST
+ @HttpMethod
@UriTemplate("special")
@ConsumeMime({"text/xml", "application/xml"})
- public void setDiscounted(
+ public void putDiscounted(
@HttpContext HttpHeaders headers,
Widget special
)
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java 2007-11-20 12:59:52 UTC (rev 5073)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java 2007-11-20 14:05:33 UTC (rev 5074)
@@ -101,7 +101,7 @@
public void testHttpContextParamBinding() throws Exception
{
URI uri = new URI("/rest/widgets/special");
- RuntimeContext context = defaultRuntimeContext(MethodHTTP.POST, uri);
+ RuntimeContext context = defaultRuntimeContext(MethodHTTP.PUT, uri);
context.parseContentTypeHeader("text/xml");
StatefulResourceResolver resolver = StatefulResourceResolver.newInstance(context);
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ModelParserTestCase.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ModelParserTestCase.java 2007-11-20 12:59:52 UTC (rev 5073)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ModelParserTestCase.java 2007-11-20 14:05:33 UTC (rev 5074)
@@ -41,7 +41,7 @@
ResourceMethod match = null;
for(ResourceMethod m : root.getSubResourceMethods())
{
- if(m.getMethodHTTP() == MethodHTTP.POST
+ if(m.getMethodHTTP() == MethodHTTP.PUT
&& m.getUriTemplate().equals("special"))
{
match = m;
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ResolverTestCase.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ResolverTestCase.java 2007-11-20 12:59:52 UTC (rev 5073)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/model/ResolverTestCase.java 2007-11-20 14:05:33 UTC (rev 5074)
@@ -67,7 +67,7 @@
public void testRegexResolver2() throws Exception
{
URI uri = new URI("/rest/widgets/special");
- RuntimeContext context = defaultRuntimeContext(MethodHTTP.POST, uri);
+ RuntimeContext context = defaultRuntimeContext(MethodHTTP.PUT, uri);
context.parseContentTypeHeader("text/xml");
StatefulResourceResolver resolver = StatefulResourceResolver.newInstance(context);
Modified: stack/native/branches/rest/version.properties
===================================================================
--- stack/native/branches/rest/version.properties 2007-11-20 12:59:52 UTC (rev 5073)
+++ stack/native/branches/rest/version.properties 2007-11-20 14:05:33 UTC (rev 5074)
@@ -67,7 +67,7 @@
jboss-vfs=2.0.0.Beta2
jbossas-core-libs=4.2.0.GA
junit=3.8.1
-jsr-311=0.3
+jsr-311=0.5
oswego-concurrent=1.3.4
qdox=1.4
sun-hudson=1.93
18 years, 5 months
JBossWS SVN: r5073 - in stack/native/branches/rest/src: test/java/org/jboss/test/rs and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-11-20 07:59:52 -0500 (Tue, 20 Nov 2007)
New Revision: 5073
Modified:
stack/native/branches/rest/src/main/java/org/jboss/rs/model/ParameterBinding.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/Widget.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/WidgetList.java
stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java
Log:
Cleanup
Modified: stack/native/branches/rest/src/main/java/org/jboss/rs/model/ParameterBinding.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/ParameterBinding.java 2007-11-20 11:51:01 UTC (rev 5072)
+++ stack/native/branches/rest/src/main/java/org/jboss/rs/model/ParameterBinding.java 2007-11-20 12:59:52 UTC (rev 5073)
@@ -66,9 +66,6 @@
/* Pattern of the owning ResourceMethod */
private final Pattern regex;
- /* Pattern to strip prefix from runtime path */
- private static final String PREFIX_PATTERN = "(.*?)";
-
/*the total number of parameters */
private int totalParameters = 0;
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/Widget.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/Widget.java 2007-11-20 11:51:01 UTC (rev 5072)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/Widget.java 2007-11-20 12:59:52 UTC (rev 5073)
@@ -25,6 +25,8 @@
import javax.ws.rs.UriParam;
import javax.ws.rs.UriTemplate;
import javax.ws.rs.ProduceMime;
+import java.util.List;
+import java.util.ArrayList;
/**
* @author Heiko.Braun(a)jboss.com
@@ -51,8 +53,10 @@
@GET
@UriTemplate("spec")
- public Specification[] getSpecification() {
- return new Specification[]{ new Specification() };
+ public List<Specification> getSpecifications() {
+ List<Specification> specs = new ArrayList<Specification>();
+ specs.add( new Specification());
+ return specs;
}
@GET
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/WidgetList.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/WidgetList.java 2007-11-20 11:51:01 UTC (rev 5072)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/WidgetList.java 2007-11-20 12:59:52 UTC (rev 5073)
@@ -53,7 +53,7 @@
Widget special
)
{
-
+
}
@UriTemplate("{id}")
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java 2007-11-20 11:51:01 UTC (rev 5072)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/invocation/InvocationBuilderTestCase.java 2007-11-20 12:59:52 UTC (rev 5073)
@@ -114,6 +114,7 @@
// setup a builder
InvocationBuilder builder = new DefaultInvocationBuilder();
builder.addInvocationModel(method.getParameterBinding());
+ builder.addInvocationModel(method.getOperationBinding());
// create an Invocation instance
Invocation invocation = builder.build(context);
18 years, 5 months
JBossWS SVN: r5072 - stack/native/branches/rest/src/test/java/org/jboss/test/rs/deployment.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-11-20 06:51:01 -0500 (Tue, 20 Nov 2007)
New Revision: 5072
Modified:
stack/native/branches/rest/src/test/java/org/jboss/test/rs/deployment/DescriptorParserTestCase.java
Log:
Fix descriptor test case
Modified: stack/native/branches/rest/src/test/java/org/jboss/test/rs/deployment/DescriptorParserTestCase.java
===================================================================
--- stack/native/branches/rest/src/test/java/org/jboss/test/rs/deployment/DescriptorParserTestCase.java 2007-11-20 11:48:04 UTC (rev 5071)
+++ stack/native/branches/rest/src/test/java/org/jboss/test/rs/deployment/DescriptorParserTestCase.java 2007-11-20 11:51:01 UTC (rev 5072)
@@ -27,6 +27,7 @@
import org.jboss.rs.model.dd.ResourceType;
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
/**
* Test the deployment descriptor parser.
@@ -64,6 +65,9 @@
dd.getResource().add(resource);
- DeploymentDescriptorParser.write(dd, System.out);
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ DeploymentDescriptorParser.write(dd, bout);
+ String result = new String(bout.toByteArray());
+ assertTrue(result.indexOf("FooBarResource")!=-1);
}
}
18 years, 5 months