q = String2.utf(s);
}
else if (hq.getQueryString() != null)
q = URLDecoder.decode(hq.getQueryString(), "UTF-8").toCharArray();
Container c = con.create();
c.set(HttpServletRequest.class, hq);
c.set(HttpServletResponse.class, hp);
c.set(HttpSession.class, hq.getSession());
c.set(String.class, "application/octet-stream");
Object p;
try
{
p = handler.handle(c, inf, q, 0, q.length, extraQs);
}
catch (RuntimeException e)
{
throw e;
}
catch (IOException e)
{
throw e;
}
catch (Exception e)
{
throw new ServletException(e);
}
finally
{
if ( !String2.empty(up))
hq.getSession().removeAttribute(up);
}
if (p == null)
throw null;
if (p instanceof CharSequence)
{
if (up != null)
{
hp.setContentType("text/html; charset=UTF-8");
CharSequence r = (CharSequence)p;
StringBuilder s = new StringBuilder();
s.append("<pre id=objot>");
for (int i = 0; i < r.length(); i++)
if (r.charAt(i) == '&')
s.append("&");
else if (r.charAt(i) == '<')
s.append("<");
else
s.append(r.charAt(i));
p = s.append("</pre>").toString();
}
byte[] bs = String2.utf((CharSequence)p);
hp.setContentLength(bs.length);
hp.getOutputStream().write(bs);
}
else if (p instanceof InputStream)
{
hp.setContentType(c.get(String.class));
Input.readTo((InputStream)p, hp.getOutputStream());
}
else
{
hp.setContentType(c.get(String.class));
hp.setContentLength(((byte[])p).length);
hp.getOutputStream().write((byte[])p);
}
}