Lines 146-152
Link Here
|
146 |
* File encoding to be used when reading static files. If none is specified |
146 |
* File encoding to be used when reading static files. If none is specified |
147 |
* the platform default is used. |
147 |
* the platform default is used. |
148 |
*/ |
148 |
*/ |
149 |
protected String fileEncoding = null; |
149 |
protected String fileEncodingParam = null; |
150 |
|
150 |
|
151 |
|
151 |
|
152 |
/** |
152 |
/** |
Lines 235-241
Link Here
|
235 |
sendfileSize = |
235 |
sendfileSize = |
236 |
Integer.parseInt(getServletConfig().getInitParameter("sendfileSize")) * 1024; |
236 |
Integer.parseInt(getServletConfig().getInitParameter("sendfileSize")) * 1024; |
237 |
|
237 |
|
238 |
fileEncoding = getServletConfig().getInitParameter("fileEncoding"); |
238 |
fileEncodingParam = getServletConfig().getInitParameter("fileEncoding"); |
239 |
|
239 |
|
240 |
globalXsltFile = getServletConfig().getInitParameter("globalXsltFile"); |
240 |
globalXsltFile = getServletConfig().getInitParameter("globalXsltFile"); |
241 |
localXsltFile = getServletConfig().getInitParameter("localXsltFile"); |
241 |
localXsltFile = getServletConfig().getInitParameter("localXsltFile"); |
Lines 322-328
Link Here
|
322 |
throws IOException, ServletException { |
322 |
throws IOException, ServletException { |
323 |
|
323 |
|
324 |
// Serve the requested resource, including the data content |
324 |
// Serve the requested resource, including the data content |
325 |
serveResource(request, response, true); |
325 |
serveResource(request, response, true, fileEncodingParam); |
326 |
|
326 |
|
327 |
} |
327 |
} |
328 |
|
328 |
|
Lines 341-347
Link Here
|
341 |
throws IOException, ServletException { |
341 |
throws IOException, ServletException { |
342 |
|
342 |
|
343 |
// Serve the requested resource, without the data content |
343 |
// Serve the requested resource, without the data content |
344 |
serveResource(request, response, false); |
344 |
serveResource(request, response, false, fileEncodingParam); |
345 |
|
345 |
|
346 |
} |
346 |
} |
347 |
|
347 |
|
Lines 626-632
Link Here
|
626 |
*/ |
626 |
*/ |
627 |
protected void serveResource(HttpServletRequest request, |
627 |
protected void serveResource(HttpServletRequest request, |
628 |
HttpServletResponse response, |
628 |
HttpServletResponse response, |
629 |
boolean content) |
629 |
boolean content, |
|
|
630 |
String fileEncodingArg) |
630 |
throws IOException, ServletException { |
631 |
throws IOException, ServletException { |
631 |
|
632 |
|
632 |
// Identify the requested resource path |
633 |
// Identify the requested resource path |
Lines 808-814
Link Here
|
808 |
if (!checkSendfile(request, response, cacheEntry, contentLength, null)) |
809 |
if (!checkSendfile(request, response, cacheEntry, contentLength, null)) |
809 |
copy(cacheEntry, renderResult, ostream); |
810 |
copy(cacheEntry, renderResult, ostream); |
810 |
} else { |
811 |
} else { |
811 |
copy(cacheEntry, renderResult, writer); |
812 |
copy(cacheEntry, renderResult, writer, fileEncodingArg); |
812 |
} |
813 |
} |
813 |
} |
814 |
} |
814 |
|
815 |
|
Lines 853-859
Link Here
|
853 |
if (!checkSendfile(request, response, cacheEntry, range.end - range.start + 1, range)) |
854 |
if (!checkSendfile(request, response, cacheEntry, range.end - range.start + 1, range)) |
854 |
copy(cacheEntry, ostream, range); |
855 |
copy(cacheEntry, ostream, range); |
855 |
} else { |
856 |
} else { |
856 |
copy(cacheEntry, writer, range); |
857 |
copy(cacheEntry, writer, range, fileEncodingArg); |
857 |
} |
858 |
} |
858 |
} |
859 |
} |
859 |
|
860 |
|
Lines 873-879
Link Here
|
873 |
contentType); |
874 |
contentType); |
874 |
} else { |
875 |
} else { |
875 |
copy(cacheEntry, writer, ranges.iterator(), |
876 |
copy(cacheEntry, writer, ranges.iterator(), |
876 |
contentType); |
877 |
contentType, fileEncodingArg); |
877 |
} |
878 |
} |
878 |
} |
879 |
} |
879 |
|
880 |
|
Lines 1733-1739
Link Here
|
1733 |
* |
1734 |
* |
1734 |
* @exception IOException if an input/output error occurs |
1735 |
* @exception IOException if an input/output error occurs |
1735 |
*/ |
1736 |
*/ |
1736 |
protected void copy(CacheEntry cacheEntry, InputStream is, PrintWriter writer) |
1737 |
protected void copy(CacheEntry cacheEntry, InputStream is, PrintWriter writer, String fileEncodingArg) |
1737 |
throws IOException { |
1738 |
throws IOException { |
1738 |
|
1739 |
|
1739 |
IOException exception = null; |
1740 |
IOException exception = null; |
Lines 1746-1756
Link Here
|
1746 |
} |
1747 |
} |
1747 |
|
1748 |
|
1748 |
Reader reader; |
1749 |
Reader reader; |
1749 |
if (fileEncoding == null) { |
1750 |
if (fileEncodingArg == null) { |
1750 |
reader = new InputStreamReader(resourceInputStream); |
1751 |
reader = new InputStreamReader(resourceInputStream); |
1751 |
} else { |
1752 |
} else { |
1752 |
reader = new InputStreamReader(resourceInputStream, |
1753 |
reader = new InputStreamReader(resourceInputStream, |
1753 |
fileEncoding); |
1754 |
fileEncodingArg); |
1754 |
} |
1755 |
} |
1755 |
|
1756 |
|
1756 |
// Copy the input stream to the output stream |
1757 |
// Copy the input stream to the output stream |
Lines 1808-1814
Link Here
|
1808 |
* @exception IOException if an input/output error occurs |
1809 |
* @exception IOException if an input/output error occurs |
1809 |
*/ |
1810 |
*/ |
1810 |
protected void copy(CacheEntry cacheEntry, PrintWriter writer, |
1811 |
protected void copy(CacheEntry cacheEntry, PrintWriter writer, |
1811 |
Range range) |
1812 |
Range range, String fileEncodingArg) |
1812 |
throws IOException { |
1813 |
throws IOException { |
1813 |
|
1814 |
|
1814 |
IOException exception = null; |
1815 |
IOException exception = null; |
Lines 1816-1826
Link Here
|
1816 |
InputStream resourceInputStream = cacheEntry.resource.streamContent(); |
1817 |
InputStream resourceInputStream = cacheEntry.resource.streamContent(); |
1817 |
|
1818 |
|
1818 |
Reader reader; |
1819 |
Reader reader; |
1819 |
if (fileEncoding == null) { |
1820 |
if (fileEncodingArg == null) { |
1820 |
reader = new InputStreamReader(resourceInputStream); |
1821 |
reader = new InputStreamReader(resourceInputStream); |
1821 |
} else { |
1822 |
} else { |
1822 |
reader = new InputStreamReader(resourceInputStream, |
1823 |
reader = new InputStreamReader(resourceInputStream, |
1823 |
fileEncoding); |
1824 |
fileEncodingArg); |
1824 |
} |
1825 |
} |
1825 |
|
1826 |
|
1826 |
exception = copyRange(reader, writer, range.start, range.end); |
1827 |
exception = copyRange(reader, writer, range.start, range.end); |
Lines 1900-1906
Link Here
|
1900 |
* @exception IOException if an input/output error occurs |
1901 |
* @exception IOException if an input/output error occurs |
1901 |
*/ |
1902 |
*/ |
1902 |
protected void copy(CacheEntry cacheEntry, PrintWriter writer, |
1903 |
protected void copy(CacheEntry cacheEntry, PrintWriter writer, |
1903 |
Iterator ranges, String contentType) |
1904 |
Iterator ranges, String contentType, String fileEncodingArg) |
1904 |
throws IOException { |
1905 |
throws IOException { |
1905 |
|
1906 |
|
1906 |
IOException exception = null; |
1907 |
IOException exception = null; |
Lines 1910-1920
Link Here
|
1910 |
InputStream resourceInputStream = cacheEntry.resource.streamContent(); |
1911 |
InputStream resourceInputStream = cacheEntry.resource.streamContent(); |
1911 |
|
1912 |
|
1912 |
Reader reader; |
1913 |
Reader reader; |
1913 |
if (fileEncoding == null) { |
1914 |
if (fileEncodingArg == null) { |
1914 |
reader = new InputStreamReader(resourceInputStream); |
1915 |
reader = new InputStreamReader(resourceInputStream); |
1915 |
} else { |
1916 |
} else { |
1916 |
reader = new InputStreamReader(resourceInputStream, |
1917 |
reader = new InputStreamReader(resourceInputStream, |
1917 |
fileEncoding); |
1918 |
fileEncodingArg); |
1918 |
} |
1919 |
} |
1919 |
|
1920 |
|
1920 |
Range currentRange = (Range) ranges.next(); |
1921 |
Range currentRange = (Range) ranges.next(); |