Class AbstractRestResponse
- java.lang.Object
-
- com.aspectran.web.activity.response.AbstractRestResponse
-
- All Implemented Interfaces:
CustomTransformer
,RestResponse
- Direct Known Subclasses:
DefaultRestResponse
public abstract class AbstractRestResponse extends java.lang.Object implements RestResponse
Abstract class shared by RestResponse.Created: 2019-06-16
-
-
Constructor Summary
Constructors Constructor Description AbstractRestResponse()
AbstractRestResponse(java.lang.Object data)
AbstractRestResponse(java.lang.String name, java.lang.Object data)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description RestResponse
accepted()
void
addHeader(java.lang.String name, java.lang.String value)
Add the given single header value to the current list of values for the given header.RestResponse
badRequest()
RestResponse
conflict()
RestResponse
created()
RestResponse
created(java.lang.String location)
RestResponse
defaultContentType(MediaType defaultContentType)
protected MediaType
determineContentType(Activity activity)
protected java.lang.String
determineEncoding(Activity activity)
RestResponse
favorPathExtension(boolean favorPathExtension)
RestResponse
forbidden()
protected abstract MediaType
getContentTypeByPathExtension(java.lang.String extension)
java.lang.Object
getData()
MediaType
getDefaultContentType()
protected MultiValueMap<java.lang.String,java.lang.String>
getHeaders()
java.lang.String
getName()
int
getStatus()
protected abstract java.util.List<MediaType>
getSupportedContentTypes()
RestResponse
ignoreAcceptHeader(boolean ignoreAcceptHeader)
RestResponse
ignoreUnknownPathExtensions(boolean ignoreUnknownPathExtensions)
RestResponse
internalServerError()
boolean
isFavorPathExtension()
boolean
isIgnoreAcceptHeader()
boolean
isIgnoreUnknownPathExtensions()
boolean
isPrettyPrint()
RestResponse
methodNotAllowed()
RestResponse
movedPermanently()
RestResponse
noContent()
RestResponse
notAcceptable()
RestResponse
notFound()
RestResponse
notModified()
RestResponse
ok()
RestResponse
preconditionFailed()
RestResponse
prettyPrint(boolean prettyPrint)
RestResponse
seeOther()
RestResponse
setData(java.lang.Object data)
Specifies response data.RestResponse
setData(java.lang.String name, java.lang.Object data)
Specifies response data with a name.void
setDefaultContentType(MediaType defaultContentType)
void
setDefaultContentType(java.lang.String defaultContentType)
void
setFavorPathExtension(boolean favorPathExtension)
void
setHeader(java.lang.String name, java.lang.String value)
Set the given single header value under the given header name.void
setIgnoreAcceptHeader(boolean ignoreAcceptHeader)
void
setIgnoreUnknownPathExtensions(boolean ignoreUnknownPathExtensions)
void
setPrettyPrint(boolean prettyPrint)
Sets whether to apply indentations and line breaks when generating response data.void
setStatus(int status)
void
setStatus(HttpStatus status)
RestResponse
temporaryRedirect()
RestResponse
unauthorized()
RestResponse
unsupportedMediaType()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.aspectran.core.activity.response.transform.CustomTransformer
transform
-
-
-
-
Method Detail
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceRestResponse
-
getData
public java.lang.Object getData()
- Specified by:
getData
in interfaceRestResponse
-
setData
public RestResponse setData(java.lang.Object data)
Description copied from interface:RestResponse
Specifies response data.- Specified by:
setData
in interfaceRestResponse
- Parameters:
data
- the response data
-
setData
public RestResponse setData(java.lang.String name, java.lang.Object data)
Description copied from interface:RestResponse
Specifies response data with a name.- Specified by:
setData
in interfaceRestResponse
- Parameters:
name
- the name of the response datadata
- the response data
-
isPrettyPrint
public boolean isPrettyPrint()
- Specified by:
isPrettyPrint
in interfaceRestResponse
-
setPrettyPrint
public void setPrettyPrint(boolean prettyPrint)
Description copied from interface:RestResponse
Sets whether to apply indentations and line breaks when generating response data.- Specified by:
setPrettyPrint
in interfaceRestResponse
- Parameters:
prettyPrint
- true if responding with indentations and line breaks; otherwise false
-
prettyPrint
public RestResponse prettyPrint(boolean prettyPrint)
- Specified by:
prettyPrint
in interfaceRestResponse
-
isFavorPathExtension
public boolean isFavorPathExtension()
- Specified by:
isFavorPathExtension
in interfaceRestResponse
-
setFavorPathExtension
public void setFavorPathExtension(boolean favorPathExtension)
- Specified by:
setFavorPathExtension
in interfaceRestResponse
-
favorPathExtension
public RestResponse favorPathExtension(boolean favorPathExtension)
- Specified by:
favorPathExtension
in interfaceRestResponse
-
isIgnoreUnknownPathExtensions
public boolean isIgnoreUnknownPathExtensions()
- Specified by:
isIgnoreUnknownPathExtensions
in interfaceRestResponse
-
setIgnoreUnknownPathExtensions
public void setIgnoreUnknownPathExtensions(boolean ignoreUnknownPathExtensions)
- Specified by:
setIgnoreUnknownPathExtensions
in interfaceRestResponse
-
ignoreUnknownPathExtensions
public RestResponse ignoreUnknownPathExtensions(boolean ignoreUnknownPathExtensions)
- Specified by:
ignoreUnknownPathExtensions
in interfaceRestResponse
-
isIgnoreAcceptHeader
public boolean isIgnoreAcceptHeader()
- Specified by:
isIgnoreAcceptHeader
in interfaceRestResponse
-
setIgnoreAcceptHeader
public void setIgnoreAcceptHeader(boolean ignoreAcceptHeader)
- Specified by:
setIgnoreAcceptHeader
in interfaceRestResponse
-
ignoreAcceptHeader
public RestResponse ignoreAcceptHeader(boolean ignoreAcceptHeader)
- Specified by:
ignoreAcceptHeader
in interfaceRestResponse
-
getDefaultContentType
public MediaType getDefaultContentType()
- Specified by:
getDefaultContentType
in interfaceRestResponse
-
setDefaultContentType
public void setDefaultContentType(MediaType defaultContentType)
- Specified by:
setDefaultContentType
in interfaceRestResponse
-
setDefaultContentType
public void setDefaultContentType(java.lang.String defaultContentType)
- Specified by:
setDefaultContentType
in interfaceRestResponse
-
defaultContentType
public RestResponse defaultContentType(MediaType defaultContentType)
- Specified by:
defaultContentType
in interfaceRestResponse
-
ok
public RestResponse ok()
- Specified by:
ok
in interfaceRestResponse
-
created
public RestResponse created()
- Specified by:
created
in interfaceRestResponse
-
created
public RestResponse created(java.lang.String location)
- Specified by:
created
in interfaceRestResponse
-
accepted
public RestResponse accepted()
- Specified by:
accepted
in interfaceRestResponse
-
noContent
public RestResponse noContent()
- Specified by:
noContent
in interfaceRestResponse
-
movedPermanently
public RestResponse movedPermanently()
- Specified by:
movedPermanently
in interfaceRestResponse
-
seeOther
public RestResponse seeOther()
- Specified by:
seeOther
in interfaceRestResponse
-
notModified
public RestResponse notModified()
- Specified by:
notModified
in interfaceRestResponse
-
temporaryRedirect
public RestResponse temporaryRedirect()
- Specified by:
temporaryRedirect
in interfaceRestResponse
-
badRequest
public RestResponse badRequest()
- Specified by:
badRequest
in interfaceRestResponse
-
unauthorized
public RestResponse unauthorized()
- Specified by:
unauthorized
in interfaceRestResponse
-
forbidden
public RestResponse forbidden()
- Specified by:
forbidden
in interfaceRestResponse
-
notFound
public RestResponse notFound()
- Specified by:
notFound
in interfaceRestResponse
-
methodNotAllowed
public RestResponse methodNotAllowed()
- Specified by:
methodNotAllowed
in interfaceRestResponse
-
notAcceptable
public RestResponse notAcceptable()
- Specified by:
notAcceptable
in interfaceRestResponse
-
conflict
public RestResponse conflict()
- Specified by:
conflict
in interfaceRestResponse
-
preconditionFailed
public RestResponse preconditionFailed()
- Specified by:
preconditionFailed
in interfaceRestResponse
-
unsupportedMediaType
public RestResponse unsupportedMediaType()
- Specified by:
unsupportedMediaType
in interfaceRestResponse
-
internalServerError
public RestResponse internalServerError()
- Specified by:
internalServerError
in interfaceRestResponse
-
getStatus
public int getStatus()
- Specified by:
getStatus
in interfaceRestResponse
-
setStatus
public void setStatus(int status)
- Specified by:
setStatus
in interfaceRestResponse
-
setStatus
public void setStatus(HttpStatus status)
- Specified by:
setStatus
in interfaceRestResponse
-
setHeader
public void setHeader(java.lang.String name, java.lang.String value)
Description copied from interface:RestResponse
Set the given single header value under the given header name.- Specified by:
setHeader
in interfaceRestResponse
- Parameters:
name
- the header namevalue
- the header value to set
-
addHeader
public void addHeader(java.lang.String name, java.lang.String value)
Description copied from interface:RestResponse
Add the given single header value to the current list of values for the given header.- Specified by:
addHeader
in interfaceRestResponse
- Parameters:
name
- the header namevalue
- the header value to be added
-
getHeaders
protected MultiValueMap<java.lang.String,java.lang.String> getHeaders()
-
getSupportedContentTypes
protected abstract java.util.List<MediaType> getSupportedContentTypes()
-
getContentTypeByPathExtension
protected abstract MediaType getContentTypeByPathExtension(java.lang.String extension)
-
determineEncoding
protected java.lang.String determineEncoding(Activity activity)
-
determineContentType
protected MediaType determineContentType(Activity activity) throws HttpMediaTypeNotAcceptableException
-
-