Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot serialize proxied sesion scope beans. #52

Closed
ghost opened this issue Oct 11, 2014 · 2 comments
Closed

Cannot serialize proxied sesion scope beans. #52

ghost opened this issue Oct 11, 2014 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 11, 2014

In my case, I have some proxied session scope beans for Spring security oauth.

@sbeimin
Copy link

sbeimin commented Oct 30, 2014

After some research I discovered that beans with scope="session" that will be proxied using aop:scoped-proxy/ get instantiated and stored into the org.springframework.web.context.request.RequestAttributes through the org.springframework.web.context.request.SessionScope. The SessionScope acquires the RequestAttributes instance through RequestContextHolder.currentRequestAttributes();

This RequestAttributes object contains an unwrapped ServletRequest. Said ServletRequest isn't wrapped by the SessionRepositoryFilter because it the ServletRequestAttributes gets instantiated with the original HttpServletRequest in the org.springframework.web.context.request.RequestContextListener. This Listener is called before any Filters.

A solution to this is to use a org.springframework.web.filter.RequestContextFilter instead of a org.springframework.web.context.request.RequestContextListener

@rwinch
Copy link
Member

rwinch commented Feb 26, 2016

Closing since a work around was found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants