geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject cvs commit: incubator-geronimo/specs/j2ee-jacc/src/java/javax/security/jacc WebUserDataPermission.java
Date Sun, 25 Jul 2004 00:57:35 GMT
adc         2004/07/24 17:57:35

  Modified:    specs/j2ee-jacc/src/java/javax/security/jacc
                        WebUserDataPermission.java
  Log:
  Removed double CR/LF
  
  Revision  Changes    Path
  1.5       +107 -80   incubator-geronimo/specs/j2ee-jacc/src/java/javax/security/jacc/WebUserDataPermission.java
  
  Index: WebUserDataPermission.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/specs/j2ee-jacc/src/java/javax/security/jacc/WebUserDataPermission.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- WebUserDataPermission.java	10 Mar 2004 09:59:53 -0000	1.4
  +++ WebUserDataPermission.java	25 Jul 2004 00:57:35 -0000	1.5
  @@ -21,83 +21,110 @@
   // DO NOT add / change / or delete method signatures!
   //
   
  -package javax.security.jacc;
  -
  -import java.io.IOException;
  -import java.io.ObjectInputStream;
  -import java.io.ObjectOutputStream;
  -import java.security.Permission;
  -import java.security.PermissionCollection;
  -import javax.servlet.http.HttpServletRequest;
  -
  -/**
  - *
  - * @version $Revision$ $Date$
  - */
  -public final class WebUserDataPermission extends Permission {
  -
  -    private transient int cachedHashCode = 0;
  -    private transient URLPatternSpec urlPatternSpec;
  -    private transient HTTPMethodSpec httpMethodSpec;
  -
  -    public WebUserDataPermission(HttpServletRequest request) {
  -        super(request.getServletPath());
  -
  -        urlPatternSpec = new URLPatternSpec(request.getServletPath());
  -        httpMethodSpec = new HTTPMethodSpec(request.getMethod());
  -    }
  -
  -    public WebUserDataPermission(String name, String actions) {
  -        super(name);
  -
  -        urlPatternSpec = new URLPatternSpec(name);
  -        httpMethodSpec = new HTTPMethodSpec(actions, true);
  -    }
  -
  -    public WebUserDataPermission(String urlPattern, String[] HTTPMethods, String transportType)
{
  -        super(urlPattern);
  -
  -        urlPatternSpec = new URLPatternSpec(urlPattern);
  -        httpMethodSpec = new HTTPMethodSpec(HTTPMethods, transportType);
  -    }
  -
  -    public boolean equals(Object o) {
  -        if (o == null || !(o instanceof WebUserDataPermission)) return false;
  -
  -        WebUserDataPermission other = (WebUserDataPermission)o;
  -        return urlPatternSpec.equals(other.urlPatternSpec) && httpMethodSpec.equals(other.httpMethodSpec);
  -    }
  -
  -    public String getActions() {
  -        return httpMethodSpec.getActions();
  -    }
  -
  -    public int hashCode() {
  -        if (cachedHashCode == 0) {
  -            cachedHashCode = urlPatternSpec.hashCode() ^ httpMethodSpec.hashCode();
  -        }
  -        return cachedHashCode;
  -    }
  -
  -    public boolean implies(Permission permission) {
  -        if (permission == null || !(permission instanceof WebUserDataPermission)) return
false;
  -
  -        WebUserDataPermission other = (WebUserDataPermission)permission;
  -        return urlPatternSpec.implies(other.urlPatternSpec) && httpMethodSpec.implies(other.httpMethodSpec);
  -    }
  -
  -    public PermissionCollection newPermissionCollection() {
  -    	return new WebUserDataPermissionCollection();
  -    }
  -
  -    private synchronized void readObject(ObjectInputStream in) throws IOException {
  -        urlPatternSpec = new URLPatternSpec(in.readUTF());
  -        httpMethodSpec = new HTTPMethodSpec(in.readUTF());
  -    }
  -
  -    private synchronized void writeObject(ObjectOutputStream out) throws IOException {
  -        out.writeUTF(urlPatternSpec.getPatternSpec());
  -        out.writeUTF(httpMethodSpec.getActions());
  -    }
  -}
  -
  +package javax.security.jacc;
  +
  +import java.io.IOException;
  +
  +import java.io.ObjectInputStream;
  +
  +import java.io.ObjectOutputStream;
  +
  +import java.security.Permission;
  +
  +import java.security.PermissionCollection;
  +
  +import javax.servlet.http.HttpServletRequest;
  +
  +
  +/**
  + * Class for Servlet Web user data permissions. A WebUserDataPermission is a
  + * named permission and has actions.<p>
  + *
  + * The name of a WebUserDataPermission (also referred to as the target name)
  + * identifies a Web resource by its context path relative URL pattern.
  + *
  + * @version $Revision$ $Date$
  + * @see java.security.Permission
  + */
  +public final class WebUserDataPermission extends Permission {
  +
  +    private transient int cachedHashCode = 0;
  +    private transient URLPatternSpec urlPatternSpec;
  +    private transient HTTPMethodSpec httpMethodSpec;
  +
  +    /**
  +     * Creates a new WebUserDataPermission from the HttpServletRequest object.
  +     * 
  +     * @param request the HttpServletRequest object corresponding to the
  +     * Servlet operation to which the permission pertains. The permission
  +     * name is the substring of the requestURI (HttpServletRequest.getRequestURI())
  +     * that begins after the contextPath (HttpServletRequest.getContextPath()).
  +     * When the substring operation yields the string “/”, the permission is
  +     * constructed with the empty string as its name. The HTTP method component
  +     * of the permission’s actions is as obtained from HttpServletRequest.getMethod().
  +     * The TransportType component of the permission’s actions is determined
  +     * by calling HttpServletRequest.isSecure().
  +     */
  +    public WebUserDataPermission(HttpServletRequest request) {
  +        super(request.getServletPath());
  +
  +        urlPatternSpec = new URLPatternSpec(request.getServletPath());
  +        httpMethodSpec = new HTTPMethodSpec(request.getMethod());
  +    }
  +
  +    public WebUserDataPermission(String name, String actions) {
  +        super(name);
  +
  +        urlPatternSpec = new URLPatternSpec(name);
  +        httpMethodSpec = new HTTPMethodSpec(actions, true);
  +    }
  +
  +    public WebUserDataPermission(String urlPattern, String[] HTTPMethods, String transportType)
{
  +        super(urlPattern);
  +
  +        urlPatternSpec = new URLPatternSpec(urlPattern);
  +        httpMethodSpec = new HTTPMethodSpec(HTTPMethods, transportType);
  +    }
  +
  +    public boolean equals(Object o) {
  +        if (o == null || !(o instanceof WebUserDataPermission)) return false;
  +
  +        WebUserDataPermission other = (WebUserDataPermission)o;
  +        return urlPatternSpec.equals(other.urlPatternSpec) && httpMethodSpec.equals(other.httpMethodSpec);
  +    }
  +
  +    public String getActions() {
  +        return httpMethodSpec.getActions();
  +    }
  +
  +    public int hashCode() {
  +        if (cachedHashCode == 0) {
  +            cachedHashCode = urlPatternSpec.hashCode() ^ httpMethodSpec.hashCode();
  +        }
  +        return cachedHashCode;
  +    }
  +
  +    public boolean implies(Permission permission) {
  +        if (permission == null || !(permission instanceof WebUserDataPermission)) return
false;
  +
  +        WebUserDataPermission other = (WebUserDataPermission)permission;
  +        return urlPatternSpec.implies(other.urlPatternSpec) && httpMethodSpec.implies(other.httpMethodSpec);
  +    }
  +
  +    public PermissionCollection newPermissionCollection() {
  +    	return new WebUserDataPermissionCollection();
  +    }
  +
  +    private synchronized void readObject(ObjectInputStream in) throws IOException {
  +        urlPatternSpec = new URLPatternSpec(in.readUTF());
  +        httpMethodSpec = new HTTPMethodSpec(in.readUTF());
  +    }
  +
  +    private synchronized void writeObject(ObjectOutputStream out) throws IOException {
  +        out.writeUTF(urlPatternSpec.getPatternSpec());
  +        out.writeUTF(httpMethodSpec.getActions());
  +    }
  +}
  +
  +
  +
  
  
  

Mime
View raw message