-
Notifications
You must be signed in to change notification settings - Fork 332
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
Fixing instability with deserializing and instantiator order #680
Conversation
I dislike this inline if. What you think if you extract to method names hasConstraint and add this check in existent if? |
done, what about now? |
Turini, I really sorry about my typo (my cellphone is too bad). I think in something like:
That means, only extract your But since you already merged both methods, may we can rename to another name (hasConstraint is a mistake, because we don't have any constraint here). Suggestions? I'm not good with names. My two dogs know about this :) |
no worries, I'll change it tomorrow =) |
return methodInfo.getControllerMethod().getArity() > 0; | ||
public boolean hasConstraint() { | ||
ControllerMethod method = methodInfo.getControllerMethod(); | ||
return method.getArity() < 0 || method.containsAnnotation(Consumes.class); |
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.
arity will never be less than 0 ;)
use == 0
My only concern about this PR is that we won't support: @Post("/product/{product.id}")
@Consumes
public void update(Product product) {....} or @Post("/product/{product.id}/reviews")
@Consumes
public void add(Review review, Product product) {....} |
Not supporting this kind of parameters within url is not a good thing :-T On Thu, Jul 10, 2014 at 11:24 PM, Lucas Cavalcanti <notifications@github.com
Rafael Ponte |
yes, this is not nice... I'll write some tests and change the code to cover that |
this example provided for @lucascs does not work independent of |
its different from VRaptor 3? i've never used @consumes in VRAptor 3, but i heard that it work perfectly using VRaptor 3, so maybe can use the same idea? or cant because the CDI? |
Done! Now the code works fine independent of execution @Consumes("application/json")
@Path("/url/{id}")
public void test(Long id, Curso curso) {
System.out.println("ID "+id);
System.out.println("JSON "+ curso);
result.forwardTo(this).index();
} Or even: @Consumes("application/json")
@Path("/url/{curso.id}/{curso.nome}")
public void test2(Curso curso, Curso curso2) {
System.out.println("URL "+curso);
System.out.println("JSON "+ curso2);
result.forwardTo(this).index();
} |
ẁhat do you think? |
} else { | ||
valuedParameters[i].setValue(values[i]); | ||
|
||
if (!hasInstantiatableParameters()) return; |
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.
good name
sounds ⛵ to me |
🚢, but it doesn't support:
@Post("/cursos/{curso.id}") @Consumes
public void atualiza(Curso curso) {...} |
But this is another PR. |
Fixing instability with deserializing and instantiator order
Closes #668