geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r165343 - /geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty
Date Fri, 29 Apr 2005 21:16:48 GMT
Author: djencks
Date: Fri Apr 29 14:16:48 2005
New Revision: 165343

URL: http://svn.apache.org/viewcvs?rev=165343&view=rev
Log:
untyped accessors invite classcast exceptions

Modified:
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JAASJettyRealm.java
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServletHolder.java

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JAASJettyRealm.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JAASJettyRealm.java?rev=165343&r1=165342&r2=165343&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JAASJettyRealm.java (original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JAASJettyRealm.java Fri
Apr 29 14:16:48 2005
@@ -121,7 +121,7 @@
     public boolean isUserInRole(Principal user, String role) {
         AccessControlContext acc = ContextManager.getCurrentContext();
         try {
-            acc.checkPermission(new WebRoleRefPermission(JettyServletHolder.getJettyServletHolder().getName(),
role));
+            acc.checkPermission(new WebRoleRefPermission(JettyServletHolder.getCurrentServletName(),
role));
         } catch (AccessControlException e) {
             return false;
         }

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java?rev=165343&r1=165342&r2=165343&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java
(original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java
Fri Apr 29 14:16:48 2005
@@ -99,7 +99,7 @@
         //  TODO There has to be some way to get this in on the Servlet's init method.
 //        request.setAttribute(POJOWebServiceServlet.WEBSERVICE_CONTAINER, webServiceContainer);
 
-        JettyServletHolder.currentServletHolder.set(this);
+        JettyServletHolder.setCurrentServletName(getServletName());
         PolicyContext.setHandlerData(ServletHttpRequest.unwrap(request));
 
         super.handle(request, response);

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServletHolder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServletHolder.java?rev=165343&r1=165342&r2=165343&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServletHolder.java
(original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServletHolder.java
Fri Apr 29 14:16:48 2005
@@ -44,7 +44,7 @@
  * @see org.apache.geronimo.jetty.JAASJettyRealm#isUserInRole(java.security.Principal, java.lang.String)
  */
 public class JettyServletHolder extends ServletHolder {
-    static final ThreadLocal currentServletHolder = new ThreadLocal();
+    private static final ThreadLocal currentServletName = new ThreadLocal();
 
     //todo consider interface instead of this constructor for endpoint use.
     public JettyServletHolder() {
@@ -87,7 +87,7 @@
     public void handle(ServletRequest request, ServletResponse response)
             throws ServletException, UnavailableException, IOException {
 
-        currentServletHolder.set(this);
+        setCurrentServletName(getServletName());
 
         super.handle(request, response);
     }
@@ -98,8 +98,12 @@
      * @return the thread's current JettyServletHolder
      * @see org.apache.geronimo.jetty.JAASJettyRealm#isUserInRole(java.security.Principal,
java.lang.String)
      */
-    static JettyServletHolder getJettyServletHolder() {
-        return (JettyServletHolder) currentServletHolder.get();
+    static String getCurrentServletName() {
+        return (String) currentServletName.get();
+    }
+
+    static void setCurrentServletName(String servletName) {
+        currentServletName.set(servletName);
     }
 
     public static final GBeanInfo GBEAN_INFO;
@@ -108,7 +112,7 @@
         GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(JettyServletHolder.class, NameFactory.DEFAULT_SERVLET);
         //todo replace with interface
         infoBuilder.addInterface(ServletHolder.class);
-        
+
         infoBuilder.addAttribute("servletName", String.class, true);
         infoBuilder.addAttribute("servletClass", String.class, true);
         infoBuilder.addAttribute("jspFile", String.class, true);
@@ -121,8 +125,8 @@
         infoBuilder.setConstructor(new String[] {"servletName",
                                                  "servletClass",
                                                  "jspFile",
-                                                 "initParams", 
-                                                 "loadOnStartup", 
+                                                 "initParams",
+                                                 "loadOnStartup",
                                                  "servletMappings",
                                                  "webRoleRefPermissions",
                                                  "JettyServletRegistration"});



Mime
View raw message