|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=CLASS) @Target(value={METHOD,TYPE}) public @interface RequiresCookie
Use on Get
, Post
, … annotated methods to inject a cookie in
the request.
value()
is mandatory and define the cookie's name you
want to inject.
To set a cookie's value you MUST either let your RestClient interface extends
of RestClientHeaders
or add the following method to your interface :
void setCookie(String name, String value)
.
You can also add the getter version to read a cookie value :
void getCookie(String name)
.
Example :@Rest(rootUrl = "http://myserver", converters = MappingJacksonHttpMessageConverter.class) public interface MyRestClient { @Get("/events/{id}") @RequiresCookie("session") Event getEvent(long id); void setCookie(String name, String value); String getCookie(String name); } @EBean public class MyBean { @RestService MyRestClient; @AfterInject public void init() { myRestClient.setCookie("session", "my session uid"); } }
Rest
,
Get
,
Post
,
Put
,
Delete
,
Head
,
Options
,
SetsCookie
Required Element Summary | |
---|---|
String[] |
value
|
Element Detail |
---|
public abstract String[] value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |