* Fix bug where post parameters weren't parsed with prototype.js Ajax requests
because of charset subheader appended to ContentType * Use Servlet.log() instead of System.err.println() and pass exception as second argument.
This commit is contained in:
parent
21dfa78b0b
commit
900d16654a
1 changed files with 14 additions and 11 deletions
|
@ -86,7 +86,7 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
try {
|
try {
|
||||||
uploadLimit = (upstr == null) ? 1024 : Integer.parseInt(upstr);
|
uploadLimit = (upstr == null) ? 1024 : Integer.parseInt(upstr);
|
||||||
} catch (NumberFormatException x) {
|
} catch (NumberFormatException x) {
|
||||||
System.err.println("Bad number format for uploadLimit: " + upstr);
|
log("Bad number format for uploadLimit: " + upstr);
|
||||||
uploadLimit = 1024;
|
uploadLimit = 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception upx) {
|
} catch (Exception upx) {
|
||||||
System.err.println("Error in file upload: " + upx);
|
log("Error in file upload", upx);
|
||||||
if (uploadSoftfail) {
|
if (uploadSoftfail) {
|
||||||
String msg = upx.getMessage();
|
String msg = upx.getMessage();
|
||||||
if (msg == null || msg.length() == 0) {
|
if (msg == null || msg.length() == 0) {
|
||||||
|
@ -345,9 +345,9 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
"Please check back later.");
|
"Please check back later.");
|
||||||
}
|
}
|
||||||
|
|
||||||
log("Exception in execute: " + x);
|
log("Exception in execute", x);
|
||||||
} catch (IOException io_e) {
|
} catch (IOException iox) {
|
||||||
log("Exception in sendError: " + io_e);
|
log("Exception in sendError", iox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -406,8 +406,8 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
|
|
||||||
out.write(hopres.getContent());
|
out.write(hopres.getContent());
|
||||||
out.flush();
|
out.flush();
|
||||||
} catch (Exception io_e) {
|
} catch (Exception iox) {
|
||||||
log("Exception in writeResponse: " + io_e);
|
log("Exception in writeResponse: " + iox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -694,13 +694,16 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
try {
|
try {
|
||||||
parseParameters(parameters, queryString.getBytes(), encoding);
|
parseParameters(parameters, queryString.getBytes(), encoding);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("Error parsing query string: "+e);
|
log("Error parsing query string", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse any posted parameters in the input stream
|
// Parse any posted parameters in the input stream
|
||||||
if ("POST".equals(request.getMethod()) &&
|
String contentType = request.getContentType();
|
||||||
"application/x-www-form-urlencoded".equals(request.getContentType())) {
|
if ("post".equals(request.getMethod().toLowerCase())
|
||||||
|
&& contentType != null
|
||||||
|
&& contentType.toLowerCase()
|
||||||
|
.startsWith("application/x-www-form-urlencoded")) {
|
||||||
try {
|
try {
|
||||||
int max = request.getContentLength();
|
int max = request.getContentLength();
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
@ -719,8 +722,8 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
|
|
||||||
// is.close();
|
// is.close();
|
||||||
parseParameters(parameters, buf, encoding);
|
parseParameters(parameters, buf, encoding);
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
log("Error reading POST body", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue