tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlmonte...@apache.org
Subject svn commit: r1528598 - /tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/web/LightweightWebAppBuilder.java
Date Wed, 02 Oct 2013 19:14:55 GMT
Author: jlmonteiro
Date: Wed Oct  2 19:14:55 2013
New Revision: 1528598

URL: http://svn.apache.org/r1528598
Log:
OPENEJB-2039 Implement POJO Web Services in embedded mode

Modified:
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/web/LightweightWebAppBuilder.java

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/web/LightweightWebAppBuilder.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/web/LightweightWebAppBuilder.java?rev=1528598&r1=1528597&r2=1528598&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/web/LightweightWebAppBuilder.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/web/LightweightWebAppBuilder.java
Wed Oct  2 19:14:55 2013
@@ -28,6 +28,7 @@ import org.apache.openejb.assembler.clas
 import org.apache.openejb.assembler.classic.JndiEncBuilder;
 import org.apache.openejb.assembler.classic.ListenerInfo;
 import org.apache.openejb.assembler.classic.ParamValueInfo;
+import org.apache.openejb.assembler.classic.PortInfo;
 import org.apache.openejb.assembler.classic.ServletInfo;
 import org.apache.openejb.assembler.classic.WebAppBuilder;
 import org.apache.openejb.assembler.classic.WebAppInfo;
@@ -69,6 +70,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
+import java.util.TreeMap;
 
 public class LightweightWebAppBuilder implements WebAppBuilder {
     private static final Logger LOGGER = Logger.getInstance(LogCategory.OPENEJB, LightweightWebAppBuilder.class);
@@ -184,7 +186,7 @@ public class LightweightWebAppBuilder im
                         }
 
                         final FilterConfig config = new SimpleFilterConfig(sce.getServletContext(),
info.name, initParams);
-                        for (String mapping: annotation.urlPatterns()) {
+                        for (String mapping : annotation.urlPatterns()) {
                             try {
                                 addFilterMethod.invoke(null, clazz.getName(), webContext,
mapping, config);
                                 deployedWebObjects.filterMappings.add(mapping);
@@ -196,6 +198,11 @@ public class LightweightWebAppBuilder im
                 }
             }
 
+            final Map<String, PortInfo> ports = new TreeMap<String, PortInfo>();
+            for (final PortInfo port : webAppInfo.portInfos) {
+                ports.put(port.serviceLink, port);
+            }
+
             // register servlets
             for (ServletInfo info : webAppInfo.servlets) {
                 if ("true".equalsIgnoreCase(appInfo.properties.getProperty("openejb.jaxrs.on",
"true"))) {
@@ -220,7 +227,12 @@ public class LightweightWebAppBuilder im
                             // no-op
                         }
                     }
-                } // else let the user manage itself a rest servlet etc...
+                }
+
+                // If POJO web services, it will be overriden with WsServlet
+                if (ports.containsKey(info.servletName) || ports.containsKey(info.servletClass))
{
+                    continue;
+                }
 
                 // deploy
                 for (String mapping : info.mappings) {
@@ -232,13 +244,14 @@ public class LightweightWebAppBuilder im
                     }
                 }
             }
+
             for (ClassListInfo info : webAppInfo.webAnnotatedClasses) {
                 final String url = info.name;
                 for (String servletPath : info.list) {
                     final Class<?> clazz = loadFromUrls(webContext.getClassLoader(),
url, servletPath);
                     final WebServlet annotation = clazz.getAnnotation(WebServlet.class);
                     if (annotation != null) {
-                        for (String mapping: annotation.urlPatterns()) {
+                        for (String mapping : annotation.urlPatterns()) {
                             try {
                                 addServletMethod.invoke(null, clazz.getName(), webContext,
mapping);
                                 deployedWebObjects.mappings.add(mapping);



Mime
View raw message