knielsen    01/09/05 02:59:26

  Modified:    proposals/kasper/newrundata Context.java Cookie.java
                        Request.java Response.java Session.java
               proposals/kasper/newrundata/servlet HttpContext.java
                        HttpCookie.java HttpRequest.java HttpResponse.java
                        HttpSession.java
  Log:
  more changes
  
  Revision  Changes    Path
  1.2       +0 -0      jakarta-turbine-3/proposals/kasper/newrundata/Context.java
  
  Index: Context.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/proposals/kasper/newrundata/Context.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Context.java      2001/09/05 09:34:25     1.1
  +++ Context.java      2001/09/05 09:59:25     1.2
  @@ -8,7 +8,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Davanum Srinivas</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Kasper Nielsen</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/09/05 09:34:25 $
  + * @version CVS $Revision: 1.2 $ $Date: 2001/09/05 09:59:25 $
    *
    */
   
  
  
  
  1.2       +0 -0      jakarta-turbine-3/proposals/kasper/newrundata/Cookie.java
  
  Index: Cookie.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/proposals/kasper/newrundata/Cookie.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Cookie.java       2001/09/05 09:34:25     1.1
  +++ Cookie.java       2001/09/05 09:59:25     1.2
  @@ -37,7 +37,7 @@
    *
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/09/05 09:34:25 $
  + * @version CVS $Revision: 1.2 $ $Date: 2001/09/05 09:59:25 $
    *
    */
   
  
  
  
  1.2       +760 -10   jakarta-turbine-3/proposals/kasper/newrundata/Request.java
  
  Index: Request.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/proposals/kasper/newrundata/Request.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Request.java      2001/09/05 09:34:25     1.1
  +++ Request.java      2001/09/05 09:59:25     1.2
  @@ -1,16 +1,766 @@
   package org.apache.turbine.newrundata;
   
  +import java.io.BufferedReader;
  +import java.io.IOException;
  +import java.io.UnsupportedEncodingException;
  +import java.util.Enumeration;
  +import java.util.Locale;
  +import java.util.Map;
  +import java.security.Principal;
  +
   /**
  - * Title:
  - * Description:
  - * Copyright:    Copyright (c) 2001
  - * Company:
  - * @author
  - * @version 1.0
  + * Defines an interface to provide client request information .
  + *
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Davanum Srinivas</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Berin Loritsch</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Kasper Nielsen</a>
  + * @version CVS $Revision: 1.2 $ $Date: 2001/09/05 09:59:25 $
  + *
    */
   
   public interface Request {
  -//Todo
  -//needs to be filled out (Kasper)
  -//
  -}
  \ No newline at end of file
  +
  +    /**
  +     *
  +     * Returns the value of the named attribute as an <code>Object</code>,
  +     * or <code>null</code> if no attribute of the given name exists.
  +     *
  +     * @param name        a <code>String</code> specifying the name of
  +     *                        the attribute
  +     *
  +     * @return                an <code>Object</code> containing the value
  +     *                        of the attribute, or <code>null</code> if
  +     *                        the attribute does not exist
  +     *
  +     */
  +    Object get(String name);
  +
  +    /**
  +     *
  +     * Returns the value of the named attribute as an <code>Object</code>,
  +     * or <code>null</code> if no attribute of the given name exists.
  +     *
  +     * @param name        a <code>String</code> specifying the name of
  +     *                        the attribute
  +     *
  +     * @return                an <code>Object</code> containing the value
  +     *                        of the attribute, or <code>null</code> if
  +     *                        the attribute does not exist
  +     *
  +     */
  +
  +    Object getAttribute(String name);
  +
  +    /**
  +     * Returns an <code>Enumeration</code> containing the
  +     * names of the attributes available to this request.
  +     * This method returns an empty <code>Enumeration</code>
  +     * if the request has no attributes available to it.
  +     *
  +     *
  +     * @return                an <code>Enumeration</code> of strings
  +     *                        containing the names
  +     *                         of the request's attributes
  +     *
  +     */
  +
  +    Enumeration getAttributeNames();
  +
  +    /**
  +     *
  +     * Returns the name of the authentication scheme used to protect
  +     * the servlet, for example, "BASIC" or "SSL," or null if the servlet was
  +     * not protected
  +     *
  +     * @return                The name of the authentication scheme used to
  +     *                        protect the servlet, or null if the servlet was
  +     *                        not protected
  +     */
  +    String getAuthType();
  +
  +    /**
  +     * Returns the name of the character encoding used in the body of this
  +     * request. This method returns <code>null</code> if the request
  +     * does not specify a character encoding
  +     *
  +     *
  +     * @return                a <code>String</code> containing the name of
  +     *                        the chararacter encoding, or <code>null</code>
  +     *                        if the request does not specify a character encoding
  +     *
  +     */
  +
  +    String getCharacterEncoding();
  +
  +    /**
  +     * Returns the length, in bytes, of the request body
  +     *
  +     * @return                an integer containing the length of the
  +     *                         request body or -1 if the length is not known
  +     *
  +     */
  +
  +    int getContentLength();
  +
  +    /**
  +     * Returns the MIME type of the body of the request
  +     *
  +     * @return                a <code>String</code> containing the name
  +     *                        of the MIME type of
  +     *                         the request, or -1 if the type is not known
  +     *
  +     */
  +
  +    String getContentType();
  +
  +    /**
  +     * Returns the value of a request parameter as a <code>String</code>,
  +     *
  +     * @param name         a <code>String</code> specifying the
  +     *                        name of the parameter
  +     *
  +     * @return                a <code>String</code> representing the
  +     *                        single value of the parameter
  +     *
  +     * @see                 #getParameterValues
  +     *
  +     */
  +
  +    String getParameter(String name);
  +
  +    /**
  +     *
  +     * Returns an <code>Enumeration</code> of <code>String</code>
  +     * objects containing the names of the parameters contained
  +     * in this request. If the request has
  +     * no parameters, the method returns an
  +     * empty <code>Enumeration</code>.
  +     *
  +     * @return                an <code>Enumeration</code> of <code>String</code>
  +     *                        objects, each <code>String</code> containing
  +     *                         the name of a request parameter; or an
  +     *                        empty <code>Enumeration</code> if the
  +     *                        request has no parameters
  +     *
  +     */
  +
  +    Enumeration getParameterNames();
  +
  +    /**
  +     * Returns an array of <code>String</code> objects containing
  +     * all of the values the given request parameter has, or
  +     * <code>null</code> if the parameter does not exist.
  +     *
  +     * <p>If the parameter has a single value, the array has a length
  +     * of 1.
  +     *
  +     * @param name        a <code>String</code> containing the name of
  +     *                        the parameter whose value is requested
  +     *
  +     * @return                an array of <code>String</code> objects
  +     *                        containing the parameter's values
  +     *
  +     * @see                #getParameter
  +     *
  +     */
  +
  +    String[] getParameterValues(String name);
  +
  +
  +    /**
  +     * Returns the name and version of the protocol the request uses
  +     * in the form <i>protocol/majorVersion.minorVersion</i>, for
  +     * example, HTTP/1.1. For HTTP servlets, the value
  +     * returned is the same as the value of the CGI variable
  +     * <code>SERVER_PROTOCOL</code>.
  +     *
  +     * @return                a <code>String</code> containing the protocol
  +     *                        name and version number
  +     *
  +     */
  +
  +    String getProtocol();
  +
  +    /**
  +     * Returns the name of the scheme used to make this request,
  +     * for example,
  +     * <code>http</code>, <code>https</code>, or <code>ftp</code>.
  +     * Different schemes have different rules for constructing URLs,
  +     * as noted in RFC 1738.
  +     *
  +     * @return                a <code>String</code> containing the name
  +     *                        of the scheme used to make this request
  +     *
  +     */
  +
  +    String getScheme();
  +
  +    /**
  +     * Returns the host name of the server that received the request.
  +     * For HTTP servlets, same as the value of the CGI variable
  +     * <code>SERVER_NAME</code>.
  +     *
  +     * @return                a <code>String</code> containing the name
  +     *                        of the server to which the request was sent
  +     */
  +
  +    String getServerName();
  +
  +    /**
  +     * Returns the port number on which this request was received.
  +     * For HTTP servlets, same as the value of the CGI variable
  +     * <code>SERVER_PORT</code>.
  +     *
  +     * @return                an integer specifying the port number
  +     *
  +     */
  +
  +    int getServerPort();
  +
  +    /**
  +     * Returns the Internet Protocol (IP) address of the client
  +     * that sent the request.  For HTTP servlets, same as the value of the
  +     * CGI variable <code>REMOTE_ADDR</code>.
  +     *
  +     * @return                a <code>String</code> containing the
  +     *                        IP address of the client that sent the request
  +     *
  +     */
  +
  +    String getRemoteAddr();
  +
  +    /**
  +     * Returns the fully qualified name of the client that sent the
  +     * request, or the IP address of the client if the name cannot be
  +     * determined. For HTTP servlets, same as the value of the CGI variable
  +     * <code>REMOTE_HOST</code>.
  +     *
  +     * @return                a <code>String</code> containing the fully qualified 
name
  +     *                        of the client
  +     *
  +     */
  +
  +    String getRemoteHost();
  +
  +    /**
  +     *
  +     * Stores an attribute in this request.
  +     * Attributes are reset between requests.
  +     *
  +     * <p>Attribute names should follow the same conventions as
  +     * package names. Names beginning with <code>java.*</code>,
  +     * <code>javax.*</code>, and <code>com.sun.*</code>, are
  +     * reserved for use by Sun Microsystems.
  +     *
  +     *
  +     * @param name                        a <code>String</code> specifying
  +     *                                        the name of the attribute
  +     *
  +     * @param o                                the <code>Object</code> to be stored
  +     *
  +     */
  +
  +    void setAttribute(String name, Object o);
  +
  +    /**
  +     *
  +     * Removes an attribute from this request.  This method is not
  +     * generally needed as attributes only persist as long as the request
  +     * is being handled.
  +     *
  +     * <p>Attribute names should follow the same conventions as
  +     * package names. Names beginning with <code>java.*</code>,
  +     * <code>javax.*</code>, and <code>com.sun.*</code>, are
  +     * reserved for use by Sun Microsystems.
  +     *
  +     *
  +     * @param name                        a <code>String</code> specifying
  +     *                                        the name of the attribute to remove
  +     *
  +     */
  +
  +    void removeAttribute(String name);
  +
  +    /**
  +     *
  +     * Returns the preferred <code>Locale</code> that the client will
  +     * accept content in, based on the Accept-Language header.
  +     * If the client request doesn't provide an Accept-Language header,
  +     * this method returns the default locale for the server.
  +     *
  +     *
  +     * @return                the preferred <code>Locale</code> for the client
  +     *
  +     */
  +
  +    Locale getLocale();
  +
  +    /**
  +     *
  +     * Returns an <code>Enumeration</code> of <code>Locale</code> objects
  +     * indicating, in decreasing order starting with the preferred locale, the
  +     * locales that are acceptable to the client based on the Accept-Language
  +     * header.
  +     * If the client request doesn't provide an Accept-Language header,
  +     * this method returns an <code>Enumeration</code> containing one
  +     * <code>Locale</code>, the default locale for the server.
  +     *
  +     *
  +     * @return                an <code>Enumeration</code> of preferred
  +     *                  <code>Locale</code> objects for the client
  +     *
  +     */
  +
  +    Enumeration getLocales();
  +
  +    /**
  +     *
  +     * Returns a boolean indicating whether this request was made using a
  +     * secure channel, such as HTTPS.
  +     *
  +     *
  +     * @return                a boolean indicating if the request was made using a
  +     *                  secure channel
  +     *
  +     */
  +
  +    boolean isSecure();
  +
  +    /**
  +     *
  +     * Returns an array containing all of the <code>Cookie</code>
  +     * objects the client sent with this request.
  +     * This method returns <code>null</code> if no cookies were sent.
  +     *
  +     * @return                an array of all the <code>Cookies</code>
  +     *                        included with this request, or <code>null</code>
  +     *                        if the request has no cookies
  +     *
  +     *
  +     */
  +
  +    Cookie[] getCookies();
  +
  +    /**
  +     * Returns a map of the <code>Cookie</code> objects the client sent
  +     * with this request, indexed by name. This method returns an empty
  +     * map if no cookies were sent.
  +     *
  +     * @return a Map of <code>Cookie</code> objects
  +     */
  +    Map getCookieMap();
  +
  +    /**
  +     *
  +     * Returns the value of the specified request header
  +     * as a <code>long</code> value that represents a
  +     * <code>Date</code> object. Use this method with
  +     * headers that contain dates, such as
  +     * <code>If-Modified-Since</code>.
  +     *
  +     * <p>The date is returned as
  +     * the number of milliseconds since January 1, 1970 GMT.
  +     * The header name is case insensitive.
  +     *
  +     * <p>If the request did not have a header of the
  +     * specified name, this method returns -1. If the header
  +     * can't be converted to a date, the method throws
  +     * an <code>IllegalArgumentException</code>.
  +     *
  +     * @param name                a <code>String</code> specifying the
  +     *                                name of the header
  +     *
  +     * @return                        a <code>long</code> value
  +     *                                representing the date specified
  +     *                                in the header expressed as
  +     *                                the number of milliseconds
  +     *                                since January 1, 1970 GMT,
  +     *                                or -1 if the named header
  +     *                                was not included with the
  +     *                                reqest
  +     *
  +     * @exception        IllegalArgumentException        If the header value
  +     *                                                        can't be converted
  +     *                                                        to a date
  +     *
  +     */
  +
  +    long getDateHeader(String name);
  +
  +    /**
  +     *
  +     * Returns the value of the specified request header
  +     * as a <code>String</code>. If the request did not include a header
  +     * of the specified name, this method returns <code>null</code>.
  +     * The header name is case insensitive. You can use
  +     * this method with any request header.
  +     *
  +     * @param name                a <code>String</code> specifying the
  +     *                                header name
  +     *
  +     * @return                        a <code>String</code> containing the
  +     *                                value of the requested
  +     *                                header, or <code>null</code>
  +     *                                if the request does not
  +     *                                have a header of that name
  +     *
  +     */
  +
  +    String getHeader(String name);
  +
  +    /**
  +     *
  +     * Returns all the values of the specified request header
  +     * as an <code>Enumeration</code> of <code>String</code> objects.
  +     *
  +     * <p>Some headers, such as <code>Accept-Language</code> can be sent
  +     * by clients as several headers each with a different value rather than
  +     * sending the header as a comma separated list.
  +     *
  +     * <p>If the request did not include any headers
  +     * of the specified name, this method returns an empty
  +     * <code>Enumeration</code>.
  +     * The header name is case insensitive. You can use
  +     * this method with any request header.
  +     *
  +     * @param name                a <code>String</code> specifying the
  +     *                                header name
  +     *
  +     * @return                        a <code>Enumeration</code> containing the
  +     *                                values of the requested
  +     *                                header, or <code>null</code>
  +     *                                if the request does not
  +     *                                have any headers of that name
  +     *
  +     */
  +
  +    Enumeration getHeaders(String name);
  +
  +    /**
  +     *
  +     * Returns an enumeration of all the header names
  +     * this request contains. If the request has no
  +     * headers, this method returns an empty enumeration.
  +     *
  +     * <p>Some servlet containers do not allow do not allow
  +     * servlets to access headers using this method, in
  +     * which case this method returns <code>null</code>
  +     *
  +     * @return                        an enumeration of all the
  +     *                                header names sent with this
  +     *                                request; if the request has
  +     *                                no headers, an empty enumeration;
  +     *                                if the servlet container does not
  +     *                                allow servlets to use this method,
  +     *                                <code>null</code>
  +     *
  +     */
  +
  +    Enumeration getHeaderNames();
  +
  +    /**
  +     *
  +     * Returns the name of the HTTP method with which this
  +     * request was made, for example, GET, POST, or PUT.
  +     * Same as the value of the CGI variable REQUEST_METHOD.
  +     *
  +     * @return                        a <code>String</code>
  +     *                                specifying the name
  +     *                                of the method with which
  +     *                                this request was made
  +     *
  +     */
  +
  +    String getMethod();
  +
  +    /**
  +     *
  +     * Returns any extra path information associated with
  +     * the URL the client sent when it made this request.
  +     * The extra path information follows the servlet path
  +     * but precedes the query string.
  +     * This method returns <code>null</code> if there
  +     * was no extra path information.
  +     *
  +     * <p>Same as the value of the CGI variable PATH_INFO.
  +     *
  +     *
  +     * @return                a <code>String</code> specifying
  +     *                        extra path information that comes
  +     *                        after the servlet path but before
  +     *                        the query string in the request URL;
  +     *                        or <code>null</code> if the URL does not have
  +     *                        any extra path information
  +     *
  +     */
  +
  +    String getPathInfo();
  +
  +    /**
  +     *
  +     * Returns any extra path information after the servlet name
  +     * but before the query string, and translates it to a real
  +     * path. Same as the value of the CGI variable PATH_TRANSLATED.
  +     *
  +     * <p>If the URL does not have any extra path information,
  +     * this method returns <code>null</code>.
  +     *
  +     *
  +     * @return                a <code>String</code> specifying the
  +     *                        real path, or <code>null</code> if
  +     *                        the URL does not have any extra path
  +     *                        information
  +     *
  +     *
  +     */
  +
  +    String getPathTranslated();
  +
  +    /**
  +     *
  +     * Returns the portion of the request URI that indicates the context
  +     * of the request.  The context path always comes first in a request
  +     * URI.  The path starts with a "/" character but does not end with a "/"
  +     * character.  For servlets in the default (root) context, this method
  +     * returns "".
  +     *
  +     *
  +     * @return                a <code>String</code> specifying the
  +     *                        portion of the request URI that indicates the context
  +     *                        of the request
  +     *
  +     *
  +     */
  +
  +    String getContextPath();
  +
  +    /**
  +     *
  +     * Returns the query string that is contained in the request
  +     * URL after the path. This method returns <code>null</code>
  +     * if the URL does not have a query string. Same as the value
  +     * of the CGI variable QUERY_STRING.
  +     *
  +     * @return                a <code>String</code> containing the query
  +     *                        string or <code>null</code> if the URL
  +     *                        contains no query string
  +     *
  +     */
  +
  +    String getQueryString();
  +
  +    /**
  +     *
  +     * Returns the login of the user making this request, if the
  +     * user has been authenticated, or <code>null</code> if the user
  +     * has not been authenticated.
  +     * Whether the user name is sent with each subsequent request
  +     * depends on the browser and type of authentication. Same as the
  +     * value of the CGI variable REMOTE_USER.
  +     *
  +     * @return                a <code>String</code> specifying the login
  +     *                        of the user making this request, or <code>null</code
  +     *                        if the user login is not known
  +     *
  +     */
  +
  +    String getRemoteUser();
  +
  +    /**
  +     *
  +     * Returns the login of the user making this request, if the
  +     * user has been authenticated, or <code>null</code> if the user
  +     * has not been authenticated.
  +     * Whether the user name is sent with each subsequent request
  +     * depends on the browser and type of authentication. Same as the
  +     * value of the CGI variable REMOTE_USER.
  +     *
  +     * @return                a <code>String</code> specifying the login
  +     *                        of the user making this request, or <code>null</code
  +     *                        if the user login is not known
  +     *
  +     */
  +
  +    //we need to discuss these in connection with the rework of the Security service
  +
  +
  +    //Principal getUserPrincipal();
  +
  +    /**
  +     *
  +     * Checks whether the currently logged in user is in a specified role.
  +     *
  +     * @return                        <code>true</code> if the user is
  +     *                                authenticated and in the role;
  +     *                                otherwise, <code>false</code>
  +     *
  +     *
  +     * @see                        #getRemoteUser
  +     *
  +     */
  +
  +    //boolean isUserInRole(String role);
  +
  +    /**
  +     *
  +     * Returns the session ID specified by the client. This may
  +     * not be the same as the ID of the actual session in use.
  +     * For example, if the request specified an old (expired)
  +     * session ID and the server has started a new session, this
  +     * method gets a new session with a new ID. If the request
  +     * did not specify a session ID, this method returns
  +     * <code>null</code>.
  +     *
  +     *
  +     * @return                a <code>String</code> specifying the session
  +     *                        ID, or <code>null</code> if the request did
  +     *                        not specify a session ID
  +     *
  +     * @see                #isRequestedSessionIdValid
  +     *
  +     */
  +
  +    String getRequestedSessionId();
  +
  +    /**
  +     *
  +     * Returns the part of this request's URL from the protocol
  +     * name up to the query string in the first line of the HTTP request.
  +     * For example:
  +     *
  +     * <blockquote>
  +     * <table>
  +     * <tr align=left><th>First line of HTTP request<th>
  +     * <th>Returned Value
  +     * <tr><td>POST /some/path.html HTTP/1.1<td><td>/some/path.html
  +     * <tr><td>GET http://foo.bar/a.html HTTP/1.0
  +     * <td><td>http://foo.bar/a.html
  +     * <tr><td>HEAD /xyz?a=b HTTP/1.1<td><td>/xyz
  +     * </table>
  +     * </blockquote>
  +     *
  +     * @return                a <code>String</code> containing
  +     *                        the part of the URL from the
  +     *                        protocol name up to the query string
  +     *
  +     *
  +     */
  +
  +    String getRequestURI();
  +
  +    /**
  +     *
  +     * Returns the part of this request's URL that calls
  +     * the servlet. This includes either the servlet name or
  +     * a path to the servlet, but does not include any extra
  +     * path information or a query string. Same as the value
  +     * of the CGI variable SCRIPT_NAME.
  +     *
  +     *
  +     * @return                a <code>String</code> containing
  +     *                        the name or path of the servlet being
  +     *                        called, as specified in the request URL
  +     *
  +     *
  +     */
  +
  +    String getServletPath();
  +
  +    /**
  +     *
  +     * Returns the current <code>HttpSession</code>
  +     * associated with this request or, if if there is no
  +     * current session and <code>create</code> is true, returns
  +     * a new session.
  +     *
  +     * <p>If <code>create</code> is <code>false</code>
  +     * and the request has no valid <code>HttpSession</code>,
  +     * this method returns <code>null</code>.
  +     *
  +     * <p>To make sure the session is properly maintained,
  +     * you must call this method before
  +     * the response is committed.
  +     *
  +     *
  +     *
  +     *
  +     * @param                <code>true</code> to create
  +     *                        a new session for this request if necessary;
  +     *                        <code>false</code> to return <code>null</code>
  +     *                        if there's no current session
  +     *
  +     *
  +     * @return                 the <code>HttpSession</code> associated
  +     *                        with this request or <code>null</code> if
  +     *                         <code>create</code> is <code>false</code>
  +     *                        and the request has no valid session
  +     *
  +     * @see        #getSession()
  +     *
  +     *
  +     */
  +
  +    Session getSession(boolean create);
  +
  +    /**
  +     *
  +     * Returns the current session associated with this request,
  +     * or if the request does not have a session, creates one.
  +     *
  +     * @return                the <code>HttpSession</code> associated
  +     *                        with this request
  +     *
  +     * @see        #getSession(boolean)
  +     *
  +     */
  +
  +     Session getSession();
  +
  +    /**
  +     *
  +     * Checks whether the requested session ID is still valid.
  +     *
  +     * @return                        <code>true</code> if this
  +     *                                request has an id for a valid session
  +     *                                in the current session context;
  +     *                                <code>false</code> otherwise
  +     *
  +     * @see                        #getRequestedSessionId
  +     * @see                        #getSession
  +     *
  +     */
  +
  +    boolean isRequestedSessionIdValid();
  +
  +    /**
  +     *
  +     * Checks whether the requested session ID came in as a cookie.
  +     *
  +     * @return                        <code>true</code> if the session ID
  +     *                                came in as a
  +     *                                cookie; otherwise, <code>false</code>
  +     *
  +     *
  +     * @see                        #getSession
  +     *
  +     */
  +
  +    boolean isRequestedSessionIdFromCookie();
  +
  +    /**
  +     *
  +     * Checks whether the requested session ID came in as part of the
  +     * request URL.
  +     *
  +     * @return                        <code>true</code> if the session ID
  +     *                                came in as part of a URL; otherwise,
  +     *                                <code>false</code>
  +     *
  +     *
  +     * @see                        #getSession
  +     *
  +     */
  +
  +    boolean isRequestedSessionIdFromURL();
  +}
  
  
  
  1.2       +189 -10   jakarta-turbine-3/proposals/kasper/newrundata/Response.java
  
  Index: Response.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/proposals/kasper/newrundata/Response.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Response.java     2001/09/05 09:34:25     1.1
  +++ Response.java     2001/09/05 09:59:25     1.2
  @@ -1,16 +1,195 @@
   package org.apache.turbine.newrundata;
   
  +import java.io.IOException;
  +import java.util.Locale;
  +
   /**
  - * Title:
  - * Description:
  - * Copyright:    Copyright (c) 2001
  - * Company:
  - * @author
  - * @version 1.0
  + * Defines an interface to provide client response information .
  + *
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Davanum Srinivas</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Kasper Nielsen</a>
  + * @version CVS $Revision: 1.2 $ $Date: 2001/09/05 09:59:25 $
  + *
    */
   
   public interface Response {
  -//Todo
  -//needs to be filled out (Kasper)
  -//
  -}
  \ No newline at end of file
  +
  +    /**
  +     * Returns the name of the charset used for
  +     * the MIME body sent in this response.
  +     *
  +     * <p>If no charset has been assigned, it is implicitly
  +     * set to <code>ISO-8859-1</code> (<code>Latin-1</code>).
  +     *
  +     * <p>See RFC 2047 (http://ds.internic.net/rfc/rfc2045.txt)
  +     * for more information about character encoding and MIME.
  +     *
  +     * @return                a <code>String</code> specifying the
  +     *                        name of the charset, for
  +     *                        example, <code>ISO-8859-1</code>
  +     *
  +     */
  +
  +    String getCharacterEncoding();
  +
  +    /**
  +     * Sets the locale of the response, setting the headers (including the
  +     * Content-Type's charset) as appropriate.  By default, the response locale
  +     * is the default locale for the server.
  +     *
  +     * @param loc  the locale of the response
  +     *
  +     * @see                 #getLocale
  +     *
  +     */
  +
  +    void setLocale(Locale loc);
  +
  +    /**
  +     * Returns the locale assigned to the response.
  +     *
  +     *
  +     * @see                 #setLocale
  +     *
  +     */
  +
  +    Locale getLocale();
  +
  +    /**
  +     * Constructs a cookie with a specified name and value.
  +     *
  +     * <p>The name must conform to RFC 2109. That means it can contain
  +     * only ASCII alphanumeric characters and cannot contain commas,
  +     * semicolons, or white space or begin with a $ character. The cookie's
  +     * name cannot be changed after creation.
  +     *
  +     * <p>The value can be anything the server chooses to send. Its
  +     * value is probably of interest only to the server. The cookie's
  +     * value can be changed after creation with the
  +     * <code>setValue</code> method.
  +     *
  +     * <p>By default, cookies are created according to the Netscape
  +     * cookie specification. The version can be changed with the
  +     * <code>setVersion</code> method.
  +     *
  +     *
  +     * @param name                         a <code>String</code> specifying the 
name of the cookie
  +     *
  +     * @param value                        a <code>String</code> specifying the 
value of the cookie
  +     *
  +     * @throws IllegalArgumentException        if the cookie name contains illegal 
characters
  +     *                                        (for example, a comma, space, or 
semicolon)
  +     *                                        or it is one of the tokens reserved 
for use
  +     *                                        by the cookie protocol
  +     *
  +     */
  +    Cookie createCookie(String name, String value);
  +
  +    /**
  +     * Adds the specified cookie to the response.  This method can be called
  +     * multiple times to set more than one cookie.
  +     *
  +     * @param cookie the Cookie to return to the client
  +     *
  +     */
  +
  +    void addCookie(Cookie cookie);
  +
  +    /**
  +     * Returns a boolean indicating whether the named response header
  +     * has already been set.
  +     *
  +     * @param        name        the header name
  +     * @return                <code>true</code> if the named response header
  +     *                        has already been set;
  +     *                         <code>false</code> otherwise
  +     */
  +
  +    boolean containsHeader(String name);
  +
  +    /**
  +     * Encodes the specified URL by including the session ID in it,
  +     * or, if encoding is not needed, returns the URL unchanged.
  +     * The implementation of this method includes the logic to
  +     * determine whether the session ID needs to be encoded in the URL.
  +     * For example, if the browser supports cookies, or session
  +     * tracking is turned off, URL encoding is unnecessary.
  +     *
  +     * <p>For robust session tracking, all URLs emitted by a servlet
  +     * should be run through this
  +     * method.  Otherwise, URL rewriting cannot be used with browsers
  +     * which do not support cookies.
  +     *
  +     * @param        url        the url to be encoded.
  +     * @return                the encoded URL if encoding is needed;
  +     *                         the unchanged URL otherwise.
  +     */
  +
  +    String encodeURL(String url);
  +
  +    /**
  +     *
  +     * Sets a response header with the given name and
  +     * date-value.  The date is specified in terms of
  +     * milliseconds since the epoch.  If the header had already
  +     * been set, the new value overwrites the previous one.  The
  +     * <code>containsHeader</code> method can be used to test for the
  +     * presence of a header before setting its value.
  +     *
  +     * @param        name        the name of the header to set
  +     * @param        value        the assigned date value
  +     *
  +     * @see #containsHeader
  +     * @see #addDateHeader
  +     */
  +
  +    void setDateHeader(String name, long date);
  +
  +    /**
  +     *
  +     * Adds a response header with the given name and
  +     * date-value.  The date is specified in terms of
  +     * milliseconds since the epoch.  This method allows response headers
  +     * to have multiple values.
  +     *
  +     * @param        name        the name of the header to set
  +     * @param        value        the additional date value
  +     *
  +     * @see #setDateHeader
  +     */
  +
  +    void addDateHeader(String name, long date);
  +
  +    /**
  +     *
  +     * Sets a response header with the given name and value.
  +     * If the header had already been set, the new value overwrites the
  +     * previous one.  The <code>containsHeader</code> method can be
  +     * used to test for the presence of a header before setting its
  +     * value.
  +     *
  +     * @param        name        the name of the header
  +     * @param        value        the header value
  +     *
  +     * @see #containsHeader
  +     * @see #addHeader
  +     */
  +
  +    void setHeader(String name, String value);
  +
  +    /**
  +     * Adds a response header with the given name and value.
  +     * This method allows response headers to have multiple values.
  +     *
  +     * @param        name        the name of the header
  +     * @param        value        the additional header value
  +     *
  +     * @see #setHeader
  +     */
  +
  +    void addHeader(String name, String value);
  +}
  +
  +
  +
  
  
  
  1.2       +3 -3      jakarta-turbine-3/proposals/kasper/newrundata/Session.java
  
  Index: Session.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/proposals/kasper/newrundata/Session.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Session.java      2001/09/05 09:34:25     1.1
  +++ Session.java      2001/09/05 09:59:25     1.2
  @@ -7,14 +7,14 @@
    * Provides a way to identify a user across more than one page
    * request or visit to a Web site and to store information about that user.
    *
  - * <p>Cocoon uses this interface to create a session
  - * between a client and the "cocoon server". The session persists
  + * <p>Turbine uses this interface to create a session
  + * between a client and the "turbine server". The session persists
    * for a specified time period, across more than one connection or
    * page request from the user. A session usually corresponds to one
    * user, who may visit a site many times. The server can maintain a
    * session in many ways such as using cookies or rewriting URLs.
    *
  - * <p>This interface allows Cocoon to
  + * <p>This interface allows Turbine to
    * <ul>
    * <li>View and manipulate information about a session, such as
    *     the session identifier, creation time, and last accessed time
  @@ -27,7 +27,7 @@
    * will not be directly visible in another.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/09/05 09:34:25 $
  + * @version CVS $Revision: 1.2 $ $Date: 2001/09/05 09:59:25 $
    *
    */
   
  
  
  
  1.2       +0 -5      
jakarta-turbine-3/proposals/kasper/newrundata/servlet/HttpContext.java
  
  Index: HttpContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-3/proposals/kasper/newrundata/servlet/HttpContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpContext.java  2001/09/05 09:34:11     1.1
  +++ HttpContext.java  2001/09/05 09:59:25     1.2
  @@ -6,11 +6,6 @@
   import javax.servlet.ServletContext;
   
   
  -/**
  - *
  - * Implements the {@link org.apache.cocoon.environment.Context} interface
  - */
  -
   public class HttpContext {
   
       /** The ServletContext */
  
  
  
  1.2       +0 -0      
jakarta-turbine-3/proposals/kasper/newrundata/servlet/HttpCookie.java
  
  Index: HttpCookie.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-3/proposals/kasper/newrundata/servlet/HttpCookie.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpCookie.java   2001/09/05 09:34:11     1.1
  +++ HttpCookie.java   2001/09/05 09:59:25     1.2
  @@ -39,7 +39,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Kasper Nielsen</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/09/05 09:34:11 $
  + * @version CVS $Revision: 1.2 $ $Date: 2001/09/05 09:59:25 $
    *
    */
   
  
  
  
  1.2       +9 -21     
jakarta-turbine-3/proposals/kasper/newrundata/servlet/HttpRequest.java
  
  Index: HttpRequest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-3/proposals/kasper/newrundata/servlet/HttpRequest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpRequest.java  2001/09/05 09:34:11     1.1
  +++ HttpRequest.java  2001/09/05 09:59:25     1.2
  @@ -21,14 +21,13 @@
   import javax.servlet.http.HttpServletRequest;
   import org.apache.turbine.newrundata.Cookie;
   import org.apache.turbine.newrundata.Request;
  -//import org.apache.cocoon.environment.Session;
  -
  +import org.apache.turbine.newrundata.Session;
   /**
    * Implements the {@link javax.servlet.http.HttpServletRequest} interface
    * to provide request information for HTTP servlets.
    *
    * @author <a href="mailto:giacomo@apache,org";>Giacomo Pati</a>
  - * @version CVS $Id: HttpRequest.java,v 1.1 2001/09/05 09:34:11 knielsen Exp $
  + * @version CVS $Id: HttpRequest.java,v 1.2 2001/09/05 09:59:25 knielsen Exp $
    */
   
   public class HttpRequest implements Request {
  @@ -146,17 +145,16 @@
       public String getRemoteUser() {
           return this.req.getRemoteUser();
       }
  -
  +    //we need to discuss these in connection with the rework of the Security service
  +    /*
       public boolean isUserInRole(String role) {
           return this.req.isUserInRole(role);
       }
  -    //okay this what was getUser once
   
       public java.security.Principal getUserPrincipal() {
           return this.req.getUserPrincipal();
  -
       }
  -
  +*/
       public String getRequestedSessionId() {
           return this.req.getRequestedSessionId();
       }
  @@ -169,18 +167,19 @@
       public String getServletPath() {
           return this.req.getServletPath();
       }
  -/*
  +
       public Session getSession(boolean create) {
           javax.servlet.http.HttpSession session = this.req.getSession(create);
           if(session != null)
  -            return new HttpSession(session);
  +        //java.util.hashtable needs to be delegeted to a factory somewhere
  +            return new HttpSession(session,new java.util.Hashtable());
           return null;
       }
   
       public Session getSession() {
           return this.getSession(true);
       }
  -*/
  +
       public boolean isRequestedSessionIdValid() {
           return this.req.isRequestedSessionIdValid();
       }
  @@ -192,17 +191,6 @@
       public boolean isRequestedSessionIdFromURL() {
           return this.req.isRequestedSessionIdFromURL();
       }
  -/*
  -
  -     * @deprecated                As of Version 2.1 of the Java Servlet
  -     * API, use {@link #isRequestedSessionIdFromURL}
  -     *instead.
  -
  -    public boolean isRequestedSessionIdFromUrl() {
  -        return this.req.isRequestedSessionIdFromUrl();
  -    }
  -*/
  -    /* The ServletRequest interface methods */
   
       public Object getAttribute(String name) {
           return this.req.getAttribute(name);
  @@ -223,7 +211,7 @@
       public String getContentType() {
           return this.req.getContentType();
       }
  -
  +    //I don't know how the turbine spews out stuff now, maybe we should remove this
       public ServletInputStream getInputStream() throws IOException {
           return this.req.getInputStream();
       }
  
  
  
  1.2       +0 -0      
jakarta-turbine-3/proposals/kasper/newrundata/servlet/HttpResponse.java
  
  Index: HttpResponse.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-3/proposals/kasper/newrundata/servlet/HttpResponse.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpResponse.java 2001/09/05 09:34:11     1.1
  +++ HttpResponse.java 2001/09/05 09:59:25     1.2
  @@ -24,7 +24,7 @@
    * to access HTTP headers and cookies.
    *
    * @author <a href="mailto:knielsen@apache,org";>Kasper Nielsen</a>
  - * @version CVS $Id: HttpResponse.java,v 1.1 2001/09/05 09:34:11 knielsen Exp $
  + * @version CVS $Id: HttpResponse.java,v 1.2 2001/09/05 09:59:25 knielsen Exp $
    */
   
   public class HttpResponse implements Response {
  
  
  
  1.2       +3 -3      
jakarta-turbine-3/proposals/kasper/newrundata/servlet/HttpSession.java
  
  Index: HttpSession.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-3/proposals/kasper/newrundata/servlet/HttpSession.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpSession.java  2001/09/05 09:34:11     1.1
  +++ HttpSession.java  2001/09/05 09:59:25     1.2
  @@ -17,14 +17,14 @@
    * Provides a way to identify a user across more than one page
    * request or visit to a Web site and to store information about that user.
    *
  - * <p>Cocoon uses this interface to create a session
  - * between a client and the "cocoon server". The session persists
  + * <p>Turbine uses this interface to create a session
  + * between a client and the "Turbine server". The session persists
    * for a specified time period, across more than one connection or
    * page request from the user. A session usually corresponds to one
    * user, who may visit a site many times. The server can maintain a
    * session in many ways such as using cookies or rewriting URLs.
    *
  - * <p>This interface allows Cocoon to
  + * <p>This interface allows Turbine to
    * <ul>
    * <li>View and manipulate information about a session, such as
    *     the session identifier, creation time, and last accessed time
  @@ -38,7 +38,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Kasper Nielsen</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/09/05 09:34:11 $
  + * @version CVS $Revision: 1.2 $ $Date: 2001/09/05 09:59:25 $
    *
    */
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to