[
https://issues.apache.org/jira/browse/WW-3451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12870381#action_12870381
]
Christian Wolfgang Stone commented on WW-3451:
----------------------------------------------
First, while I am happy to have a solution that doesn't pollute the session, I
take exception to your choice of words. I hope you can communicate like an
adult.
There already is a filter, the Struts Execute Filter, that releases control.
There is also a Servlet, the FreemarkerDecoratorServlet that handles external
decoration. I was not suggesting that you code a new filter, but look at the
filter in place and what it calls (which is what you are already modifying), or
the servlet that needs the information so you can see a better fix. If you
understood the architecture, and are calling the Struts 2 architecture
*crappy*, I think that is a different matter. The fact that Struts 2 uses a
filter is not *crappy*. I would consider Struts 2 mature, and while I would
code things a bit differently, it works quite well. So if you are stating that
Struts 2 is crappy because it uses a filter (actually several filters), I think
you could be better off saying that the web.xml file is getting polluted and we
can do better. So you either look at the struts-execute filter (which is what
I recommend), or the servlet (which is the majority of what I wrote). Anyways,
it seems like you are putting a whole lot more energy into a bad fix instead of
asking perhaps why certain things work the way they do so a fix can be made
quickly.
I do agree with the change:
model.put(KEY_SESSION, sessionModel);
It is a redundancy from the code a few lines before and that should be a good
fix.
Now it has been a while, but as I remember a new request is generated by struts
under certain conditions (struts tags perhaps... and others)? The end result
was that important request information was being dumped that freemarker really
needed to have. This information was more than just the tags, but the results
of the users actions, such as adding request objects... these things are
necessary, and care should be taken to maintain the state.
I think a more elegant solution would include copying the model to (and
possibly from if the changes would not modify the model object) the new request
objects as they are created within Struts, and make them available to the
freemarker Servlet in the request at the end. This way you wouldn't need to
store anything in the session object, or worry about passing it forward where
it could be serialized. I would still look at extending the model wrapper and
making it so it won't be serialized, but I would first look carefully at the
Freemarker code and see why they rely on serialization.
I do agree that in a cluster system heavyweight object can be evil in a
session. I am happy that you are addressing this. However, looking for a
better fix is much better than reintroducing lots of bugs...
> [FreemarkerManager] don't put ATTR_SESSION_MODEL into session
> ----------------------------------------------------------------
>
> Key: WW-3451
> URL: https://issues.apache.org/jira/browse/WW-3451
> Project: Struts 2
> Issue Type: Bug
> Reporter: zhouyanming
> Priority: Critical
> Attachments: patch.txt
>
>
> put ATTR_SESSION_MODEL into session is useless in current code, and harmful
> for distributed system
> and remove some other useless code,please see patch.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.