Author: andrei_exadel
Date: 2008-07-30 06:46:45 -0400 (Wed, 30 Jul 2008)
New Revision: 9823
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
Log:
RF-4003
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2008-07-30
08:22:27 UTC (rev 9822)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2008-07-30
10:46:45 UTC (rev 9823)
@@ -55,6 +55,8 @@
private Map<String, Param> parameters = null;
private Map<String, Object> percentMap = null;
+
+ private Map<Object, Object> attributes = Collections.synchronizedMap(new
HashMap<Object, Object>());
private enum ReadState {
BOUNDARY, HEADERS, DATA
@@ -271,14 +273,11 @@
}
}
- private HttpServletRequest request;
-
private boolean shouldStop = false;
public MultipartRequest(HttpServletRequest request,
boolean createTempFiles, int maxRequestSize, String uid) {
super(request);
- this.request = request;
this.createTempFiles = createTempFiles;
this.uid = uid;
@@ -297,7 +296,7 @@
String fileName = null;
try {
- if (request.getParameter("_richfaces_send_http_error") != null) {
+ if (getRequest().getParameter("_richfaces_send_http_error") != null) {
fileName = new String(name.getBytes(encoding), "UTF-8");
} else {
StringBuffer buffer = new StringBuffer();
@@ -335,13 +334,13 @@
}
public boolean parseRequest() {
- byte[] boundaryMarker = getBoundaryMarker(request.getContentType());
+ byte[] boundaryMarker = getBoundaryMarker(super.getContentType());
if (boundaryMarker == null) {
throw new FileUploadException("The request was rejected because "
+ "no multipart boundary was found");
}
- encoding = request.getCharacterEncoding();
+ encoding = getCharacterEncoding();
parameters = new HashMap<String, Param>();
@@ -355,7 +354,7 @@
ReadState readState = ReadState.BOUNDARY;
- InputStream input = request.getInputStream();
+ InputStream input = getInputStream();
if (!shouldStop) {
int read = input.read(buffer);
@@ -720,4 +719,25 @@
public void stop() {
shouldStop = true;
}
+
+
+ @Override
+ public Object getAttribute(String name) {
+ Object o = attributes.get(name);
+ if (o == null) {
+ getRequest().getAttribute(name);
+ }
+ return o;
+ }
+
+ @Override
+ public void setAttribute(String name, Object o) {
+ attributes.put(name, o);
+ getRequest().setAttribute(name, o);
+ }
+
+ @Override
+ public String getContentType() {
+ return "application/x-www-form-urlencoded";
+ }
}
Show replies by date