diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-20 08:38:29 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-20 08:38:29 +0000 |
commit | 1d502eda5a49daf9fd08baa59d8a2c7f4dd32623 (patch) | |
tree | f1d6468fc00d8a4aa1af018de577c15fdb5e4dfd /sca-java-2.x/trunk/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo | |
parent | cadacde2a3eb109b53247e92198e5268d4304d62 (diff) |
Adding try/catch to display warning when dojo or tuscany dojo extensions are already registered
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@912088 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo')
-rw-r--r-- | sca-java-2.x/trunk/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/sca-java-2.x/trunk/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java b/sca-java-2.x/trunk/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java index fa1a46b384..f9fdd96e1f 100644 --- a/sca-java-2.x/trunk/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java +++ b/sca-java-2.x/trunk/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java @@ -20,6 +20,7 @@ package org.apache.tuscany.sca.web.javascript.dojo; import java.net.URI; +import java.util.logging.Logger; import javax.servlet.Servlet; @@ -27,8 +28,11 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.ModuleActivator; import org.apache.tuscany.sca.host.http.ServletHost; import org.apache.tuscany.sca.host.http.ServletHostHelper; +import org.apache.tuscany.sca.host.http.ServletMappingException; public class DojoModuleActivator implements ModuleActivator { + private final static Logger logger = Logger.getLogger(DojoModuleActivator.class.getName()); + private static final String dojoBaseUri = URI.create("/dojo").toString(); private static final String dojoUri = URI.create("/dojo/*").toString(); @@ -51,20 +55,28 @@ public class DojoModuleActivator implements ModuleActivator { servlet = servletHost.getServletMapping(dojoBaseUri); if(servlet == null) { - DojoResourceServlet baseResourceServlet = new DojoResourceServlet(); - servletHost.addServletMapping(dojoBaseUri, baseResourceServlet); + try { + DojoResourceServlet baseResourceServlet = new DojoResourceServlet(); + servletHost.addServletMapping(dojoBaseUri, baseResourceServlet); - DojoResourceServlet resourceServlet = new DojoResourceServlet(); - servletHost.addServletMapping(dojoUri, resourceServlet); + DojoResourceServlet resourceServlet = new DojoResourceServlet(); + servletHost.addServletMapping(dojoUri, resourceServlet); + } catch (ServletMappingException me ) { + logger.warning("Dojo already registered at :" + dojoBaseUri); + } } servlet = servletHost.getServletMapping(tuscanyBaseUri); if(servlet == null) { - DojoResourceServlet baseResourceServlet = new DojoResourceServlet(); - servletHost.addServletMapping(tuscanyBaseUri, baseResourceServlet); + try { + DojoResourceServlet baseResourceServlet = new DojoResourceServlet(); + servletHost.addServletMapping(tuscanyBaseUri, baseResourceServlet); - DojoResourceServlet resourceServlet = new DojoResourceServlet(); - servletHost.addServletMapping(tuscanyUri, resourceServlet); + DojoResourceServlet resourceServlet = new DojoResourceServlet(); + servletHost.addServletMapping(tuscanyUri, resourceServlet); + } catch (ServletMappingException me ) { + logger.warning("Tuscany dojo extensions already registered at :" + tuscanyBaseUri); + } } } |