Author: richard.opalka(a)jboss.com
Date: 2011-09-01 09:23:39 -0400 (Thu, 01 Sep 2011)
New Revision: 14919
Modified:
common/trunk/src/main/java/org/jboss/ws/common/Constants.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/ContextRootDeploymentAspect.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/URLPatternDeploymentAspect.java
Log:
[JBWS-3348] get rid of org.jboss.ws.backward_compatible_context_root property
Modified: common/trunk/src/main/java/org/jboss/ws/common/Constants.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/Constants.java 2011-09-01 11:07:51 UTC
(rev 14918)
+++ common/trunk/src/main/java/org/jboss/ws/common/Constants.java 2011-09-01 13:23:39 UTC
(rev 14919)
@@ -331,6 +331,4 @@
static final String HTTP_MAX_CONNECTIONS =
"org.jboss.ws.http.maxConnections";
static final String NETTY_MESSAGE = "org.jboss.ws.http.netty.Message";
-
- static final boolean BC_CONTEXT_MODE =
Boolean.parseBoolean(System.getProperty("org.jboss.ws.backward_compatible_context_creator",
"false"));
}
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/ContextRootDeploymentAspect.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/ContextRootDeploymentAspect.java 2011-09-01
11:07:51 UTC (rev 14918)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/ContextRootDeploymentAspect.java 2011-09-01
13:23:39 UTC (rev 14919)
@@ -27,7 +27,6 @@
import org.jboss.ws.api.annotation.TransportGuarantee;
import org.jboss.ws.api.annotation.WebContext;
import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.Constants;
import org.jboss.ws.common.integration.AbstractDeploymentAspect;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
@@ -105,11 +104,6 @@
{
String simpleName = dep.getSimpleName();
String contextRoot = simpleName.substring(0, simpleName.length() - 4);
- if (dep.getParent() != null && Constants.BC_CONTEXT_MODE)
- {
- simpleName = dep.getParent().getSimpleName();
- contextRoot = simpleName.substring(0, simpleName.length() - 4) + "-" +
contextRoot;
- }
return contextRoot;
}
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/URLPatternDeploymentAspect.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/URLPatternDeploymentAspect.java 2011-09-01
11:07:51 UTC (rev 14918)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/URLPatternDeploymentAspect.java 2011-09-01
13:23:39 UTC (rev 14919)
@@ -28,7 +28,6 @@
import org.jboss.ws.api.annotation.WebContext;
import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.Constants;
import org.jboss.ws.common.integration.AbstractDeploymentAspect;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -41,7 +40,7 @@
* A deployer that assigns the URLPattern to endpoints.
*
* @author Thomas.Diesler(a)jboss.org
- * @since 19-May-2007
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public class URLPatternDeploymentAspect extends AbstractDeploymentAspect
{
@@ -60,7 +59,7 @@
{
urlPattern = getExplicitPattern(dep, ep);
if (urlPattern == null)
- urlPattern = getImplicitPattern(dep, ep);
+ urlPattern = ep.getShortName();
// Always prefix with '/'
if (urlPattern.startsWith("/") == false)
@@ -110,42 +109,45 @@
// #3 For EJB use @WebContext.urlPattern
if (urlPattern == null)
{
- Class beanClass = ep.getTargetBeanClass();
+ Class<?> beanClass = ep.getTargetBeanClass();
WebContext anWebContext =
(WebContext)beanClass.getAnnotation(WebContext.class);
if (anWebContext != null && anWebContext.urlPattern().length() > 0)
{
urlPattern = anWebContext.urlPattern();
}
- else if (!Constants.BC_CONTEXT_MODE)
- {
- WebService webServiceAnnotation =
(WebService)beanClass.getAnnotation(WebService.class);
- String name = webServiceAnnotation != null ? webServiceAnnotation.name() :
null;
- if (name != null && name.length() > 0)
- {
- urlPattern = name;
- }
- else
- {
- String fullClassName = beanClass.getName();
- urlPattern =
fullClassName.substring(fullClassName.lastIndexOf('.') + 1);
- }
- if (webServiceAnnotation != null &&
!"".equals(webServiceAnnotation.serviceName()))
- {
- urlPattern = webServiceAnnotation.serviceName() + "/" +
urlPattern;
- }
-
- }
}
+
+ // #4 Use @WebService
+ if (urlPattern == null)
+ {
+ Class<?> beanClass = ep.getTargetBeanClass();
+ WebService webServiceAnnotation =
(WebService)beanClass.getAnnotation(WebService.class);
+ if (webServiceAnnotation != null)
+ {
+ String name = webServiceAnnotation.name();
+ urlPattern = !isEmpty(name) ? name : beanClass.getSimpleName();
+ String serviceName = webServiceAnnotation.serviceName();
+ if (!isEmpty(serviceName))
+ {
+ urlPattern = serviceName + "/" + urlPattern;
+ }
+ }
+ }
+ // TODO: WebServiceProvider ???
+
+ // #5 Use simple class name
+ if (urlPattern == null)
+ {
+ Class<?> beanClass = ep.getTargetBeanClass();
+ urlPattern = beanClass.getSimpleName();
+ }
return urlPattern;
}
- protected String getImplicitPattern(Deployment dep, Endpoint ep)
- {
- // #4 Fallback to the ejb-name
- String urlPattern = ep.getShortName();
- return urlPattern;
+ private static boolean isEmpty(final String s) {
+ return s == null || s.length() == 0;
}
}
Show replies by date