public class ConfiguredStatusProvider extends java.lang.Object implements HttpStatusProvider
HttpStatusProvider
that uses HttpStatusProvider.HttpStatus
to derive the correct code.
If you are configuring a static HTTP status, then you could use RawStatusProvider
and the actual numeric
code if that makes more sense to you. This class is provided so that a typesafe enum can be used to derive the correct status
code.
In the adapter configuration file this class is aliased as http-configured-status which is the preferred alternative to the fully qualified classname when building your configuration.
HttpStatusProvider.HttpStatus, HttpStatusProvider.Status
Constructor and Description |
---|
ConfiguredStatusProvider() |
ConfiguredStatusProvider(HttpStatusProvider.HttpStatus status) |
Modifier and Type | Method and Description |
---|---|
HttpStatusProvider.HttpStatus |
getStatus() |
HttpStatusProvider.Status |
getStatus(AdaptrisMessage msg)
Get the method that should be used with the HTTP request.
|
java.lang.String |
getText() |
void |
setStatus(HttpStatusProvider.HttpStatus status)
Set the HTTP Status to use.
|
void |
setText(java.lang.String txt)
Set the optional response text that will be sent with the response code.
|
public ConfiguredStatusProvider()
public ConfiguredStatusProvider(HttpStatusProvider.HttpStatus status)
public HttpStatusProvider.Status getStatus(AdaptrisMessage msg)
HttpStatusProvider
getStatus
in interface HttpStatusProvider
msg
- the AdaptrisMessage
if required to derive the method.HttpStatusProvider.Status
.public HttpStatusProvider.HttpStatus getStatus()
public void setStatus(HttpStatusProvider.HttpStatus status)
status
- the status, which defaults to HttpStatusProvider.HttpStatus.INTERNAL_ERROR_500
public java.lang.String getText()
public void setText(java.lang.String txt)
Note that for StandardResponseProducer
any values configured here will be ignored as that
will use HttpServletResponse.setStatus(int)
method only. This field is included only for
completeness, a sensible default will be made available based on the HttpStatusProvider.HttpStatus
selected.
txt
- the text to be sent (e.g. OK
, if the status code is HttpStatusProvider.HttpStatus.OK_200
).