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

Add support for @HttpParameter #215

Closed
cescoffier opened this issue May 11, 2014 · 1 comment
Closed

Add support for @HttpParameter #215

cescoffier opened this issue May 11, 2014 · 1 comment
Milestone

Comments

@cescoffier
Copy link
Member

Issue related to #204.

The @HttpParameter annotation is designed to ease the injection of HTTP related attributes in action methods. Lookup is made by the parameter's type and if ambiguous by a hint given as parameter:

  • if the parameter's type is Context, the HTTP context is injected
  • if the parameter's type is Request, the HTTP Request is injected
  • otherwise, the value is looked up in the HTTP Headers, in that header value is converted to the parameter's type using the converter engine
@cescoffier cescoffier added this to the 0.6 milestone May 11, 2014
@cescoffier cescoffier changed the title Add support for @Http Add support for @HttpParameter May 15, 2014
@cescoffier
Copy link
Member Author

Here is the resolution algorithm:

  • if the parameter's type is {@link org.wisdom.api.http.Context}, the HTTP context is injected
  • if the parameter's type is {@link org.wisdom.api.http.Request}, the HTTP Request is injected
  • if the parameter's type is {@link org.wisdom.api.cookies.Cookie}, the Cookie corresponding to the argument's name is injected.
  • if the parameter's type is {@link org.wisdom.api.cookies.SessionCookie}, the Session Cookie is injected.
  • if the parameter's type is {@link org.wisdom.api.cookies.FlashCookie}, the Flash Cookie is injected.
  • if the parameter's type is {@link org.wisdom.api.router.Route}, the route is injected.
  • if the parameter's type is {@link java.io.Reader}, the reader on the request body is injected.
  • otherwise, the value is looked up in the HTTP Headers, in that header value is converted to the parameter's type using the converter engine

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

1 participant