javax.servlet_3.0.0.v201112011016

ServletResponseWrapper
  implements ServletResponse
{
  private ServletResponse response;
  
  public ServletResponseWrapper(ServletResponse response)
  {
    if (response == null) {
      throw new IllegalArgumentException("Response cannot be null");
    }
    this.response = response;
  }
  
  public ServletResponse getResponse()
  {
    return response;
  }
  
  public void setResponse(ServletResponse response)
  {
    if (response == null) {
      throw new IllegalArgumentException("Response cannot be null");
    }
    this.response = response;
  }
  
  public void setCharacterEncoding(String charset)
  {
    response.setCharacterEncoding(charset);
  }
  
  public String getCharacterEncoding()
  {
    return response.getCharacterEncoding();
  }
  
  public ServletOutputStream getOutputStream()
    throws IOException
  {
    return response.getOutputStream();
  }
  
  public PrintWriter getWriter()
    throws IOException
  {
    return response.getWriter();
  }
  
  public void setContentLength(int len)
  {
    response.setContentLength(len);
  }
  
  public void setContentType(String type)
  {
    response.setContentType(type);
  }
  
  public String getContentType()
  {
    return response.getContentType();
  }
  
  public void setBufferSize(int size)
  {
    response.setBufferSize(size);
  }
  
  public int getBufferSize()
  {
    return response.getBufferSize();
  }
  
  public void flushBuffer()
    throws IOException
  {
    response.flushBuffer();
  }
  
  public boolean isCommitted()
  {
    return response.isCommitted();
  }
  
  public void reset()
  {
    response.reset();
  }
  
  public void resetBuffer()
  {
    response.resetBuffer();
  }
  
  public void setLocale(Locale loc)
  {
    response.setLocale(loc);
  }
  
  public Locale getLocale()
  {
    return response.getLocale();
  }
  
  public boolean isWrapperFor(ServletResponse wrapped)
  {
    if (response == wrapped) {
      return true;
    }
    if ((response instanceof ServletResponseWrapper)) {
      return ((ServletResponseWrapper)response).isWrapperFor(wrapped);
    }
    return false;
  }
  
  public boolean isWrapperFor(Class wrappedType)
  {
    if (!ServletResponse.class.isAssignableFrom(wrappedType)) {
      throw new IllegalArgumentException("Given class " + wrappedType.getName() + " not a subinterface of " + ServletResponse.class.getName());
    }
    if (wrappedType.isAssignableFrom(response.getClass())) {
      return true;
    }
    if ((response instanceof ServletResponseWrapper)) {
      return ((ServletResponseWrapper)response).isWrapperFor(wrappedType);
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     javax.servlet.ServletResponseWrapper
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import javax.servlet.annotation.HttpConstraint;
import javax.servlet.annotation.HttpMethodConstraint;
import javax.servlet.annotation.ServletSecurity;

public class ServletSecurityElement
  extends HttpConstraintElement
{
  private Collection<String> methodNames;
  private Collection<HttpMethodConstraintElement> methodConstraints;
  
  public ServletSecurityElement()
  {
    methodConstraints = new HashSet();
    methodNames = Collections.emptySet();
  }
  
  public ServletSecurityElement(HttpConstraintElement constraint)
  {
    super(constraint.getEmptyRoleSemantic(), constraint.getTransportGuarantee(), constraint.getRolesAllowed());
    
    methodConstraints = new HashSet();
    methodNames = Collections.emptySet();
  }
  
  public ServletSecurityElement(Collection<HttpMethodConstraintElement> methodConstraints)
  {
    this.methodConstraints = (methodConstraints == null ? new HashSet() : methodConstraints);
    
    methodNames = checkMethodNames(this.methodConstraints);
  }
  
  public ServletSecurityElement(HttpConstraintElement constraint, Collection<HttpMethodConstraintElement> methodConstraints)
  {
    super(constraint.getEmptyRoleSemantic(), constraint.getTransportGuarantee(), constraint.getRolesAllowed());
    
    this.methodConstraints = (methodConstraints == null ? new HashSet() : methodConstraints);
    
    methodNames = checkMethodNames(this.methodConstraints);
  }
  
  public ServletSecurityElement(ServletSecurity annotation)
  {
    super(annotation.value().value(), annotation.value().transportGuarantee(), annotation.value().rolesAllowed());
    
    methodConstraints = new HashSet();
    for (HttpMethodConstraint constraint : annotation.httpMethodConstraints()) {
      methodConstraints.add(new HttpMethodConstraintElement(constraint.value(), new HttpConstraintElement(constraint.emptyRoleSemantic(), constraint.transportGuarantee(), constraint.rolesAllowed())));
    }
    methodNames = checkMethodNames(methodConstraints);
  }
  
  public Collection<HttpMethodConstraintElement> getHttpMethodConstraints()
  {
    return Collections.unmodifiableCollection(methodConstraints);
  }
  
  public Collection<String> getMethodNames()
  {
    return Collections.unmodifiableCollection(methodNames);
  }
  
  private Collection<String> checkMethodNames(Collection<HttpMethodConstraintElement> methodConstraints)
  {
    Collection<String> methodNames = new HashSet();
    for (HttpMethodConstraintElement methodConstraint : methodConstraints)
    {
      String methodName = methodConstraint.getMethodName();
      if (!methodNames.add(methodName)) {
        throw new IllegalArgumentException("Duplicate HTTP method name: " + methodName);
      }
    }
    return methodNames;
  }
}

/* Location:
 * Qualified Name:     javax.servlet.ServletSecurityElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet;

public abstract interface SessionCookieConfig
{
  public abstract void setName(String paramString);
  
  public abstract String getName();
  
  public abstract void setDomain(String paramString);
  
  public abstract String getDomain();
  
  public abstract void setPath(String paramString);
  
  public abstract String getPath();
  
  public abstract void setComment(String paramString);
  
  public abstract String getComment();
  
  public abstract void setHttpOnly(boolean paramBoolean);
  
  public abstract boolean isHttpOnly();
  
  public abstract void setSecure(boolean paramBoolean);
  
  public abstract boolean isSecure();
  
  public abstract void setMaxAge(int paramInt);
  
  public abstract int getMaxAge();
}

/* Location:
 * Qualified Name:     javax.servlet.SessionCookieConfig
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet;

public enum SessionTrackingMode
{
  COOKIE,  URL,  SSL;
  
  private SessionTrackingMode() {}
}

/* Location:
 * Qualified Name:     javax.servlet.SessionTrackingMode
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet;

/**
 * @deprecated
 */
public abstract interface SingleThreadModel {}

/* Location:
 * Qualified Name:     javax.servlet.SingleThreadModel
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet;

public class UnavailableException
  extends ServletException
{
  private Servlet servlet;
  private boolean permanent;
  private int seconds;
  
  /**
   * @deprecated
   */
  public UnavailableException(Servlet servlet, String msg)
  {
    super(msg);
    this.servlet = servlet;
    permanent = true;
  }
  
  /**
   * @deprecated
   */
  public UnavailableException(int seconds, Servlet servlet, String msg)
  {
    super(msg);
    this.servlet = servlet;
    if (seconds <= 0) {
      this.seconds = -1;
    } else {
      this.seconds = seconds;
    }
    permanent = false;
  }
  
  public UnavailableException(String msg)
  {
    super(msg);
    
    permanent = true;
  }
  
  public UnavailableException(String msg, int seconds)
  {
    super(msg);
    if (seconds <= 0) {
      this.seconds = -1;
    } else {
      this.seconds = seconds;
    }
    permanent = false;
  }
  
  public boolean isPermanent()
  {
    return permanent;
  }
  
  /**
   * @deprecated
   */
  public Servlet getServlet()
  {
    return servlet;
  }
  
  public int getUnavailableSeconds()
  {
    return permanent ? -1 : seconds;
  }
}

/* Location:
 * Qualified Name:     javax.servlet.UnavailableException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.annotation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({java.lang.annotation.ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface HandlesTypes
{
  Class[] value();
}

/* Location:
 * Qualified Name:     javax.servlet.annotation.HandlesTypes
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.annotation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface HttpConstraint
{
  ServletSecurity.EmptyRoleSemantic value() default ServletSecurity.EmptyRoleSemantic.PERMIT;
  
  ServletSecurity.TransportGuarantee transportGuarantee() default ServletSecurity.TransportGuarantee.NONE;
  
  String[] rolesAllowed() default {};
}

/* Location:
 * Qualified Name:     javax.servlet.annotation.HttpConstraint
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.annotation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface HttpMethodConstraint
{
  String value();
  
  ServletSecurity.EmptyRoleSemantic emptyRoleSemantic() default ServletSecurity.EmptyRoleSemantic.PERMIT;
  
  ServletSecurity.TransportGuarantee transportGuarantee() default ServletSecurity.TransportGuarantee.NONE;
  
  String[] rolesAllowed() default {};
}

/* Location:
 * Qualified Name:     javax.servlet.annotation.HttpMethodConstraint
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.annotation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({java.lang.annotation.ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface MultipartConfig
{
  String location() default "";
  
  long maxFileSize() default -1L;
  
  long maxRequestSize() default -1L;
  
  int fileSizeThreshold() default 0;
}

/* Location:
 * Qualified Name:     javax.servlet.annotation.MultipartConfig
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.annotation;

public enum ServletSecurity$EmptyRoleSemantic
{
  PERMIT,  DENY;
  
  private ServletSecurity$EmptyRoleSemantic() {}
}

/* Location:
 * Qualified Name:     javax.servlet.annotation.ServletSecurity.EmptyRoleSemantic
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.annotation;

public enum ServletSecurity$TransportGuarantee
{
  NONE,  CONFIDENTIAL;
  
  private ServletSecurity$TransportGuarantee() {}
}

/* Location:
 * Qualified Name:     javax.servlet.annotation.ServletSecurity.TransportGuarantee
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.annotation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Inherited
@Documented
@Target({java.lang.annotation.ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface ServletSecurity
{
  HttpConstraint value() default @HttpConstraint;
  
  HttpMethodConstraint[] httpMethodConstraints() default {};
  
  public static enum EmptyRoleSemantic
  {
    PERMIT,  DENY;
    
    private EmptyRoleSemantic() {}
  }
  
  public static enum TransportGuarantee
  {
    NONE,  CONFIDENTIAL;
    
    private TransportGuarantee() {}
  }
}

/* Location:
 * Qualified Name:     javax.servlet.annotation.ServletSecurity
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.annotation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.servlet.DispatcherType;

@Target({java.lang.annotation.ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface WebFilter
{
  String description() default "";
  
  String displayName() default "";
  
  WebInitParam[] initParams() default {};
  
  String filterName() default "";
  
  String smallIcon() default "";
  
  String largeIcon() default "";
  
  String[] servletNames() default {};
  
  String[] value() default {};
  
  String[] urlPatterns() default {};
  
  DispatcherType[] dispatcherTypes() default {DispatcherType.REQUEST};
  
  boolean asyncSupported() default false;
}

/* Location:
 * Qualified Name:     javax.servlet.annotation.WebFilter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.annotation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({java.lang.annotation.ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface WebInitParam
{
  String name();
  
  String value();
  
  String description() default "";
}

/* Location:
 * Qualified Name:     javax.servlet.annotation.WebInitParam
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.annotation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({java.lang.annotation.ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface WebListener
{
  String value() default "";
}

/* Location:
 * Qualified Name:     javax.servlet.annotation.WebListener
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.annotation;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({java.lang.annotation.ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface WebServlet
{
  String name() default "";
  
  String[] value() default {};
  
  String[] urlPatterns() default {};
  
  int loadOnStartup() default -1;
  
  WebInitParam[] initParams() default {};
  
  boolean asyncSupported() default false;
  
  String smallIcon() default "";
  
  String largeIcon() default "";
  
  String description() default "";
  
  String displayName() default "";
}

/* Location:
 * Qualified Name:     javax.servlet.annotation.WebServlet
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.descriptor;

import java.util.Collection;

public abstract interface JspConfigDescriptor
{
  public abstract Collection<TaglibDescriptor> getTaglibs();
  
  public abstract Collection<JspPropertyGroupDescriptor> getJspPropertyGroups();
}

/* Location:
 * Qualified Name:     javax.servlet.descriptor.JspConfigDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.descriptor;

import java.util.Collection;

public abstract interface JspPropertyGroupDescriptor
{
  public abstract Collection<String> getUrlPatterns();
  
  public abstract String getElIgnored();
  
  public abstract String getPageEncoding();
  
  public abstract String getScriptingInvalid();
  
  public abstract String getIsXml();
  
  public abstract Collection<String> getIncludePreludes();
  
  public abstract Collection<String> getIncludeCodas();
  
  public abstract String getDeferredSyntaxAllowedAsLiteral();
  
  public abstract String getTrimDirectiveWhitespaces();
  
  public abstract String getDefaultContentType();
  
  public abstract String getBuffer();
  
  public abstract String getErrorOnUndeclaredNamespace();
}

/* Location:
 * Qualified Name:     javax.servlet.descriptor.JspPropertyGroupDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.descriptor;

public abstract interface TaglibDescriptor
{
  public abstract String getTaglibURI();
  
  public abstract String getTaglibLocation();
}

/* Location:
 * Qualified Name:     javax.servlet.descriptor.TaglibDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.http;

import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;

public class Cookie
  implements Cloneable, Serializable
{
  private static final long serialVersionUID = -6454587001725327448L;
  private static final String TSPECIALS;
  private static final String LSTRING_FILE = "javax.servlet.http.LocalStrings";
  private static ResourceBundle lStrings = ResourceBundle.getBundle("javax.servlet.http.LocalStrings");
  private String name;
  private String value;
  private String comment;
  private String domain;
  
  static
  {
    if (Boolean.valueOf(System.getProperty("org.glassfish.web.rfc2109_cookie_names_enforced", "true")).booleanValue()) {
      TSPECIALS = "/()<>@,;:\\\"[]?={} \t";
    } else {
      TSPECIALS = ",; ";
    }
  }
  
  private int maxAge = -1;
  private String path;
  private boolean secure;
  private int version = 0;
  private boolean isHttpOnly = false;
  
  public Cookie(String name, String value)
  {
    if ((name == null) || (name.length() == 0)) {
      throw new IllegalArgumentException(lStrings.getString("err.cookie_name_blank"));
    }
    if ((!isToken(name)) || (name.equalsIgnoreCase("Comment")) || (name.equalsIgnoreCase("Discard")) || (name.equalsIgnoreCase("Domain")) || (name.equalsIgnoreCase("Expires")) || (name.equalsIgnoreCase("Max-Age")) || (name.equalsIgnoreCase("Path")) || (name.equalsIgnoreCase("Secure")) || (name.equalsIgnoreCase("Version")) || (name.startsWith("$")))
    {
      String errMsg = lStrings.getString("err.cookie_name_is_token");
      Object[] errArgs = new Object[1];
      errArgs[0] = name;
      errMsg = MessageFormat.format(errMsg, errArgs);
      throw new IllegalArgumentException(errMsg);
    }
    this.name = name;
    this.value = value;
  }
  
  public void setComment(String purpose)
  {
    comment = purpose;
  }
  
  public String getComment()
  {
    return comment;
  }
  
  public void setDomain(String domain)
  {
    this.domain = domain.toLowerCase(Locale.ENGLISH);
  }
  
  public String getDomain()
  {
    return domain;
  }
  
  public void setMaxAge(int expiry)
  {
    maxAge = expiry;
  }
  
  public int getMaxAge()
  {
    return maxAge;
  }
  
  public void setPath(String uri)
  {
    path = uri;
  }
  
  public String getPath()
  {
    return path;
  }
  
  public void setSecure(boolean flag)
  {
    secure = flag;
  }
  
  public boolean getSecure()
  {
    return secure;
  }
  
  public String getName()
  {
    return name;
  }
  
  public void setValue(String newValue)
  {
    value = newValue;
  }
  
  public String getValue()
  {
    return value;
  }
  
  public int getVersion()
  {
    return version;
  }
  
  public void setVersion(int v)
  {
    version = v;
  }
  
  private boolean isToken(String value)
  {
    int len = value.length();
    for (int i = 0; i < len; i++)
    {
      char c = value.charAt(i);
      if ((c < ' ') || (c >= '') || (TSPECIALS.indexOf(c) != -1)) {
        return false;
      }
    }
    return true;
  }
  
  public Object clone()
  {
    try
    {
      return super.clone();
    }
    catch (CloneNotSupportedException e)
    {
      throw new RuntimeException(e.getMessage());
    }
  }
  
  public void setHttpOnly(boolean isHttpOnly)
  {
    this.isHttpOnly = isHttpOnly;
  }
  
  public boolean isHttpOnly()
  {
    return isHttpOnly;
  }
}

/* Location:
 * Qualified Name:     javax.servlet.http.Cookie
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.http;

import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.text.MessageFormat;
import java.util.Enumeration;
import java.util.ResourceBundle;
import javax.servlet.GenericServlet;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public abstract class HttpServlet
  extends GenericServlet
  implements Serializable
{
  private static final String METHOD_DELETE = "DELETE";
  private static final String METHOD_HEAD = "HEAD";
  private static final String METHOD_GET = "GET";
  private static final String METHOD_OPTIONS = "OPTIONS";
  private static final String METHOD_POST = "POST";
  private static final String METHOD_PUT = "PUT";
  private static final String METHOD_TRACE = "TRACE";
  private static final String HEADER_IFMODSINCE = "If-Modified-Since";
  private static final String HEADER_LASTMOD = "Last-Modified";
  private static final String LSTRING_FILE = "javax.servlet.http.LocalStrings";
  private static ResourceBundle lStrings = ResourceBundle.getBundle("javax.servlet.http.LocalStrings");
  
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException
  {
    String protocol = req.getProtocol();
    String msg = lStrings.getString("http.method_get_not_supported");
    if (protocol.endsWith("1.1")) {
      resp.sendError(405, msg);
    } else {
      resp.sendError(400, msg);
    }
  }
  
  protected long getLastModified(HttpServletRequest req)
  {
    return -1L;
  }
  
  protected void doHead(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException
  {
    NoBodyResponse response = new NoBodyResponse(resp);
    
    doGet(req, response);
    response.setContentLength();
  }
  
  protected void doPost(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException
  {
    String protocol = req.getProtocol();
    String msg = lStrings.getString("http.method_post_not_supported");
    if (protocol.endsWith("1.1")) {
      resp.sendError(405, msg);
    } else {
      resp.sendError(400, msg);
    }
  }
  
  protected void doPut(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException
  {
    String protocol = req.getProtocol();
    String msg = lStrings.getString("http.method_put_not_supported");
    if (protocol.endsWith("1.1")) {
      resp.sendError(405, msg);
    } else {
      resp.sendError(400, msg);
    }
  }
  
  protected void doDelete(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException
  {
    String protocol = req.getProtocol();
    String msg = lStrings.getString("http.method_delete_not_supported");
    if (protocol.endsWith("1.1")) {
      resp.sendError(405, msg);
    } else {
      resp.sendError(400, msg);
    }
  }
  
  private Method[] getAllDeclaredMethods(Class<?> c)
  {
    if (c.equals(HttpServlet.class)) {
      return null;
    }
    Method[] parentMethods = getAllDeclaredMethods(c.getSuperclass());
    Method[] thisMethods = c.getDeclaredMethods();
    if ((parentMethods != null) && (parentMethods.length > 0))
    {
      Method[] allMethods = new Method[parentMethods.length + thisMethods.length];
      
      System.arraycopy(parentMethods, 0, allMethods, 0, parentMethods.length);
      
      System.arraycopy(thisMethods, 0, allMethods, parentMethods.length, thisMethods.length);
      
      thisMethods = allMethods;
    }
    return thisMethods;
  }
  
  protected void doOptions(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException
  {
    Method[] methods = getAllDeclaredMethods(getClass());
    
    boolean ALLOW_GET = false;
    boolean ALLOW_HEAD = false;
    boolean ALLOW_POST = false;
    boolean ALLOW_PUT = false;
    boolean ALLOW_DELETE = false;
    boolean ALLOW_TRACE = true;
    boolean ALLOW_OPTIONS = true;
    for (int i = 0; i < methods.length; i++)
    {
      Method m = methods[i];
      if (m.getName().equals("doGet"))
      {
        ALLOW_GET = true;
        ALLOW_HEAD = true;
      }
      if (m.getName().equals("doPost")) {
        ALLOW_POST = true;
      }
      if (m.getName().equals("doPut")) {
        ALLOW_PUT = true;
      }
      if (m.getName().equals("doDelete")) {
        ALLOW_DELETE = true;
      }
    }
    String allow = null;
    if (ALLOW_GET) {
      allow = "GET";
    }
    if (ALLOW_HEAD) {
      if (allow == null) {
        allow = "HEAD";
      } else {
        allow = allow + ", HEAD";
      }
    }
    if (ALLOW_POST) {
      if (allow == null) {
        allow = "POST";
      } else {
        allow = allow + ", POST";
      }
    }
    if (ALLOW_PUT) {
      if (allow == null) {
        allow = "PUT";
      } else {
        allow = allow + ", PUT";
      }
    }
    if (ALLOW_DELETE) {
      if (allow == null) {
        allow = "DELETE";
      } else {
        allow = allow + ", DELETE";
      }
    }
    if (ALLOW_TRACE) {
      if (allow == null) {
        allow = "TRACE";
      } else {
        allow = allow + ", TRACE";
      }
    }
    if (ALLOW_OPTIONS) {
      if (allow == null) {
        allow = "OPTIONS";
      } else {
        allow = allow + ", OPTIONS";
      }
    }
    resp.setHeader("Allow", allow);
  }
  
  protected void doTrace(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException
  {
    String CRLF = "\r\n";
    StringBuilder buffer = new StringBuilder("TRACE ").append(req.getRequestURI()).append(" ").append(req.getProtocol());
    
    Enumeration<String> reqHeaderEnum = req.getHeaderNames();
    while (reqHeaderEnum.hasMoreElements())
    {
      String headerName = (String)reqHeaderEnum.nextElement();
      buffer.append(CRLF).append(headerName).append(": ").append(req.getHeader(headerName));
    }
    buffer.append(CRLF);
    
    int responseLength = buffer.length();
    
    resp.setContentType("message/http");
    resp.setContentLength(responseLength);
    ServletOutputStream out = resp.getOutputStream();
    out.print(buffer.toString());
  }
  
  protected void service(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException
  {
    String method = req.getMethod();
    if (method.equals("GET"))
    {
      long lastModified = getLastModified(req);
      if (lastModified == -1L)
      {
        doGet(req, resp);
      }
      else
      {
        long ifModifiedSince = req.getDateHeader("If-Modified-Since");
        if (ifModifiedSince < lastModified)
        {
          maybeSetLastModified(resp, lastModified);
          doGet(req, resp);
        }
        else
        {
          resp.setStatus(304);
        }
      }
    }
    else if (method.equals("HEAD"))
    {
      long lastModified = getLastModified(req);
      maybeSetLastModified(resp, lastModified);
      doHead(req, resp);
    }
    else if (method.equals("POST"))
    {
      doPost(req, resp);
    }
    else if (method.equals("PUT"))
    {
      doPut(req, resp);
    }
    else if (method.equals("DELETE"))
    {
      doDelete(req, resp);
    }
    else if (method.equals("OPTIONS"))
    {
      doOptions(req, resp);
    }
    else if (method.equals("TRACE"))
    {
      doTrace(req, resp);
    }
    else
    {
      String errMsg = lStrings.getString("http.method_not_implemented");
      Object[] errArgs = new Object[1];
      errArgs[0] = method;
      errMsg = MessageFormat.format(errMsg, errArgs);
      
      resp.sendError(501, errMsg);
    }
  }
  
  private void maybeSetLastModified(HttpServletResponse resp, long lastModified)
  {
    if (resp.containsHeader("Last-Modified")) {
      return;
    }
    if (lastModified >= 0L) {
      resp.setDateHeader("Last-Modified", lastModified);
    }
  }
  
  public void service(ServletRequest req, ServletResponse res)
    throws ServletException, IOException
  {
    HttpServletRequest request;
    HttpServletResponse response;
    try
    {
      request = (HttpServletRequest)req;
      response = (HttpServletResponse)res;
    }
    catch (ClassCastException e)
    {
      throw new ServletException("non-HTTP request or response");
    }
    service(request, response);
  }
}

/* Location:
 * Qualified Name:     javax.servlet.http.HttpServlet
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.http;

import java.io.IOException;
import java.security.Principal;
import java.util.Collection;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;

public abstract interface HttpServletRequest
  extends ServletRequest
{
  public static final String BASIC_AUTH = "BASIC";
  public static final String FORM_AUTH = "FORM";
  public static final String CLIENT_CERT_AUTH = "CLIENT_CERT";
  public static final String DIGEST_AUTH = "DIGEST";
  
  public abstract String getAuthType();
  
  public abstract Cookie[] getCookies();
  
  public abstract long getDateHeader(String paramString);
  
  public abstract String getHeader(String paramString);
  
  public abstract Enumeration<String> getHeaders(String paramString);
  
  public abstract Enumeration<String> getHeaderNames();
  
  public abstract int getIntHeader(String paramString);
  
  public abstract String getMethod();
  
  public abstract String getPathInfo();
  
  public abstract String getPathTranslated();
  
  public abstract String getContextPath();
  
  public abstract String getQueryString();
  
  public abstract String getRemoteUser();
  
  public abstract boolean isUserInRole(String paramString);
  
  public abstract Principal getUserPrincipal();
  
  public abstract String getRequestedSessionId();
  
  public abstract String getRequestURI();
  
  public abstract StringBuffer getRequestURL();
  
  public abstract String getServletPath();
  
  public abstract HttpSession getSession(boolean paramBoolean);
  
  public abstract HttpSession getSession();
  
  public abstract boolean isRequestedSessionIdValid();
  
  public abstract boolean isRequestedSessionIdFromCookie();
  
  public abstract boolean isRequestedSessionIdFromURL();
  
  /**
   * @deprecated
   */
  public abstract boolean isRequestedSessionIdFromUrl();
  
  public abstract boolean authenticate(HttpServletResponse paramHttpServletResponse)
    throws IOException, ServletException;
  
  public abstract void login(String paramString1, String paramString2)
    throws ServletException;
  
  public abstract void logout()
    throws ServletException;
  
  public abstract Collection<Part> getParts()
    throws IOException, ServletException;
  
  public abstract Part getPart(String paramString)
    throws IOException, ServletException;
}

/* Location:
 * Qualified Name:     javax.servlet.http.HttpServletRequest
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.http;

import java.io.IOException;
import java.security.Principal;
import java.util.Collection;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.ServletRequestWrapper;

public class HttpServletRequestWrapper
  extends ServletRequestWrapper
  implements HttpServletRequest
{
  public HttpServletRequestWrapper(HttpServletRequest request)
  {
    super(request);
  }
  
  private HttpServletRequest _getHttpServletRequest()
  {
    return (HttpServletRequest)super.getRequest();
  }
  
  public String getAuthType()
  {
    return _getHttpServletRequest().getAuthType();
  }
  
  public Cookie[] getCookies()
  {
    return _getHttpServletRequest().getCookies();
  }
  
  public long getDateHeader(String name)
  {
    return _getHttpServletRequest().getDateHeader(name);
  }
  
  public String getHeader(String name)
  {
    return _getHttpServletRequest().getHeader(name);
  }
  
  public Enumeration<String> getHeaders(String name)
  {
    return _getHttpServletRequest().getHeaders(name);
  }
  
  public Enumeration<String> getHeaderNames()
  {
    return _getHttpServletRequest().getHeaderNames();
  }
  
  public int getIntHeader(String name)
  {
    return _getHttpServletRequest().getIntHeader(name);
  }
  
  public String getMethod()
  {
    return _getHttpServletRequest().getMethod();
  }
  
  public String getPathInfo()
  {
    return _getHttpServletRequest().getPathInfo();
  }
  
  public String getPathTranslated()
  {
    return _getHttpServletRequest().getPathTranslated();
  }
  
  public String getContextPath()
  {
    return _getHttpServletRequest().getContextPath();
  }
  
  public String getQueryString()
  {
    return _getHttpServletRequest().getQueryString();
  }
  
  public String getRemoteUser()
  {
    return _getHttpServletRequest().getRemoteUser();
  }
  
  public boolean isUserInRole(String role)
  {
    return _getHttpServletRequest().isUserInRole(role);
  }
  
  public Principal getUserPrincipal()
  {
    return _getHttpServletRequest().getUserPrincipal();
  }
  
  public String getRequestedSessionId()
  {
    return _getHttpServletRequest().getRequestedSessionId();
  }
  
  public String getRequestURI()
  {
    return _getHttpServletRequest().getRequestURI();
  }
  
  public StringBuffer getRequestURL()
  {
    return _getHttpServletRequest().getRequestURL();
  }
  
  public String getServletPath()
  {
    return _getHttpServletRequest().getServletPath();
  }
  
  public HttpSession getSession(boolean create)
  {
    return _getHttpServletRequest().getSession(create);
  }
  
  public HttpSession getSession()
  {
    return _getHttpServletRequest().getSession();
  }
  
  public boolean isRequestedSessionIdValid()
  {
    return _getHttpServletRequest().isRequestedSessionIdValid();
  }
  
  public boolean isRequestedSessionIdFromCookie()
  {
    return _getHttpServletRequest().isRequestedSessionIdFromCookie();
  }
  
  public boolean isRequestedSessionIdFromURL()
  {
    return _getHttpServletRequest().isRequestedSessionIdFromURL();
  }
  
  public boolean isRequestedSessionIdFromUrl()
  {
    return _getHttpServletRequest().isRequestedSessionIdFromUrl();
  }
  
  public boolean authenticate(HttpServletResponse response)
    throws IOException, ServletException
  {
    return _getHttpServletRequest().authenticate(response);
  }
  
  public void login(String username, String password)
    throws ServletException
  {
    _getHttpServletRequest().login(username, password);
  }
  
  public void logout()
    throws ServletException
  {
    _getHttpServletRequest().logout();
  }
  
  public Collection<Part> getParts()
    throws IOException, ServletException
  {
    return _getHttpServletRequest().getParts();
  }
  
  public Part getPart(String name)
    throws IOException, ServletException
  {
    return _getHttpServletRequest().getPart(name);
  }
}

/* Location:
 * Qualified Name:     javax.servlet.http.HttpServletRequestWrapper
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.http;

import java.io.IOException;
import java.util.Collection;
import javax.servlet.ServletResponse;

public abstract interface HttpServletResponse
  extends ServletResponse
{
  public static final int SC_CONTINUE = 100;
  public static final int SC_SWITCHING_PROTOCOLS = 101;
  public static final int SC_OK = 200;
  public static final int SC_CREATED = 201;
  public static final int SC_ACCEPTED = 202;
  public static final int SC_NON_AUTHORITATIVE_INFORMATION = 203;
  public static final int SC_NO_CONTENT = 204;
  public static final int SC_RESET_CONTENT = 205;
  public static final int SC_PARTIAL_CONTENT = 206;
  public static final int SC_MULTIPLE_CHOICES = 300;
  public static final int SC_MOVED_PERMANENTLY = 301;
  public static final int SC_MOVED_TEMPORARILY = 302;
  public static final int SC_FOUND = 302;
  public static final int SC_SEE_OTHER = 303;
  public static final int SC_NOT_MODIFIED = 304;
  public static final int SC_USE_PROXY = 305;
  public static final int SC_TEMPORARY_REDIRECT = 307;
  public static final int SC_BAD_REQUEST = 400;
  public static final int SC_UNAUTHORIZED = 401;
  public static final int SC_PAYMENT_REQUIRED = 402;
  public static final int SC_FORBIDDEN = 403;
  public static final int SC_NOT_FOUND = 404;
  public static final int SC_METHOD_NOT_ALLOWED = 405;
  public static final int SC_NOT_ACCEPTABLE = 406;
  public static final int SC_PROXY_AUTHENTICATION_REQUIRED = 407;
  public static final int SC_REQUEST_TIMEOUT = 408;
  public static final int SC_CONFLICT = 409;
  public static final int SC_GONE = 410;
  public static final int SC_LENGTH_REQUIRED = 411;
  public static final int SC_PRECONDITION_FAILED = 412;
  public static final int SC_REQUEST_ENTITY_TOO_LARGE = 413;
  public static final int SC_REQUEST_URI_TOO_LONG = 414;
  public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415;
  public static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
  public static final int SC_EXPECTATION_FAILED = 417;
  public static final int SC_INTERNAL_SERVER_ERROR = 500;
  public static final int SC_NOT_IMPLEMENTED = 501;
  public static final int SC_BAD_GATEWAY = 502;
  public static final int SC_SERVICE_UNAVAILABLE = 503;
  public static final int SC_GATEWAY_TIMEOUT = 504;
  public static final int SC_HTTP_VERSION_NOT_SUPPORTED = 505;
  
  public abstract void addCookie(Cookie paramCookie);
  
  public abstract boolean containsHeader(String paramString);
  
  public abstract String encodeURL(String paramString);
  
  public abstract String encodeRedirectURL(String paramString);
  
  /**
   * @deprecated
   */
  public abstract String encodeUrl(String paramString);
  
  /**
   * @deprecated
   */
  public abstract String encodeRedirectUrl(String paramString);
  
  public abstract void sendError(int paramInt, String paramString)
    throws IOException;
  
  public abstract void sendError(int paramInt)
    throws IOException;
  
  public abstract void sendRedirect(String paramString)
    throws IOException;
  
  public abstract void setDateHeader(String paramString, long paramLong);
  
  public abstract void addDateHeader(String paramString, long paramLong);
  
  public abstract void setHeader(String paramString1, String paramString2);
  
  public abstract void addHeader(String paramString1, String paramString2);
  
  public abstract void setIntHeader(String paramString, int paramInt);
  
  public abstract void addIntHeader(String paramString, int paramInt);
  
  public abstract void setStatus(int paramInt);
  
  /**
   * @deprecated
   */
  public abstract void setStatus(int paramInt, String paramString);
  
  public abstract int getStatus();
  
  public abstract String getHeader(String paramString);
  
  public abstract Collection<String> getHeaders(String paramString);
  
  public abstract Collection<String> getHeaderNames();
}

/* Location:
 * Qualified Name:     javax.servlet.http.HttpServletResponse
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package javax.servlet.http;

import java.io.IOException;
import java.util.Collection;
import javax.servlet.ServletResponseWrapper;

public class HttpServletResponseWrapper
  extends ServletResponseWrapper
  implements HttpServletResponse
{
  public HttpServletResponseWrapper(HttpServletResponse response)
  {
    super(response);
  }
  
  private HttpServletResponse _getHttpServletResponse()
  {
    return (HttpServletResponse)sup
1 2 3

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd