JBossWS SVN: r1446 - branches
by jbossws-commits@lists.jboss.org
Author: mageshbk
Date: 2006-11-16 04:19:19 -0500 (Thu, 16 Nov 2006)
New Revision: 1446
Added:
branches/jbossws-1.0.4.GA-JBWS-1379/
Log:
made a copy
Copied: branches/jbossws-1.0.4.GA-JBWS-1379 (from rev 1445, tags/jbossws-1.0.4.GA)
18 years, 1 month
JBossWS SVN: r1445 - branches/jbossws-1.0/src/main/java/org/jboss/ws/soap/attachment
by jbossws-commits@lists.jboss.org
Author: mageshbk
Date: 2006-11-16 04:05:38 -0500 (Thu, 16 Nov 2006)
New Revision: 1445
Modified:
branches/jbossws-1.0/src/main/java/org/jboss/ws/soap/attachment/ImageDataContentHandler.java
Log:
Fixed JBWS-1284 Gracefully handle invalid ImageIO mime types.
Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/soap/attachment/ImageDataContentHandler.java
===================================================================
--- branches/jbossws-1.0/src/main/java/org/jboss/ws/soap/attachment/ImageDataContentHandler.java 2006-11-16 06:25:04 UTC (rev 1444)
+++ branches/jbossws-1.0/src/main/java/org/jboss/ws/soap/attachment/ImageDataContentHandler.java 2006-11-16 09:05:38 UTC (rev 1445)
@@ -30,6 +30,7 @@
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.ArrayList;
import java.util.Iterator;
import javax.activation.ActivationDataFlavor;
@@ -39,6 +40,8 @@
import javax.imageio.ImageWriter;
import javax.imageio.stream.ImageOutputStream;
+import org.jboss.logging.Logger;
+
/**
* <code>ImageDataContentHandler</code> is a JAF content handler that handles
* marshalling/unmarshalling between <code>Image</code> objects and a stream.
@@ -53,9 +56,13 @@
* an exception will be thrown indicating the lack of encoding support.
*
* @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
+ * @author <a href="mailto:mageshbk@jboss.com">Magesh Kumar B</a>
*/
public class ImageDataContentHandler extends Component implements DataContentHandler
{
+ // provide logging
+ private static Logger log = Logger.getLogger(ImageDataContentHandler.class);
+
private static DataFlavor[] flavors;
static
@@ -71,11 +78,28 @@
String[] mimeTypes = ImageIO.getReaderMIMETypes();
if (mimeTypes == null)
return;
- flavors = new DataFlavor[mimeTypes.length];
+ ArrayList flavs = new ArrayList ();
+ DataFlavor flavor;
+ //flavors = new DataFlavor[mimeTypes.length];
for (int i = 0; i < mimeTypes.length; i++)
{
- flavors[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
+ try
+ {
+ flavor = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
+ flavs.add(flavor);
+ }
+ catch (IllegalArgumentException iae)
+ {
+ //This mime type is not supported
+ log.warn("Unsupported MIME Type '" + mimeTypes[i] +"'");
+ }
}
+ int size = flavs.size();
+ flavors = new DataFlavor[size];
+ for (int i = 0; i < size; i++)
+ {
+ flavors[i] = (ActivationDataFlavor)flavs.get(i);
+ }
}
private static ImageWriter getImageWriter(String mimeType) {
18 years, 1 month
JBossWS SVN: r1444 - in trunk/src/main: java/org/jboss/ws/integration/jboss50 resources/jbossws.deployer/META-INF
by jbossws-commits@lists.jboss.org
Author: jason.greene(a)jboss.com
Date: 2006-11-16 01:25:04 -0500 (Thu, 16 Nov 2006)
New Revision: 1444
Removed:
trunk/src/main/java/org/jboss/ws/integration/jboss50/WebAppClassLoaderDeployer.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/WebAppClassLoaderFactory.java
Modified:
trunk/src/main/resources/jbossws.deployer/META-INF/deployer-beans.xml
Log:
Get rid of old classloader stuff
Deleted: trunk/src/main/java/org/jboss/ws/integration/jboss50/WebAppClassLoaderDeployer.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss50/WebAppClassLoaderDeployer.java 2006-11-16 03:13:56 UTC (rev 1443)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss50/WebAppClassLoaderDeployer.java 2006-11-16 06:25:04 UTC (rev 1444)
@@ -1,76 +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.ws.integration.jboss50;
-
-//$Id$
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import org.jboss.deployers.plugins.deployer.AbstractSimpleDeployer;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.classloader.ClassLoaderFactory;
-import org.jboss.deployers.spi.deployer.DeploymentUnit;
-import org.jboss.deployers.spi.structure.DeploymentContext;
-import org.jboss.logging.Logger;
-
-/**
- * A deployer that adds a webapp class loader to the depployment unit
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 31-Oct-2005
- */
-public class WebAppClassLoaderDeployer extends AbstractSimpleDeployer
-{
- // The default relative order after the JBossWebAppParsingDeployer
- public int getRelativeOrder()
- {
- return PARSER_DEPLOYER + 2;
- }
-
- @Override
- public void deploy(DeploymentUnit unit) throws DeploymentException
- {
- ClassLoader classLoader = null;
- try
- {
- // This throws a RTE if the loader was not set
- classLoader = unit.getClassLoader();
- }
- catch (Exception ex)
- {
- // ignore
- }
-
-
- if (classLoader == null)
- {
- unit.getDeploymentContext().createClassLoader(new WebAppClassLoaderFactory());
- }
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/integration/jboss50/WebAppClassLoaderFactory.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss50/WebAppClassLoaderFactory.java 2006-11-16 03:13:56 UTC (rev 1443)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss50/WebAppClassLoaderFactory.java 2006-11-16 06:25:04 UTC (rev 1444)
@@ -1,145 +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.ws.integration.jboss50;
-
-//$Id$
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import org.jboss.deployers.spi.classloader.ClassLoaderFactory;
-import org.jboss.deployers.spi.structure.DeploymentContext;
-import org.jboss.logging.Logger;
-
-/**
- * A class loader factory for web apps
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 31-Oct-2005
- */
-public class WebAppClassLoaderFactory implements ClassLoaderFactory
-{
- // provide logging
- private static Logger log = Logger.getLogger(WebAppClassLoaderFactory.class);
-
- private ClassLoader classLoader;
-
- public ClassLoader createClassLoader(DeploymentContext context) throws Exception
- {
- log.debug("createClassLoader: " + context.getRoot());
-
- ArrayList<URL> list = new ArrayList<URL>();
-
- URL warURL = context.getRoot().toURL();
- String externalForm = warURL.toExternalForm();
-
- if (externalForm.endsWith("!/"))
- {
- String fileName = warURL.getFile();
- if (fileName.indexOf("!/") > 0)
- fileName = fileName.substring(0, fileName.indexOf("!/"));
-
- try
- {
- URL url = new URL(fileName);
- fileName = url.getFile();
- }
- catch (MalformedURLException ex)
- {
- // ignore
- }
-
- File warFile = new File(fileName);
- if (warFile.exists())
- {
- // Add root url
- list.add(new URL(externalForm));
-
- ZipFile zipFile = new ZipFile(warFile);
- Enumeration en = zipFile.entries();
- while (en.hasMoreElements())
- {
- ZipEntry entry = (ZipEntry)en.nextElement();
- String entryName = entry.getName();
-
- // Add WEB-INF/classes
- if (entryName.equals("WEB-INF/classes/"))
- {
- URL classesURL = new URL(externalForm + entryName);
- list.add(classesURL);
- }
-
- // Add WEB-INF/lib/*.jar
- if (entryName.startsWith("WEB-INF/lib") && entryName.endsWith(".jar"))
- {
- URL jarURL = new URL(externalForm + entryName);
- list.add(jarURL);
- }
- }
- }
- else
- {
- log.warn("WAR file does not exist: " + warFile);
- }
- }
- else
- {
- String path = warURL.getFile();
-
- File classesDir = new File(path, "WEB-INF/classes");
- if (classesDir.exists())
- list.add(classesDir.toURL());
-
- File libDir = new File(path, "WEB-INF/lib");
- if (libDir.exists())
- {
- File[] jars = libDir.listFiles();
- int length = jars != null ? jars.length : 0;
- for (int j = 0; j < length; j++)
- {
- File jar = jars[j];
- if (jar.getAbsolutePath().endsWith(".jar"))
- {
- list.add(jar.toURL());
- }
- }
- }
- }
-
- ClassLoader parent = Thread.currentThread().getContextClassLoader();
- classLoader = new URLClassLoader(list.toArray(new URL[list.size()]), parent);
-
- return classLoader;
- }
-
- public void removeClassLoader(DeploymentContext context) throws Exception
- {
- log.debug("removeClassLoader: " + context.getRoot());
- this.classLoader = null;
- }
-}
Modified: trunk/src/main/resources/jbossws.deployer/META-INF/deployer-beans.xml
===================================================================
--- trunk/src/main/resources/jbossws.deployer/META-INF/deployer-beans.xml 2006-11-16 03:13:56 UTC (rev 1443)
+++ trunk/src/main/resources/jbossws.deployer/META-INF/deployer-beans.xml 2006-11-16 06:25:04 UTC (rev 1444)
@@ -17,21 +17,6 @@
<depends>JBossWebAppParsingDeployer</depends>
</bean>
- <!--
- <bean name="WebAppClassLoaderDeployer" class="org.jboss.ws.integration.jboss50.WebAppClassLoaderDeployer">
- <install bean="MainDeployer" method="addDeployer">
- <parameter>
- <this/>
- </parameter>
- </install>
- <uninstall bean="MainDeployer" method="removeDeployer">
- <parameter>
- <this/>
- </parameter>
- </uninstall>
- </bean>
- -->
-
<bean name="JAXWSDeployerJSE" class="org.jboss.ws.integration.jboss50.JAXWSDeployerJSE">
<install bean="MainDeployer" method="addDeployer">
<parameter>
@@ -73,4 +58,4 @@
</uninstall>
</bean>
-</deployment>
\ No newline at end of file
+</deployment>
18 years, 1 month
JBossWS SVN: r1443 - in trunk/src/main/java/org/jboss/ws: deployment integration/jboss50 integration/tomcat jaxws soap/attachment utils
by jbossws-commits@lists.jboss.org
Author: jason.greene(a)jboss.com
Date: 2006-11-15 22:13:56 -0500 (Wed, 15 Nov 2006)
New Revision: 1443
Modified:
trunk/src/main/java/org/jboss/ws/deployment/AbstractServiceEndpointPublisher.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractJSEDeployer.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/DeploymentInfoAdaptor.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXRPCDeployerJSE.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerJSE.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointPublisher.java
trunk/src/main/java/org/jboss/ws/integration/tomcat/wspublish.java
trunk/src/main/java/org/jboss/ws/jaxws/DynamicWrapperGenerator.java
trunk/src/main/java/org/jboss/ws/soap/attachment/SwapableMemoryDataSource.java
trunk/src/main/java/org/jboss/ws/utils/IOUtils.java
trunk/src/main/java/org/jboss/ws/utils/JavaUtils.java
Log:
JBCTS-410 Rework deployers to use relativeOrder correctly
Switch to a delegate deployment classloader
Detect and handle RepositoryClassLoader blacklists when performing dynamic class creation
Modified: trunk/src/main/java/org/jboss/ws/deployment/AbstractServiceEndpointPublisher.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/AbstractServiceEndpointPublisher.java 2006-11-16 00:37:11 UTC (rev 1442)
+++ trunk/src/main/java/org/jboss/ws/deployment/AbstractServiceEndpointPublisher.java 2006-11-16 03:13:56 UTC (rev 1443)
@@ -23,7 +23,10 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
@@ -33,8 +36,11 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
+import org.jboss.ws.server.ServerConfig;
+import org.jboss.ws.server.ServerConfigFactory;
import org.jboss.ws.utils.DOMUtils;
import org.jboss.ws.utils.DOMWriter;
+import org.jboss.ws.utils.IOUtils;
import org.w3c.dom.Element;
/**
@@ -71,7 +77,7 @@
public abstract String destroyServiceEndpoint(URL warURL) throws Exception;
- public URL rewriteWebXML(URL warURL)
+ public URL rewriteWarWebXml(URL warURL)
{
File warFile = new File(warURL.getFile());
if (warFile.isDirectory() == false)
@@ -83,11 +89,6 @@
try
{
- Element root = DOMUtils.parse(new FileInputStream(webXML));
-
- String warName = warFile.getName();
- Map<String, String> sepTargetMap = modifyServletConfig(root, warName);
-
// After redeployment there might be a stale copy of the original web.xml.org, we delete it
File orgWebXML = new File(webXML.getCanonicalPath() + ".org");
orgWebXML.delete();
@@ -96,11 +97,8 @@
if (webXML.renameTo(orgWebXML) == false)
throw new WSException("Cannot rename web.xml: " + orgWebXML);
- FileOutputStream fos = new FileOutputStream(webXML);
- new DOMWriter(fos).setPrettyprint(true).print(root);
- fos.close();
-
- return warURL;
+ FileInputStream stream = new FileInputStream(orgWebXML);
+ return rewriteWebXml(stream, webXML).toURL();
}
catch (RuntimeException rte)
{
@@ -112,8 +110,27 @@
}
}
- private Map<String, String> modifyServletConfig(Element root, String warName)
+ public File rewriteWebXml(InputStream source, File dest) throws IOException, FileNotFoundException
{
+ if (dest == null)
+ {
+ dest = File.createTempFile("jbossws-alt-web", "xml", IOUtils.createTempDirectory());
+ dest.deleteOnExit();
+ }
+
+ Element root = DOMUtils.parse(source);
+ modifyServletConfig(root);
+
+ FileOutputStream fos = new FileOutputStream(dest);
+ new DOMWriter(fos).setPrettyprint(true).print(root);
+ fos.flush();
+ fos.close();
+
+ return dest;
+ }
+
+ private Map<String, String> modifyServletConfig(Element root)
+ {
Map<String, String> sepTargetMap = new HashMap<String, String>();
Iterator itServlets = DOMUtils.getChildElements(root, "servlet");
@@ -132,7 +149,7 @@
String targetBeanName = null;
- // Nothing to do if we have an <init-param>
+ // Nothing to do if we have an <init-param>
if (isAlreadyModified(servletElement) == false)
{
// Check if it is a real servlet that we can ignore
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractJSEDeployer.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractJSEDeployer.java 2006-11-16 00:37:11 UTC (rev 1442)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss50/AbstractJSEDeployer.java 2006-11-16 03:13:56 UTC (rev 1443)
@@ -22,7 +22,9 @@
package org.jboss.ws.integration.jboss50;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
@@ -39,8 +41,8 @@
import org.jboss.metadata.NameValuePair;
import org.jboss.metadata.WebMetaData;
import org.jboss.metadata.web.Servlet;
-import org.jboss.util.file.Files;
import org.jboss.virtual.VirtualFile;
+import org.jboss.ws.WSException;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.server.ServerConfig;
import org.jboss.ws.server.ServerConfigFactory;
@@ -55,62 +57,44 @@
* @author Thomas.Diesler(a)jboss.org
* @since 31-Oct-2006
*/
-public abstract class AbstractJSEDeployer extends AbstractDeployer
+public abstract class AbstractJSEDeployer extends AbstractDeployer
{
- // The URL the expanded webapp in the deployment unit
- public static final String JBOSSWS_EXPANDED_WAR_URL = "jbossws.expanded.war.url";
// The servlet init param in web.xml that is the service endpoint class
public static final String INIT_PARAM_SERVICE_ENDPOINT_IMPL = "ServiceEndpointImpl";
- /** Install an annotation class loader, if there is none already
- */
- @Override
- public void deploy(DeploymentUnit unit) throws DeploymentException
+ public AbstractJSEDeployer()
{
- Set<? extends WebMetaData> allMetaData = unit.getAllMetaData(WebMetaData.class);
- if (allMetaData.size() > 0)
- {
- boolean removeLoader = false;
- try
- {
- unit.getClassLoader();
- }
- catch (Exception ex)
- {
- unit.getDeploymentContext().createClassLoader(new WebAppClassLoaderFactory());
- removeLoader = true;
- }
- try
- {
- super.deploy(unit);
- }
- finally
- {
- if (removeLoader == true)
- unit.getDeploymentContext().removeClassLoader();
- }
- }
+ super();
+ super.setRelativeOrder(CLASSLOADER_DEPLOYER + 1);
}
- /** Create the unified deployment info and create and start th eservice endpoints
- * through the ServiceEndpointDeployer
+ /** Create the unified deployment info and create and start th eservice endpoints
+ * through the ServiceEndpointDeployer
*/
@Override
protected void deployWebServiceDeployment(DeploymentUnit unit) throws DeploymentException
{
// Call the super implementation
super.deployWebServiceDeployment(unit);
-
+
// FIXME: JBAS-3812 - TomcatDeployment should use modified WebMetaData
- URL expWebAppURL = expandWebDeployment(unit);
- if (expWebAppURL != null)
+ String altDD = generateAltDD(unit);
+
+ // modify the WebMetaData
+ modifyWebMetaData(unit, altDD);
+ }
+
+ private String generateAltDD(DeploymentUnit unit)
+ {
+ try
{
- getServiceEndpointPublisher().rewriteWebXML(expWebAppURL);
- unit.addAttachment(JBOSSWS_EXPANDED_WAR_URL, expWebAppURL);
+ InputStream stream = unit.getDeploymentContext().getRoot().findChild("WEB-INF/web.xml").openStream();
+ return getServiceEndpointPublisher().rewriteWebXml(stream, null).toString();
}
-
- // modify the WebMetaData
- modifyWebMetaData(unit);
+ catch (Exception e)
+ {
+ throw new WSException("Could not generate alternate deployment descriptor", e);
+ }
}
@Override
@@ -118,16 +102,9 @@
{
// Call the super implementation
super.undeployWebServiceDeployment(unit, udi);
-
- // FIXME: JBAS-3812 - TomcatDeployment should use modified WebMetaData
- URL warURL = (URL)unit.getAttachment(JBOSSWS_EXPANDED_WAR_URL);
- if (warURL != null)
- {
- Files.delete(new File(warURL.getFile()));
- }
}
- private void modifyWebMetaData(DeploymentUnit unit) throws DeploymentException
+ private void modifyWebMetaData(DeploymentUnit unit, String altDD) throws DeploymentException
{
try
{
@@ -146,7 +123,7 @@
Class<?> servletClass = anLoader.loadClass(className);
if (servletClass.isAnnotationPresent(WebService.class))
{
- // Nothing to do if we have an <init-param>
+ // Nothing to do if we have an <init-param>
if (isAlreadyModified(servlet) == false)
{
servlet.setServletClass(serviceEndpointServlet);
@@ -154,6 +131,8 @@
servlet.addInitParam(initParam);
}
}
+ // FIXME: JBAS-3812 - TomcatDeployment should use modified WebMetaData
+ webMetaData.setAltDDPath(altDD);
}
}
}
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss50/DeploymentInfoAdaptor.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss50/DeploymentInfoAdaptor.java 2006-11-16 00:37:11 UTC (rev 1442)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss50/DeploymentInfoAdaptor.java 2006-11-16 03:13:56 UTC (rev 1443)
@@ -22,6 +22,7 @@
package org.jboss.ws.integration.jboss50;
import java.net.URL;
+import java.net.URLClassLoader;
import java.util.Set;
import org.jboss.deployers.spi.deployer.DeploymentUnit;
@@ -56,15 +57,10 @@
udi.url = getDeploymentURL(unit);
udi.metaData = buildMetaData(unit);
- // FIXME - parent deployments really don't need a classloader since the classpath
- // is built via the VFS
- try
- {
- udi.classLoader = unit.getClassLoader();
- }
- catch (IllegalStateException e)
- {
- }
+ // Since we create temporary classes, we need to create a delegate loader
+ // This prevents CCE problems where the parent loader is available at deploy time,
+ // and a child loader is available at start time.
+ udi.classLoader = new URLClassLoader(new URL[]{}, unit.getClassLoader());
log.debug("UnifiedDeploymentInfo:\n" + udi);
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXRPCDeployerJSE.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXRPCDeployerJSE.java 2006-11-16 00:37:11 UTC (rev 1442)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXRPCDeployerJSE.java 2006-11-16 03:13:56 UTC (rev 1443)
@@ -39,18 +39,12 @@
*/
public class JAXRPCDeployerJSE extends AbstractJSEDeployer
{
- // The default relative order after the JBossWebAppParsingDeployer
- public int getRelativeOrder()
- {
- return PARSER_DEPLOYER + 3;
- }
-
@Override
protected DeploymentType getDeploymentType()
{
return DeploymentType.JSR109_JSE;
}
-
+
@Override
public boolean isWebServiceDeployment(DeploymentUnit unit)
{
@@ -66,7 +60,7 @@
DeploymentInfoAdaptor.buildDeploymentInfo(udi, unit);
return udi;
}
-
+
private URL getWebServicesURL(DeploymentUnit unit)
{
VirtualFile vfile = unit.getMetaDataFile("webservices.xml");
@@ -77,7 +71,7 @@
String urlStr = vfile.toURL().toExternalForm();
if (urlStr.startsWith("jar:") && urlStr.endsWith("!/"))
urlStr = urlStr.substring(4, urlStr.length() - 2);
-
+
return new URL(urlStr);
}
catch (Exception ex)
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerJSE.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerJSE.java 2006-11-16 00:37:11 UTC (rev 1442)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerJSE.java 2006-11-16 03:13:56 UTC (rev 1443)
@@ -45,19 +45,13 @@
public class JAXWSDeployerJSE extends AbstractJSEDeployer
{
private DeploymentType deploymentType;
-
- // The default relative order after the JBossWebAppParsingDeployer
- public int getRelativeOrder()
- {
- return PARSER_DEPLOYER + 3;
- }
@Override
protected DeploymentType getDeploymentType()
{
return deploymentType;
}
-
+
@Override
public boolean isWebServiceDeployment(DeploymentUnit unit)
{
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointPublisher.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointPublisher.java 2006-11-16 00:37:11 UTC (rev 1442)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointPublisher.java 2006-11-16 03:13:56 UTC (rev 1443)
@@ -65,7 +65,7 @@
{
log.debug("publishServiceEndpoint: " + warURL);
- rewriteWebXML(warURL);
+ rewriteWarWebXml(warURL);
DeploymentContext context = createDeploymentContext(warURL);
mainDeployer.addDeploymentContext(context);
Modified: trunk/src/main/java/org/jboss/ws/integration/tomcat/wspublish.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/tomcat/wspublish.java 2006-11-16 00:37:11 UTC (rev 1442)
+++ trunk/src/main/java/org/jboss/ws/integration/tomcat/wspublish.java 2006-11-16 03:13:56 UTC (rev 1443)
@@ -69,7 +69,7 @@
TomcatServiceEndpointPublisher publisher = new TomcatServiceEndpointPublisher();
publisher.setServiceEndpointServlet(servletName);
- publisher.rewriteWebXML(tmpDir.toURL());
+ publisher.rewriteWarWebXml(tmpDir.toURL());
File outFile = new File(destDir.getCanonicalPath() + "/" + warName);
outFile.getParentFile().mkdirs();
Modified: trunk/src/main/java/org/jboss/ws/jaxws/DynamicWrapperGenerator.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/DynamicWrapperGenerator.java 2006-11-16 00:37:11 UTC (rev 1442)
+++ trunk/src/main/java/org/jboss/ws/jaxws/DynamicWrapperGenerator.java 2006-11-16 03:13:56 UTC (rev 1443)
@@ -90,7 +90,7 @@
throw new WSException("Cannot generate a type when their is no wrapper parameters");
log.debug("Generating wrapper: " + wrapperName);
-
+
QName xmlName = pmd.getXmlName();
QName xmlType = pmd.getXmlType();
@@ -105,12 +105,13 @@
addProperty(clazz, parameter.getType(), parameter.getName(), parameter.getVariable(), parameter.getTypeArguments());
}
pool.toClass(clazz, loader);
+ JavaUtils.clearBlacklists(loader);
}
catch (Exception e)
{
throw new WSException("Could not generate wrapper type: " + wrapperName, e);
}
-
+
// Add the generated type to the types meta data
TypesMetaData types = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
types.addTypeMapping(new TypeMappingMetaData(types, xmlType, wrapperName));
@@ -137,6 +138,7 @@
addProperty(clazz, properties.get(property).getName(), new QName(property), property, null);
pool.toClass(clazz, loader);
+ JavaUtils.clearBlacklists(loader);
}
catch (Exception e)
{
Modified: trunk/src/main/java/org/jboss/ws/soap/attachment/SwapableMemoryDataSource.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/attachment/SwapableMemoryDataSource.java 2006-11-16 00:37:11 UTC (rev 1442)
+++ trunk/src/main/java/org/jboss/ws/soap/attachment/SwapableMemoryDataSource.java 2006-11-16 03:13:56 UTC (rev 1443)
@@ -33,44 +33,43 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.server.ServerConfig;
-import org.jboss.ws.server.ServerConfigFactory;
+import org.jboss.ws.utils.IOUtils;
/**
* A datasource which offloads large attachments to disk.
- *
+ *
* @author Thomas.Diesler(a)jboss.org
* @author <a href="mailto:jason@stacksmash.com">Jason T. Greene</a>
*/
public class SwapableMemoryDataSource implements DataSource
{
private static Logger log = Logger.getLogger(SwapableMemoryDataSource.class);
-
+
private static final int BLOCK_SIZE = 32 * 1024;
-
+
private static final int DEFAULT_MAX_MEMORY_SIZE = 64 * 1024;
-
+
private static final String SWAP_PREFIX = "JBossWSsattachment";
-
+
private static final String SWAP_SUFFIX = ".dat";
-
+
private File swapFile;
-
+
private String contentType = MimeConstants.TYPE_APPLICATION_OCTET_STREAM;
-
+
private byte[] content;
-
+
private int contentLength;
-
- private int maxMemorySize = 64 * 1024;
-
-
+
+ private int maxMemorySize = 64 * 1024;
+
+
/**
* Constructs a <code>SwapableMemoryDataSource</code> from inputStream, and contentType.
* The instance then reads from the input stream, and stores it in memory unless the size
- * of the content is larger that 64KB, at whichpoint the stream is stored in a temporary
+ * of the content is larger that 64KB, at whichpoint the stream is stored in a temporary
* file on disk.
- *
+ *
* @param inputStream the stream to read from
* @param contentType the content type of this stream
*/
@@ -78,47 +77,44 @@
{
this(inputStream, contentType, DEFAULT_MAX_MEMORY_SIZE);
}
-
+
/**
* Constructs a <code>SwapableMemoryDataSource</code> from inputStream, and
* contentType. The instance then reads from the input stream, and stores it
* in memory unless the size of the content is larger than maxMemorySize, at
* whichpoint the stream is stored in a temporary file on disk.
- *
+ *
* @param inputStream the stream to read from
* @param contentType the content type of this stream
- * @param maxMemorySize the maximum size in bytes that this data source is
+ * @param maxMemorySize the maximum size in bytes that this data source is
* allowed to allocate for stream storage
*/
public SwapableMemoryDataSource(InputStream inputStream, String contentType, int maxMemorySize) throws IOException
{
if (contentType != null)
this.contentType = contentType;
-
- this.maxMemorySize = maxMemorySize;
-
+
+ this.maxMemorySize = maxMemorySize;
+
load(inputStream);
}
-
+
private void load(InputStream inputStream) throws IOException
{
RawByteArrayOutputStream rbaos = new RawByteArrayOutputStream();
OutputStream os = rbaos;
-
+
byte[] buffer = new byte[BLOCK_SIZE];
int count = inputStream.read(buffer);
while (count > 0) {
os.write(buffer, 0, count);
-
+
if (rbaos != null && rbaos.size() > maxMemorySize)
{
File tmpdir = null;
try
{
- ServerConfigFactory factory = ServerConfigFactory.getInstance();
- ServerConfig config = factory.getServerConfig();
- tmpdir = new File(config.getServerTempDir().getCanonicalPath() + "/jbossws");
- tmpdir.mkdirs();
+ tmpdir = IOUtils.createTempDirectory();
}
catch (Throwable e)
{
@@ -132,13 +128,13 @@
rbaos.writeTo(os);
rbaos = null;
}
-
+
count = inputStream.read(buffer);
}
-
+
os.flush();
os.close();
-
+
if (rbaos == null)
{
log.debug("Using swap file, location = " + swapFile.toURL() + " size = " + swapFile.length());
@@ -150,18 +146,18 @@
content = rbaos.getBytes();
}
}
-
+
protected void finalize() throws Throwable
{
super.finalize();
-
+
if (swapFile != null)
swapFile.delete();
}
-
+
/**
* Returns the content type of this data source.
- *
+ *
* @return the content type
*/
public String getContentType()
@@ -172,33 +168,33 @@
/**
* Returns a new input stream on this data source. Multiple calls
* are allowed because the data is stored.
- *
+ *
* @return a new input stream at the start of the data
*/
public InputStream getInputStream() throws IOException
{
if (content != null)
return new ByteArrayInputStream(content, 0, contentLength);
-
+
if (swapFile != null)
return new FileInputStream(swapFile);
-
+
throw new WSException("No content available");
}
/**
* This method always returns null.
- *
+ *
* @return null
*/
public String getName()
{
return null;
}
-
+
/**
* This method always returns null.
- *
+ *
* @return null
*/
public OutputStream getOutputStream() throws IOException
Modified: trunk/src/main/java/org/jboss/ws/utils/IOUtils.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/utils/IOUtils.java 2006-11-16 00:37:11 UTC (rev 1442)
+++ trunk/src/main/java/org/jboss/ws/utils/IOUtils.java 2006-11-16 03:13:56 UTC (rev 1443)
@@ -21,12 +21,15 @@
*/
package org.jboss.ws.utils;
-// $Id: $
+// $Id$
import java.io.*;
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
+import org.jboss.ws.server.ServerConfig;
+import org.jboss.ws.server.ServerConfigFactory;
+
import javax.activation.DataHandler;
/**
@@ -93,4 +96,13 @@
}
return new ByteArrayInputStream(strBuffer.toString().getBytes());
}
+
+ public static File createTempDirectory() throws IOException
+ {
+ ServerConfigFactory factory = ServerConfigFactory.getInstance();
+ ServerConfig config = factory.getServerConfig();
+ File tmpdir = new File(config.getServerTempDir().getCanonicalPath() + "/jbossws");
+ tmpdir.mkdirs();
+ return tmpdir;
+ }
}
Modified: trunk/src/main/java/org/jboss/ws/utils/JavaUtils.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/utils/JavaUtils.java 2006-11-16 00:37:11 UTC (rev 1442)
+++ trunk/src/main/java/org/jboss/ws/utils/JavaUtils.java 2006-11-16 03:13:56 UTC (rev 1443)
@@ -29,6 +29,7 @@
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
+import java.net.URLClassLoader;
import java.util.HashMap;
import java.util.HashSet;
@@ -475,7 +476,7 @@
{
if (val == null)
return "null";
-
+
StringBuilder out = new StringBuilder("[");
for (int i = 0; i < val.length; i++)
{
@@ -586,4 +587,52 @@
return ret;
}
+
+ /**
+ * Tests if this class loader is a JBoss RepositoryClassLoader
+ *
+ * @param loader
+ * @return
+ */
+ public static boolean isJBossRepositoryClassLoader(ClassLoader loader)
+ {
+ Class clazz = loader.getClass();
+ while (!clazz.getName().startsWith("java"))
+ {
+ if ("org.jboss.mx.loading.RepositoryClassLoader".equals(clazz.getName()))
+ return true;
+ clazz = clazz.getSuperclass();
+ }
+
+ return false;
+ }
+
+ /**
+ * Clears black lists on a JBoss RepositoryClassLoader. This is somewhat of a hack, and
+ * could be replaced with an integration module. This is needed when the following order of
+ * events occur.
+ *
+ * <ol>
+ * <li>loadClass() returns not found</li>
+ * <li>Some call to defineClass()</li>
+ * <ol>
+ *
+ * The CNFE triggers a black list addition, which cause the class never again to be found.
+ *
+ * @param loader the loader to clear black lists for
+ */
+ public static void clearBlacklists(ClassLoader loader)
+ {
+ if (isJBossRepositoryClassLoader(loader))
+ {
+ try
+ {
+ loader.getClass().getMethod("clearBlacklists").invoke(loader);
+ }
+ catch (Exception e)
+ {
+ log.debug("Could not clear blacklists on " + loader);
+ }
+ }
+ }
}
\ No newline at end of file
18 years, 1 month
JBossWS SVN: r1442 - branches/jbossws-1.0/src/ant
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-15 19:37:11 -0500 (Wed, 15 Nov 2006)
New Revision: 1442
Modified:
branches/jbossws-1.0/src/ant/build-release.xml
Log:
add release instructions
Modified: branches/jbossws-1.0/src/ant/build-release.xml
===================================================================
--- branches/jbossws-1.0/src/ant/build-release.xml 2006-11-15 18:18:07 UTC (rev 1441)
+++ branches/jbossws-1.0/src/ant/build-release.xml 2006-11-16 00:37:11 UTC (rev 1442)
@@ -19,14 +19,17 @@
<echo message="*"/>
<echo message="* Almost there, please do these steps manually"/>
<echo message="*"/>
- <echo message="* 1) Create SVN tag: jbossws-${version.id}"/>
- <echo message="* 2) Update portal-content/project.xml"/>
- <echo message="* 3) Update portal-content/counter.xml"/>
- <echo message="* 4) Commit the portal-content"/>
- <echo message="* 5) Write a stick post on the user forum"/>
- <echo message="* 6) Release the jbossws-${version.id} version in JIRA"/>
- <echo message="* 7) Post a message to jbossws-announce(a)lists.jboss.org"/>
- <echo message="* 8) Post a message to thecore(a)jboss.org"/>
+ <echo message="* 1) Create SVN tag: jbossws-${version.id}"/>
+ <echo message="* 2) Update portal-content/project.xml"/>
+ <echo message="* 3) Update portal-content/counter.xml"/>
+ <echo message="* 4) Update news in portal-content/freezone/projectDescription.xml"/>
+ <echo message="* 5) Verify release notes and install instructions"/>
+ <echo message="* 6) Commit the portal-content"/>
+ <echo message="* 7) Commit the repository jars"/>
+ <echo message="* 8) Write a stick post on the user forum"/>
+ <echo message="* 9) Release the jbossws-${version.id} version in JIRA"/>
+ <echo message="* 10) Post a message to jbossws-announce(a)lists.jboss.org"/>
+ <echo message="* 11) Post a message to thecore(a)jboss.org"/>
<echo message="*"/>
<echo message="*********************************************"/>
</target>
18 years, 1 month
JBossWS SVN: r1441 - in trunk/src/test: java/org/jboss/test/ws/jaxws/samples/retail/cc resources/jaxws/samples/retail/META-INF
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2006-11-15 13:18:07 -0500 (Wed, 15 Nov 2006)
New Revision: 1441
Added:
trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/CreditcardProcessor.java
trunk/src/test/resources/jaxws/samples/retail/META-INF/jaxws-handler.xml
Log:
Add support for async invocations
Added: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/CreditcardProcessor.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/CreditcardProcessor.java 2006-11-15 18:17:48 UTC (rev 1440)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/CreditcardProcessor.java 2006-11-15 18:18:07 UTC (rev 1441)
@@ -0,0 +1,43 @@
+/*
+* 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.test.ws.jaxws.samples.retail.cc;
+
+/**
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @version $Id$
+ * @since Nov 9, 2006
+ */
+public class CreditcardProcessor {
+
+ public static void process(String creditcatrd)
+ {
+ // this will take some time
+ try
+ {
+ Thread.currentThread().join(1500);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
Property changes on: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/CreditcardProcessor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/test/resources/jaxws/samples/retail/META-INF/jaxws-handler.xml
===================================================================
--- trunk/src/test/resources/jaxws/samples/retail/META-INF/jaxws-handler.xml 2006-11-15 18:17:48 UTC (rev 1440)
+++ trunk/src/test/resources/jaxws/samples/retail/META-INF/jaxws-handler.xml 2006-11-15 18:18:07 UTC (rev 1441)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ns1="http://org.jboss.ws/jaxws/handlerscope"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
+
+ <handler-chain>
+ <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
+ <handler>
+ <handler-name>SOAPMessageTrace</handler-name>
+ <handler-class>org.jboss.test.ws.jaxws.samples.retail.handler.SOAPMessageTrace</handler-class>
+ </handler>
+ </handler-chain>
+
+</handler-chains>
\ No newline at end of file
18 years, 1 month
JBossWS SVN: r1440 - in trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail: . handler
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2006-11-15 13:17:48 -0500 (Wed, 15 Nov 2006)
New Revision: 1440
Added:
trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/handler/
trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/handler/SOAPMessageTrace.java
trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/handler/Timer.java
Log:
Add support for async invocations
Added: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/handler/SOAPMessageTrace.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/handler/SOAPMessageTrace.java 2006-11-15 18:13:04 UTC (rev 1439)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/handler/SOAPMessageTrace.java 2006-11-15 18:17:48 UTC (rev 1440)
@@ -0,0 +1,90 @@
+/*
+* 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.test.ws.jaxws.samples.retail.handler;
+
+import org.jboss.ws.jaxws.handler.GenericSOAPHandler;
+import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.soap.SOAPMessageImpl;
+import org.jboss.ws.soap.SOAPElementWriter;
+import org.jboss.ws.soap.SOAPElementImpl;
+import org.jboss.logging.Logger;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPEnvelope;
+
+public class SOAPMessageTrace extends GenericSOAPHandler
+{
+ private static final Logger log = Logger.getLogger(SOAPMessageTrace.class);
+
+ private Timer timer = Timer.getInstance();
+
+ @Override
+ public boolean handleInbound(MessageContext msgContext)
+ {
+ timer.push(System.currentTimeMillis());
+ return trace();
+ }
+
+ @Override
+ public boolean handleOutbound(MessageContext msgContext)
+ {
+ trace();
+ log.info("Exectime time: " + timer.pop() + " ms");
+ return true;
+ }
+
+ private boolean trace() {
+ String envStr = getCurrentSOAPEnvelope();
+ if(envStr!=null)
+ {
+ log.info("\n"+envStr);
+ }
+
+ return true;
+ }
+
+ /**
+ * Dump the current message into a string
+ */
+ private String getCurrentSOAPEnvelope()
+ {
+
+ String env = null;
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+
+ try
+ {
+ SOAPMessageImpl soapMsg = (SOAPMessageImpl)msgContext.getSOAPMessage();
+ SOAPEnvelope soapReqEnv = soapMsg.getSOAPPart().getEnvelope();
+ env = SOAPElementWriter.writeElement((SOAPElementImpl)soapReqEnv, true);
+ }
+ catch (SOAPException e)
+ {
+ //
+ }
+
+ return env ;
+ }
+
+}
Property changes on: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/handler/SOAPMessageTrace.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/handler/Timer.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/handler/Timer.java 2006-11-15 18:13:04 UTC (rev 1439)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/handler/Timer.java 2006-11-15 18:17:48 UTC (rev 1440)
@@ -0,0 +1,57 @@
+/*
+* 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.
+*/
+/**
+ * @author Heiko Braun <heiko.braun(a)jboss.com>
+ * @since Nov 9, 2006
+ * @version $Id$
+ */
+package org.jboss.test.ws.jaxws.samples.retail.handler;
+
+import java.util.Stack;
+
+public class Timer {
+
+ private Stack<Long> timings = new Stack<Long>();
+
+ private static Timer ourInstance = new Timer();
+
+ public static Timer getInstance() {
+ return ourInstance;
+ }
+
+ private Timer() {
+ }
+
+ public synchronized void push(long t)
+ {
+ timings.push(new Long(t));
+ }
+
+ public synchronized long pop()
+ {
+ if(timings.isEmpty())
+ return 0;
+
+ Long aLong = timings.pop();
+ return System.currentTimeMillis() - aLong.longValue();
+ }
+}
Property changes on: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/handler/Timer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
18 years, 1 month
JBossWS SVN: r1439 - in trunk/src: main/java/org/jboss/ws main/java/org/jboss/ws/common main/java/org/jboss/ws/deployment main/java/org/jboss/ws/jaxrpc main/java/org/jboss/ws/jaxws/client main/java/org/jboss/ws/metadata main/java/org/jboss/ws/soap main/java/org/jboss/ws/utils test/ant test/java/org/jboss/test/ws/jaxws/asynchronous test/java/org/jboss/test/ws/jaxws/samples/retail test/java/org/jboss/test/ws/jaxws/samples/retail/cc test/java/org/jboss/test/ws/jaxws/samples/retail/profile
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2006-11-15 13:13:04 -0500 (Wed, 15 Nov 2006)
New Revision: 1439
Modified:
trunk/src/main/java/org/jboss/ws/Constants.java
trunk/src/main/java/org/jboss/ws/common/CommonSOAPBinding.java
trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java
trunk/src/main/java/org/jboss/ws/jaxws/client/ClientProxy.java
trunk/src/main/java/org/jboss/ws/jaxws/client/ResponseImpl.java
trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java
trunk/src/main/java/org/jboss/ws/utils/ThreadLocalAssociation.java
trunk/src/test/ant/build-jars-jaxws.xml
trunk/src/test/java/org/jboss/test/ws/jaxws/asynchronous/AsynchronousProxyTestCase.java
trunk/src/test/java/org/jboss/test/ws/jaxws/asynchronous/TestEndpointBean.java
trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/OrderMgmtBean.java
trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/OrderStatus.java
trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java
trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerification.java
trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerificationBean.java
trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/VerificationRequest.java
trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/VerificationResponse.java
trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/profile/ProfileMgmtBean.java
Log:
Add support for async invocations
Modified: trunk/src/main/java/org/jboss/ws/Constants.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/Constants.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/main/java/org/jboss/ws/Constants.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -267,4 +267,6 @@
static final String WSDL20_PATTERN_ROBUST_OUT_ONLY = "http://www.w3.org/2004/08/wsdl/robust-out-only";
static final String WSDL20_PATTERN_OUT_IN = "http://www.w3.org/2004/08/wsdl/out-in";
static final String WSDL20_PATTERN_OUT_OPT_IN = "http://www.w3.org/2004/08/wsdl/out-opt-in";
+
+ static final String ASYNC_METHOD_SUFFIX = "Async";
}
Modified: trunk/src/main/java/org/jboss/ws/common/CommonSOAPBinding.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/common/CommonSOAPBinding.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/main/java/org/jboss/ws/common/CommonSOAPBinding.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -96,6 +96,7 @@
/** A constant representing the identity of the SOAP 1.1 over HTTP binding. */
public static final String SOAP11HTTP_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http";
+ private static final Name SOAP_ARRAY_NAME = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
public CommonSOAPBinding()
{
@@ -785,7 +786,6 @@
private Object getParameterFromMessage(ParameterMetaData paramMetaData, SOAPElement soapElement, boolean optional) throws BindingException
{
Name xmlName = new NameImpl(paramMetaData.getXmlName());
- Name soapArrayName = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
SOAPContentElement soapContentElement = null;
Iterator childElements = soapElement.getChildElements();
@@ -808,7 +808,7 @@
break;
}
- if (soapArrayName.equals(elName))
+ if (SOAP_ARRAY_NAME.equals(elName))
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
Modified: trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -134,15 +134,36 @@
{
Class seiClass = null;
String seiName = null;
+
if (anWebService.endpointInterface().length() > 0)
{
seiName = anWebService.endpointInterface();
seiClass = udi.classLoader.loadClass(seiName);
anWebService = (WebService)seiClass.getAnnotation(WebService.class);
+
if (anWebService == null)
throw new WSException("Interface does not have a @WebService annotation: " + seiName);
}
+ else
+ {
+ WebService seiAnnotation = null;
+
+ for(Class potentialSEI : sepClass.getInterfaces())
+ {
+ if(potentialSEI.isAnnotationPresent(WebService.class))
+ {
+ seiClass = potentialSEI;
+ seiName = seiClass.getName();
+ seiAnnotation = sepClass.getAnnotation(WebService.class);
+ break;
+ }
+ }
+
+ if(seiAnnotation!=null)
+ anWebService = seiAnnotation;
+ }
+
// Clear the java types, etc.
resetMetaDataBuilder(udi.classLoader);
@@ -371,11 +392,12 @@
if (webMethodCount == 0)
{
Class superClass = wsClass.getSuperclass();
- boolean isJDKClass = superClass.getPackage().getName().startsWith("java");
- if(!isJDKClass)
+ while (superClass != null)
{
- while (superClass != null)
+ boolean isJDKClass = superClass.getPackage().getName().startsWith("java");
+
+ if(!isJDKClass)
{
for (Method method : superClass.getMethods())
{
@@ -384,6 +406,7 @@
}
superClass = superClass.getSuperclass();
+
}
}
}
@@ -394,6 +417,12 @@
private void processWebMethod(EndpointMetaData epMetaData, Method method)
{
+ String javaName = method.getName();
+
+ // skip asnyc methods, they dont need meta data representation
+ if(method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX))
+ return;
+
ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
TypesMetaData typesMetaData = serviceMetaData.getTypesMetaData();
String targetNS = epMetaData.getQName().getNamespaceURI();
@@ -408,10 +437,11 @@
WebMethod anWebMethod = method.getAnnotation(WebMethod.class);
soapAction = anWebMethod.action();
if (anWebMethod.operationName().length() > 0)
+ {
operationName = anWebMethod.operationName();
+ }
}
- String javaName = method.getName();
OperationMetaData opMetaData = new OperationMetaData(epMetaData, new QName(targetNS, operationName), javaName);
opMetaData.setOneWayOperation(method.isAnnotationPresent(Oneway.class));
opMetaData.setSOAPAction(soapAction);
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -29,6 +29,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.Constants;
/** A helper that synchronizes the SEI with the endpoint meta data
*
@@ -52,6 +53,10 @@
for (int i = 0; i < methods.length; i++)
{
Method method = methods[i];
+
+ if(method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX))
+ continue;
+
log.debug("synchronize method: " + method);
OperationMetaData opMetaData = epMetaData.getOperation(method);
Modified: trunk/src/main/java/org/jboss/ws/jaxws/client/ClientProxy.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/client/ClientProxy.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/main/java/org/jboss/ws/jaxws/client/ClientProxy.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -26,11 +26,7 @@
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.rmi.RemoteException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
@@ -42,6 +38,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
+import org.jboss.ws.Constants;
import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.metadata.OperationMetaData;
import org.jboss.ws.utils.JavaUtils;
@@ -122,7 +119,7 @@
{
Object retObj;
Class retType = method.getReturnType();
- boolean isAsync = methodName.endsWith("Async");
+ boolean isAsync = methodName.endsWith(Constants.ASYNC_METHOD_SUFFIX);
// Invoke asynchronously
if (isAsync && JavaUtils.isAssignableFrom(Response.class, retType))
@@ -169,6 +166,9 @@
{
ResponseImpl response = new ResponseImpl();
Runnable task = new AsyncRunnable(response, null, opName, args, retType);
+
+ log.debug("Schedule task " + ((AsyncRunnable)task).getTaskID().toString());
+
Future future = executor.submit(task);
response.setFuture(future);
return response;
@@ -196,6 +196,7 @@
private QName opName;
private Object[] args;
private Class retType;
+ private UUID uuid;
public AsyncRunnable(ResponseImpl response, AsyncHandler handler, QName opName, Object[] args, Class retType)
{
@@ -204,6 +205,7 @@
this.opName = opName;
this.args = args;
this.retType = retType;
+ this.uuid = UUID.randomUUID();
}
public void run()
@@ -212,6 +214,9 @@
{
Map<String, Object> resContext = response.getContext();
Object result = invoke(opName, args, retType, resContext);
+
+ log.debug("Finished task " + getTaskID().toString()+": " + result);
+
response.set(result);
// Call the handler if available
@@ -244,5 +249,9 @@
}
response.setException(wsex);
}
+
+ public UUID getTaskID() {
+ return uuid;
+ }
}
}
Modified: trunk/src/main/java/org/jboss/ws/jaxws/client/ResponseImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/client/ResponseImpl.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/main/java/org/jboss/ws/jaxws/client/ResponseImpl.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -23,6 +23,8 @@
// $Id$
+import javax.xml.ws.Response;
+import javax.xml.ws.WebServiceException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
@@ -30,9 +32,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import javax.xml.ws.Response;
-import javax.xml.ws.WebServiceException;
-
/**
* The Response interface provides methods used to obtain the payload and context of a
* message sent in response to an operation invocation.
@@ -47,7 +46,7 @@
private WebServiceException exception;
private Map<String, Object> context = new HashMap<String, Object>();
-
+
public void setException(WebServiceException ex)
{
this.exception = ex;
@@ -57,7 +56,7 @@
{
if (delegate == null)
throw new IllegalStateException("Future not available");
-
+
return delegate;
}
@@ -70,12 +69,12 @@
{
return context;
}
-
+
void set(Object result)
{
this.result = result;
}
-
+
public boolean cancel(boolean mayInterruptIfRunning)
{
return getFuture().cancel(mayInterruptIfRunning);
@@ -87,10 +86,10 @@
{
getFuture().get();
}
-
+
if (exception != null)
throw new ExecutionException(exception);
-
+
return result;
}
@@ -100,10 +99,10 @@
{
getFuture().get(timeout, unit);
}
-
+
if (exception != null)
throw new ExecutionException(exception);
-
+
return result;
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -38,6 +38,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
+import org.jboss.ws.Constants;
import org.jboss.ws.common.CommonSOAPBinding;
import org.jboss.ws.jaxrpc.Style;
import org.jboss.ws.jaxrpc.TypeMappingImpl;
@@ -338,7 +339,7 @@
{
QName opQName = aux.getQName();
String javaName = aux.getJavaName();
- if (opQName.equals(xmlName) && !javaName.endsWith("Async"))
+ if (opQName.equals(xmlName) && !javaName.endsWith(Constants.ASYNC_METHOD_SUFFIX))
{
if (opMetaData == null)
{
@@ -389,12 +390,23 @@
{
for (OperationMetaData aux : operations)
{
- if (aux.getJavaMethod().equals(method))
+ boolean doesMatch = aux.getJavaMethod().equals(method);
+
+ // fallback for async methods
+ if(!doesMatch && method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX))
{
+ String name = method.getName();
+ name = name.substring(0, name.length()-5);
+ doesMatch = aux.getJavaName().equals(name);
+ }
+
+ if (doesMatch)
+ {
methodCache.put(method, aux);
opMetaData = aux;
break;
}
+
}
}
return opMetaData;
Modified: trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/main/java/org/jboss/ws/soap/MessageContextAssociation.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -43,7 +43,7 @@
public static void pushMessageContext(CommonMessageContext msgContext)
{
- log.debug("pushMessageContext: " + msgContext);
+ log.debug("pushMessageContext: " + msgContext + " (Thread " +Thread.currentThread().getName()+ ")");
Stack<CommonMessageContext> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
if (stack == null)
{
@@ -72,7 +72,7 @@
{
msgContext = stack.pop();
}
- log.debug("popMessageContext: " + msgContext);
+ log.debug("popMessageContext: " + msgContext +" (Thread " +Thread.currentThread().getName()+ ")");
return msgContext;
}
}
Modified: trunk/src/main/java/org/jboss/ws/utils/ThreadLocalAssociation.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/utils/ThreadLocalAssociation.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/main/java/org/jboss/ws/utils/ThreadLocalAssociation.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -46,12 +46,12 @@
* SOAP message context
* @see org.jboss.ws.soap.MessageContextAssociation
*/
- private static ThreadLocal<Stack<CommonMessageContext>> msgContextAssoc = new InheritableThreadLocal<Stack<CommonMessageContext>>();
+ private static ThreadLocal<Stack<CommonMessageContext>> msgContextAssoc = new ThreadLocal<Stack<CommonMessageContext>>();
/**
* @see org.jboss.ws.wsse.STRTransform
*/
- private static InheritableThreadLocal<SecurityStore> strTransformAssoc = new InheritableThreadLocal<SecurityStore>();
+ private static ThreadLocal<SecurityStore> strTransformAssoc = new ThreadLocal<SecurityStore>();
public static ThreadLocal localInvokerMDBAssoc() {
return invokerMDBAssoc;
Modified: trunk/src/test/ant/build-jars-jaxws.xml
===================================================================
--- trunk/src/test/ant/build-jars-jaxws.xml 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/test/ant/build-jars-jaxws.xml 2006-11-15 18:13:04 UTC (rev 1439)
@@ -21,6 +21,7 @@
<!-- jaxws-asynchronous -->
<war warfile="${build.test.dir}/libs/jaxws-asynchronous.war" webxml="${build.test.dir}/resources/jaxws/asynchronous/WEB-INF/web.xml">
<classes dir="${build.test.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/asynchronous/TestEndpoint.class"/>
<include name="org/jboss/test/ws/jaxws/asynchronous/TestEndpointBean.class"/>
</classes>
</war>
@@ -406,7 +407,8 @@
<include name="org/jboss/test/ws/jaxws/samples/retail/**/*.class"/>
</fileset>
<metainf dir="${build.test.dir}/resources/jaxws/samples/retail/META-INF">
- <include name="wsdl/*"/>
+ <include name="wsdl/*"/>
+ <include name="jaxws-handler.xml"/>
</metainf>
</jar>
<jar jarfile="${build.test.dir}/libs/jaxws-samples-retail-client.jar">
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/asynchronous/AsynchronousProxyTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/asynchronous/AsynchronousProxyTestCase.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/asynchronous/AsynchronousProxyTestCase.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -37,6 +37,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.jaxws.client.ResponseImpl;
/**
* Test JAXWS asynchrous proxy
@@ -57,9 +58,6 @@
public void testInvokeSync() throws Exception
{
- System.out.println("FIXME: [JBWS-1294] Add support for mapping async methods");
- if (true) return;
-
TestEndpoint port = createProxy();
String retStr = port.echo("Hello");
assertEquals("Hello", retStr);
@@ -67,20 +65,37 @@
public void testInvokeAsync() throws Exception
{
- System.out.println("FIXME: [JBWS-1294] Add support for mapping async methods");
- if (true) return;
-
TestEndpoint port = createProxy();
- Response response = port.echoAsync("Hello");
- String retStr = (String) response.get(1000, TimeUnit.MILLISECONDS);
- assertEquals("Hello", retStr);
+ Response response = port.echoAsync("Async");
+
+ // access future
+ String retStr = (String) response.get();
+ assertEquals("Async", retStr);
}
+ public void testInvokeAsyncReentrant() throws Exception
+ {
+
+ if(true)
+ {
+ System.out.println("FIXME:JBWS-1294");
+ return;
+ }
+
+ TestEndpoint port = createProxy();
+ Response response = port.echoAsync("Async");
+
+ // do something in between
+ String retStr = port.echo("Sync");
+ assertEquals("Sync", retStr);
+
+ // access future
+ retStr = (String) response.get();
+ assertEquals("Async", retStr);
+ }
+
public void testInvokeAsyncHandler() throws Exception
{
- System.out.println("FIXME: [JBWS-1294] Add support for mapping async methods");
- if (true) return;
-
AsyncHandler<String> handler = new AsyncHandler<String>()
{
public void handleResponse(Response response)
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/asynchronous/TestEndpointBean.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/asynchronous/TestEndpointBean.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/asynchronous/TestEndpointBean.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -30,7 +30,10 @@
import org.jboss.logging.Logger;
-@WebService(name = "TestEndpoint", targetNamespace = "http://org.jboss.ws/jaxws/asynchronous")
+@WebService(
+ name = "TestEndpoint", targetNamespace = "http://org.jboss.ws/jaxws/asynchronous",
+ endpointInterface = "org.jboss.test.ws.jaxws.asynchronous.TestEndpoint"
+)
@SOAPBinding(style = Style.RPC)
public class TestEndpointBean
{
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/OrderMgmtBean.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/OrderMgmtBean.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/OrderMgmtBean.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -21,18 +21,22 @@
*/
package org.jboss.test.ws.jaxws.samples.retail;
+import org.jboss.logging.Logger;
+import org.jboss.test.ws.jaxws.samples.retail.cc.CCVerification;
import org.jboss.test.ws.jaxws.samples.retail.cc.CCVerificationService;
-import org.jboss.test.ws.jaxws.samples.retail.cc.CCVerification;
-import org.jboss.test.ws.jaxws.samples.retail.profile.ProfileMgmtService;
-import org.jboss.test.ws.jaxws.samples.retail.profile.ProfileMgmt;
+import org.jboss.test.ws.jaxws.samples.retail.cc.VerificationRequest;
+import org.jboss.test.ws.jaxws.samples.retail.cc.VerificationResponse;
import org.jboss.test.ws.jaxws.samples.retail.profile.DiscountRequest;
import org.jboss.test.ws.jaxws.samples.retail.profile.DiscountResponse;
-import org.jboss.logging.Logger;
+import org.jboss.test.ws.jaxws.samples.retail.profile.ProfileMgmt;
+import org.jboss.test.ws.jaxws.samples.retail.profile.ProfileMgmtService;
import javax.annotation.PostConstruct;
import javax.ejb.Stateless;
+import javax.jws.HandlerChain;
import javax.jws.WebService;
import javax.xml.ws.WebServiceRef;
+import javax.xml.ws.Response;
/**
* An example order management component
@@ -40,6 +44,7 @@
*/
@Stateless
@WebService(endpointInterface = "org.jboss.test.ws.jaxws.samples.retail.OrderMgmt")
+@HandlerChain(file = "META-INF/jaxws-handler.xml")
public class OrderMgmtBean implements OrderMgmt {
private static final Logger log = Logger.getLogger(OrderMgmtBean.class);
@@ -64,14 +69,14 @@
* @param order
* @return OrderStaus
*/
- public OrderStatus prepareOrder(Order order) {
+ public OrderStatus prepareOrder(Order order)
+ {
log.info("Preparing order " + order);
// verify billing details
String creditCard = order.getCustomer().getCreditCardDetails();
- boolean isValidCard = verificationPort.verify(creditCard);
- log.info(creditCard + " valid? " + isValidCard);
+ Response<Boolean> response = verificationPort.verifyAsync( creditCard );
// high value customer discount
DiscountRequest discountRequest = new DiscountRequest(order.getCustomer());
@@ -79,11 +84,21 @@
boolean hasDiscount = discount.getDiscount() > 0.00;
log.info("High value customer ? " + hasDiscount);
+ try
+ {
+ log.info(creditCard + " valid? " + response.get());
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to access async results", e);
+ }
+
// transition to prepared state
order.setState(Order.OrderState.PREPARED);
// done
- return new OrderStatus("Prepared", order.getOrderNum());
+ //return new OrderStatus("Prepared", order.getOrderNum(), discount.getDiscount());
+ return new OrderStatus("Prepared", order.getOrderNum(), 0);
}
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/OrderStatus.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/OrderStatus.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/OrderStatus.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -31,13 +31,15 @@
public class OrderStatus implements Serializable {
private String status;
private long orderNum;
+ private double discount;
public OrderStatus() {
}
- public OrderStatus(String status, long orderNum) {
+ public OrderStatus(String status, long orderNum, double discount) {
this.status = status;
this.orderNum = orderNum;
+ this.discount = discount;
}
public String getStatus() {
@@ -55,4 +57,12 @@
public void setOrderNum(long orderNum) {
this.orderNum = orderNum;
}
+
+ public double getDiscount() {
+ return discount;
+ }
+
+ public void setDiscount(double discount) {
+ this.discount = discount;
+ }
}
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/RetailSampleTestCase.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -27,7 +27,6 @@
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory;
-import javax.naming.InitialContext;
import javax.xml.namespace.QName;
import java.net.MalformedURLException;
import java.net.URL;
@@ -74,16 +73,6 @@
}
- public void testRemoteAccess() throws Exception
- {
- InitialContext iniCtx = getInitialContext();
- OrderMgmt orderMgmtEJB = (OrderMgmt)iniCtx.lookup("/OrderMgmtBean/remote");
- assertNotNull(orderMgmtEJB);
-
- OrderStatus result = orderMgmtEJB.prepareOrder(ORDER);
- assertEquals("Prepared", result.getStatus());
- }
-
public void testWebService() throws Exception
{
assertWSDLAccess();
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerification.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerification.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerification.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -7,6 +7,7 @@
import javax.jws.WebService;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
+import javax.xml.ws.Response;
/**
@@ -29,8 +30,10 @@
@WebResult(name = "verified", targetNamespace = "")
@RequestWrapper(localName = "verify", targetNamespace = "http://org.jboss.ws/samples/retail/cc", className = "org.jboss.test.ws.jaxws.samples.retail.cc.VerificationRequest")
@ResponseWrapper(localName = "verifyResponse", targetNamespace = "http://org.jboss.ws/samples/retail/cc", className = "org.jboss.test.ws.jaxws.samples.retail.cc.VerificationResponse")
- public boolean verify(
+ public Boolean verify(
@WebParam(name = "creditCardNumber", targetNamespace = "")
String creditCardNumber);
+ Response<Boolean> verifyAsync(String creditCardNumber);
+
}
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerificationBean.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerificationBean.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerificationBean.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -25,18 +25,26 @@
import javax.ejb.Stateless;
import javax.jws.WebService;
+import javax.jws.HandlerChain;
+import javax.xml.ws.Response;
@Stateless
@WebService(endpointInterface = "org.jboss.test.ws.jaxws.samples.retail.cc.CCVerification")
+@HandlerChain(file = "META-INF/jaxws-handler.xml")
public class CCVerificationBean implements CCVerification {
private static final Logger log = Logger.getLogger(CCVerificationBean.class);
- public boolean verify(String creditcard) {
+ public Boolean verify(String creditcard) {
log.info("Verifying credit card: " + creditcard);
-
+
+ CreditcardProcessor.process(creditcard);
+
return true;
}
+ public Response<Boolean> verifyAsync(String creditCardNumber) {
+ return null;
+ }
}
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/VerificationRequest.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/VerificationRequest.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/VerificationRequest.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -8,9 +8,9 @@
/**
* <p>Java class for verificationRequest complex type.
- *
+ *
* <p>The following schema fragment specifies the expected content contained within this class.
- *
+ *
* <pre>
* <complexType name="verificationRequest">
* <complexContent>
@@ -22,39 +22,46 @@
* </complexContent>
* </complexType>
* </pre>
- *
- *
+ *
+ *
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "verificationRequest", propOrder = {
"creditCardNumber"
-})
+ })
public class VerificationRequest {
- protected String creditCardNumber;
+ protected String creditCardNumber;
- /**
- * Gets the value of the creditCardNumber property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getCreditCardNumber() {
- return creditCardNumber;
- }
+ public VerificationRequest(String creditCardNumber) {
+ this.creditCardNumber = creditCardNumber;
+ }
- /**
- * Sets the value of the creditCardNumber property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setCreditCardNumber(String value) {
- this.creditCardNumber = value;
- }
+ public VerificationRequest() {
+ }
+ /**
+ * Gets the value of the creditCardNumber property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCreditCardNumber() {
+ return creditCardNumber;
+ }
+
+ /**
+ * Sets the value of the creditCardNumber property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCreditCardNumber(String value) {
+ this.creditCardNumber = value;
+ }
+
}
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/VerificationResponse.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/VerificationResponse.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/cc/VerificationResponse.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -8,9 +8,9 @@
/**
* <p>Java class for verificationResponse complex type.
- *
+ *
* <p>The following schema fragment specifies the expected content contained within this class.
- *
+ *
* <pre>
* <complexType name="verificationResponse">
* <complexContent>
@@ -22,8 +22,8 @@
* </complexContent>
* </complexType>
* </pre>
- *
- *
+ *
+ *
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "verificationResponse", propOrder = {
@@ -31,21 +31,21 @@
})
public class VerificationResponse {
- protected boolean verified;
+ protected Boolean verified;
/**
* Gets the value of the verified property.
- *
+ *
*/
- public boolean isVerified() {
+ public Boolean isVerified() {
return verified;
}
/**
* Sets the value of the verified property.
- *
+ *
*/
- public void setVerified(boolean value) {
+ public void setVerified(Boolean value) {
this.verified = value;
}
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/profile/ProfileMgmtBean.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/profile/ProfileMgmtBean.java 2006-11-15 18:01:07 UTC (rev 1438)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/profile/ProfileMgmtBean.java 2006-11-15 18:13:04 UTC (rev 1439)
@@ -23,9 +23,11 @@
import javax.ejb.Stateless;
import javax.jws.WebService;
+import javax.jws.HandlerChain;
@Stateless
@WebService(endpointInterface = "org.jboss.test.ws.jaxws.samples.retail.profile.ProfileMgmt")
+@HandlerChain(file = "META-INF/jaxws-handler.xml")
public class ProfileMgmtBean implements ProfileMgmt {
public DiscountResponse getCustomerDiscount(DiscountRequest request) {
18 years, 1 month
JBossWS SVN: r1438 - trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/profile
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2006-11-15 13:01:07 -0500 (Wed, 15 Nov 2006)
New Revision: 1438
Modified:
trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/profile/ObjectFactory.java
Log:
clean imports
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/profile/ObjectFactory.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/profile/ObjectFactory.java 2006-11-15 15:43:11 UTC (rev 1437)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/samples/retail/profile/ObjectFactory.java 2006-11-15 18:01:07 UTC (rev 1438)
@@ -1,6 +1,8 @@
package org.jboss.test.ws.jaxws.samples.retail.profile;
+import org.jboss.test.ws.jaxws.samples.retail.Customer;
+
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
18 years, 1 month
JBossWS SVN: r1437 - tags
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-15 10:43:11 -0500 (Wed, 15 Nov 2006)
New Revision: 1437
Added:
tags/jbossws-1.0.4.GA/
Log:
jbossws-1.0.4.GA -r1435
Copied: tags/jbossws-1.0.4.GA (from rev 1436, branches/jbossws-1.0)
18 years, 1 month