cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/components/jsp JSPEngineImplNamedDispatcherInclude.java JSPEngineImplWLS.java JSPEngineImpl.java
Date Thu, 10 Jul 2003 23:38:04 GMT
joerg       2003/07/10 16:38:04

  Modified:    src/blocks/jsp/java/org/apache/cocoon/reading JSPReader.java
               src/blocks/jsp/java/org/apache/cocoon/generation
                        JspGenerator.java
               .        status.xml
               src/blocks/jsp/java/org/apache/cocoon/components/jsp
                        JSPEngineImplNamedDispatcherInclude.java
                        JSPEngineImplWLS.java JSPEngineImpl.java
  Log:
  reverted the changes on the default encoding (bugfix 14327), JSPReader already has a TODO
for re-encoding
  
  changed JSPReader from deprecated ComposerReader to ServiceableReader
  
  fixed some deprecation messages on the wrong methods
  
  Revision  Changes    Path
  1.3       +4 -4      cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/reading/JSPReader.java
  
  Index: JSPReader.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/reading/JSPReader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JSPReader.java	7 Jun 2003 23:01:48 -0000	1.2
  +++ JSPReader.java	10 Jul 2003 23:38:04 -0000	1.3
  @@ -69,7 +69,7 @@
    * @author <a href="mailto:kpiroumian@flagship.ru">Konstantin Piroumian</a>
    * @version CVS $Id$
    */
  -public class JSPReader extends ComposerReader {
  +public class JSPReader extends ServiceableReader {
   
       /**
        * Generates the output from JSP page.
  @@ -93,7 +93,7 @@
   
           JSPEngine engine = null;
           try {
  -            // FIXME (KP): Should we exclude not supported protocols, say 'context'?
  +            // TODO (KP): Should we exclude not supported protocols, say 'context'?
               String url = this.source;
   
               // absolute path is processed as is
  @@ -112,7 +112,7 @@
               }
   
               byte[] bytes = engine.executeJSP(url, httpRequest, httpResponse, httpContext);
  -            // FIXME (KP): Make buffer size configurable
  +            // TODO (KP): Make buffer size configurable
               byte[] buffer = new byte[8192];
               int length = -1;
   
  
  
  
  1.3       +2 -2      cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/generation/JspGenerator.java
  
  Index: JspGenerator.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/generation/JspGenerator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JspGenerator.java	7 Jun 2003 23:01:48 -0000	1.2
  +++ JspGenerator.java	10 Jul 2003 23:38:04 -0000	1.3
  @@ -102,7 +102,7 @@
           JSPEngine engine = null;
           SAXParser parser = null;
           try {
  -            // FIXME (KP): Should we exclude not supported protocols, say 'context'?
  +            // TODO (KP): Should we exclude not supported protocols, say 'context'?
               String url = this.source;
               // absolute path is processed as is
               if (!url.startsWith("/")) {
  
  
  
  1.84      +5 -1      cocoon-2.1/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/status.xml,v
  retrieving revision 1.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- status.xml	10 Jul 2003 22:17:43 -0000	1.83
  +++ status.xml	10 Jul 2003 23:38:04 -0000	1.84
  @@ -184,6 +184,10 @@
     <changes>
   
    <release version="@version@" date="@date@">
  +  <action dev="JH" type="fix" fixes-bug="14327">
  +  	Reverted the encoding changes in the JSP engine. The fix should be done in
  +  	the JSPReader, that already contains a TODO.
  +  </action>
     <action dev="RP" type="fix">
       Web3: The stylesheets in the examples use Xalan as transformer and work correctly now
       as XSLTC has problems with the 'rfc' namespace.
  
  
  
  1.3       +8 -3      cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/components/jsp/JSPEngineImplNamedDispatcherInclude.java
  
  Index: JSPEngineImplNamedDispatcherInclude.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/components/jsp/JSPEngineImplNamedDispatcherInclude.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JSPEngineImplNamedDispatcherInclude.java	24 Mar 2003 14:33:56 -0000	1.2
  +++ JSPEngineImplNamedDispatcherInclude.java	10 Jul 2003 23:38:04 -0000	1.3
  @@ -167,6 +167,7 @@
           public boolean isRequestedSessionIdValid(){ return request.isRequestedSessionIdValid();
}
           public boolean isRequestedSessionIdFromCookie(){ return request.isRequestedSessionIdFromCookie();
}
           public boolean isRequestedSessionIdFromURL(){ return request.isRequestedSessionIdFromURL();
}
  +        /** @deprecated use isRequestedSessionIdFromURL instead. */
           public boolean isRequestedSessionIdFromUrl(){ return request.isRequestedSessionIdFromUrl();
}
           public Object getAttribute(String s){
               if(s != null && s.equals(INC_SERVLET_PATH))
  @@ -195,6 +196,7 @@
           public Enumeration getLocales(){ return request.getLocales(); }
           public boolean isSecure(){ return request.isSecure(); }
           public RequestDispatcher getRequestDispatcher(String s){ return request.getRequestDispatcher(s);
}
  +        /** @deprecated use ServletContext.getRealPath(java.lang.String) instead. */
           public String getRealPath(String s){ return request.getRealPath(s); }
           public java.lang.StringBuffer getRequestURL() { return null; }
           public java.util.Map getParameterMap() { return null; }
  @@ -230,10 +232,12 @@
           }
           public void addCookie(Cookie cookie){ response.addCookie(cookie); }
           public boolean containsHeader(String s){ return response.containsHeader(s); }
  -        public String encodeURL(String s){ return response.encodeURL(s); }
  -        public String encodeRedirectURL(String s){ return response.encodeRedirectURL(s);
}
  +        /** @deprecated use encodeURL(String url) instead. */
           public String encodeUrl(String s){ return response.encodeUrl(s); }
  +        public String encodeURL(String s){ return response.encodeURL(s); }
  +        /** @deprecated use encodeRedirectURL(String url) instead. */
           public String encodeRedirectUrl(String s){ return response.encodeRedirectUrl(s);
}
  +        public String encodeRedirectURL(String s){ return response.encodeRedirectURL(s);
}
           public void sendError(int i, String s)
               throws IOException{response.sendError(i,s); }
           public void sendError(int i)
  @@ -247,6 +251,7 @@
           public void setIntHeader(String s, int i){response.setIntHeader(s, i); }
           public void addIntHeader(String s, int i){response.addIntHeader(s, i); }
           public void setStatus(int i){response.setStatus(i); }
  +        /** @deprecated use sendError(int, String) instead */
           public void setStatus(int i, String s){response.setStatus(i, s); }
           public void resetBuffer(){}
   
  
  
  
  1.2       +6 -3      cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/components/jsp/JSPEngineImplWLS.java
  
  Index: JSPEngineImplWLS.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/components/jsp/JSPEngineImplWLS.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JSPEngineImplWLS.java	9 Mar 2003 00:04:13 -0000	1.1
  +++ JSPEngineImplWLS.java	10 Jul 2003 23:38:04 -0000	1.2
  @@ -248,10 +248,12 @@
         public Locale getLocale(){ return this.response.getLocale();}
         public void addCookie(Cookie cookie){ response.addCookie(cookie); }
         public boolean containsHeader(String s){ return response.containsHeader(s); }
  -      public String encodeURL(String s){ return response.encodeURL(s); }
  -      public String encodeRedirectURL(String s){ return response.encodeRedirectURL(s);
}
  +      /** @deprecated use encodeURL(String url) instead. */
         public String encodeUrl(String s){ return response.encodeUrl(s); }
  +      public String encodeURL(String s){ return response.encodeURL(s); }
  +      /** @deprecated use encodeRedirectURL(String url) instead. */
         public String encodeRedirectUrl(String s){ return response.encodeRedirectUrl(s);
}
  +      public String encodeRedirectURL(String s){ return response.encodeRedirectURL(s);
}
         public void sendError(int i, String s)
             throws IOException{response.sendError(i,s); }
         public void sendError(int i)
  @@ -265,6 +267,7 @@
         public void setIntHeader(String s, int i){response.setIntHeader(s, i); }
         public void addIntHeader(String s, int i){response.addIntHeader(s, i); }
         public void setStatus(int i){response.setStatus(i); }
  +      /** @deprecated use sendError(int, String) instead */
         public void setStatus(int i, String s){response.setStatus(i, s); }
       }
   }
  
  
  
  1.6       +18 -46    cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/components/jsp/JSPEngineImpl.java
  
  Index: JSPEngineImpl.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/components/jsp/JSPEngineImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JSPEngineImpl.java	7 Jun 2003 23:01:48 -0000	1.5
  +++ JSPEngineImpl.java	10 Jul 2003 23:38:04 -0000	1.6
  @@ -69,14 +69,12 @@
   import java.security.Principal;
   import java.util.Enumeration;
   import java.util.Locale;
  -import java.util.StringTokenizer;
   
   /**
    * Allows JSP to be used as a generator.  Builds upon the JSP servlet
    * functionality - overrides the output method and returns the byte(s).
    *
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
  - * @author <a href="mailto:miyabe@jzf.co.jp">MIYABE Tatsuhiko</a>
    * @version CVS $Id$
    */
   public class JSPEngineImpl extends AbstractLogEnabled
  @@ -134,7 +132,7 @@
        * Stub implementation of Servlet Config
        */
       class config implements ServletConfig {
  -        ServletContext c;
  +        ServletContext c = null;
           public config(ServletContext c) {this.c = c; }
   
           public String getServletName() { return "JSPEngineImpl"; }
  @@ -148,8 +146,8 @@
        * Stub implementation of HttpServletRequest
        */
       class MyServletRequest implements HttpServletRequest {
  -        HttpServletRequest request;
  -        String jspFile;
  +        HttpServletRequest request = null;
  +        String jspFile = null;
   
           public MyServletRequest(HttpServletRequest request, String jspFile) {
               this.request = request;
  @@ -218,60 +216,37 @@
        * Stub implementation of HttpServletResponse
        */
       class MyServletResponse implements HttpServletResponse {
  -        HttpServletResponse response;
  +        HttpServletResponse response = null;
           MyServletOutputStream output = null;
  -        String encoding = "iso-8859-1";
   
           public MyServletResponse(HttpServletResponse response){
               this.response = response;
  +            this.output = new MyServletOutputStream();
           }
           public void flushBuffer() throws IOException { }
           public int getBufferSize() { return 1024; }
           public String getCharacterEncoding() { return this.response.getCharacterEncoding();}
           public Locale getLocale(){ return this.response.getLocale();}
           public PrintWriter getWriter() {
  -            if (this.output == null) {
  -                this.output = new MyServletOutputStream(this.encoding);
  -            }
               return this.output.getWriter();
           }
           public boolean isCommitted() { return false; }
           public void reset() {}
           public void setBufferSize(int size) {}
           public void setContentLength(int len) {}
  -        public void setContentType(java.lang.String type) {
  -            StringTokenizer st = new StringTokenizer(type, ";,");
  -            st.nextToken();
  -            while (st.hasMoreTokens())  {
  -                String param = st.nextToken();
  -                int equal = param.indexOf("=");
  -                if (equal != -1) {
  -                    String name = param.substring(0, equal);
  -                    if (name.trim().equalsIgnoreCase("charset")) {
  -                        this.encoding = param.substring(equal + 1).trim();
  -                        break;
  -                    }
  -                    continue;
  -                }
  -                break;
  -            }
  -        }
  +        public void setContentType(java.lang.String type) {}
           public void setLocale(java.util.Locale loc) {}
           public ServletOutputStream getOutputStream() {
  -            if (this.output == null) {
  -                // FIXME: Won't it break JSPEngine contract? See JSPEngine.executeJSP
  -                this.output = new MyServletOutputStream(this.encoding);
  -            }
               return this.output;
           }
           public void addCookie(Cookie cookie){ response.addCookie(cookie); }
           public boolean containsHeader(String s){ return response.containsHeader(s); }
  -        public String encodeURL(String s){ return response.encodeURL(s); }
  -        /** @deprecated use encodeRedirectURL(String url) instead. */
  -        public String encodeRedirectURL(String s){ return response.encodeRedirectURL(s);
}
           /** @deprecated use encodeURL(String url) instead. */
           public String encodeUrl(String s){ return response.encodeUrl(s); }
  +        public String encodeURL(String s){ return response.encodeURL(s); }
  +        /** @deprecated use encodeRedirectURL(String url) instead. */
           public String encodeRedirectUrl(String s){ return response.encodeRedirectUrl(s);
}
  +        public String encodeRedirectURL(String s){ return response.encodeRedirectURL(s);
}
           public void sendError(int i, String s)
               throws IOException{response.sendError(i,s); }
           public void sendError(int i)
  @@ -290,12 +265,7 @@
           public void resetBuffer(){}
   
           public byte[] toByteArray() {
  -            if (this.output != null) {
  -                return output.toByteArray();
  -            }
  -            else {
  -                return new byte[0];
  -            }
  +            return output.toByteArray();
           }
       }
   
  @@ -303,15 +273,17 @@
        * Stub implementation of ServletOutputStream
        */
       class MyServletOutputStream extends ServletOutputStream {
  -        ByteArrayOutputStream output;
  -        PrintWriter writer;
  +        ByteArrayOutputStream output = null;
  +        PrintWriter writer = null;
   
  -        public MyServletOutputStream(String encoding) {
  +        public MyServletOutputStream() {
               this.output = new ByteArrayOutputStream();
               try {
  -                this.writer = new PrintWriter(new OutputStreamWriter(output, encoding));
  +                this.writer = new PrintWriter(new OutputStreamWriter(output, "UTF-8"));
               } catch (UnsupportedEncodingException e) {
  -                getLogger().error("Unsupported encoding: " + encoding + ", using platform
default instead.");
  +                getLogger().error("Your JVM seems not to support UTF-8,"
  +                                  + " using platform default instead."
  +                                  + " This can cause problems as you can imagine.");
                   this.writer = new PrintWriter(new OutputStreamWriter(output));
               }
           }
  
  
  

Mime
View raw message