Author: richard.opalka(a)jboss.com
Date: 2009-08-12 04:14:28 -0400 (Wed, 12 Aug 2009)
New Revision: 10521
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXRPC.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java
Log:
[JBWS-2720] rollback + removing obsolete security code
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXRPC.java
===================================================================
---
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXRPC.java 2009-08-11
17:56:42 UTC (rev 10520)
+++
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerJAXRPC.java 2009-08-12
08:14:28 UTC (rev 10521)
@@ -24,8 +24,6 @@
import javax.xml.rpc.server.ServiceLifecycle;
import javax.xml.rpc.server.ServletEndpointContext;
-import org.jboss.wsf.common.injection.PreDestroyHolder;
-import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.invocation.Invocation;
import org.jboss.wsf.spi.invocation.InvocationContext;
@@ -48,14 +46,13 @@
/**
* Calls {@link javax.xml.rpc.server.ServiceLifecycle#init(Object)}
- * method on target bean and registers it for predestroy phase if
- * target bean implements {@link javax.xml.rpc.server.ServiceLifecycle} interface.
+ * method on target bean if this bean implements
+ * {@link javax.xml.rpc.server.ServiceLifecycle} interface.
*
- * @param endpoint used for predestroy phase registration process
* @param invocation current invocation
* @throws Exception if any error occurs
*/
- protected void onEndpointInstantiated(final Endpoint endpoint, final Invocation
invocation) throws Exception
+ protected void onBeforeInvocation(final Invocation invocation) throws Exception
{
final InvocationContext invocationContext = invocation.getInvocationContext();
final Object targetBean = invocationContext.getTargetBean();
@@ -65,8 +62,27 @@
{
final ServletEndpointContext sepContext =
invocationContext.getAttachment(ServletEndpointContext.class);
((ServiceLifecycle)targetBean).init(sepContext);
- endpoint.addAttachment(PreDestroyHolder.class, new
PreDestroyHolder(targetBean));
}
}
+
+ /**
+ * Calls {@link javax.xml.rpc.server.ServiceLifecycle#destroy()}
+ * method on target bean if this bean implements
+ * {@link javax.xml.rpc.server.ServiceLifecycle} interface.
+ *
+ * @param invocation current invocation
+ * @throws Exception if any error occurs
+ */
+ protected void onAfterInvocation(final Invocation invocation) throws Exception
+ {
+ final InvocationContext invocationContext = invocation.getInvocationContext();
+ final Object targetBean = invocationContext.getTargetBean();
+ final boolean isJaxrpcLifecycleBean = targetBean instanceof ServiceLifecycle;
+ if (isJaxrpcLifecycleBean)
+ {
+ ((ServiceLifecycle)targetBean).destroy();
+ }
+ }
+
}
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java
===================================================================
---
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java 2009-08-11
17:56:42 UTC (rev 10520)
+++
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java 2009-08-12
08:14:28 UTC (rev 10521)
@@ -56,16 +56,7 @@
*/
public Principal getPrincipal()
{
- final Principal principal = SecurityAssociation.getPrincipal();
-
- if (principal != null)
- {
- return principal;
- }
- else
- {
- return AccessController.doPrivileged(new PrincipalPrivilegedAction());
- }
+ return SecurityAssociation.getPrincipal();
}
/**
@@ -85,16 +76,7 @@
*/
public Object getCredential()
{
- final Object credential = SecurityAssociation.getCredential();
-
- if (credential != null)
- {
- return credential;
- }
- else
- {
- return AccessController.doPrivileged(new CredentialPrivilegedAction());
- }
+ return SecurityAssociation.getCredential();
}
/**
@@ -133,70 +115,4 @@
});
}
- /**
- * Returns user principal from security context if available.
- */
- private static final class PrincipalPrivilegedAction implements
PrivilegedAction<Principal>
- {
-
- /**
- * Constructor.
- */
- private PrincipalPrivilegedAction()
- {
- super();
- }
-
- /**
- * Execute this action.
- *
- * @return user principal if available or null.
- */
- public Principal run()
- {
- final SecurityContext securityContext =
SecurityContextAssociation.getSecurityContext();
-
- if (securityContext != null)
- {
- return securityContext.getUtil().getUserPrincipal();
- }
-
- return null;
- }
-
- }
-
- /**
- * Returns user credential from security context if available.
- */
- private static final class CredentialPrivilegedAction implements
PrivilegedAction<Object>
- {
-
- /**
- * Constructor.
- */
- private CredentialPrivilegedAction()
- {
- super();
- }
-
- /**
- * Execute this action.
- *
- * @return user credential if available or null.
- */
- public Object run()
- {
- final SecurityContext securityContext =
SecurityContextAssociation.getSecurityContext();
-
- if (securityContext != null)
- {
- return securityContext.getUtil().getCredential();
- }
-
- return null;
- }
-
- }
-
}
Show replies by date