Thanks for all the work here.  Are we building with the 2.3 jar then?  

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 17, 2002 9:22 PM
> To: [EMAIL PROTECTED]
> Subject: cvs commit: jakarta-turbine-
> stratum/src/java/org/apache/stratum/jcs/utils/servlet/session
> HttpServletRequestFacade.java
> 
> dlr         02/01/17 18:22:06
> 
>   Modified:    src/java/org/apache/stratum/jcs/utils/servlet/session
>                         HttpServletRequestFacade.java
>   Log:
>   Achieved compatibility with the 2.3 Servlet API.  Added
>   setCharacterEncoding(String) and getParameterMap() implementations.
>   The setCharacterEncoding() implementation does not modify the
>   underlying request (to preserve 2.2 compatibility).
> 
>   Revision  Changes    Path
>   1.6       +60 -4     jakarta-turbine-
>
stratum/src/java/org/apache/stratum/jcs/utils/servlet/session/HttpServle
tR
> equestFacade.java
> 
>   Index: HttpServletRequestFacade.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-turbine-
>
stratum/src/java/org/apache/stratum/jcs/utils/servlet/session/HttpServle
tR
> equestFacade.java,v
>   retrieving revision 1.5
>   retrieving revision 1.6
>   diff -u -u -r1.5 -r1.6
>   --- HttpServletRequestFacade.java   18 Jan 2002 02:02:44 -0000
1.5
>   +++ HttpServletRequestFacade.java   18 Jan 2002 02:22:06 -0000
1.6
>   @@ -3,11 +3,14 @@
> 
>    import java.io.BufferedReader;
>    import java.io.IOException;
>   +import java.io.UnsupportedEncodingException;
> 
>    import java.security.Principal;
> 
>    import java.util.Enumeration;
>   +import java.util.HashMap;
>    import java.util.Locale;
>   +import java.util.Map;
> 
>    import javax.servlet.RequestDispatcher;
>    import javax.servlet.ServletInputStream;
>   @@ -22,10 +25,12 @@
>    import
org.apache.stratum.jcs.utils.servlet.session.MetaHttpSession;
> 
>    /**
>   - *  Session wrapper, to overide some methods.  Servlet 2.3 has an
> easier way to do this.
>   + * Session wrapper, to overide some methods.  Servlet 2.3 has an
>   + * easier way to do this.
>     *
>   - *@author     asmuts
>   - *@created    January 15, 2002
>   + * @author asmuts
>   + * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel Rall</a>
>   + * @created January 15, 2002
>     */
>    public class HttpServletRequestFacade implements HttpServletRequest
>    {
>   @@ -33,6 +38,7 @@
>        private final HttpServletRequest req;
>        private final HttpServletResponse res;
>        private MetaHttpSession ms;
>   +    private String characterEncoding;
> 
> 
> 
> /////////////////////////////////////////////////////////////////////
>   @@ -122,7 +128,37 @@
>         */
>        public String getCharacterEncoding()
>        {
>   -        return req.getCharacterEncoding();
>   +        // FUTURE: Always delegate when we switch to servlet api
2.3
>   +        return (characterEncoding != null ? characterEncoding :
>   +                req.getCharacterEncoding());
>   +    }
>   +
>   +
>   +    /**
>   +     * 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>.
>   +     *
>   +     * NOTE: This method will not modify the underlying request
until
>   +     * Servlet API 2.3 is adopted.
>   +     *
>   +     * @param enc The character encoding to be used
>   +     *
>   +     * @exception UnsupportedEncodingException If the specified
>   +     * encoding is not supported.
>   +     */
>   +    public void setCharacterEncoding(String enc)
>   +        throws UnsupportedEncodingException
>   +    {
>   +        // FUTURE: Call req.setCharacterEncoding(enc) for servlet
api
> 2.3
>   +
>   +        // 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
>   +        this.characterEncoding = enc;
>        }
> 
> 
>   @@ -194,6 +230,26 @@
>        public String[] getParameterValues( String name )
>        {
>            return req.getParameterValues( name );
>   +    }
>   +
>   +
>   +    /**
>   +     * The implementation of this method will remain somewhat
>   +     * expensive until Servlet API 2.3 is adopted.
>   +     */
>   +    public Map getParameterMap()
>   +    {
>   +        // FUTURE: Call req.getParameterMap() for servlet api 2.3
>   +
>   +        Map params = new HashMap();
>   +        Enumeration enum = req.getParameterNames();
>   +        String name;
>   +        while (enum.hasMoreElements())
>   +        {
>   +            name = (String) enum.nextElement();
>   +            params.put(name, req.getParameterValues(name));
>   +        }
>   +        return params;
>        }
> 
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:turbine-dev-
> [EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:turbine-dev-
> [EMAIL PROTECTED]>



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

Reply via email to