struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yogesh Patel (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4741) Http Sessions forcefully created for all requests using I18nInterceptor with default Storage value.
Date Wed, 31 Jan 2018 05:59:02 GMT

    [ https://issues.apache.org/jira/browse/WW-4741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16346293#comment-16346293
] 

Yogesh Patel commented on WW-4741:
----------------------------------

Thanks [~yasser.zamani]

Agreed that it should create session to store locale. But

Below is difference compare to old and new struts version:
{panel:title=Previous Struts Versions behaviour (i.e 2.3.24.1)}
If locale is NULL then it keeps storage as NONE and it does not create session
{panel}
{panel:title=Struts Version 2.3.13}


if locale is NULL then it keeps storage as SESSION and it creates session and stores *WW_TRANS_I18N_LOCALE*
attribute in session.
{panel}

Just to confirm, is this valid behavior ?

 

> 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
>            Priority: Major
>             Fix For: 2.5.12
>
>
> 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
(v7.6.3#76005)

Mime
View raw message