Added a getHeader method with a TypedKey in RestRequest.
This commit is contained in:
parent
d8638badf3
commit
7a115785b7
|
@ -19,6 +19,7 @@ import com.google.gson.webservice.definition.ContentBodySpec;
|
||||||
import com.google.gson.webservice.definition.HeaderMap;
|
import com.google.gson.webservice.definition.HeaderMap;
|
||||||
import com.google.gson.webservice.definition.HttpMethod;
|
import com.google.gson.webservice.definition.HttpMethod;
|
||||||
import com.google.gson.webservice.definition.RequestBody;
|
import com.google.gson.webservice.definition.RequestBody;
|
||||||
|
import com.google.gson.webservice.definition.TypedKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The data associated with a Web service request. This includes HTTP request header parameters
|
* The data associated with a Web service request. This includes HTTP request header parameters
|
||||||
|
@ -64,6 +65,10 @@ public final class RestRequest<R> {
|
||||||
return ContentBodySpec.JSON_CONTENT_TYPE;
|
return ContentBodySpec.JSON_CONTENT_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T> T getHeader(TypedKey<T> key) {
|
||||||
|
return headers.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T getHeader(String headerName) {
|
public <T> T getHeader(String headerName) {
|
||||||
return (T) headers.get(headerName);
|
return (T) headers.get(headerName);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user