Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>When you construct <a href="http://download.oracle.com/javase/6/docs/api/java/io/InputStreamReader.html" rel="nofollow"><code>InputStreamReader</code></a> without specifying a charset as 2nd argument, then the platform default encoding will be used, which is often ISO-8859-1. You need to specify the same charset as specified in the response header of the target URL, which is UTF-8.</p> <pre><code>input = new BufferedReader(new InputStreamReader(target.openStream(), "UTF-8")); </code></pre> <p>The <code>IllegalStateException</code> is caused because you're doing this in a JSP instead of a Servlet. The JSP internally uses <a href="http://download.oracle.com/javaee/6/api/javax/servlet/ServletResponse.html#getWriter%28%29" rel="nofollow"><code>response.getWriter()</code></a>, but you're calling <a href="http://download.oracle.com/javaee/6/api/javax/servlet/ServletResponse.html#getOutputStream%28%29" rel="nofollow"><code>response.getOutputStream()</code></a> in a JSP <em>scriptlet</em>. This cannot be done simultaneously as explained in their javadocs. Also, the double loop is far from efficient. Just write immediately to <code>out</code> (which is <code>response.getWriter()</code>) in the first loop instead of to some buffer.</p> <p>Regardless, this is a terrible way of proxying. Rather use a Servlet or grab JSTL <a href="http://download.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/c/import.html" rel="nofollow"><code>&lt;c:import&gt;</code></a> instead.</p> <pre><code>&lt;c:import url="http://en.wikipedia.org/wiki/Main_Page" /&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload