cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/pluto/servlet ServletResponseImpl.java ServletRequestImpl.java
Date Mon, 05 Jul 2004 07:38:12 GMT
cziegeler    2004/07/05 00:38:12

  Modified:    src/blocks/portal/java/org/apache/cocoon/portal/pluto/servlet
                        ServletResponseImpl.java ServletRequestImpl.java
  Log:
  Use wrapper classes (fix bug 29556)
  
  Revision  Changes    Path
  1.3       +3 -140    cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/pluto/servlet/ServletResponseImpl.java
  
  Index: ServletResponseImpl.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/pluto/servlet/ServletResponseImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServletResponseImpl.java	5 Mar 2004 13:02:16 -0000	1.2
  +++ ServletResponseImpl.java	5 Jul 2004 07:38:12 -0000	1.3
  @@ -21,8 +21,8 @@
   import java.util.Locale;
   
   import javax.servlet.ServletOutputStream;
  -import javax.servlet.http.Cookie;
   import javax.servlet.http.HttpServletResponse;
  +import javax.servlet.http.HttpServletResponseWrapper;
   
   /**
    * Our response wrapper
  @@ -32,9 +32,8 @@
    * @version CVS $Id: URICopletAdapter.java,v 1.11 2003/10/20 13:36:41 cziegeler
    *          Exp $
    */
  -public class ServletResponseImpl implements HttpServletResponse {
  +public class ServletResponseImpl extends HttpServletResponseWrapper {
   
  -    protected final HttpServletResponse response;
       protected MyOutputStream stream;
       protected PrintWriter writer;
   
  @@ -44,7 +43,7 @@
       protected String redirectURL;
       
       public ServletResponseImpl(HttpServletResponse response) {
  -        this.response = response;
  +        super(response);
           this.stream = new MyOutputStream();
           this.writer = new PrintWriter(this.stream);
       }
  @@ -81,94 +80,6 @@
       /*
        * (non-Javadoc)
        * 
  -     * @see javax.servlet.http.HttpServletResponse#addCookie(javax.servlet.http.Cookie)
  -     */
  -    public void addCookie(Cookie arg0) {
  -        this.response.addCookie(null);
  -
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletResponse#addDateHeader(java.lang.String,
  -     *      long)
  -     */
  -    public void addDateHeader(String arg0, long arg1) {
  -        this.response.addDateHeader(arg0, arg1);
  -
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletResponse#addHeader(java.lang.String,
  -     *      java.lang.String)
  -     */
  -    public void addHeader(String arg0, String arg1) {
  -        this.response.addHeader(arg0, arg1);
  -
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletResponse#addIntHeader(java.lang.String,
  -     *      int)
  -     */
  -    public void addIntHeader(String arg0, int arg1) {
  -        this.response.addIntHeader(arg0, arg1);
  -
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletResponse#containsHeader(java.lang.String)
  -     */
  -    public boolean containsHeader(String arg0) {
  -        return this.response.containsHeader(arg0);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletResponse#encodeRedirectUrl(java.lang.String)
  -     */
  -    public String encodeRedirectUrl(String arg0) {
  -        return this.response.encodeRedirectURL(arg0);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletResponse#encodeRedirectURL(java.lang.String)
  -     */
  -    public String encodeRedirectURL(String arg0) {
  -        return this.response.encodeRedirectURL(arg0);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletResponse#encodeUrl(java.lang.String)
  -     */
  -    public String encodeUrl(String arg0) {
  -        return this.response.encodeURL(arg0);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletResponse#encodeURL(java.lang.String)
  -     */
  -    public String encodeURL(String arg0) {
  -        return this.response.encodeURL(arg0);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
        * @see javax.servlet.http.HttpServletResponse#sendError(int,
        *      java.lang.String)
        */
  @@ -197,36 +108,6 @@
       /*
        * (non-Javadoc)
        * 
  -     * @see javax.servlet.http.HttpServletResponse#setDateHeader(java.lang.String,
  -     *      long)
  -     */
  -    public void setDateHeader(String arg0, long arg1) {
  -        this.response.setDateHeader(arg0, arg1);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletResponse#setHeader(java.lang.String,
  -     *      java.lang.String)
  -     */
  -    public void setHeader(String arg0, String arg1) {
  -        this.response.setHeader(arg0, arg1);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletResponse#setIntHeader(java.lang.String,
  -     *      int)
  -     */
  -    public void setIntHeader(String arg0, int arg1) {
  -        this.response.setIntHeader(arg0, arg1);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
        * @see javax.servlet.http.HttpServletResponse#setStatus(int,
        *      java.lang.String)
        */
  @@ -259,24 +140,6 @@
        */
       public int getBufferSize() {
           return this.bufferSize = 1024;
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletResponse#getCharacterEncoding()
  -     */
  -    public String getCharacterEncoding() {
  -        return this.response.getCharacterEncoding();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletResponse#getLocale()
  -     */
  -    public Locale getLocale() {
  -        return this.response.getLocale();
       }
   
       /*
  
  
  
  1.4       +7 -391    cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/pluto/servlet/ServletRequestImpl.java
  
  Index: ServletRequestImpl.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/pluto/servlet/ServletRequestImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ServletRequestImpl.java	5 Mar 2004 13:02:16 -0000	1.3
  +++ ServletRequestImpl.java	5 Jul 2004 07:38:12 -0000	1.4
  @@ -15,22 +15,15 @@
    */
   package org.apache.cocoon.portal.pluto.servlet;
   
  -import java.io.BufferedReader;
  -import java.io.IOException;
   import java.io.UnsupportedEncodingException;
  -import java.security.Principal;
   import java.util.Collections;
   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.ServletInputStream;
  -import javax.servlet.http.Cookie;
   import javax.servlet.http.HttpServletRequest;
  -import javax.servlet.http.HttpSession;
  +import javax.servlet.http.HttpServletRequestWrapper;
   
   import org.apache.cocoon.portal.pluto.PortletURLProviderImpl;
   import org.apache.pluto.om.window.PortletWindow;
  @@ -43,19 +36,20 @@
    * @version CVS $Id: URICopletAdapter.java,v 1.11 2003/10/20 13:36:41 cziegeler
    *          Exp $
    */
  -public class ServletRequestImpl implements HttpServletRequest {
  -
  -    final protected HttpServletRequest request;
  +public class ServletRequestImpl extends HttpServletRequestWrapper {
   
       /** Cache the parameter map */
       protected Map portletParameterMap;
   
  +    final protected HttpServletRequest request;
  +    
       final protected PortletURLProviderImpl provider;
   
       protected PortletWindow window;
   
       public ServletRequestImpl(HttpServletRequest request,
                                 PortletURLProviderImpl provider) {
  +        super(request);
           this.request = request;
           this.provider = provider;
       }
  @@ -63,6 +57,7 @@
       public ServletRequestImpl(HttpServletRequest request,
                                 PortletURLProviderImpl provider,
                                 PortletWindow window) {
  +        super(request);
           this.request = request;
           this.provider = provider;
           this.window = window;
  @@ -75,105 +70,6 @@
       /*
        * (non-Javadoc)
        * 
  -     * @see javax.servlet.http.HttpServletRequest#getAuthType()
  -     */
  -    public String getAuthType() {
  -        return this.request.getAuthType();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#getContextPath()
  -     */
  -    public String getContextPath() {
  -        return this.request.getContextPath();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#getCookies()
  -     */
  -    public Cookie[] getCookies() {
  -        return this.request.getCookies();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#getDateHeader(java.lang.String)
  -     */
  -    public long getDateHeader(String arg0) {
  -        return this.request.getDateHeader(arg0);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#getHeader(java.lang.String)
  -     */
  -    public String getHeader(String arg0) {
  -        return this.request.getHeader(arg0);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#getHeaderNames()
  -     */
  -    public Enumeration getHeaderNames() {
  -        return this.request.getHeaderNames();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#getHeaders(java.lang.String)
  -     */
  -    public Enumeration getHeaders(String arg0) {
  -        return this.request.getHeaders(arg0);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#getIntHeader(java.lang.String)
  -     */
  -    public int getIntHeader(String arg0) {
  -        return this.request.getIntHeader(arg0);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#getMethod()
  -     */
  -    public String getMethod() {
  -        return this.request.getMethod();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#getPathInfo()
  -     */
  -    public String getPathInfo() {
  -        return this.request.getPathInfo();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#getPathTranslated()
  -     */
  -    public String getPathTranslated() {
  -        return this.request.getPathTranslated();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
        * @see javax.servlet.http.HttpServletRequest#getQueryString()
        */
       public String getQueryString() {
  @@ -183,33 +79,6 @@
       /*
        * (non-Javadoc)
        * 
  -     * @see javax.servlet.http.HttpServletRequest#getRemoteUser()
  -     */
  -    public String getRemoteUser() {
  -        return this.request.getRemoteUser();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#getRequestedSessionId()
  -     */
  -    public String getRequestedSessionId() {
  -        return this.request.getRequestedSessionId();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#getRequestURI()
  -     */
  -    public String getRequestURI() {
  -        return this.request.getRequestURI();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
        * @see javax.servlet.http.HttpServletRequest#getRequestURL()
        */
       public StringBuffer getRequestURL() {
  @@ -220,259 +89,6 @@
       /*
        * (non-Javadoc)
        * 
  -     * @see javax.servlet.http.HttpServletRequest#getServletPath()
  -     */
  -    public String getServletPath() {
  -        return this.request.getServletPath();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#getSession()
  -     */
  -    public HttpSession getSession() {
  -        return this.request.getSession();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#getSession(boolean)
  -     */
  -    public HttpSession getSession(boolean arg0) {
  -        return this.request.getSession(arg0);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#getUserPrincipal()
  -     */
  -    public Principal getUserPrincipal() {
  -        return this.request.getUserPrincipal();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromCookie()
  -     */
  -    public boolean isRequestedSessionIdFromCookie() {
  -        return this.request.isRequestedSessionIdFromCookie();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromUrl()
  -     */
  -    public boolean isRequestedSessionIdFromUrl() {
  -        return this.request.isRequestedSessionIdFromURL();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromURL()
  -     */
  -    public boolean isRequestedSessionIdFromURL() {
  -        return this.request.isRequestedSessionIdFromURL();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdValid()
  -     */
  -    public boolean isRequestedSessionIdValid() {
  -        return this.request.isRequestedSessionIdValid();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.http.HttpServletRequest#isUserInRole(java.lang.String)
  -     */
  -    public boolean isUserInRole(String arg0) {
  -        return this.request.isUserInRole(arg0);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getAttribute(java.lang.String)
  -     */
  -    public Object getAttribute(String arg0) {
  -        return this.request.getAttribute(arg0);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getAttributeNames()
  -     */
  -    public Enumeration getAttributeNames() {
  -        return this.request.getAttributeNames();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getCharacterEncoding()
  -     */
  -    public String getCharacterEncoding() {
  -        return this.request.getCharacterEncoding();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getContentLength()
  -     */
  -    public int getContentLength() {
  -        return this.request.getContentLength();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getInputStream()
  -     */
  -    public ServletInputStream getInputStream() throws IOException {
  -        return this.request.getInputStream();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getLocale()
  -     */
  -    public Locale getLocale() {
  -        return this.request.getLocale();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getLocales()
  -     */
  -    public Enumeration getLocales() {
  -        return this.request.getLocales();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getProtocol()
  -     */
  -    public String getProtocol() {
  -        return this.request.getProtocol();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getReader()
  -     */
  -    public BufferedReader getReader() throws IOException {
  -        return this.request.getReader();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getRealPath(java.lang.String)
  -     */
  -    public String getRealPath(String arg0) {
  -        return this.request.getRealPath(arg0);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getRemoteAddr()
  -     */
  -    public String getRemoteAddr() {
  -        return this.request.getRemoteAddr();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getRemoteHost()
  -     */
  -    public String getRemoteHost() {
  -        return this.request.getRemoteHost();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getRequestDispatcher(java.lang.String)
  -     */
  -    public RequestDispatcher getRequestDispatcher(String arg0) {
  -        return this.request.getRequestDispatcher(arg0);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getScheme()
  -     */
  -    public String getScheme() {
  -        return this.request.getScheme();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getServerName()
  -     */
  -    public String getServerName() {
  -        return this.request.getServerName();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#getServerPort()
  -     */
  -    public int getServerPort() {
  -        return this.request.getServerPort();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#isSecure()
  -     */
  -    public boolean isSecure() {
  -        return this.request.isSecure();
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#removeAttribute(java.lang.String)
  -     */
  -    public void removeAttribute(String arg0) {
  -        this.request.removeAttribute(arg0);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
  -     * @see javax.servlet.ServletRequest#setAttribute(java.lang.String,
  -     *      java.lang.Object)
  -     */
  -    public void setAttribute(String arg0, Object arg1) {
  -        this.request.setAttribute(arg0, arg1);
  -    }
  -
  -    /*
  -     * (non-Javadoc)
  -     * 
        * @see javax.servlet.ServletRequest#setCharacterEncoding(java.lang.String)
        */
       public void setCharacterEncoding(String arg0)
  @@ -485,7 +101,7 @@
        * 
        * @see javax.servlet.ServletRequest#getContentType()
        */
  -    public java.lang.String getContentType() {
  +    public String getContentType() {
           String contentType = "text/html";
           if (getCharacterEncoding() != null) {
               contentType += ";" + getCharacterEncoding();
  
  
  

Mime
View raw message