--- DefaultServlet-543680.java 2009-02-17 18:23:11.719511000 -0500 +++ DefaultServlet-543680.java 2009-02-17 18:24:01.449319000 -0500 @@ -146,7 +146,7 @@ * File encoding to be used when reading static files. If none is specified * the platform default is used. */ - protected String fileEncoding = null; + protected String fileEncodingParam = null; /** @@ -235,7 +235,7 @@ sendfileSize = Integer.parseInt(getServletConfig().getInitParameter("sendfileSize")) * 1024; - fileEncoding = getServletConfig().getInitParameter("fileEncoding"); + fileEncodingParam = getServletConfig().getInitParameter("fileEncoding"); globalXsltFile = getServletConfig().getInitParameter("globalXsltFile"); localXsltFile = getServletConfig().getInitParameter("localXsltFile"); @@ -322,7 +322,7 @@ throws IOException, ServletException { // Serve the requested resource, including the data content - serveResource(request, response, true); + serveResource(request, response, true, fileEncodingParam); } @@ -341,7 +341,7 @@ throws IOException, ServletException { // Serve the requested resource, without the data content - serveResource(request, response, false); + serveResource(request, response, false, fileEncodingParam); } @@ -626,7 +626,8 @@ */ protected void serveResource(HttpServletRequest request, HttpServletResponse response, - boolean content) + boolean content, + String fileEncodingArg) throws IOException, ServletException { // Identify the requested resource path @@ -808,7 +809,7 @@ if (!checkSendfile(request, response, cacheEntry, contentLength, null)) copy(cacheEntry, renderResult, ostream); } else { - copy(cacheEntry, renderResult, writer); + copy(cacheEntry, renderResult, writer, fileEncodingArg); } } @@ -853,7 +854,7 @@ if (!checkSendfile(request, response, cacheEntry, range.end - range.start + 1, range)) copy(cacheEntry, ostream, range); } else { - copy(cacheEntry, writer, range); + copy(cacheEntry, writer, range, fileEncodingArg); } } @@ -873,7 +874,7 @@ contentType); } else { copy(cacheEntry, writer, ranges.iterator(), - contentType); + contentType, fileEncodingArg); } } @@ -1733,7 +1734,7 @@ * * @exception IOException if an input/output error occurs */ - protected void copy(CacheEntry cacheEntry, InputStream is, PrintWriter writer) + protected void copy(CacheEntry cacheEntry, InputStream is, PrintWriter writer, String fileEncodingArg) throws IOException { IOException exception = null; @@ -1746,11 +1747,11 @@ } Reader reader; - if (fileEncoding == null) { + if (fileEncodingArg == null) { reader = new InputStreamReader(resourceInputStream); } else { reader = new InputStreamReader(resourceInputStream, - fileEncoding); + fileEncodingArg); } // Copy the input stream to the output stream @@ -1808,7 +1809,7 @@ * @exception IOException if an input/output error occurs */ protected void copy(CacheEntry cacheEntry, PrintWriter writer, - Range range) + Range range, String fileEncodingArg) throws IOException { IOException exception = null; @@ -1816,11 +1817,11 @@ InputStream resourceInputStream = cacheEntry.resource.streamContent(); Reader reader; - if (fileEncoding == null) { + if (fileEncodingArg == null) { reader = new InputStreamReader(resourceInputStream); } else { reader = new InputStreamReader(resourceInputStream, - fileEncoding); + fileEncodingArg); } exception = copyRange(reader, writer, range.start, range.end); @@ -1900,7 +1901,7 @@ * @exception IOException if an input/output error occurs */ protected void copy(CacheEntry cacheEntry, PrintWriter writer, - Iterator ranges, String contentType) + Iterator ranges, String contentType, String fileEncodingArg) throws IOException { IOException exception = null; @@ -1910,11 +1911,11 @@ InputStream resourceInputStream = cacheEntry.resource.streamContent(); Reader reader; - if (fileEncoding == null) { + if (fileEncodingArg == null) { reader = new InputStreamReader(resourceInputStream); } else { reader = new InputStreamReader(resourceInputStream, - fileEncoding); + fileEncodingArg); } Range currentRange = (Range) ranges.next();