addHeader(stream, ws, "QUERY_STRING", "");
String scriptPath = req.getServletPath();
String pathInfo = req.getPathInfo();
WebApp webApp = (WebApp) req.getServletContext();
Path appDir = webApp.getRootDirectory();
String realPath = webApp.getRealPath(scriptPath);
if (! appDir.lookup(realPath).isFile() && pathInfo != null)
scriptPath = scriptPath + pathInfo;
/*
* FastCGI (specifically quercus) uses the PATH_INFO and PATH_TRANSLATED
* for the script path.
*/
log.finer("STREAM file: " + webApp.getRealPath(scriptPath));
addHeader(stream, ws, "PATH_INFO", req.getContextPath() + scriptPath);
addHeader(stream, ws, "PATH_TRANSLATED", webApp.getRealPath(scriptPath));
/* These are the values which would be sent to CGI.
addHeader(stream, ws, "SCRIPT_NAME", req.getContextPath() + scriptPath);
addHeader(stream, ws, "SCRIPT_FILENAME", app.getRealPath(scriptPath));
if (pathInfo != null) {
addHeader(stream, ws, "PATH_INFO", pathInfo);
addHeader(stream, ws, "PATH_TRANSLATED", req.getRealPath(pathInfo));
}
else {
addHeader(stream, ws, "PATH_INFO", "");
addHeader(stream, ws, "PATH_TRANSLATED", "");
}
*/
int contentLength = req.getContentLength();
if (contentLength < 0)
addHeader(stream, ws, "CONTENT_LENGTH", "0");
else
addHeader(stream, ws, "CONTENT_LENGTH", String.valueOf(contentLength));
ServletContext rootContext = webApp.getContext("/");
if (rootContext != null)
addHeader(stream, ws, "DOCUMENT_ROOT", rootContext.getRealPath("/"));
CharBuffer cb = new CharBuffer();