Package cloud.piranha.http.api
Interface HttpServerResponse
-
- All Known Implementing Classes:
DefaultHttpServerResponse
,GrizzlyHttpServerResponse
,NettyHttpServerResponse
,UndertowHttpResponse
public interface HttpServerResponse
THe HttpServerResponse API.This API delivers an abstraction over the HTTP response status line, the HTTP response headers and the HTTP response body.
- Author:
- Manfred Riem ([email protected])
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
closeResponse()
String
getHeader(String name)
Get the header.OutputStream
getOutputStream()
Get the output stream.void
setHeader(String name, String value)
Set the specified header.void
setStatus(int status)
Set the status.void
writeHeaders()
Write the response headers.void
writeStatusLine()
Write the status line.
-
-
-
Method Detail
-
getHeader
String getHeader(String name)
Get the header.- Parameters:
name
- the name.- Returns:
- the value, or null if not found.
-
getOutputStream
OutputStream getOutputStream()
Get the output stream.- Returns:
- the output stream.
-
setHeader
void setHeader(String name, String value)
Set the specified header.- Parameters:
name
- the header name.value
- the header value.
-
setStatus
void setStatus(int status)
Set the status.- Parameters:
status
- the status.
-
writeHeaders
void writeHeaders() throws IOException
Write the response headers.- Throws:
IOException
- when an I/O error occurs.
-
writeStatusLine
void writeStatusLine() throws IOException
Write the status line.- Throws:
IOException
- when an I/O error occurs.
-
closeResponse
default void closeResponse() throws IOException
- Throws:
IOException
-
-