Author: richard.opalka(a)jboss.com
Date: 2011-01-28 07:23:19 -0500 (Fri, 28 Jan 2011)
New Revision: 13637
Removed:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/WebServiceContextEJB.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/WebServiceContextJSE.java
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeWebServiceContext.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/WebServiceContextFactoryImpl.java
Log:
[JBPAPP-5052] backporting ThreadLocal aware WebServiceContext implementation
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeWebServiceContext.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeWebServiceContext.java 2011-01-28
12:22:32 UTC (rev 13636)
+++
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeWebServiceContext.java 2011-01-28
12:23:19 UTC (rev 13637)
@@ -21,6 +21,8 @@
*/
package org.jboss.wsf.stack.jbws;
+import java.security.Principal;
+
import javax.xml.ws.EndpointReference;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.MessageContext;
@@ -35,24 +37,24 @@
import org.w3c.dom.Element;
/**
- * An ExtensibileWebServiceContext implementing the getEndpointReference jaxws 2.1
methods
+ * A WebServiceContext implementing the getEndpointReference jaxws methods.
*
* @author alessio.soldano(a)jboss.com
- * @since 27-Jan-2009
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
-public abstract class NativeWebServiceContext extends ExtensibleWebServiceContext
+public final class NativeWebServiceContext extends ExtensibleWebServiceContext
{
- public NativeWebServiceContext(MessageContext messageContext)
+ public NativeWebServiceContext(final MessageContext messageContext)
{
super(messageContext);
}
- public EndpointReference getEndpointReference(Element... referenceParameters)
+ public EndpointReference getEndpointReference(final Element... referenceParameters)
{
- return getEndpointReference(W3CEndpointReference.class, referenceParameters);
+ return this.getEndpointReference(W3CEndpointReference.class, referenceParameters);
}
- public <T extends EndpointReference> T getEndpointReference(Class<T>
clazz, Element... referenceParameters)
+ public <T extends EndpointReference> T getEndpointReference(final Class<T>
clazz, final Element... referenceParameters)
{
EndpointMetaData epMetaData =
((CommonMessageContext)getMessageContext()).getEndpointMetaData();
if (epMetaData == null)
@@ -75,4 +77,16 @@
}
return EndpointReferenceUtil.transform(clazz, builder.build());
}
+
+ @Override
+ public Principal getUserPrincipal()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isUserInRole(String role)
+ {
+ throw new UnsupportedOperationException();
+ }
}
Deleted:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/WebServiceContextEJB.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/WebServiceContextEJB.java 2011-01-28
12:22:32 UTC (rev 13636)
+++
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/WebServiceContextEJB.java 2011-01-28
12:23:19 UTC (rev 13637)
@@ -1,55 +0,0 @@
-/*
- * 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 java.security.Principal;
-
-import javax.ejb.EJBContext;
-import javax.xml.ws.handler.MessageContext;
-
-/**
- * A WebServiceContext implementation that delegates to the EJBContext.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 23-Jan-2007
- */
-public class WebServiceContextEJB extends NativeWebServiceContext
-{
- public WebServiceContextEJB(MessageContext msgContext)
- {
- super(msgContext);
- }
-
- public Principal getUserPrincipal()
- {
- EJBContext ejbContext = getAttachment(EJBContext.class);
- Principal principal = ejbContext.getCallerPrincipal();
- return principal;
- }
-
- public boolean isUserInRole(String role)
- {
- EJBContext ejbContext = getAttachment(EJBContext.class);
- boolean isUserInRole = ejbContext.isCallerInRole(role);
- return isUserInRole;
- }
-}
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/WebServiceContextFactoryImpl.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/WebServiceContextFactoryImpl.java 2011-01-28
12:22:32 UTC (rev 13636)
+++
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/WebServiceContextFactoryImpl.java 2011-01-28
12:23:19 UTC (rev 13637)
@@ -23,6 +23,8 @@
import javax.xml.ws.handler.MessageContext;
+import org.jboss.wsf.common.invocation.WebServiceContextEJB;
+import org.jboss.wsf.common.invocation.WebServiceContextJSE;
import org.jboss.wsf.spi.invocation.ExtensibleWebServiceContext;
import org.jboss.wsf.spi.invocation.InvocationType;
import org.jboss.wsf.spi.invocation.WebServiceContextFactory;
@@ -39,9 +41,9 @@
ExtensibleWebServiceContext context = null;
if(type.toString().indexOf("EJB")!=-1 ||
type.toString().indexOf("MDB")!=-1)
- context = new WebServiceContextEJB(messageContext);
+ context = new WebServiceContextEJB(new
NativeWebServiceContext(messageContext));
else
- context = new WebServiceContextJSE(messageContext);
+ context = new WebServiceContextJSE(new
NativeWebServiceContext(messageContext));
return context;
}
Deleted:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/WebServiceContextJSE.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/WebServiceContextJSE.java 2011-01-28
12:22:32 UTC (rev 13636)
+++
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/wsf/stack/jbws/WebServiceContextJSE.java 2011-01-28
12:23:19 UTC (rev 13637)
@@ -1,60 +0,0 @@
-/*
- * 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 java.security.Principal;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.xml.ws.handler.MessageContext;
-
-/**
- * A WebServiceContext implementation that delegates to the HttpServletRequest.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 23-Jan-2007
- */
-public class WebServiceContextJSE extends NativeWebServiceContext
-{
- private HttpServletRequest httpRequest;
-
- public WebServiceContextJSE(MessageContext msgContext)
- {
- super(msgContext);
- httpRequest = (HttpServletRequest)msgContext.get(MessageContext.SERVLET_REQUEST);
- if (httpRequest == null)
- throw new IllegalStateException("Cannot obtain HTTPServletRequest from
message context");
- }
-
- @Override
- public Principal getUserPrincipal()
- {
- Principal principal = httpRequest.getUserPrincipal();
- return principal;
- }
-
- @Override
- public boolean isUserInRole(String role)
- {
- boolean isUserInRole = httpRequest.isUserInRole(role);
- return isUserInRole;
- }
-}