support to options http verb in the controller resources through of Opti... #473

Merged
merged 3 commits into from Oct 30, 2012

Projects

None yet

2 participants

@douglasrodrigo
Contributor

support to opttions http with Options Annotation

ex.:

@Resource
public class SomeController {
...
    @Path("/options")
    @Options
    public void options() {
        Status statusResult = result.use(Results.status());
        statusResult.header("Access-Control-Allow-Origin", "*");        
        statusResult.noContent();
    }
...
}
@lucascs

Following the other annotations, this one should also accept a path attribute.

@lucascs

I don't think we should remove this if here... We should support OPTIONS the same way it is today... @Options is an extension for overriding default behavior.

@lucascs
Member
lucascs commented Oct 30, 2012

Thank you very much for this pull request, please consider the comments I've made, and update the pull request =)

@douglasrodrigo

Hi @lucascs thanks for the tips, I'm already changing the code following your observations.

@douglasrodrigo
Contributor

@lucascs can you take a look now?

@lucascs
Member
lucascs commented Oct 30, 2012

Have you already tested it in a controller? With a real request?

@douglasrodrigo
Contributor

yep, I've created a custom project here to see working.
@lucascs are there an integration test that I have to create??

    @Options
    public void options() {
        Status resultStatus = result.use(Results.status());
        resultStatus.header("Access-Control-Allow-Origin", "*");        
        resultStatus.noContent();
    }

request:

curl -i http://localhost:8080/vraptor-options-test -X OPTIONS

HTTP/1.1 204 No Content
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: JSESSIONID=rj7jxgd78hha;Path=/vraptor-options-test
Access-Control-Allow-Origin: *
Server: Jetty(6.1.10)
@lucascs
Member
lucascs commented Oct 30, 2012

Maybe adding a test on PathAnnotationsRoutesParserTest would be good =)

@douglasrodrigo
Contributor

I had already created the shouldAcceptAResultWithOptionsWebMethod on PathAnnotationsRoutesParserTest, I'm missing something?

@lucascs
Member
lucascs commented Oct 30, 2012

No, that's fine, thanks!

@lucascs lucascs merged commit ad1e326 into caelum:master Oct 30, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment