com.google.sitebricks.http.negotiate
Annotation Type Accept
@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface Accept
This annotation is used to select request handlers based on
request headers provided by clients and can be used to perform HTTP
content negotiation. If a client sends in a request for an
image via uri, "/city/atlantis" and accepts JPEG type, then
you may instruct sitebricks to choose a request handler as
follows:
@At("/city/atlantis")
public class PictureWebService {
@Accept("Accept") @Get("image/jpeg")
public Response getJpeg() {
//return JPEG image...
}
@Accept("Accept") @Get("image/png")
public Response getPng() {
//return PNG image instead...
}
}
Note that you cannot mix the two kinds of negotiation.
- Author:
- Dhanji R. Prasanna (dhanji@gmail.com)
value
public abstract String value
Copyright © 2014. All rights reserved.