Package com.predic8.membrane.core.http
Class Response
java.lang.Object
com.predic8.membrane.core.http.Message
com.predic8.membrane.core.http.Response
- Direct Known Subclasses:
NoResponse
-
Nested Class Summary
Nested Classes -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Response.ResponseBuilderaccepted()static Response.ResponseBuilderbadGateway(String message) static Response.ResponseBuilderstatic Response.ResponseBuilderbadRequest(String message) static Response.ResponseBuilderbadRequest(String message, boolean escape) static Response.ResponseBuilderprotected void<T extends Message>
TcreateSnapshot(Runnable bodyUpdatedCallback, BodyCollectingMessageObserver.Strategy strategy, long limit) intstatic Response.ResponseBuilderstatic Response.ResponseBuilderstatic Response.ResponseBuilderstatic Response.ResponseBuilderfromStatusCode(int statusCode, String msg) static Response.ResponseBuildergatewayTimeout(String message) getName()intbooleanstatic Response.ResponseBuilderstatic Response.ResponseBuilderinternalServerError(String message) booleanbooleanisOk()booleanbooleanbooleanstatic Response.ResponseBuilderstatic Response.ResponseBuilderstatic Response.ResponseBuildernotFound()static Response.ResponseBuilderstatic Response.ResponseBuildernotModified(String date) static Response.ResponseBuilderok()static Response.ResponseBuildervoidvoidread(InputStream in, boolean createBody) If the message is HTTP 1.1 but the header has no information about the content length, then an assumption is made that after the body the server will send an EOF.static Response.ResponseBuilderstatic Response.ResponseBuilderredirectWithout300(String uri) static Response.ResponseBuilderredirectWithout300(String uri, String body) static Response.ResponseBuilderserviceUnavailable(String message) voidsetStatusCode(int statusCode) voidsetStatusMessage(String statusMessage) booleanstatic Response.ResponseBuilderstatusCode(int statusCode) static Response.ResponseBuilderstatic Response.ResponseBuilderunauthorized(String message) Methods inherited from class com.predic8.membrane.core.http.Message
addObserver, containsObserver, createMessageSnapshot, discardBody, getBody, getBodyAsStream, getBodyAsStreamDecoded, getBodyAsStringDecoded, getCharset, getErrorMessage, getHeader, getVersion, hasMsgReleased, isBodyEmpty, isCSS, isDeflate, isGzip, isHTML, isHTTP10, isHTTP11, isImage, isJavaScript, isJSON, isReleased, isXML, readBody, release, setBody, setBodyContent, setErrorMessage, setHeader, setReleased, setVersion, toString, write, writeStartLine
-
Constructor Details
-
Response
public Response()
-
-
Method Details
-
ok
- Throws:
Exception
-
statusCode
-
ok
-
accepted
-
noContent
-
found
-
notModified
-
badRequest
-
badRequest
-
badRequest
-
continue100
-
redirect
-
redirectWithout300
-
redirectWithout300
-
internalServerError
-
notImplemented
-
internalServerError
-
badGateway
-
gatewayTimeout
-
forbidden
-
notFound
-
forbidden
-
unauthorized
-
fromStatusCode
-
unauthorized
-
methodNotAllowed
-
getStartLine
- Specified by:
getStartLinein classMessage
-
getStatusCode
public int getStatusCode() -
setStatusCode
public void setStatusCode(int statusCode) -
getStatusMessage
-
setStatusMessage
-
parseStartLine
- Specified by:
parseStartLinein classMessage- Throws:
IOExceptionEndOfStreamException
-
read
Description copied from class:MessageIf the message is HTTP 1.1 but the header has no information about the content length, then an assumption is made that after the body the server will send an EOF. So the body is read till end of the stream. See http://www.ietf.org/rfc/rfc2145.txt- Overrides:
readin classMessage- Throws:
IOExceptionEndOfStreamException
-
createBody
- Overrides:
createBodyin classMessage- Throws:
IOException
-
isRedirect
public boolean isRedirect() -
hasNoContent
public boolean hasNoContent() -
getName
-
shouldNotContainBody
public boolean shouldNotContainBody()- Specified by:
shouldNotContainBodyin classMessage
-
isOk
public boolean isOk() -
isUserError
public boolean isUserError() -
isServerError
public boolean isServerError() -
isKeepAlive
public boolean isKeepAlive()- Overrides:
isKeepAlivein classMessage
-
estimateHeapSize
public int estimateHeapSize()- Overrides:
estimateHeapSizein classMessage
-
createSnapshot
public <T extends Message> T createSnapshot(Runnable bodyUpdatedCallback, BodyCollectingMessageObserver.Strategy strategy, long limit) - Specified by:
createSnapshotin classMessage
-