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
allowing controllers to receive optional parameters #618
Conversation
@@ -70,6 +70,12 @@ public void intercept(InterceptorStack stack, ResourceMethod method, Object reso | |||
Consumes consumesAnnotation = method.getMethod().getAnnotation(Consumes.class); | |||
List<String> supported = Arrays.asList(consumesAnnotation.value()); | |||
|
|||
if(request.getContentType() == null) { | |||
logger.info("Request does not have Content-Type and parameters will be not deserialized"); |
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'd use warn
.
Thanks for you comment @garcia-jj. Done! We need to replicate this to VRaptor4? |
can you reproduce it on vr4? If so, it would be nice to replicate the solution |
I can't understand why this solution allow optional parameters, because we Why content type is related to parameters? Why you simple bypass Your pull request sounds good, but I did this questions because I don't |
+1 to replicate to vraptor 4. |
When you make a request without content, then it wont have the Content-Type On Tuesday, October 14, 2014, Otávio Garcia notifications@github.com
|
Hmm, ok, now I see your point. Sounds like good to merge for me. Can you send a pull request in vr4 linked to this pull request? Thank you |
Sure! I'll do this. But this interceptor does not exists in VRaptor4. I'll find out where this logic has been doing there. Thank you. |
DeserializingObserver at VRaptor 4 |
Thanks Turini, I'll send a pullrequest right now. []s 2014-10-14 11:19 GMT-03:00 Rodrigo Turini notifications@github.com:
|
@Turini we already merged the VRaptor4 implementation. Can we merge this now? |
allowing controllers to receive optional parameters
done! thank you again, @nykolaslima |
No problem. Thank you. 2014-10-14 18:00 GMT-03:00 Rodrigo Turini notifications@github.com:
|
Currently we can't create a controller method that receives an optional parameter, when using deserialization.
If we call
/doSomething
with empty body, this will throw aNullPointerException
because it does not haveContent-Type
header.