[
https://issues.apache.org/jira/browse/WW-4741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15882827#comment-15882827
]
ASF GitHub Bot commented on WW-4741:
------------------------------------
GitHub user yasserzamani opened a pull request:
https://github.com/apache/struts/pull/119
[WW-4741] Do not force session creation on locale read operation
These changes prevent Struts to create session for request when it tries to
check if request's session has pre-putted locale. It returns null instead if
the request has no valid HttpSession.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/yasserzamani/struts WW-4741
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/struts/pull/119.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #119
----
commit 78db281cd6f66d50b3a5f48e2b1dee596d0a2232
Author: Yasser Zamani <[email protected]>
Date: 2017-02-24T14:48:53Z
[WW-4741] Do not force session creation on locale read operation
----
> Http Sessions forcefully created for all requests using I18nInterceptor with
> default Storage value.
> ---------------------------------------------------------------------------------------------------
>
> Key: WW-4741
> URL: https://issues.apache.org/jira/browse/WW-4741
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.5.10
> Reporter: Adam Greenfield
> Fix For: 2.5.next
>
>
> Changes made in WW-4730 for store and read functions cause an httpSession to
> be created for every request that uses I18nInterceptor when storage =
> Storage.SESSION.
> Current code checks for
> {noformat}Map<String, Object> session =
> invocation.getInvocationContext().getSession(){noformat}
> to be null and then calls
> {noformat}ServletActionContext.getRequest().getSession(){noformat}
> (notice how the second one references the HttpServletRequest. The
> HttpServletRequest Session and and the InvocationContext session are
> different. The request's session can be null, even if the
> InvocationContext's session is not).
> Calling .getSession() in this manner forcefully creates a session.
> An appropriate check here might be
> {noformat}HttpSession httpSession =
> ServletActionContext.getRequest().getSession(false);
> if(httpSession != null) {
> ... // get sessionId and synchronize on it
> }
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)