remm 02/01/31 10:42:30 Modified: coyote build.xml coyote/src/java/org/apache/coyote Request.java Response.java coyote/src/java/org/apache/coyote/tomcat4 Constants.java CoyoteProcessor.java CoyoteRequest.java Log: - Cleanup. - Don't build Javadoc by default. - Add partial skeleton for the request part of the TC 4 adapter. Revision Changes Path 1.5 +2 -2 jakarta-tomcat-connectors/coyote/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/build.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- build.xml 25 Jan 2002 17:30:06 -0000 1.4 +++ build.xml 31 Jan 2002 18:42:29 -0000 1.5 @@ -3,7 +3,7 @@ <!-- "Coyote" connector framework for Jakarta Tomcat - $Id: build.xml,v 1.4 2002/01/25 17:30:06 remm Exp $ + $Id: build.xml,v 1.5 2002/01/31 18:42:29 remm Exp $ --> @@ -175,7 +175,7 @@ </target> <target name="compile" - depends="static,javadoc,report,compile.shared,compile.tomcat4" + depends="static,report,compile.shared,compile.tomcat4" description="Compile Coyote and its Adapters"> <jar jarfile="${build.home}/lib/tomcat-${component.name}.jar" basedir="${build.home}/classes" 1.4 +34 -26 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Request.java Index: Request.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Request.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Request.java 17 Sep 2001 05:29:09 -0000 1.3 +++ Request.java 31 Jan 2002 18:42:29 -0000 1.4 @@ -114,9 +114,7 @@ public Request() { - headers = new MimeHeaders(); - scookies = new Cookies(headers); - initRequest(); + recycle(); } @@ -138,18 +136,9 @@ protected MessageBytes remoteAddrMB = new MessageBytes(); protected MessageBytes remoteHostMB = new MessageBytes(); - protected MimeHeaders headers; - - protected int contentLength = -1; - // how much body we still have to read. - protected int available = -1; - - protected MessageBytes contentTypeMB = null; - protected String charEncoding = null; - protected MessageBytes serverNameMB = new MessageBytes(); - - protected Cookies scookies; + protected MimeHeaders headers = new MimeHeaders(); + protected MessageBytes instanceId = new MessageBytes(); /** * Notes. @@ -169,9 +158,30 @@ UDecoder urlDecoder = new UDecoder(); + /** + * HTTP specific fields. (remove them ?) + */ + protected int contentLength = -1; + // how much body we still have to read. + protected int available = -1; + protected MessageBytes contentTypeMB = null; + protected String charEncoding = null; + protected MessageBytes serverNameMB = new MessageBytes(); + protected Cookies cookies = new Cookies(headers); + + // ------------------------------------------------------------- Properties + /** + * Get the host id ( or jvmRoute ) + * @return the jvm route + */ + public MessageBytes getInstanceId() { + return instanceId; + } + + public MimeHeaders getMimeHeaders() { return headers; } @@ -259,7 +269,7 @@ } - public void setCharEncoding(String enc) { + public void setCharacterEncoding(String enc) { this.charEncoding = enc; } @@ -306,11 +316,16 @@ } + public String getHeader(String name) { + return headers.getHeader(name); + } + + // -------------------- Cookies -------------------- public Cookies getCookies() { - return scookies; + return cookies; } @@ -330,7 +345,7 @@ /** * Read data from the input buffer and put it into a byte chunk. */ - public int doRead(ByteChunk chunk/*byte b[], int off, int len*/) + public int doRead(ByteChunk chunk) throws IOException { int n = inputBuffer.doRead(chunk); if (n > 0) @@ -364,21 +379,14 @@ public void recycle() { - initRequest(); - } - - - public void initRequest() { - //params.recycle(); contentLength = -1; contentTypeMB = null; charEncoding = null; - //didReadFormData = false; - headers.clear(); // XXX use recycle pattern + headers.recycle(); serverNameMB.recycle(); serverPort=-1; - scookies.recycle(); + cookies.recycle(); unparsedURIMB.recycle(); uriMB.recycle(); 1.4 +15 -10 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java Index: Response.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Response.java 17 Sep 2001 05:29:09 -0000 1.3 +++ Response.java 31 Jan 2002 18:42:29 -0000 1.4 @@ -71,7 +71,8 @@ import org.apache.tomcat.util.http.ContentType; /** - * + * Response object. + * * @author James Duncan Davidson [[EMAIL PROTECTED]] * @author Jason Hunter [[EMAIL PROTECTED]] * @author James Todd [[EMAIL PROTECTED]] @@ -122,25 +123,29 @@ protected boolean commited = false; - // holds request error exception - // set this just once during request processing - Exception errorException = null; - // holds request error URI - String errorURI = null; + /** + * Action hook. + */ + public ActionHook hook; - // Http specific fileds (remove them ?) + /** + * HTTP specific fields (remove them ?) + */ protected String contentType = Constants.DEFAULT_CONTENT_TYPE; protected String contentLanguage = null; protected String characterEncoding = Constants.DEFAULT_CHARACTER_ENCODING; protected int contentLength = -1; private Locale locale = Constants.DEFAULT_LOCALE; - /** - * Action hook. + * FIXME: Remove. */ - public ActionHook hook; + // holds request error exception + // set this just once during request processing + Exception errorException = null; + // holds request error URI + String errorURI = null; // ------------------------------------------------------------- Properties 1.3 +5 -0 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/Constants.java Index: Constants.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/Constants.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Constants.java 17 Jan 2002 21:08:44 -0000 1.2 +++ Constants.java 31 Jan 2002 18:42:29 -0000 1.3 @@ -77,4 +77,9 @@ public static final int PROCESSOR_IDLE = 0; public static final int PROCESSOR_ACTIVE = 1; + /** + * Default header names. + */ + public static final String AUTHORIZATION_HEADER = "authorization"; + } 1.2 +5 -5 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteProcessor.java Index: CoyoteProcessor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteProcessor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CoyoteProcessor.java 17 Jan 2002 21:08:44 -0000 1.1 +++ CoyoteProcessor.java 31 Jan 2002 18:42:29 -0000 1.2 @@ -1,6 +1,6 @@ -/* * $Header: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteProcessor.java,v 1.1 2002/01/17 21:08:44 remm Exp $ - * $Revision: 1.1 $ - * $Date: 2002/01/17 21:08:44 $ +/* * $Header: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteProcessor.java,v 1.2 2002/01/31 18:42:29 remm Exp $ + * $Revision: 1.2 $ + * $Date: 2002/01/31 18:42:29 $ * * ==================================================================== * @@ -111,7 +111,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.1 $ $Date: 2002/01/17 21:08:44 $ + * @version $Revision: 1.2 $ $Date: 2002/01/31 18:42:29 $ */ final class CoyoteProcessor @@ -434,7 +434,7 @@ throws Exception { // Wrapping the Coyote requests - request.setRequest(req); + request.setCoyoteRequest(req); response.setResponse(res); try { 1.2 +1248 -16 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java Index: CoyoteRequest.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CoyoteRequest.java 17 Jan 2002 21:08:44 -0000 1.1 +++ CoyoteRequest.java 31 Jan 2002 18:42:30 -0000 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java,v 1.1 2002/01/17 21:08:44 remm Exp $ - * $Revision: 1.1 $ - * $Date: 2002/01/17 21:08:44 $ + * $Header: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java,v 1.2 2002/01/31 18:42:30 remm Exp $ + * $Revision: 1.2 $ + * $Date: 2002/01/31 18:42:30 $ * * ==================================================================== * @@ -67,31 +67,189 @@ import java.io.InputStream; import java.io.IOException; +import java.io.BufferedReader; +import java.io.UnsupportedEncodingException; import java.net.Socket; +import java.security.Principal; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Enumeration; +import java.util.HashMap; import java.util.Iterator; +import java.util.Locale; +import java.util.Map; + +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletInputStream; import javax.servlet.ServletRequest; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; import org.apache.coyote.Request; import org.apache.catalina.Connector; +import org.apache.catalina.Context; +import org.apache.catalina.Globals; +import org.apache.catalina.HttpRequest; +import org.apache.catalina.Manager; +import org.apache.catalina.Realm; +import org.apache.catalina.Session; +import org.apache.catalina.Wrapper; + +import org.apache.catalina.connector.HttpRequestFacade; + +import org.apache.catalina.util.Enumerator; +import org.apache.catalina.util.RequestUtil; +import org.apache.catalina.util.StringManager; /** * Wrapper object for the Coyote request. * * @author Remy Maucherat - * @version $Revision: 1.1 $ $Date: 2002/01/17 21:08:44 $ + * @version $Revision: 1.2 $ $Date: 2002/01/31 18:42:30 $ */ -public class CoyoteRequest { +public class CoyoteRequest + implements HttpRequest, HttpServletRequest { // ------------------------------------------------------------- Properties /** + * Coyote request. + */ + protected Request coyoteRequest; + + /** + * Set the Coyote request. + * + * @param coyoteRequest The Coyote request + */ + public void setCoyoteRequest(Request coyoteRequest) { + this.coyoteRequest = coyoteRequest; + } + + /** + * Get the Coyote request. + */ + public Request getCoyoteRequest() { + return (this.coyoteRequest); + } + + + // ----------------------------------------------------- Instance Variables + + + /** + * The string manager for this package. + */ + protected static StringManager sm = + StringManager.getManager(Constants.Package); + + + /** + * The set of cookies associated with this Request. + */ + protected ArrayList cookies = new ArrayList(); + + + /** + * The set of SimpleDateFormat formats to use in getDateHeader(). + */ + protected SimpleDateFormat formats[] = { + new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US), + new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US), + new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US) + }; + + + /** + * The default Locale if none are specified. + */ + protected static Locale defaultLocale = Locale.getDefault(); + + + /** + * The attributes associated with this Request, keyed by attribute name. + */ + protected HashMap attributes = new HashMap(); + + + /** + * The preferred Locales assocaited with this Request. + */ + protected ArrayList locales = new ArrayList(); + + + /** + * Internal notes associated with this request by Catalina components + * and event listeners. + */ + private transient HashMap notes = new HashMap(); + + + /** + * Reader. + */ + protected BufferedReader reader = null; + + + /** + * ServletInputStream. + */ + protected ServletInputStream stream = null; + + + // --------------------------------------------------------- Public Methods + + + /** + * Release all object references, and initialize instance variables, in + * preparation for reuse of this object. + */ + public void recycle() { + } + + + // -------------------------------------------------------- Request Methods + + + /** + * The authorization credentials sent with this Request. + */ + protected String authorization = null; + protected boolean authorizationParsed = false; + + /** + * Return the authorization credentials sent with this request. + */ + public String getAuthorization() { + if (!authorizationParsed) { + setAuthorization(coyoteRequest.getHeader + (Constants.AUTHORIZATION_HEADER)); + authorizationParsed = true; + } + return (this.authorization); + } + + /** + * Set the authorization credentials sent with this request. + * + * @param authorization The new authorization credentials + */ + public void setAuthorization(String authorization) { + this.authorization = authorization; + } + + + /** * Associated Catalina connector. */ protected Connector connector; @@ -114,28 +272,1102 @@ /** - * Coyote request. + * The Context within which this Request is being processed. */ - protected Request request; + protected Context context = null; /** - * Set the Coyote request. - * - * @param request The Coyote request + * Return the Context within which this Request is being processed. */ - public void setRequest(Request request) { - this.request = request; + public Context getContext() { + return (this.context); } + /** + * Set the Context within which this Request is being processed. This + * must be called as soon as the appropriate Context is identified, because + * it identifies the value to be returned by <code>getContextPath()</code>, + * and thus enables parsing of the request URI. + * + * @param context The newly associated Context + */ + public void setContext(Context context) { + this.context = context; + } - // --------------------------------------------------------- Public Methods + /** + * Descriptive information about this Request implementation. + */ + protected static final String info = + "org.apache.coyote.catalina.CoyoteRequest/1.0"; /** - * Release all object references, and initialize instance variables, in - * preparation for reuse of this object. + * Return descriptive information about this Request implementation and + * the corresponding version number, in the format + * <code><description>/<version></code>. */ - public void recycle() { + public String getInfo() { + return (info); + } + + + /** + * The facade associated with this request. + */ + protected HttpRequestFacade facade = new HttpRequestFacade(this); + + /** + * Return the <code>ServletRequest</code> for which this object + * is the facade. This method must be implemented by a subclass. + */ + public ServletRequest getRequest() { + return (facade); + } + + + /** + * The response with which this request is associated. + */ + protected org.apache.catalina.Response response = null; + + /** + * Return the Response with which this Request is associated. + */ + public org.apache.catalina.Response getResponse() { + return (this.response); + } + + /** + * Set the Response with which this Request is associated. + * + * @param response The new associated response + */ + public void setResponse(org.apache.catalina.Response response) { + this.response = response; + } + + + /** + * Return the Socket (if any) through which this Request was received. + * This should <strong>only</strong> be used to access underlying state + * information about this Socket, such as the SSLSession associated with + * an SSLSocket. + */ + public Socket getSocket() { + return (null); // FIXME: Return a note + } + + /** + * Set the Socket (if any) through which this Request was received. + * + * @param socket The socket through which this request was received + */ + public void setSocket(Socket socket) { + } + + + /** + * Return the input stream associated with this Request. + */ + public InputStream getStream() { + return null; // This call shouldn't exist in the first place + } + + /** + * Set the input stream associated with this Request. + * + * @param stream The new input stream + */ + public void setStream(InputStream stream) { + } + + + /** + * The Wrapper within which this Request is being processed. + */ + protected Wrapper wrapper = null; + + /** + * Return the Wrapper within which this Request is being processed. + */ + public Wrapper getWrapper() { + return (this.wrapper); + } + + /** + * Set the Wrapper within which this Request is being processed. This + * must be called as soon as the appropriate Wrapper is identified, and + * before the Request is ultimately passed to an application servlet. + * + * @param wrapper The newly associated Wrapper + */ + public void setWrapper(Wrapper wrapper) { + this.wrapper = wrapper; + } + + + // ------------------------------------------------- Request Public Methods + + + /** + * Create and return a ServletInputStream to read the content + * associated with this Request. + * + * @exception IOException if an input/output error occurs + */ + public ServletInputStream createInputStream() + throws IOException { + return null; + } + + + /** + * Perform whatever actions are required to flush and close the input + * stream or reader, in a single operation. + * + * @exception IOException if an input/output error occurs + */ + public void finishRequest() throws IOException { + // Close reader and input stream + } + + + /** + * Return the object bound with the specified name to the internal notes + * for this request, or <code>null</code> if no such binding exists. + * + * @param name Name of the note to be returned + */ + public Object getNote(String name) { + return (notes.get(name)); + } + + + /** + * Return an Iterator containing the String names of all notes bindings + * that exist for this request. + */ + public Iterator getNoteNames() { + return (notes.keySet().iterator()); + } + + + /** + * Remove any object bound to the specified name in the internal notes + * for this request. + * + * @param name Name of the note to be removed + */ + public void removeNote(String name) { + notes.remove(name); + } + + + /** + * Bind an object to a specified name in the internal notes associated + * with this request, replacing any existing binding for this name. + * + * @param name Name to which the object should be bound + * @param value Object to be bound to the specified name + */ + public void setNote(String name, Object value) { + notes.put(name, value); + } + + + /** + * Set the content length associated with this Request. + * + * @param length The new content length + */ + public void setContentLength(int length) { + // Not used + } + + + /** + * Set the content type (and optionally the character encoding) + * associated with this Request. For example, + * <code>text/html; charset=ISO-8859-4</code>. + * + * @param type The new content type + */ + public void setContentType(String type) { + // Not used + } + + + /** + * Set the protocol name and version associated with this Request. + * + * @param protocol Protocol name and version + */ + public void setProtocol(String protocol) { + } + + + /** + * Set the IP address of the remote client associated with this Request. + * + * @param remoteAddr The remote IP address + */ + public void setRemoteAddr(String remoteAddr) { + } + + + /** + * Set the fully qualified name of the remote client associated with this + * Request. + * + * @param remoteHost The remote host name + */ + public void setRemoteHost(String remoteHost) { + } + + + /** + * Set the name of the scheme associated with this request. Typical values + * are <code>http</code>, <code>https</code>, and <code>ftp</code>. + * + * @param scheme The scheme + */ + public void setScheme(String scheme) { + } + + + /** + * Set the value to be returned by <code>isSecure()</code> + * for this Request. + * + * @param secure The new isSecure value + */ + public void setSecure(boolean secure) { + } + + + /** + * Set the name of the server (virtual host) to process this request. + * + * @param name The server name + */ + public void setServerName(String name) { + } + + + /** + * Set the port number of the server to process this request. + * + * @param port The server port + */ + public void setServerPort(int port) { + } + + + // ------------------------------------------------- ServletRequest Methods + + + /** + * Return the specified request attribute if it exists; otherwise, return + * <code>null</code>. + * + * @param name Name of the request attribute to return + */ + public Object getAttribute(String name) { + return (attributes.get(name)); + } + + + /** + * Return the names of all request attributes for this Request, or an + * empty <code>Enumeration</code> if there are none. + */ + public Enumeration getAttributeNames() { + return (new Enumerator(attributes.keySet())); + } + + + /** + * Return the character encoding for this Request. + */ + public String getCharacterEncoding() { + return (coyoteRequest.getCharacterEncoding()); + } + + + /** + * Return the content length for this Request. + */ + public int getContentLength() { + return (coyoteRequest.getContentLength()); + } + + + /** + * Return the content type for this Request. + */ + public String getContentType() { + return (coyoteRequest.getContentType()); + } + + + /** + * Return the servlet input stream for this Request. The default + * implementation returns a servlet input stream created by + * <code>createInputStream()</code>. + * + * @exception IllegalStateException if <code>getReader()</code> has + * already been called for this request + * @exception IOException if an input/output error occurs + */ + public ServletInputStream getInputStream() throws IOException { + + if (reader != null) + throw new IllegalStateException + (sm.getString("requestBase.getInputStream.ise")); + + if (stream == null) + stream = createInputStream(); + return (stream); + + } + + + /** + * Return the preferred Locale that the client will accept content in, + * based on the value for the first <code>Accept-Language</code> header + * that was encountered. If the request did not specify a preferred + * language, the server's default Locale is returned. + */ + public Locale getLocale() { + if (locales.size() > 0) + return ((Locale) locales.get(0)); + else + return (defaultLocale); + } + + + /** + * Return the set of preferred Locales that the client will accept + * content in, based on the values for any <code>Accept-Language</code> + * headers that were encountered. If the request did not specify a + * preferred language, the server's default Locale is returned. + */ + public Enumeration getLocales() { + if (locales.size() > 0) + return (new Enumerator(locales)); + ArrayList results = new ArrayList(); + results.add(defaultLocale); + return (new Enumerator(results)); + } + + + /** + * Return the value of the specified request parameter, if any; otherwise, + * return <code>null</code>. If there is more than one value defined, + * return only the first one. + * + * @param name Name of the desired request parameter + */ + public String getParameter(String name) { + return null; + } + + + + /** + * Returns a <code>Map</code> of the parameters of this request. + * Request parameters are extra information sent with the request. + * For HTTP servlets, parameters are contained in the query string + * or posted form data. + * + * @return A <code>Map</code> containing parameter names as keys + * and parameter values as map values. + */ + public Map getParameterMap() { + return null; + } + + + /** + * Return the names of all defined request parameters for this request. + */ + public Enumeration getParameterNames() { + return null; + } + + + /** + * Return the defined values for the specified request parameter, if any; + * otherwise, return <code>null</code>. + * + * @param name Name of the desired request parameter + */ + public String[] getParameterValues(String name) { + return null; + } + + + /** + * Return the protocol and version used to make this Request. + */ + public String getProtocol() { + return coyoteRequest.protocol().toString(); + } + + + /** + * Read the Reader wrapping the input stream for this Request. The + * default implementation wraps a <code>BufferedReader</code> around the + * servlet input stream returned by <code>createInputStream()</code>. + * + * @exception IllegalStateException if <code>getInputStream()</code> + * has already been called for this request + * @exception IOException if an input/output error occurs + */ + public BufferedReader getReader() throws IOException { + + if (stream != null) + throw new IllegalStateException + (sm.getString("requestBase.getReader.ise")); + + if (reader == null) { + // FIXME + } + return (reader); + + } + + + /** + * Return the real path of the specified virtual path. + * + * @param path Path to be translated + * + * @deprecated As of version 2.1 of the Java Servlet API, use + * <code>ServletContext.getRealPath()</code>. + */ + public String getRealPath(String path) { + + if (context == null) + return (null); + ServletContext servletContext = context.getServletContext(); + if (servletContext == null) + return (null); + else { + try { + return (servletContext.getRealPath(path)); + } catch (IllegalArgumentException e) { + return (null); + } + } + + } + + + /** + * Return the remote IP address making this Request. + */ + public String getRemoteAddr() { + return (null); + } + + + /** + * Return the remote host name making this Request. + */ + public String getRemoteHost() { + return (null); + } + + + /** + * Return a RequestDispatcher that wraps the resource at the specified + * path, which may be interpreted as relative to the current request path. + * + * @param path Path of the resource to be wrapped + */ + public RequestDispatcher getRequestDispatcher(String path) { + + if (context == null) + return (null); + + // If the path is already context-relative, just pass it through + if (path == null) + return (null); + else if (path.startsWith("/")) + return (context.getServletContext().getRequestDispatcher(path)); + + // Convert a request-relative path to a context-relative one + String servletPath = (String) getAttribute(Globals.SERVLET_PATH_ATTR); + if (servletPath == null) + servletPath = getServletPath(); + String relative = RequestUtil.normalize(servletPath + "/../" + path); + return (context.getServletContext().getRequestDispatcher(relative)); + + } + + + /** + * Return the scheme used to make this Request. + */ + public String getScheme() { + return (coyoteRequest.scheme().toString()); + } + + + /** + * Return the server name responding to this Request. + */ + public String getServerName() { + return (coyoteRequest.serverName().toString()); + } + + + /** + * Return the server port responding to this Request. + */ + public int getServerPort() { + return (coyoteRequest.getServerPort()); + } + + + /** + * Was this request received on a secure connection? + */ + public boolean isSecure() { + return (false); + } + + + /** + * Remove the specified request attribute if it exists. + * + * @param name Name of the request attribute to remove + */ + public void removeAttribute(String name) { + attributes.remove(name); + } + + + /** + * Set the specified request attribute to the specified value. + * + * @param name Name of the request attribute to set + * @param value The associated value + */ + public void setAttribute(String name, Object value) { + + // Name cannot be null + if (name == null) + throw new IllegalArgumentException + (sm.getString("requestBase.setAttribute.namenull")); + + // Null value is the same as removeAttribute() + if (value == null) { + removeAttribute(name); + return; + } + + attributes.put(name, value); + + } + + + /** + * Overrides the name of the character encoding used in the body of + * this request. This method must be called prior to reading request + * parameters or reading input using <code>getReader()</code>. + * + * @param enc The character encoding to be used + * + * @exception UnsupportedEncodingException if the specified encoding + * is not supported + * + * @since Servlet 2.3 + */ + public void setCharacterEncoding(String enc) + throws UnsupportedEncodingException { + + // Ensure that the specified encoding is valid + byte buffer[] = new byte[1]; + buffer[0] = (byte) 'a'; + String dummy = new String(buffer, enc); + + // Save the validated encoding + coyoteRequest.setCharacterEncoding(enc); + + } + + + // ---------------------------------------------------- HttpRequest Methods + + + /** + * Add a Cookie to the set of Cookies associated with this Request. + * + * @param cookie The new cookie + */ + public void addCookie(Cookie cookie) { + } + + + /** + * Add a Header to the set of Headers associated with this Request. + * + * @param name The new header name + * @param value The new header value + */ + public void addHeader(String name, String value) { + } + + + /** + * Add a Locale to the set of preferred Locales for this Request. The + * first added Locale will be the first one returned by getLocales(). + * + * @param locale The new preferred Locale + */ + public void addLocale(Locale locale) { + } + + + /** + * Add a parameter name and corresponding set of values to this Request. + * (This is used when restoring the original request on a form based + * login). + * + * @param name Name of this request parameter + * @param values Corresponding values for this request parameter + */ + public void addParameter(String name, String values[]) { + } + + + /** + * Clear the collection of Cookies associated with this Request. + */ + public void clearCookies() { + } + + + /** + * Clear the collection of Headers associated with this Request. + */ + public void clearHeaders() { + } + + + /** + * Clear the collection of Locales associated with this Request. + */ + public void clearLocales() { + } + + + /** + * Clear the collection of parameters associated with this Request. + */ + public void clearParameters() { + } + + + /** + * Set the authentication type used for this request, if any; otherwise + * set the type to <code>null</code>. Typical values are "BASIC", + * "DIGEST", or "SSL". + * + * @param type The authentication type used + */ + public void setAuthType(String type) { + } + + + /** + * Set the context path for this Request. This will normally be called + * when the associated Context is mapping the Request to a particular + * Wrapper. + * + * @param path The context path + */ + public void setContextPath(String path) { + } + + + /** + * Set the HTTP request method used for this Request. + * + * @param method The request method + */ + public void setMethod(String method) { + } + + + /** + * Set the query string for this Request. This will normally be called + * by the HTTP Connector, when it parses the request headers. + * + * @param query The query string + */ + public void setQueryString(String query) { + } + + + /** + * Set the path information for this Request. This will normally be called + * when the associated Context is mapping the Request to a particular + * Wrapper. + * + * @param path The path information + */ + public void setPathInfo(String path) { + } + + + /** + * Set a flag indicating whether or not the requested session ID for this + * request came in through a cookie. This is normally called by the + * HTTP Connector, when it parses the request headers. + * + * @param flag The new flag + */ + public void setRequestedSessionCookie(boolean flag) { + } + + + /** + * Set the requested session ID for this request. This is normally called + * by the HTTP Connector, when it parses the request headers. + * + * @param id The new session id + */ + public void setRequestedSessionId(String id) { + } + + + /** + * Set a flag indicating whether or not the requested session ID for this + * request came in through a URL. This is normally called by the + * HTTP Connector, when it parses the request headers. + * + * @param flag The new flag + */ + public void setRequestedSessionURL(boolean flag) { + } + + + /** + * Set the unparsed request URI for this Request. This will normally be + * called by the HTTP Connector, when it parses the request headers. + * + * @param uri The request URI + */ + public void setRequestURI(String uri) { + } + + + /** + * Set the servlet path for this Request. This will normally be called + * when the associated Context is mapping the Request to a particular + * Wrapper. + * + * @param path The servlet path + */ + public void setServletPath(String path) { + } + + + /** + * Set the Principal who has been authenticated for this Request. This + * value is also used to calculate the value to be returned by the + * <code>getRemoteUser()</code> method. + * + * @param principal The user Principal + */ + public void setUserPrincipal(Principal principal) { + } + + + // --------------------------------------------- HttpServletRequest Methods + + + /** + * Return the authentication type used for this Request. + */ + public String getAuthType() { + return (null); + } + + + /** + * Return the portion of the request URI used to select the Context + * of the Request. + */ + public String getContextPath() { + return (null); + } + + + /** + * Return the set of Cookies received with this Request. + */ + public Cookie[] getCookies() { + + if (cookies.size() < 1) + return (null); + Cookie results[] = new Cookie[cookies.size()]; + return ((Cookie[]) cookies.toArray(results)); + + } + + + /** + * Return the value of the specified date header, if any; otherwise + * return -1. + * + * @param name Name of the requested date header + * + * @exception IllegalArgumentException if the specified header value + * cannot be converted to a date + */ + public long getDateHeader(String name) { + + String value = getHeader(name); + if (value == null) + return (-1L); + + // Work around a bug in SimpleDateFormat in pre-JDK1.2b4 + // (Bug Parade bug #4106807) + value += " "; + + // Attempt to convert the date header in a variety of formats + for (int i = 0; i < formats.length; i++) { + try { + Date date = formats[i].parse(value); + return (date.getTime()); + } catch (ParseException e) { + ; + } + } + throw new IllegalArgumentException(value); + + } + + + /** + * Return the first value of the specified header, if any; otherwise, + * return <code>null</code> + * + * @param name Name of the requested header + */ + public String getHeader(String name) { + return null; + } + + + /** + * Return all of the values of the specified header, if any; otherwise, + * return an empty enumeration. + * + * @param name Name of the requested header + */ + public Enumeration getHeaders(String name) { + return null; + } + + + /** + * Return the names of all headers received with this request. + */ + public Enumeration getHeaderNames() { + return null; + } + + + /** + * Return the value of the specified header as an integer, or -1 if there + * is no such header for this request. + * + * @param name Name of the requested header + * + * @exception IllegalArgumentException if the specified header value + * cannot be converted to an integer + */ + public int getIntHeader(String name) { + + String value = getHeader(name); + if (value == null) + return (-1); + else + return (Integer.parseInt(value)); + + } + + + /** + * Return the HTTP request method used in this Request. + */ + public String getMethod() { + return null; + } + + + /** + * Return the path information associated with this Request. + */ + public String getPathInfo() { + return null; + } + + + /** + * Return the extra path information for this request, translated + * to a real path. + */ + public String getPathTranslated() { + return null; + } + + + + /** + * Return the query string associated with this request. + */ + public String getQueryString() { + return null; + } + + + /** + * Return the name of the remote user that has been authenticated + * for this Request. + */ + public String getRemoteUser() { + return null; + } + + + /** + * Return the session identifier included in this request, if any. + */ + public String getRequestedSessionId() { + return null; + } + + + /** + * Return the request URI for this request. + */ + public String getRequestURI() { + return null; + } + + + /** + * Reconstructs the URL the client used to make the request. + * The returned URL contains a protocol, server name, port + * number, and server path, but it does not include query + * string parameters. + * <p> + * Because this method returns a <code>StringBuffer</code>, + * not a <code>String</code>, you can modify the URL easily, + * for example, to append query parameters. + * <p> + * This method is useful for creating redirect messages and + * for reporting errors. + * + * @return A <code>StringBuffer</code> object containing the + * reconstructed URL + */ + public StringBuffer getRequestURL() { + return null; + } + + + /** + * Return the portion of the request URI used to select the servlet + * that will process this request. + */ + public String getServletPath() { + return null; + } + + + /** + * Return the session associated with this Request, creating one + * if necessary. + */ + public HttpSession getSession() { + return (getSession(true)); + } + + + /** + * Return the session associated with this Request, creating one + * if necessary and requested. + * + * @param create Create a new session if one does not exist + */ + public HttpSession getSession(boolean create) { + return null; + } + + + /** + * Return <code>true</code> if the session identifier included in this + * request came from a cookie. + */ + public boolean isRequestedSessionIdFromCookie() { + return false; + } + + + /** + * Return <code>true</code> if the session identifier included in this + * request came from the request URI. + */ + public boolean isRequestedSessionIdFromURL() { + return false; + } + + + /** + * Return <code>true</code> if the session identifier included in this + * request came from the request URI. + * + * @deprecated As of Version 2.1 of the Java Servlet API, use + * <code>isRequestedSessionIdFromURL()</code> instead. + */ + public boolean isRequestedSessionIdFromUrl() { + return false; + } + + + /** + * Return <code>true</code> if the session identifier included in this + * request identifies a valid session. + */ + public boolean isRequestedSessionIdValid() { + return false; + } + + + /** + * Return <code>true</code> if the authenticated user principal + * possesses the specified role name. + * + * @param role Role name to be validated + */ + public boolean isUserInRole(String role) { + return false; + } + + + /** + * Return the principal that has been authenticated for this Request. + */ + public Principal getUserPrincipal() { + return null; }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>