Author: richard.opalka(a)jboss.com
Date: 2012-09-24 10:42:59 -0400 (Mon, 24 Sep 2012)
New Revision: 16757
Modified:
stack/cxf/branches/ropalka_JBWS-3550/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
stack/cxf/branches/ropalka_JBWS-3550/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java
Log:
[JBWS-3550] still support @PostConstruct & @PreDestroy due to BC reasons
Modified:
stack/cxf/branches/ropalka_JBWS-3550/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
===================================================================
---
stack/cxf/branches/ropalka_JBWS-3550/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2012-09-24
13:08:04 UTC (rev 16756)
+++
stack/cxf/branches/ropalka_JBWS-3550/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2012-09-24
14:42:59 UTC (rev 16757)
@@ -91,6 +91,12 @@
}
@Override
+ public void destroy()
+ {
+ ServletHelper.callPreDestroy(endpoint);
+ }
+
+ @Override
public void doHead(HttpServletRequest request, HttpServletResponse response,
ServletContext context)
throws ServletException, IOException
{
Modified:
stack/cxf/branches/ropalka_JBWS-3550/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java
===================================================================
---
stack/cxf/branches/ropalka_JBWS-3550/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java 2012-09-24
13:08:04 UTC (rev 16756)
+++
stack/cxf/branches/ropalka_JBWS-3550/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java 2012-09-24
14:42:59 UTC (rev 16757)
@@ -21,6 +21,8 @@
*/
package org.jboss.wsf.stack.cxf.transport;
+import static org.jboss.ws.common.integration.WSHelper.isJaxwsJseEndpoint;
+
import java.io.IOException;
import java.util.List;
import java.util.ResourceBundle;
@@ -45,6 +47,7 @@
import org.apache.cxf.management.interceptor.ResponseTimeMessageOutInterceptor;
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.common.ObjectNameFactory;
+import org.jboss.ws.common.injection.InjectionHelper;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
@@ -124,11 +127,30 @@
for (Handler handler : chain)
{
final Reference handlerReference =
endpoint.getInstanceProvider().getInstance(handler.getClass().getName());
+ if (!handlerReference.isInitialized()) {
+ final Object handlerInstance = handlerReference.getValue();
+ InjectionHelper.callPostConstructMethod(handlerInstance);
+ handlerReference.setInitialized();
+ }
}
}
}
}
+ public static void callPreDestroy(Endpoint endpoint)
+ {
+ ServerFactoryBean factory = endpoint.getAttachment(ServerFactoryBean.class);
+ if (factory != null)
+ {
+ if (isJaxwsJseEndpoint(endpoint) && factory.getServiceBean() != null)
+ {
+ final Reference epReference =
endpoint.getInstanceProvider().getInstance(factory.getServiceBean().getClass().getName());
+ final Object epInstance = epReference.getValue();
+ InjectionHelper.callPreDestroyMethod(epInstance);
+ }
+ }
+ }
+
public static void callRequestHandler(HttpServletRequest req, HttpServletResponse res,
ServletContext ctx, Bus bus,
Endpoint endpoint) throws ServletException
{
Show replies by date