Package org.infinispan.rest
Class InfinispanResponse
- java.lang.Object
-
- org.infinispan.rest.InfinispanResponse
-
- Direct Known Subclasses:
InfinispanCacheResponse,InfinispanErrorResponse,InfinispanSearchResponse
public abstract class InfinispanResponse extends Object
Representation of a HTTP response tailed for Infinispan-specific responses.- Author:
- Sebastian Ćaskawiec
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedInfinispanResponse(Optional<InfinispanRequest> request)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddSpecificHeaders(io.netty.handler.codec.http.FullHttpResponse response)voidauthenticate(String authenticateHeader)Addswww-authenticateheader.Optional<String>authenticateHeader()voidcharset(Charset charset)Adds a charset.voidcontentAsBytes(byte[] content)Adds content as binary array.voidcontentAsText(String content)Adds content as text.voidcontentType(String contentType)AddsContent-Typeheader.voidhttpVersion(io.netty.handler.codec.http.HttpVersion httpVersion)Adds HTTP version header.booleanisKeepAlive()Checks whether this is a Keep Alive type of response.voidstatus(io.netty.handler.codec.http.HttpResponseStatus httpStatus)Adds status code.io.netty.handler.codec.http.FullHttpResponsetoNettyHttpResponse()RendersFullHttpResponseobject.
-
-
-
Constructor Detail
-
InfinispanResponse
protected InfinispanResponse(Optional<InfinispanRequest> request)
-
-
Method Detail
-
contentAsText
public void contentAsText(String content)
Adds content as text. Converts it internally toUTF-8.- Parameters:
content- Content.
-
contentAsBytes
public void contentAsBytes(byte[] content)
Adds content as binary array.- Parameters:
content- Content.
-
contentType
public void contentType(String contentType)
AddsContent-Typeheader.- Parameters:
contentType-Content-Typeheader.
-
httpVersion
public void httpVersion(io.netty.handler.codec.http.HttpVersion httpVersion)
Adds HTTP version header.- Parameters:
httpVersion- HTTP version header.
-
status
public void status(io.netty.handler.codec.http.HttpResponseStatus httpStatus)
Adds status code.- Parameters:
httpStatus- Status code.
-
isKeepAlive
public boolean isKeepAlive()
Checks whether this is a Keep Alive type of response.- Returns:
trueif the response contains Keep Alive headers.
-
addSpecificHeaders
protected void addSpecificHeaders(io.netty.handler.codec.http.FullHttpResponse response)
-
toNettyHttpResponse
public io.netty.handler.codec.http.FullHttpResponse toNettyHttpResponse()
RendersFullHttpResponseobject.- Returns:
FullHttpResponseobject based on thisInfinispanResponse.
-
authenticate
public void authenticate(String authenticateHeader)
Addswww-authenticateheader.- Parameters:
authenticateHeader-www-authenticateheader value.
-
charset
public void charset(Charset charset)
Adds a charset.- Parameters:
charset- charset value.
-
-