jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mets...@apache.org
Subject svn commit: r1488547 - in /incubator/jspwiki/trunk: ChangeLog jspwiki-war/src/main/java/org/apache/wiki/Release.java jspwiki-war/src/main/java/org/apache/wiki/ui/WikiJSPFilter.java
Date Sat, 01 Jun 2013 17:12:22 GMT
Author: metskem
Date: Sat Jun  1 17:12:22 2013
New Revision: 1488547

URL: http://svn.apache.org/r1488547
Log:
2013-06-01  Harry Metske (metskem@apache.org)

       * 2.10.0-svn-2

       * JSPWIKI-396: UTF-8 characters in wiki pages incorrectly rendered if served by Weblogic

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java
    incubator/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/ui/WikiJSPFilter.java

Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=1488547&r1=1488546&r2=1488547&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Sat Jun  1 17:12:22 2013
@@ -1,3 +1,9 @@
+2013-06-01  Harry Metske (metskem@apache.org)
+
+       * 2.10.0-svn-2
+
+       * JSPWIKI-396: UTF-8 characters in wiki pages incorrectly rendered if served by Weblogic
+
 2013-05-28  Juan Pablo Santos (juanpablo AT apache DOT org)
 
        * 2.10.0-svn-1

Modified: incubator/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java?rev=1488547&r1=1488546&r2=1488547&view=diff
==============================================================================
--- incubator/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java (original)
+++ incubator/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java Sat Jun
 1 17:12:22 2013
@@ -75,7 +75,7 @@ public final class Release
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "1";
+    public static final String     BUILD         = "2";
     
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/ui/WikiJSPFilter.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/ui/WikiJSPFilter.java?rev=1488547&r1=1488546&r2=1488547&view=diff
==============================================================================
--- incubator/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/ui/WikiJSPFilter.java
(original)
+++ incubator/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/ui/WikiJSPFilter.java
Sat Jun  1 17:12:22 2013
@@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletRes
 import org.apache.log4j.NDC;
 
 import org.apache.wiki.WikiContext;
+import org.apache.wiki.WikiEngine;
 import org.apache.wiki.event.WikiEventManager;
 import org.apache.wiki.event.WikiPageEvent;
 import org.apache.wiki.url.DefaultURLConstructor;
@@ -67,6 +68,7 @@ import org.apache.wiki.util.WatchDog;
 public class WikiJSPFilter extends WikiServletFilter
 {
     private Boolean m_useOutputStream;
+    private String m_wiki_encoding = m_engine.getWikiProperties().getProperty(WikiEngine.PROP_ENCODING);
 
     /** {@inheritDoc} */
     public void init( FilterConfig config ) throws ServletException
@@ -76,9 +78,7 @@ public class WikiJSPFilter extends WikiS
         m_useOutputStream = UtilJ2eeCompat.useOutputStream( context.getServerInfo() );
     }
 
-    public void doFilter( ServletRequest  request,
-                          ServletResponse response,
-                          FilterChain     chain )
+    public void doFilter( ServletRequest  request, ServletResponse response, FilterChain
chain )
         throws ServletException, IOException
     {
         WatchDog w = m_engine.getCurrentWatchDog();
@@ -92,13 +92,12 @@ public class WikiJSPFilter extends WikiS
             if( m_useOutputStream )
             {
                 log.debug( "Using ByteArrayResponseWrapper" );
-                responseWrapper = new ByteArrayResponseWrapper( (HttpServletResponse)response
);
+                responseWrapper = new ByteArrayResponseWrapper( (HttpServletResponse)response,
m_wiki_encoding );
             }
             else
             {
                 log.debug( "Using MyServletResponseWrapper" );
-                responseWrapper = new MyServletResponseWrapper( (HttpServletResponse)response
);
-                
+                responseWrapper = new MyServletResponseWrapper( (HttpServletResponse)response,
m_wiki_encoding );
             }
         
             // fire PAGE_REQUESTED event
@@ -118,13 +117,6 @@ public class WikiJSPFilter extends WikiS
                 w.enterState( "Delivering response", 30 );
                 WikiContext wikiContext = getWikiContext( request );
                 String r = filter( wikiContext, responseWrapper );
-        
-                //String encoding = "UTF-8";
-                //if( wikiContext != null ) encoding = wikiContext.getEngine().getContentEncoding();
-        
-                // Only now write the (real) response to the client.
-                // response.setContentLength(r.length());
-                // response.setContentType(encoding);
                 
                 if (m_useOutputStream) 
                 {
@@ -166,7 +158,7 @@ public class WikiJSPFilter extends WikiS
      * Goes through all types and writes the appropriate response.
      * 
      * @param wikiContext The usual processing context
-     * @param string The source string
+     * @param response The source string
      * @return The modified string with all the insertions in place.
      */
     private String filter(WikiContext wikiContext, HttpServletResponse response )
@@ -268,12 +260,12 @@ public class WikiJSPFilter extends WikiS
          */
         private static final int INIT_BUFFER_SIZE = 4096;
         
-        public MyServletResponseWrapper( HttpServletResponse r )
-        {
+        public MyServletResponseWrapper( HttpServletResponse r, final String wiki_encoding
)
+                throws UnsupportedEncodingException {
             super(r);
             m_output = new CharArrayWriter( INIT_BUFFER_SIZE );
             m_servletOut = new MyServletOutputStream(m_output);
-            m_writer = new PrintWriter(m_servletOut, true);
+            m_writer = new PrintWriter(new OutputStreamWriter(m_servletOut, wiki_encoding),
true);
         }
 
         /**
@@ -351,12 +343,12 @@ public class WikiJSPFilter extends WikiS
          */
         private static final int INIT_BUFFER_SIZE = 4096;
         
-        public ByteArrayResponseWrapper( HttpServletResponse r )
-        {
+        public ByteArrayResponseWrapper( HttpServletResponse r, final String wiki_encoding
)
+                throws UnsupportedEncodingException {
             super(r);
             m_output = new ByteArrayOutputStream( INIT_BUFFER_SIZE );
             m_servletOut = new MyServletOutputStream(m_output);
-            m_writer = new PrintWriter(m_servletOut, true);
+            m_writer = new PrintWriter(new OutputStreamWriter(m_servletOut, wiki_encoding),
true);
             m_response = r;
         }
         



Mime
View raw message