Add support for @HttpParameter #215

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

Comments

Projects
None yet
1 participant
@cescoffier
Member

cescoffier commented May 11, 2014

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 from Add support for @Http to Add support for @HttpParameter May 15, 2014

@cescoffier

This comment has been minimized.

Show comment
Hide comment
@cescoffier

cescoffier May 15, 2014

Member

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
Member

cescoffier commented May 15, 2014

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