[jbossws-commits] JBossWS SVN: r14586 - common/trunk/src/main/java/org/jboss/ws/common/invocation.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Mon Jun 20 10:10:26 EDT 2011


Author: richard.opalka at jboss.com
Date: 2011-06-20 10:10:26 -0400 (Mon, 20 Jun 2011)
New Revision: 14586

Added:
   common/trunk/src/main/java/org/jboss/ws/common/invocation/WebServiceContextAdapter.java
Removed:
   common/trunk/src/main/java/org/jboss/ws/common/invocation/WebServiceContextEJB.java
   common/trunk/src/main/java/org/jboss/ws/common/invocation/WebServiceContextJSE.java
Log:
[JBWS-3318] WebServiceContext is invocation type agnostic since now

Added: common/trunk/src/main/java/org/jboss/ws/common/invocation/WebServiceContextAdapter.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/invocation/WebServiceContextAdapter.java	                        (rev 0)
+++ common/trunk/src/main/java/org/jboss/ws/common/invocation/WebServiceContextAdapter.java	2011-06-20 14:10:26 UTC (rev 14586)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.ws.common.invocation;
+
+import java.security.Principal;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.wsf.spi.invocation.WebServiceContextDelegate;
+
+/**
+ * Web service context which security related methods delegate to servlet container.
+ *
+ * @author alessio.soldano at jboss.com
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ */
+public final class WebServiceContextAdapter extends WebServiceContextDelegate
+{
+
+   private final HttpServletRequest httpRequest;
+
+   public WebServiceContextAdapter(final WebServiceContext ctx)
+   {
+      super(ctx);
+      httpRequest = (HttpServletRequest)ctx.getMessageContext().get(MessageContext.SERVLET_REQUEST);
+   }
+
+   @Override
+   public Principal getUserPrincipal()
+   {
+      return httpRequest.getUserPrincipal();
+   }
+
+   @Override
+   public boolean isUserInRole(String role)
+   {
+      return httpRequest.isUserInRole(role);
+   }
+
+}

Deleted: common/trunk/src/main/java/org/jboss/ws/common/invocation/WebServiceContextEJB.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/invocation/WebServiceContextEJB.java	2011-06-20 14:02:23 UTC (rev 14585)
+++ common/trunk/src/main/java/org/jboss/ws/common/invocation/WebServiceContextEJB.java	2011-06-20 14:10:26 UTC (rev 14586)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, 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.ws.common.invocation;
-
-import java.security.Principal;
-
-import javax.ejb.EJBContext;
-import javax.xml.ws.WebServiceContext;
-
-import org.jboss.wsf.spi.invocation.WebServiceContextDelegate;
-
-/**
- * EJB web service context which security related methods delegate to EJB container.
- *
- * @author alessio.soldano at jboss.com
- * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
- */
-public class WebServiceContextEJB extends WebServiceContextDelegate
-{
-
-   public WebServiceContextEJB(final WebServiceContext ctx)
-   {
-      super(ctx);
-   }
-
-   public Principal getUserPrincipal()
-   {
-      final EJBContext ejbContext = getAttachment(EJBContext.class);
-      return ejbContext.getCallerPrincipal();
-   }
-
-   public boolean isUserInRole(String role)
-   {
-      final EJBContext ejbContext = getAttachment(EJBContext.class);
-      return ejbContext.isCallerInRole(role);
-   }
-
-}

Deleted: common/trunk/src/main/java/org/jboss/ws/common/invocation/WebServiceContextJSE.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/invocation/WebServiceContextJSE.java	2011-06-20 14:02:23 UTC (rev 14585)
+++ common/trunk/src/main/java/org/jboss/ws/common/invocation/WebServiceContextJSE.java	2011-06-20 14:10:26 UTC (rev 14586)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, 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.ws.common.invocation;
-
-import java.security.Principal;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.handler.MessageContext;
-
-import org.jboss.wsf.spi.invocation.WebServiceContextDelegate;
-
-/**
- * JSE web service context which security related methods delegate to servlet container.
- *
- * @author alessio.soldano at jboss.com
- * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
- */
-public final class WebServiceContextJSE extends WebServiceContextDelegate
-{
-
-   private final HttpServletRequest httpRequest;
-
-   public WebServiceContextJSE(final WebServiceContext ctx)
-   {
-      super(ctx);
-
-      if (ctx.getMessageContext().get(MessageContext.SERVLET_REQUEST) == null)
-         throw new IllegalStateException("Cannot obtain HttpServletRequest from message context");
-
-      this.httpRequest = (HttpServletRequest)ctx.getMessageContext().get(MessageContext.SERVLET_REQUEST);
-   }
-
-   @Override
-   public Principal getUserPrincipal()
-   {
-      return this.httpRequest.getUserPrincipal();
-   }
-
-   @Override
-   public boolean isUserInRole(String role)
-   {
-      return this.httpRequest.isUserInRole(role);
-   }
-
-}



More information about the jbossws-commits mailing list