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

Bypass VRaptor filter in WebSocket requests. #891

Merged
merged 5 commits into from
Nov 24, 2014

Conversation

marcioferlan
Copy link

When you try to open a WebSocket connection to a @serverendpoint component in your application, the current implementation of the VRaptor filter prevents it from completing.

This fix allows WebSocket requests to bypass the VRaptor filter, hence, succeeding to establish the connection.

Marcio Lima added 2 commits November 19, 2014 14:59
@marcioferlan
Copy link
Author

Garcia, please take a look at this new version of the code. I also provided a unit test along with the implementation.

As an enhancement, I changed the comparison logic from equals() to contains() as the Websocket spec states that:

5.   The request MUST contain an |Upgrade| header field whose value
        MUST include the "websocket" keyword.

@@ -104,7 +104,13 @@ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)

final HttpServletRequest baseRequest = (HttpServletRequest) req;
final HttpServletResponse baseResponse = (HttpServletResponse) res;


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you have isWebsocketRequest you don't need the comment because the method name already did what's happening.

@marcioferlan
Copy link
Author

I think that both the code and the test look much better now. Please advise.

@garcia-jj
Copy link
Member

Thank you for share your contribution with us. But lets wait @Turini and @lucascs discuss about the code before merge. Best regards.

@Turini
Copy link
Member

Turini commented Nov 24, 2014

It sounds nice to me. Thanks @marcioferlan.

Turini added a commit that referenced this pull request Nov 24, 2014
Bypass VRaptor filter in WebSocket requests.
@Turini Turini merged commit 5192556 into caelum:master Nov 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants