Package com.groiss.gui
Class JSONPage
java.lang.Object
com.groiss.gui.JSONPage
- All Implemented Interfaces:
Page
,StreamablePage
A page implementation suitable for sending JSON objects to the client.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Set a header field in the response before writing the page.void
Set a header field in the response before writing the page.void
Set a header field in the response before writing the page.Returns the content type of the page, for example "text/html".Returns the list of http-response-headers to be set on theHttpServletResponse
void
show()
For a JSONPage, this is usually never called by the dispatcher; the content will be written directly to the writer of the response.
-
Field Details
-
EMPTY_PAGE
An empty page.
-
-
Constructor Details
-
JSONPage
Initializes an instance of this class with the content in JSON form. The content should not be manipulated after construction.- Parameters:
jsonContent
- the response content in JSON form.
-
-
Method Details
-
getContentType
Description copied from interface:Page
Returns the content type of the page, for example "text/html".- Specified by:
getContentType
in interfacePage
- Returns:
- the contents mime type as String
-
getContent
-
show
For a JSONPage, this is usually never called by the dispatcher; the content will be written directly to the writer of the response. -
addHeader
Set a header field in the response before writing the page. Please note thatHttpServletResponse.setHeader(String, String)
will be used to set to the new value.- Parameters:
header
- the name of the headervalue
- the header value
-
addHeader
Set a header field in the response before writing the page. Please note thatHttpServletResponse.setDateHeader(String,long)
will be used to set to the new value.- Parameters:
header
- the name of the headervalue
- the header value
-
addHeader
Set a header field in the response before writing the page. Please note thatHttpServletResponse.setIntHeader(String,int)
will be used to set to the new value.- Parameters:
header
- the name of the headervalue
- the header value
-
getHeaders
Description copied from interface:Page
Returns the list of http-response-headers to be set on theHttpServletResponse
- Specified by:
getHeaders
in interfacePage
- Returns:
- the http-headers (the value may be one of
String
,Date
orInteger
-
output
- Specified by:
output
in interfaceStreamablePage
-