-
Notifications
You must be signed in to change notification settings - Fork 49
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
Cookie handling #104
base: develop
Are you sure you want to change the base?
Cookie handling #104
Conversation
Updated the PR to support Netty's For reference, I did try and add support for
If you know how to fix this, I'll gladly re-add support for JAX-RS cookies as well. |
@chtyim Ping :) |
@chtyim Another gentle reminder. |
@chtyim Any change of getting this merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one actual comment, the rest are just about code style.
Thanks for the contribution!
@@ -125,6 +130,8 @@ public HttpMethodInfo handle(HttpRequest request, | |||
if (httpMethods.contains(request.method())) { | |||
//Setup args for reflection call | |||
Object [] args = new Object[paramsInfo.size()]; | |||
// Parse cookies | |||
Map<String, Cookie> cookies = cookieParser.parseCookies(request); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the problems with parsing here is that an invalid cookie will cause the request to fail, even if the method doesn't care about it. It could potentially cause backwards incompatibilities, as somebody could upgrade this library and then see their requests failing due to some headers they never looked at before.
instead of parsing all the cookies here, it would be better to only lookup the relevant header in the getCookieParamValue() method and decode it there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have moved it to the method so it will only be run on-demand. It does mean though that every cookie will result in parsing all the cookies. Is there a way to cache this? All the members on the HttpResourceModel
are final and set in the constructor, so I wasn't sure if it would be ok to add a cookie parsing cache there, which is the approach I'd normally take.
Implemented
@CookieParam
support forString
and Netty'sCookie
type.