Author: pyaschenko
Date: 2008-06-24 07:05:51 -0400 (Tue, 24 Jun 2008)
New Revision: 9175
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
Log:
http://jira.jboss.com/jira/browse/RF-3549
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2008-06-24
11:04:51 UTC (rev 9174)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2008-06-24
11:05:51 UTC (rev 9175)
@@ -149,6 +149,11 @@
public static final String FILE_UPLOAD_INDICATOR =
"_richfaces_upload_file_indicator";
/**
+ * Request parameter that allow to send HTTP error instead of html message
+ */
+ public static final String SEND_HTTP_ERROR = "_richfaces_send_http_error";
+
+ /**
* Initialize the filter.
*/
public void init(FilterConfig config) throws ServletException {
@@ -295,10 +300,15 @@
Map<String, MultipartRequest> sessionsMap = null;
Map<String, Object> percentMap = null;
+ boolean sendError = Boolean.parseBoolean(request.getParameter(SEND_HTTP_ERROR));
try {
if (isFileSizeRestricted(request, maxRequestSize)) {
- printResponse(response,
- "<html
id=\"_richfaces_file_upload_size_restricted\"></html>");
+ if (sendError) {
+ response.sendError(413);
+ } else {
+ printResponse(response,
+ "<html
id=\"_richfaces_file_upload_size_restricted\"></html>");
+ }
} else if (!checkFileCount(httpRequest)) {
printResponse(response,
"<html
id=\"_richfaces_file_upload_forbidden\"></html>");