[jbossws-commits] JBossWS SVN: r8351 - in stack/native/trunk/modules/core/src/main: resources/META-INF/services and 1 other directory.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Mon Oct 6 12:04:51 EDT 2008
Author: richard.opalka at jboss.com
Date: 2008-10-06 12:04:51 -0400 (Mon, 06 Oct 2008)
New Revision: 8351
Added:
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/AspectizedEndpointServlet.java
stack/native/trunk/modules/core/src/main/resources/META-INF/services/org.jboss.wsf.spi.DeploymentAspectManagerLocator
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EndpointServlet.java
Log:
[JBWS-2246][JBWS-2264][JBAS-5732] provide aspectized servlet + enhance BC compatible servlet
Added: stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/AspectizedEndpointServlet.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/AspectizedEndpointServlet.java (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/AspectizedEndpointServlet.java 2008-10-06 16:04:51 UTC (rev 8351)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.stack.jbws;
+
+import org.jboss.wsf.spi.DeploymentAspectManagerLocator;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspectManager;
+
+/**
+ * Endpoint servlet that has WS framework aspects support
+ * @author richard.opalka at jboss.com
+ */
+public class AspectizedEndpointServlet extends EndpointServlet
+{
+
+ protected DeploymentAspectManager aspectsManager;
+
+ protected void initDeploymentAspectManager()
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ DeploymentAspectManagerLocator locator = spiProvider.getSPI(DeploymentAspectManagerLocator.class);
+ aspectsManager = locator.locateDeploymentAspectManager("WSServletAspectManager");
+ }
+
+ protected void callRuntimeAspects()
+ {
+ Deployment dep = endpoint.getService().getDeployment();
+ aspectsManager.create(dep, null);
+ aspectsManager.start(dep, null);
+ }
+
+ public void destroy()
+ {
+ try
+ {
+ Deployment dep = endpoint.getService().getDeployment();
+ aspectsManager.stop(dep, null);
+ aspectsManager.destroy(dep, null);
+ }
+ finally
+ {
+ super.destroy();
+ }
+ }
+
+}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EndpointServlet.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EndpointServlet.java 2008-10-06 15:20:52 UTC (rev 8350)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EndpointServlet.java 2008-10-06 16:04:51 UTC (rev 8351)
@@ -47,7 +47,7 @@
/**
* A servlet that is installed for every web service endpoint.
- *
+ * @author richard.opalka at jboss.com
* @author Thomas.Diesler at jboss.org
* @since 25-Apr-2007
*/
@@ -62,18 +62,36 @@
public void init(ServletConfig servletConfig) throws ServletException
{
super.init(servletConfig);
+ this.initRegistry();
+ this.initDeploymentAspectManager();
+ String contextPath = servletConfig.getServletContext().getContextPath();
+ initServiceEndpoint(contextPath);
+ }
+
+ protected void initRegistry()
+ {
SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
epRegistry = spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry();
}
-
+
+ /**
+ * Template method
+ */
+ protected void initDeploymentAspectManager()
+ {
+ // does nothing (because of BC)
+ }
+
+ /**
+ * Template method
+ */
+ protected void callRuntimeAspects()
+ {
+ // does nothing (because of BC)
+ }
+
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
- if (endpoint == null)
- {
- String contextPath = req.getContextPath();
- initServiceEndpoint(contextPath);
- }
-
try
{
EndpointAssociation.setEndpoint(endpoint);
@@ -90,10 +108,23 @@
*/
protected void initServiceEndpoint(String contextPath)
{
- initEndpoint(contextPath, getServletName());
- initEndpointConfig();
- startEndpoint();
+ this.initEndpoint(contextPath, getServletName());
+ this.setRuntimeLoader();
+ this.callRuntimeAspects();
+ this.initEndpointConfig();
+ this.startEndpoint();
}
+
+ private void setRuntimeLoader()
+ {
+ // Set the runtime classloader for JSE endpoints, this should be the tomcat classloader
+ Deployment dep = endpoint.getService().getDeployment();
+ if (dep.getType() == Deployment.DeploymentType.JAXRPC_JSE || dep.getType() == Deployment.DeploymentType.JAXWS_JSE)
+ {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ dep.setRuntimeClassLoader(classLoader);
+ }
+ }
private void startEndpoint()
{
Added: stack/native/trunk/modules/core/src/main/resources/META-INF/services/org.jboss.wsf.spi.DeploymentAspectManagerLocator
===================================================================
--- stack/native/trunk/modules/core/src/main/resources/META-INF/services/org.jboss.wsf.spi.DeploymentAspectManagerLocator (rev 0)
+++ stack/native/trunk/modules/core/src/main/resources/META-INF/services/org.jboss.wsf.spi.DeploymentAspectManagerLocator 2008-10-06 16:04:51 UTC (rev 8351)
@@ -0,0 +1 @@
+org.jboss.wsf.framework.DeploymentAspectManagerLocatorImpl
\ No newline at end of file
More information about the jbossws-commits
mailing list