Package com.luciad.ogc.common
Class TLcdHttpServletResponseWrapper
java.lang.Object
com.luciad.ogc.common.TLcdHttpServletResponseWrapper
- All Implemented Interfaces:
ILcdResponse
A wrapper for
HttpServletResponse
objects.-
Field Summary
Modifier and TypeFieldDescriptionprotected jakarta.servlet.http.HttpServletResponse
protected PrintWriter
-
Constructor Summary
ConstructorDescriptionTLcdHttpServletResponseWrapper
(jakarta.servlet.http.HttpServletResponse aHttpServletResponse) Creates a new wrapper object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDateHeader
(String aName, long aValue) Adds a response header with the given name and date-value.void
Adds a response header with the given name and value.void
addIntHeader
(String aName, int aValue) Adds a response header with the given name and integer value.boolean
containsHeader
(String aName) Returns true if the response header with the given name has already been set.void
flush()
Flushes all pending data being written for this response.jakarta.servlet.http.HttpServletResponse
Returns anOutputStream
to which the server can write its response.Returns aPrintWriter
to which the server can write its response.void
setContentLength
(int aContentLength) Specifies the size of the data returned by this response.void
setContentType
(String aContentType) Sets the content type (MIME type) of the response.void
setDateHeader
(String aName, long aValue) Sets a response header with the given name and date-value.void
Sets a response header with the given name and value.void
setIntHeader
(String aName, int aValue) Sets a response header with the given name and integer value.void
setStatus
(int aStatus) Sets the HTTP status code for this response.
-
Field Details
-
fHttpServletResponse
protected jakarta.servlet.http.HttpServletResponse fHttpServletResponse -
fWriter
-
-
Constructor Details
-
TLcdHttpServletResponseWrapper
public TLcdHttpServletResponseWrapper(jakarta.servlet.http.HttpServletResponse aHttpServletResponse) Creates a new wrapper object.- Parameters:
aHttpServletResponse
- TheHttpServletResponse
object around which to build a wrapper.
-
-
Method Details
-
containsHeader
Returns true if the response header with the given name has already been set.- Parameters:
aName
- the header name- Returns:
- true if the response header with the given name has already been set
-
setDateHeader
Sets a response header with the given name and date-value. The date is specified in terms of milliseconds since the epoch. If the header had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.- Specified by:
setDateHeader
in interfaceILcdResponse
- Parameters:
aName
- the name of the header to setaValue
- the assigned date value
-
addDateHeader
Adds a response header with the given name and date-value. The date is specified in terms of milliseconds since the epoch. This method allows response headers to have multiple values.- Parameters:
aName
- the name of the header to setaValue
- the assigned date value
-
setIntHeader
Sets a response header with the given name and integer value. If the header had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.- Parameters:
aName
- the name of the header to setaValue
- the assigned integer value
-
addIntHeader
Adds a response header with the given name and integer value. This method allows response headers to have multiple values.- Parameters:
aName
- the name of the header to setaValue
- the assigned integer value
-
setHeader
Sets a response header with the given name and value. If the header had already been set, the new value overwrites the previous one. The methodcontainsHeader(String)
can be used to test for the presence of a header before setting its value.- Specified by:
setHeader
in interfaceILcdResponse
- Parameters:
aName
- the header nameaValue
- the header value
-
addHeader
Adds a response header with the given name and value. Multiple values can be registered for one header, by invoking this method multiple times for that header.- Parameters:
aName
- the header nameaValue
- the header value
-
getOutputStream
Description copied from interface:ILcdResponse
Returns anOutputStream
to which the server can write its response.- Specified by:
getOutputStream
in interfaceILcdResponse
- Returns:
- An
OutputStream
- Throws:
IOException
- if the output stream cannot be retrieved
-
setContentType
Description copied from interface:ILcdResponse
Sets the content type (MIME type) of the response.- Specified by:
setContentType
in interfaceILcdResponse
- Parameters:
aContentType
- A MIME type, e.g. "text/xml".
-
setContentLength
public void setContentLength(int aContentLength) Description copied from interface:ILcdResponse
Specifies the size of the data returned by this response.- Specified by:
setContentLength
in interfaceILcdResponse
- Parameters:
aContentLength
- The data size of the response.
-
setStatus
public void setStatus(int aStatus) Sets the HTTP status code for this response.- Specified by:
setStatus
in interfaceILcdResponse
- Parameters:
aStatus
- the HTTP status code for this response.
-
getWriter
Description copied from interface:ILcdResponse
Returns aPrintWriter
to which the server can write its response.- Specified by:
getWriter
in interfaceILcdResponse
- Returns:
- A
PrintWriter
- Throws:
IOException
- if thePrintWriter
cannot be created.
-
flush
Description copied from interface:ILcdResponse
Flushes all pending data being written for this response.- Specified by:
flush
in interfaceILcdResponse
- Throws:
IOException
- if the flush operation fails.
-
getHttpServletResponse
public jakarta.servlet.http.HttpServletResponse getHttpServletResponse()
-