ws.setEncoding(encoding);
  public void service(HttpServletRequest request,                      HttpServletResponse response)    throws ServletException, IOException  {    try {      Path path = getPath(request);      QuercusPage page = getQuercus().parse(path);      // quercus/1b06      String encoding = getQuercus().getScriptEncoding();      if (encoding != null)	response.setContentType("text/html; charset=" + encoding);      else	response.setContentType("text/html");      WriteStream ws;      // XXX: check if correct.  PHP doesn't expect the lower levels      // to deal with the encoding, so this may be okay      if (response instanceof CauchoResponse) {        ws = Vfs.openWrite(((CauchoResponse) response).getResponseStream());      } else {        OutputStream out = response.getOutputStream();        ws = Vfs.openWrite(out);      }      ws.setEncoding(encoding);      Env env = new Env(getQuercus(), page, ws, request, response);      try {        env.start();	String prepend = env.getIniString("auto_prepend_file");	if (prepend != null) {	  QuercusPage prependPage = getQuercus().parse(env.lookup(prepend));	  prependPage.executeTop(env);	}        page.executeTop(env);	String append = env.getIniString("auto_append_file");	if (append != null) {	  QuercusPage appendPage = getQuercus().parse(env.lookup(append));	  appendPage.executeTop(env);	}     //   return;      }      catch (QuercusExitException e) {        throw e;      }      catch (QuercusLineRuntimeException e) {        log.log(Level.FINE, e.toString(), e);      //  return;      }      catch (QuercusValueException e) {        log.log(Level.FINE, e.toString(), e);		ws.println(e.toString());      //  return;      }      catch (Throwable e) {        if (response.isCommitted())          e.printStackTrace(ws.getPrintWriter());        ws = null;        throw e;      }      finally {        env.close();        // don't want a flush for an exception        if (ws != null)          ws.close();      }    }    catch (QuercusDieException e) {      log.log(Level.FINE, e.toString(), e);      // normal exit    }    catch (QuercusExitException e) {      log.log(Level.FINER, e.toString(), e);      // normal exit    }    catch (RuntimeException e) {      throw e;    }    catch (Throwable e) {      throw new ServletException(e);    }  }