Class ConnectorContext
java.lang.Object
org.springframework.extensions.webscripts.connector.ConnectorContext
Describes invocation context that the connector should use
when creating the connection to a remote service.
Invocation context consists of HTTP request state such as fixed parameters and headers and the HTTP request method.
- Author:
- Kevin Roast
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new connector context.Instantiates a new connector context.ConnectorContext(HttpMethod method) Instantiates a new connector context.ConnectorContext(HttpMethod method, Map<String, String> parameters, Map<String, String> headers) Instantiates a new connector context. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the content type.booleanGets the headers.Gets the method.Gets the parameters.voidsetCommitResponseOnAuthenticationError(boolean commitResponse) voidsetContentType(String contentType) Sets the content type.voidsetExceptionOnError(boolean exceptionOnError) voidsetMethod(HttpMethod method) Sets the method.
-
Constructor Details
-
ConnectorContext
public ConnectorContext()Instantiates a new connector context. -
ConnectorContext
Instantiates a new connector context.- Parameters:
parameters- the parametersheaders- the headers
-
ConnectorContext
Instantiates a new connector context.- Parameters:
method- the HTTP method
-
ConnectorContext
public ConnectorContext(HttpMethod method, Map<String, String> parameters, Map<String, String> headers) Instantiates a new connector context.- Parameters:
method- the HTTP methodparameters- the parametersheaders- the headers
-
-
Method Details
-
getParameters
Gets the parameters.- Returns:
- the parameters
-
getHeaders
Gets the headers.- Returns:
- the headers
-
getContentType
Gets the content type.- Returns:
- the content type
-
setContentType
Sets the content type.- Parameters:
contentType- the new content type
-
getMethod
Gets the method.- Returns:
- the method
-
setMethod
Sets the method.- Parameters:
method- the new method
-
getCommitResponse
public boolean getCommitResponse()- Returns:
- true to commit the response if a 401 error is returned, false otherwise. Allows for retry of connections that stream to a remote connection after an authentication pass.
-
setCommitResponseOnAuthenticationError
public void setCommitResponseOnAuthenticationError(boolean commitResponse) - Parameters:
commitResponse- true to commit the response if a 401 error is returned, false otherwise. Allows for retry of connections that stream to a remote connection after an authentication pass.
-
setExceptionOnError
public void setExceptionOnError(boolean exceptionOnError) - Parameters:
exceptionOnError- True to throw an exception on a server 500 response - else return 500 code in the usual Response object. This is useful when internal services want to make a remote call but are not interested in dealing with and returing exceptions directly to the user.
-
getExceptionOnError
public boolean getExceptionOnError()
-