Redirect: Restoring Request Attributes
Posted by Vinay Agarwal on Jul 21, 2006; 6:12pm
URL: http://ofbiz.116.s1.nabble.com/Redirect-Restoring-Request-Attributes-tp169984.html
Hello,
My investigation of why my error messages (in request) are getting lost
during redirect, leads me to suspect that the request attribute restore code
may not be working as desired. Of course, I may have totally misunderstood
it J.
The way the code restores the request attributes is by copying them into
session attribute "_REQ_ATTR_MAP_". These attributes are put back into
request after redirection in two places, ContextFilter.java (130) and
RequestHandler.java (295).
When a user request a url that will result in redirection, the traced steps
are as follows:
1. ContextFilter (130), session attribute "_REQ_ATTR_MAP_" is null
2. Code stores request attributes to session attribute "_REQ_ATTR_MAP_"
before calling response.sendRedirect
3. RequestHandler (295), session attribute "_REQ_ATTR_MAP_" contains
all attributes
4. Attributes are copied to request object correctly and session
attribute "_REQ_ATTR_MAP_" is set to null
5. ContextFilter (130), session attribute "_REQ_ATTR_MAP_" is null
and request object does not contain any attributes copied in step 4.
6. RequestHandler (295), session attribute "_REQ_ATTR_MAP_" contains
all attributes and request object does not contain any attributes copied in
step 4.
As seen from steps 5 and 6, all request attributes copied in step 4 are
lost. I would appreciate any help in resolving it. Thanks in advance.
Regards,
Vinay Agarwal