org.baswell.routes
Annotation Type Route


@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface Route

Route metadata for a route method.


Optional Element Summary
 java.lang.String contentType
           The content type to set in the response for this route.
 java.lang.String[] defaultParameters
           Assign parameter values if the parameters are not present in the HTTP request.
 MediaType[] expectedRequestMediaType
          The expected media type of the request content.
 MediaType[] respondsToMediaRequests
          The type of media this route knows how to serve.
 HttpMethod[] respondsToMethods
          The HTTP methods this route method accepts.
 boolean[] returnedStringIsContent
           Should the String returned from this method be sent directly to the client as the response? If the return type for this method is not a String this attribute is ignored.
 java.lang.String[] tags
          The tags associated with this route.
 java.lang.String value
          The route path pattern used to match HTTP requests to this route method.
 

value

public abstract java.lang.String value
The route path pattern used to match HTTP requests to this route method. If not provided the route path pattern will be built from the route method name.

Default:
""

respondsToMethods

public abstract HttpMethod[] respondsToMethods
The HTTP methods this route method accepts. If not provided the allowed HTTP methods will be built from the route method name.

Default:
{}

respondsToMediaRequests

public abstract MediaType[] respondsToMediaRequests
The type of media this route knows how to serve. If not provided the request media type will not be used as a criteria for matching this route.

Default:
{}

expectedRequestMediaType

public abstract MediaType[] expectedRequestMediaType

The expected media type of the request content. Use this to tell Routes how to parse the content for RequestContent.

This should be used as a single value. Only the first value in the array will be used.

See Also:
RequestContent
Default:
{}

contentType

public abstract java.lang.String contentType

The content type to set in the response for this route. This can be overridden by calling ServletResponse.setContentType(String) from within the route method.

See Also:
Routes.defaultContentType()
Default:
""

returnedStringIsContent

public abstract boolean[] returnedStringIsContent

Should the String returned from this method be sent directly to the client as the response? If the return type for this method is not a String this attribute is ignored.

This should be used as a single value. Only the first value in the array will be used.

See Also:
Routes.defaultReturnedStringIsContent(), RoutesConfiguration.defaultReturnedStringIsContent
Default:
{}

defaultParameters

public abstract java.lang.String[] defaultParameters

Assign parameter values if the parameters are not present in the HTTP request. The default parameter values (when not explicitly provided) will be used to match the route method to the HTTP request (if applicable) and will also be present in RequestParameters. They will not be present in ServletRequest.getParameter(String).

The format of this attribute array is {"parameter1Name=parameter1DefaultValue", "parameter2Name=parameter2DefaultValue"...}.

Default:
{}

tags

public abstract java.lang.String[] tags
The tags associated with this route.

See Also:
BeforeRoute.exceptTags(), BeforeRoute.onlyTags(), AfterRoute.exceptTags(), AfterRoute.onlyTags()
Default:
{}