Package org.intermine.client.core
Class RequestImpl
- java.lang.Object
-
- org.intermine.client.core.RequestImpl
-
- All Implemented Interfaces:
Request
- Direct Known Subclasses:
MultiPartRequest
,QueryService.QueryRequest
,TemplateService.TemplateRequest
public class RequestImpl extends java.lang.Object implements Request
Implementation of Request interface.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.intermine.client.core.Request
Request.RequestType
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
FORMAT_PARAMETER_COUNT
protected static java.lang.String
FORMAT_PARAMETER_JSON_OBJ
protected static java.lang.String
FORMAT_PARAMETER_JSON_ROWS
protected static java.lang.String
FORMAT_PARAMETER_XML
-
Constructor Summary
Constructors Constructor Description RequestImpl(Request.RequestType type, java.lang.String url, ContentType contentType)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addParameter(java.lang.String name, java.lang.String value)
Adds parameter.ContentType
getContentType()
java.lang.String
getEncodedUrl()
java.lang.String
getHeader(java.lang.String name)
Returns the header value.java.util.Map<java.lang.String,java.lang.String>
getHeaders()
Returns request headers.java.lang.String
getParameter(java.lang.String name)
Use only if you are sure, that the parameter has only one value else use getParameterValues method.java.util.Map<java.lang.String,java.util.List<java.lang.String>>
getParameterMap()
Returns all parameters as an unmodifiable map.java.util.Set<java.lang.String>
getParameterNames()
java.util.List<java.lang.String>
getParameterValues(java.lang.String name)
java.lang.String
getServiceUrl()
Returns service URL.Request.RequestType
getType()
java.lang.String
getUnencodedUrl()
void
setAuthToken(java.lang.String token)
Set the authentication token for the requestvoid
setContentType(ContentType contentType)
void
setCountFormat()
Set the format as count format.void
setFormat(java.lang.String format)
Set the format for the request.void
setHeader(java.lang.String name, java.lang.String value)
Sets a request header.void
setJSONFormat()
Set the format as JSON-Object format.void
setJSONRowsFormat()
Set the format as JSON-Rows format.void
setMaxCount(int maxCount)
Sets the maximum number of rows returned.void
setPage(Page page)
Specify what section of the result set you wish to retrieve.void
setParameter(java.lang.String name, java.lang.String value)
Sets parametervoid
setServiceUrl(java.lang.String url)
Sets service URL.void
setStart(int start)
Set the start parameter.void
setType(Request.RequestType type)
void
setUrl(java.lang.String url)
Sets whole request URL.void
setXMLFormat()
Set the format as XML format.java.lang.String
toString()
-
-
-
Field Detail
-
FORMAT_PARAMETER_JSON_OBJ
protected static final java.lang.String FORMAT_PARAMETER_JSON_OBJ
- See Also:
- Constant Field Values
-
FORMAT_PARAMETER_JSON_ROWS
protected static final java.lang.String FORMAT_PARAMETER_JSON_ROWS
- See Also:
- Constant Field Values
-
FORMAT_PARAMETER_XML
protected static final java.lang.String FORMAT_PARAMETER_XML
- See Also:
- Constant Field Values
-
FORMAT_PARAMETER_COUNT
protected static final java.lang.String FORMAT_PARAMETER_COUNT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RequestImpl
public RequestImpl(Request.RequestType type, java.lang.String url, ContentType contentType)
Constructor.- Parameters:
type
- typeurl
- URLcontentType
- content type
-
-
Method Detail
-
addParameter
public void addParameter(java.lang.String name, java.lang.String value)
Adds parameter.- Specified by:
addParameter
in interfaceRequest
- Parameters:
name
- parameter namevalue
- parameter value
-
getParameterValues
public java.util.List<java.lang.String> getParameterValues(java.lang.String name)
- Specified by:
getParameterValues
in interfaceRequest
- Parameters:
name
- parameter name- Returns:
- parameter values
-
getParameter
public java.lang.String getParameter(java.lang.String name)
Use only if you are sure, that the parameter has only one value else use getParameterValues method.- Specified by:
getParameter
in interfaceRequest
- Parameters:
name
- parameter name- Returns:
- parameter value
-
getParameterNames
public java.util.Set<java.lang.String> getParameterNames()
- Specified by:
getParameterNames
in interfaceRequest
- Returns:
- names of all parameters
-
setParameter
public void setParameter(java.lang.String name, java.lang.String value)
Sets parameter- Specified by:
setParameter
in interfaceRequest
- Parameters:
name
- parameter namevalue
- parameter value
-
getType
public Request.RequestType getType()
- Specified by:
getType
in interfaceRequest
- Returns:
- request type
- See Also:
Request.RequestType
-
setType
public void setType(Request.RequestType type)
- Specified by:
setType
in interfaceRequest
- Parameters:
type
- request type- See Also:
Request.RequestType
-
getServiceUrl
public java.lang.String getServiceUrl()
Returns service URL. Service URL is the URL of service without service parameters. Example: http://www.flymine.org/service/query/results- Specified by:
getServiceUrl
in interfaceRequest
- Returns:
- URL as a string
-
setServiceUrl
public void setServiceUrl(java.lang.String url)
Sets service URL.- Specified by:
setServiceUrl
in interfaceRequest
- Parameters:
url
- URL as a string- See Also:
Request.setType(org.intermine.webservice.client.core.Request.RequestType)
-
setUrl
public void setUrl(java.lang.String url)
Sets whole request URL. Must not be URL encoded.
-
setMaxCount
public void setMaxCount(int maxCount)
Sets the maximum number of rows returned.- Parameters:
maxCount
- an integer number of rows, where outer joins count as multiple rows
-
setStart
public void setStart(int start)
Set the start parameter.- Parameters:
start
- The index of the first result to include.
-
setFormat
public void setFormat(java.lang.String format)
Set the format for the request.- Parameters:
format
- The format of the request.
-
setJSONFormat
public void setJSONFormat()
Set the format as JSON-Object format.
-
setJSONRowsFormat
public void setJSONRowsFormat()
Set the format as JSON-Rows format.
-
setXMLFormat
public void setXMLFormat()
Set the format as XML format.
-
setCountFormat
public void setCountFormat()
Set the format as count format.
-
getContentType
public ContentType getContentType()
- Specified by:
getContentType
in interfaceRequest
- Returns:
- content type
-
setContentType
public void setContentType(ContentType contentType)
- Specified by:
setContentType
in interfaceRequest
- Parameters:
contentType
- content type
-
getParameterMap
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getParameterMap()
Returns all parameters as an unmodifiable map.- Specified by:
getParameterMap
in interfaceRequest
- Returns:
- map
-
getEncodedUrl
public java.lang.String getEncodedUrl()
- Specified by:
getEncodedUrl
in interfaceRequest
- Returns:
- the URL-encoded URL.
- See Also:
- URL encoding specification
-
getUnencodedUrl
public java.lang.String getUnencodedUrl()
- Specified by:
getUnencodedUrl
in interfaceRequest
- Returns:
- Get the URL as an un-encoded (ie. human-readable) string.
-
setHeader
public void setHeader(java.lang.String name, java.lang.String value)
Sets a request header.
-
getHeaders
public java.util.Map<java.lang.String,java.lang.String> getHeaders()
Returns request headers.- Specified by:
getHeaders
in interfaceRequest
- Returns:
- headers
-
getHeader
public java.lang.String getHeader(java.lang.String name)
Returns the header value.
-
setAuthToken
public void setAuthToken(java.lang.String token)
Description copied from interface:Request
Set the authentication token for the request- Specified by:
setAuthToken
in interfaceRequest
- Parameters:
token
- the Authentication token for this request.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-