servlet-api-2.5

16:52:49.487 INFO  jd.cli.Main - Decompiling servlet-api-2.5.jar
package javax.servlet;

import java.io.IOException;

public abstract interface Filter
{
  public abstract void init(FilterConfig paramFilterConfig)
    throws ServletException;
  
  public abstract void doFilter(ServletRequest paramServletRequest, ServletResponse paramServletResponse, FilterChain paramFilterChain)
    throws IOException, ServletException;
  
  public abstract void destroy();
}

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

import java.io.IOException;

public abstract interface FilterChain
{
  public abstract void doFilter(ServletRequest paramServletRequest, ServletResponse paramServletResponse)
    throws IOException, ServletException;
}

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

import java.util.Enumeration;

public abstract interface FilterConfig
{
  public abstract String getFilterName();
  
  public abstract ServletContext getServletContext();
  
  public abstract String getInitParameter(String paramString);
  
  public abstract Enumeration getInitParameterNames();
}

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

import java.io.IOException;
import java.io.Serializable;
import java.util.Enumeration;
import java.util.ResourceBundle;

public abstract class GenericServlet
  implements Servlet, ServletConfig, Serializable
{
  private static final String LSTRING_FILE = "javax.servlet.LocalStrings";
  private static ResourceBundle lStrings = ResourceBundle.getBundle("javax.servlet.LocalStrings");
  private transient ServletConfig config;
  
  public void destroy() {}
  
  public String getInitParameter(String name)
  {
    ServletConfig sc = getServletConfig();
    if (sc == null) {
      throw new IllegalStateException(lStrings.getString("err.servlet_config_not_initialized"));
    }
    return sc.getInitParameter(name);
  }
  
  public Enumeration getInitParameterNames()
  {
    ServletConfig sc = getServletConfig();
    if (sc == null) {
      throw new IllegalStateException(lStrings.getString("err.servlet_config_not_initialized"));
    }
    return sc.getInitParameterNames();
  }
  
  public ServletConfig getServletConfig()
  {
    return config;
  }
  
  public ServletContext getServletContext()
  {
    ServletConfig sc = getServletConfig();
    if (sc == null) {
      throw new IllegalStateException(lStrings.getString("err.servlet_config_not_initialized"));
    }
    return sc.getServletContext();
  }
  
  public String getServletInfo()
  {
    return "";
  }
  
  public void init(ServletConfig config)
    throws ServletException
  {
    this.config = config;
    init();
  }
  
  public void init()
    throws ServletException
  {}
  
  public void log(String msg)
  {
    getServletContext().log(getServletName() + ": " + msg);
  }
  
  public void log(String message, Throwable t)
  {
    getServletContext().log(getServletName() + ": " + message, t);
  }
  
  public abstract void service(ServletRequest paramServletRequest, ServletResponse paramServletResponse)
    throws ServletException, IOException;
  
  public String getServletName()
  {
    ServletConfig sc = getServletConfig();
    if (sc == null) {
      throw new IllegalStateException(lStrings.getString("err.servlet_config_not_initialized"));
    }
    return sc.getServletName();
  }
}

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

import java.io.IOException;

public abstract interface RequestDispatcher
{
  public abstract void forward(ServletRequest paramServletRequest, ServletResponse paramServletResponse)
    throws ServletException, IOException;
  
  public abstract void include(ServletRequest paramServletRequest, ServletResponse paramServletResponse)
    throws ServletException, IOException;
}

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

import java.io.IOException;

public abstract interface Servlet
{
  public abstract void init(ServletConfig paramServletConfig)
    throws ServletException;
  
  public abstract ServletConfig getServletConfig();
  
  public abstract void service(ServletRequest paramServletRequest, ServletResponse paramServletResponse)
    throws ServletException, IOException;
  
  public abstract String getServletInfo();
  
  public abstract void destroy();
}

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

import java.util.Enumeration;

public abstract interface ServletConfig
{
  public abstract String getServletName();
  
  public abstract ServletContext getServletContext();
  
  public abstract String getInitParameter(String paramString);
  
  public abstract Enumeration getInitParameterNames();
}

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

import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;
import java.util.Set;

public abstract interface ServletContext
{
  public abstract String getContextPath();
  
  public abstract ServletContext getContext(String paramString);
  
  public abstract int getMajorVersion();
  
  public abstract int getMinorVersion();
  
  public abstract String getMimeType(String paramString);
  
  public abstract Set getResourcePaths(String paramString);
  
  public abstract URL getResource(String paramString)
    throws MalformedURLException;
  
  public abstract InputStream getResourceAsStream(String paramString);
  
  public abstract RequestDispatcher getRequestDispatcher(String paramString);
  
  public abstract RequestDispatcher getNamedDispatcher(String paramString);
  
  /**
   * @deprecated
   */
  public abstract Servlet getServlet(String paramString)
    throws ServletException;
  
  /**
   * @deprecated
   */
  public abstract Enumeration getServlets();
  
  /**
   * @deprecated
   */
  public abstract Enumeration getServletNames();
  
  public abstract void log(String paramString);
  
  /**
   * @deprecated
   */
  public abstract void log(Exception paramException, String paramString);
  
  public abstract void log(String paramString, Throwable paramThrowable);
  
  public abstract String getRealPath(String paramString);
  
  public abstract String getServerInfo();
  
  public abstract String getInitParameter(String paramString);
  
  public abstract Enumeration getInitParameterNames();
  
  public abstract Object getAttribute(String paramString);
  
  public abstract Enumeration getAttributeNames();
  
  public abstract void setAttribute(String paramString, Object paramObject);
  
  public abstract void removeAttribute(String paramString);
  
  public abstract String getServletContextName();
}

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

public class ServletContextAttributeEvent
  extends ServletContextEvent
{
  private String name;
  private Object value;
  
  public ServletContextAttributeEvent(ServletContext source, String name, Object value)
  {
    super(source);
    this.name = name;
    this.value = value;
  }
  
  public String getName()
  {
    return name;
  }
  
  public Object getValue()
  {
    return value;
  }
}

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

import java.util.EventListener;

public abstract interface ServletContextAttributeListener
  extends EventListener
{
  public abstract void attributeAdded(ServletContextAttributeEvent paramServletContextAttributeEvent);
  
  public abstract void attributeRemoved(ServletContextAttributeEvent paramServletContextAttributeEvent);
  
  public abstract void attributeReplaced(ServletContextAttributeEvent paramServletContextAttributeEvent);
}

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

import java.util.EventObject;

public class ServletContextEvent
  extends EventObject
{
  public ServletContextEvent(ServletContext source)
  {
    super(source);
  }
  
  public ServletContext getServletContext()
  {
    return (ServletContext)super.getSource();
  }
}

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

import java.util.EventListener;

public abstract interface ServletContextListener
  extends EventListener
{
  public abstract void contextInitialized(ServletContextEvent paramServletContextEvent);
  
  public abstract void contextDestroyed(ServletContextEvent paramServletContextEvent);
}

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

public class ServletException
  extends Exception
{
  private Throwable rootCause;
  
  public ServletException() {}
  
  public ServletException(String message)
  {
    super(message);
  }
  
  public ServletException(String message, Throwable rootCause)
  {
    super(message, rootCause);
    this.rootCause = rootCause;
  }
  
  public ServletException(Throwable rootCause)
  {
    super(rootCause);
    this.rootCause = rootCause;
  }
  
  public Throwable getRootCause()
  {
    return rootCause;
  }
}

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

import java.io.IOException;
import java.io.InputStream;

public abstract class ServletInputStream
  extends InputStream
{
  public int readLine(byte[] b, int off, int len)
    throws IOException
  {
    if (len <= 0) {
      return 0;
    }
    int count = 0;
    int c;
    while ((c = read()) != -1)
    {
      b[(off++)] = ((byte)c);
      count++;
      if (c != 10) {
        if (count == len) {
          break;
        }
      }
    }
    return count > 0 ? count : -1;
  }
}

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

import java.io.CharConversionException;
import java.io.IOException;
import java.io.OutputStream;
import java.text.MessageFormat;
import java.util.ResourceBundle;

public abstract class ServletOutputStream
  extends OutputStream
{
  private static final String LSTRING_FILE = "javax.servlet.LocalStrings";
  private static ResourceBundle lStrings = ResourceBundle.getBundle("javax.servlet.LocalStrings");
  
  public void print(String s)
    throws IOException
  {
    if (s == null) {
      s = "null";
    }
    int len = s.length();
    for (int i = 0; i < len; i++)
    {
      char c = s.charAt(i);
      if ((c & 0xFF00) != 0)
      {
        String errMsg = lStrings.getString("err.not_iso8859_1");
        Object[] errArgs = new Object[1];
        errArgs[0] = new Character(c);
        errMsg = MessageFormat.format(errMsg, errArgs);
        throw new CharConversionException(errMsg);
      }
      write(c);
    }
  }
  
  public void print(boolean b)
    throws IOException
  {
    String msg;
    String msg;
    if (b) {
      msg = lStrings.getString("value.true");
    } else {
      msg = lStrings.getString("value.false");
    }
    print(msg);
  }
  
  public void print(char c)
    throws IOException
  {
    print(String.valueOf(c));
  }
  
  public void print(int i)
    throws IOException
  {
    print(String.valueOf(i));
  }
  
  public void print(long l)
    throws IOException
  {
    print(String.valueOf(l));
  }
  
  public void print(float f)
    throws IOException
  {
    print(String.valueOf(f));
  }
  
  public void print(double d)
    throws IOException
  {
    print(String.valueOf(d));
  }
  
  public void println()
    throws IOException
  {
    print("\r\n");
  }
  
  public void println(String s)
    throws IOException
  {
    print(s);
    println();
  }
  
  public void println(boolean b)
    throws IOException
  {
    print(b);
    println();
  }
  
  public void println(char c)
    throws IOException
  {
    print(c);
    println();
  }
  
  public void println(int i)
    throws IOException
  {
    print(i);
    println();
  }
  
  public void println(long l)
    throws IOException
  {
    print(l);
    println();
  }
  
  public void println(float f)
    throws IOException
  {
    print(f);
    println();
  }
  
  public void println(double d)
    throws IOException
  {
    print(d);
    println();
  }
}

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;

public abstract interface ServletRequest
{
  public abstract Object getAttribute(String paramString);
  
  public abstract Enumeration getAttributeNames();
  
  public abstract String getCharacterEncoding();
  
  public abstract void setCharacterEncoding(String paramString)
    throws UnsupportedEncodingException;
  
  public abstract int getContentLength();
  
  public abstract String getContentType();
  
  public abstract ServletInputStream getInputStream()
    throws IOException;
  
  public abstract String getParameter(String paramString);
  
  public abstract Enumeration getParameterNames();
  
  public abstract String[] getParameterValues(String paramString);
  
  public abstract Map getParameterMap();
  
  public abstract String getProtocol();
  
  public abstract String getScheme();
  
  public abstract String getServerName();
  
  public abstract int getServerPort();
  
  public abstract BufferedReader getReader()
    throws IOException;
  
  public abstract String getRemoteAddr();
  
  public abstract String getRemoteHost();
  
  public abstract void setAttribute(String paramString, Object paramObject);
  
  public abstract void removeAttribute(String paramString);
  
  public abstract Locale getLocale();
  
  public abstract Enumeration getLocales();
  
  public abstract boolean isSecure();
  
  public abstract RequestDispatcher getRequestDispatcher(String paramString);
  
  /**
   * @deprecated
   */
  public abstract String getRealPath(String paramString);
  
  public abstract int getRemotePort();
  
  public abstract String getLocalName();
  
  public abstract String getLocalAddr();
  
  public abstract int getLocalPort();
}

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

public class ServletRequestAttributeEvent
  extends ServletRequestEvent
{
  private String name;
  private Object value;
  
  public ServletRequestAttributeEvent(ServletContext sc, ServletRequest request, String name, Object value)
  {
    super(sc, request);
    this.name = name;
    this.value = value;
  }
  
  public String getName()
  {
    return name;
  }
  
  public Object getValue()
  {
    return value;
  }
}

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

import java.util.EventListener;

public abstract interface ServletRequestAttributeListener
  extends EventListener
{
  public abstract void attributeAdded(ServletRequestAttributeEvent paramServletRequestAttributeEvent);
  
  public abstract void attributeRemoved(ServletRequestAttributeEvent paramServletRequestAttributeEvent);
  
  public abstract void attributeReplaced(ServletRequestAttributeEvent paramServletRequestAttributeEvent);
}

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

import java.util.EventObject;

public class ServletRequestEvent
  extends EventObject
{
  private ServletRequest request;
  
  public ServletRequestEvent(ServletContext sc, ServletRequest request)
  {
    super(sc);
    this.request = request;
  }
  
  public ServletRequest getServletRequest()
  {
    return request;
  }
  
  public ServletContext getServletContext()
  {
    return (ServletContext)super.getSource();
  }
}

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

import java.util.EventListener;

public abstract interface ServletRequestListener
  extends EventListener
{
  public abstract void requestDestroyed(ServletRequestEvent paramServletRequestEvent);
  
  public abstract void requestInitialized(ServletRequestEvent paramServletRequestEvent);
}

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;

public class ServletRequestWrapper
  implements ServletRequest
{
  private ServletRequest request;
  
  public ServletRequestWrapper(ServletRequest request)
  {
    if (request == null) {
      throw new IllegalArgumentException("Request cannot be null");
    }
    this.request = request;
  }
  
  public ServletRequest getRequest()
  {
    return request;
  }
  
  public void setRequest(ServletRequest request)
  {
    if (request == null) {
      throw new IllegalArgumentException("Request cannot be null");
    }
    this.request = request;
  }
  
  public Object getAttribute(String name)
  {
    return request.getAttribute(name);
  }
  
  public Enumeration getAttributeNames()
  {
    return request.getAttributeNames();
  }
  
  public String getCharacterEncoding()
  {
    return request.getCharacterEncoding();
  }
  
  public void setCharacterEncoding(String enc)
    throws UnsupportedEncodingException
  {
    request.setCharacterEncoding(enc);
  }
  
  public int getContentLength()
  {
    return request.getContentLength();
  }
  
  public String getContentType()
  {
    return request.getContentType();
  }
  
  public ServletInputStream getInputStream()
    throws IOException
  {
    return request.getInputStream();
  }
  
  public String getParameter(String name)
  {
    return request.getParameter(name);
  }
  
  public Map getParameterMap()
  {
    return request.getParameterMap();
  }
  
  public Enumeration getParameterNames()
  {
    return request.getParameterNames();
  }
  
  public String[] getParameterValues(String name)
  {
    return request.getParameterValues(name);
  }
  
  public String getProtocol()
  {
    return request.getProtocol();
  }
  
  public String getScheme()
  {
    return request.getScheme();
  }
  
  public String getServerName()
  {
    return request.getServerName();
  }
  
  public int getServerPort()
  {
    return request.getServerPort();
  }
  
  public BufferedReader getReader()
    throws IOException
  {
    return request.getReader();
  }
  
  public String getRemoteAddr()
  {
    return request.getRemoteAddr();
  }
  
  public String getRemoteHost()
  {
    return request.getRemoteHost();
  }
  
  public void setAttribute(String name, Object o)
  {
    request.setAttribute(name, o);
  }
  
  public void removeAttribute(String name)
  {
    request.removeAttribute(name);
  }
  
  public Locale getLocale()
  {
    return request.getLocale();
  }
  
  public Enumeration getLocales()
  {
    return request.getLocales();
  }
  
  public boolean isSecure()
  {
    return request.isSecure();
  }
  
  public RequestDispatcher getRequestDispatcher(String path)
  {
    return request.getRequestDispatcher(path);
  }
  
  public String getRealPath(String path)
  {
    return request.getRealPath(path);
  }
  
  public int getRemotePort()
  {
    return request.getRemotePort();
  }
  
  public String getLocalName()
  {
    return request.getLocalName();
  }
  
  public String getLocalAddr()
  {
    return request.getLocalAddr();
  }
  
  public int getLocalPort()
  {
    return request.getLocalPort();
  }
}

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

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Locale;

public abstract interface ServletResponse
{
  public abstract String getCharacterEncoding();
  
  public abstract String getContentType();
  
  public abstract ServletOutputStream getOutputStream()
    throws IOException;
  
  public abstract PrintWriter getWriter()
    throws IOException;
  
  public abstract void setCharacterEncoding(String paramString);
  
  public abstract void setContentLength(int paramInt);
  
  public abstract void setContentType(String paramString);
  
  public abstract void setBufferSize(int paramInt);
  
  public abstract int getBufferSize();
  
  public abstract void flushBuffer()
    throws IOException;
  
  public abstract void resetBuffer();
  
  public abstract boolean isCommitted();
  
  public abstract void reset();
  
  public abstract void setLocale(Locale paramLocale);
  
  public abstract Locale getLocale();
}

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

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Locale;

public class 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();
  }
}

/* Location:
 * Qualified Name:     javax.servlet.ServletResponseWrapper
 * 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.http;

import java.text.MessageFormat;
import java.util.ResourceBundle;

public class Cookie
  implements Cloneable
{
  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;
  private int maxAge = -1;
  private String path;
  private boolean secure;
  private int version = 0;
  private static final String tspecials = ",; ";
  
  public Cookie(String name, String value)
  {
    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 pattern)
  {
    domain = pattern.toLowerCase();
  }
  
  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 >= '') || (",; ".indexOf(c) != -1)) {
        return false;
      }
    }
    return true;
  }
  
  public Object clone()
  {
    try
    {
      return super.clone();
    }
    catch (CloneNotSupportedException e)
    {
      throw new RuntimeException(e.getMessage());
    }
  }
}

/* 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 == null)) {
      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";
    String responseString = "TRACE " + req.getRequestURI() + " " + req.getProtocol();
    
    Enumeration reqHeaderEnum = req.getHeaderNames();
    while (reqHeaderEnum.hasMoreElements())
    {
      String headerName = (String)reqHeaderEnum.nextElement();
      responseString = responseString + CRLF + headerName + ": " + req.getHeader(headerName);
    }
    responseString = responseString + CRLF;
    
    int responseLength = responseString.length();
    
    resp.setContentType("message/http");
    resp.setContentLength(responseLength);
    ServletOutputStream out = resp.getOutputStream();
    out.print(responseString);
    out.close();
  }
  
  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 / 1000L * 1000L)
        {
          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.security.Principal;
import java.util.Enumeration;
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 getHeaders(String paramString);
  
  public abstract Enumeration 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();
}

/* 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.security.Principal;
import java.util.Enumeration;
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 getHeaders(String name)
  {
    return _getHttpServletRequest().getHeaders(name);
  }
  
  public Enumeration getHeaderNames()
  {
    return _getHttpServletRequest().getHeaderNames();
  }
  
  public int getIntHeader(String name)
  {
    return _getHttpServletRequest().getIntHeader(na
1 2

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