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

Method not allowed (405) in forwardTo(anotherClass.class).method(arg) #1107

Open
cesarjhony opened this issue Feb 10, 2018 · 6 comments
Open

Comments

@cesarjhony
Copy link

cesarjhony commented Feb 10, 2018

Error on update Vraptor from 4.2.0-RC2 to 4.2.0.Final.
The method called not have any annotation.
The header response is
HTTP/1.1 405 Method Not Allowed Date: Sat, 10 Feb 2018 16:26:06 GMT Server: Apache Logado: true Location: https://192.168.0.69:443/operacaocaixa/0 Allow: OPTIONS Content-Type: text/html;charset=windows-1252 Content-Language: en Content-Length: 1020 Keep-Alive: timeout=5, max=200 Connection: Keep-Alive

On the code:
@Transactional @Put("/entrega/{cod}/{entregue}") public void entrega(Long cod, Boolean entregue){ ...some logic code... result.forwardTo(Another.class).myNotAnnotedMethod(data); }
The method is completely executed with any errors, the problem is the response 405.

Obs: I am working with CORS by Interceptor.

@Turini
Copy link
Member

Turini commented Feb 11, 2018

what about adding @\options? or any other required method.
does that make your request work?

could you provide some code sample to help us reproduce this?

@cesarjhony
Copy link
Author

cesarjhony commented Feb 14, 2018

My apologies, this occurs on call forwardTo:
result.forwardTo(Another.class).myNotAnnotedMethod(data);

@Transactional @Put("/entrega/{cod}/{entregue}") public void entrega(Long cod, Boolean entregue){ ...some logic code... result.forwardTo(Another.class).myNotAnnotedMethod(data); }
I updated the first post.

@IvoSestren
Copy link
Contributor

IvoSestren commented Apr 17, 2018

Maybe because of his method being Put and he can not do the forward?

@cesarjhony
Copy link
Author

I don't know about http rules, Turini could answer. Maybe this behavior is fully expected.

@Turini
Copy link
Member

Turini commented May 10, 2018

the method you’re forwarding the request also accepts the PUT method? It might be
the reason. Does that work If you use a result#redirectTo instead?

@romulotorres
Copy link

+1
If I use redirectTo instead it works fine, but I can not send my errors list to my ErrorController.
The same error occours when I use validator.onErrorForwardTo (ErrorController.class) .erro500 ().
Before, I used that to get the list of errors from validator and send to JSON with that to client.

Any help?

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

4 participants