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 protected
InfinispanResponse(Optional<InfinispanRequest> request)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addSpecificHeaders(io.netty.handler.codec.http.FullHttpResponse response)
void
authenticate(String authenticateHeader)
Addswww-authenticate
header.Optional<String>
authenticateHeader()
void
charset(Charset charset)
Adds a charset.void
contentAsBytes(byte[] content)
Adds content as binary array.void
contentAsText(String content)
Adds content as text.void
contentType(String contentType)
AddsContent-Type
header.void
httpVersion(io.netty.handler.codec.http.HttpVersion httpVersion)
Adds HTTP version header.boolean
isKeepAlive()
Checks whether this is a Keep Alive type of response.void
status(io.netty.handler.codec.http.HttpResponseStatus httpStatus)
Adds status code.io.netty.handler.codec.http.FullHttpResponse
toNettyHttpResponse()
RendersFullHttpResponse
object.
-
-
-
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-Type
header.- Parameters:
contentType
-Content-Type
header.
-
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:
true
if 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()
RendersFullHttpResponse
object.- Returns:
FullHttpResponse
object based on thisInfinispanResponse
.
-
authenticate
public void authenticate(String authenticateHeader)
Addswww-authenticate
header.- Parameters:
authenticateHeader
-www-authenticate
header value.
-
charset
public void charset(Charset charset)
Adds a charset.- Parameters:
charset
- charset value.
-
-