Renamed variable in writeResponse()
This commit is contained in:
parent
d0aa1a72b5
commit
bb3a080164
1 changed files with 18 additions and 19 deletions
|
@ -177,7 +177,7 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
String pathInfo = request.getPathInfo ();
|
String pathInfo = request.getPathInfo ();
|
||||||
ResponseTrans restrans = execute (reqtrans, pathInfo);
|
ResponseTrans restrans = execute (reqtrans, pathInfo);
|
||||||
|
|
||||||
writeResponse (request, response, restrans, cookies);
|
writeResponse (request, response, restrans);
|
||||||
|
|
||||||
} catch (Exception x) {
|
} catch (Exception x) {
|
||||||
try {
|
try {
|
||||||
|
@ -202,27 +202,26 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
|
|
||||||
void writeResponse (HttpServletRequest req,
|
void writeResponse (HttpServletRequest req,
|
||||||
HttpServletResponse res,
|
HttpServletResponse res,
|
||||||
ResponseTrans trans,
|
ResponseTrans hopres) {
|
||||||
Cookie[] cookies) {
|
|
||||||
|
|
||||||
for (int i = 0; i < trans.countCookies(); i++) try {
|
for (int i = 0; i < hopres.countCookies(); i++) try {
|
||||||
Cookie c = new Cookie(trans.getKeyAt(i), trans.getValueAt(i));
|
Cookie c = new Cookie(hopres.getKeyAt(i), hopres.getValueAt(i));
|
||||||
c.setPath ("/");
|
c.setPath ("/");
|
||||||
if (cookieDomain != null)
|
if (cookieDomain != null)
|
||||||
c.setDomain (cookieDomain);
|
c.setDomain (cookieDomain);
|
||||||
int expires = trans.getDaysAt(i);
|
int expires = hopres.getDaysAt(i);
|
||||||
if (expires > 0)
|
if (expires > 0)
|
||||||
c.setMaxAge(expires * 60*60*24); // Cookie time to live, days -> seconds
|
c.setMaxAge(expires * 60*60*24); // Cookie time to live, days -> seconds
|
||||||
res.addCookie(c);
|
res.addCookie(c);
|
||||||
} catch (Exception ign) {}
|
} catch (Exception ign) {}
|
||||||
|
|
||||||
if (trans.getRedirect () != null) {
|
if (hopres.getRedirect () != null) {
|
||||||
sendRedirect(req, res, trans.getRedirect ());
|
sendRedirect(req, res, hopres.getRedirect ());
|
||||||
} else if (trans.getNotModified ()) {
|
} else if (hopres.getNotModified ()) {
|
||||||
res.setStatus (HttpServletResponse.SC_NOT_MODIFIED);
|
res.setStatus (HttpServletResponse.SC_NOT_MODIFIED);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (!trans.cache || ! caching) {
|
if (!hopres.cache || ! caching) {
|
||||||
// Disable caching of response.
|
// Disable caching of response.
|
||||||
if (isOneDotOne (req.getProtocol ())) {
|
if (isOneDotOne (req.getProtocol ())) {
|
||||||
// for HTTP 1.0
|
// for HTTP 1.0
|
||||||
|
@ -232,12 +231,12 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
res.setHeader ("Cache-Control", "no-cache");
|
res.setHeader ("Cache-Control", "no-cache");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( trans.realm!=null )
|
if ( hopres.realm!=null )
|
||||||
res.setHeader( "WWW-Authenticate", "Basic realm=\"" + trans.realm + "\"" );
|
res.setHeader( "WWW-Authenticate", "Basic realm=\"" + hopres.realm + "\"" );
|
||||||
if (trans.status > 0)
|
if (hopres.status > 0)
|
||||||
res.setStatus (trans.status);
|
res.setStatus (hopres.status);
|
||||||
// set last-modified header to now
|
// set last-modified header to now
|
||||||
long modified = trans.getLastModified ();
|
long modified = hopres.getLastModified ();
|
||||||
if (modified > -1)
|
if (modified > -1)
|
||||||
res.setDateHeader ("Last-Modified", System.currentTimeMillis ());
|
res.setDateHeader ("Last-Modified", System.currentTimeMillis ());
|
||||||
// if we don't know which charset to use for parsing HTTP params,
|
// if we don't know which charset to use for parsing HTTP params,
|
||||||
|
@ -246,12 +245,12 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
// containing the form has. Problem is we can do this only per servlet,
|
// containing the form has. Problem is we can do this only per servlet,
|
||||||
// not per session or even per page, which would produce too much overhead
|
// not per session or even per page, which would produce too much overhead
|
||||||
if (defaultEncoding == null)
|
if (defaultEncoding == null)
|
||||||
defaultEncoding = trans.charset;
|
defaultEncoding = hopres.charset;
|
||||||
res.setContentLength (trans.getContentLength ());
|
res.setContentLength (hopres.getContentLength ());
|
||||||
res.setContentType (trans.getContentType ());
|
res.setContentType (hopres.getContentType ());
|
||||||
try {
|
try {
|
||||||
OutputStream out = res.getOutputStream ();
|
OutputStream out = res.getOutputStream ();
|
||||||
out.write (trans.getContent ());
|
out.write (hopres.getContent ());
|
||||||
out.flush ();
|
out.flush ();
|
||||||
} catch(Exception io_e) {
|
} catch(Exception io_e) {
|
||||||
log ("Exception in writeResponse: "+io_e);
|
log ("Exception in writeResponse: "+io_e);
|
||||||
|
|
Loading…
Add table
Reference in a new issue