public class JSONResponse extends Response
Response.Status
Constructor and Description |
---|
JSONResponse() |
JSONResponse(JSONResponseData data) |
JSONResponse(Response.Status stat) |
JSONResponse(Response.Status stat,
java.lang.String message) |
JSONResponse(ResponseData data) |
Modifier and Type | Method and Description |
---|---|
void |
setResponseData(JSONResponseData data) |
void |
setResponseData(ResponseData data) |
void |
writeTo(javax.servlet.http.HttpServletResponse response)
This method replaces the default XML/JAXB output with JSON using GSON annotations
and sets content type to application/json.
|
getMessage, getMethod, getResponseData, getService, getStatus, setDefaultAuthenticationHeader, setMessage, setMethod, setService, setStatus
public JSONResponse()
public JSONResponse(ResponseData data) throws java.lang.UnsupportedOperationException
data
- java.lang.UnsupportedOperationException
- if the given data is not of type JSONResponseDatapublic JSONResponse(JSONResponseData data)
data
- public JSONResponse(Response.Status stat, java.lang.String message)
stat
- message
- public JSONResponse(Response.Status stat)
stat
- public void writeTo(javax.servlet.http.HttpServletResponse response)
Response.Status.UNAUTHORIZED
.writeTo
in class Response
response
- Response.setDefaultAuthenticationHeader(HttpServletResponse)
,
Response.setStatus(core.tut.pori.http.Response.Status)
public void setResponseData(ResponseData data) throws java.lang.UnsupportedOperationException
setResponseData
in class Response
data
- the data to setjava.lang.UnsupportedOperationException
- if data is not of type JSONResponseData
setResponseData(JSONResponseData)
public void setResponseData(JSONResponseData data)
data
- Copyright © 2015 Tampere University of Technology, Pori Department.