Skip to content

portlet global session ignored by by JSF request wrapper [SPR-5637] #10308

Closed
@spring-projects-issues

Description

@spring-projects-issues

Alexandre Clement opened SPR-5637 and commented

the FacesRequestAttributes getAttributeMap() function doesn't handle the SCOPE_GLOBAL_SESSION.

protected Map getAttributeMap(int scope) {
		if (scope == SCOPE_REQUEST) {
			return getExternalContext().getRequestMap();
		}
		else {
			return getExternalContext().getSessionMap();
		}
	}

I had to access to the underlying portletsession to manage it. I didn't find a way to do it without declaring a dependency on the portlet-api.

protected Map getAttributeMap(int scope) {
		if (scope == SCOPE_REQUEST) {
			return getExternalContext().getRequestMap();
		}
		else if (scope == SCOPE_SESSION) {
			return getExternalContext().getSessionMap();
		} else {
		    Object session = getExternalContext().getSession(true);
		    if (session instanceof PortletSession) {
		        return ((PortletSession)session).getAttributeMap(PortletSession.APPLICATION_SCOPE);
		    } else {
		        return getExternalContext().getSessionMap();
		    }
		}
	}

Sub-tasks:

Referenced from: commits 2524ca3

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions