public abstract class ResponseBuilderImpl extends java.lang.Object implements ResponseBuilder, OptionsResponseBuilder, GetResponseBuilder, PutResponseBuilder, PatchResponseBuilder, PostResponseBuilder, DeleteResponseBuilder, ErrorResponseBuilder
| Modifier and Type | Field and Description |
|---|---|
protected net.eusashead.parquet.entity.EntityBuilder |
entityBuilder |
protected net.eusashead.parquet.entity.EntityFactory |
entityFactory |
protected HashStrategy |
hashStrategy |
protected org.vertx.java.core.logging.Logger |
logger |
protected Request |
request |
protected Response |
response |
protected Serializer |
serializer |
| Constructor and Description |
|---|
ResponseBuilderImpl(Request request,
Response response,
net.eusashead.parquet.entity.EntityFactory entityFactory,
Serializer serializer,
HashStrategy hashStrategy,
org.vertx.java.core.logging.Logger logger) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addVaryHeader()
Add the Vary header
|
OptionsResponseBuilder |
allow(HttpMethod... methods)
Add the supplied methods
to the Allow header
|
ResponseBuilderImpl |
body(net.eusashead.parquet.entity.Entity entity)
Set the body to the
supplied
Entity |
<T> ResponseBuilderImpl |
body(T target,
net.eusashead.parquet.entity.EntityConverter<T> converter) |
Response |
build()
Return the built
Response |
void |
checkPrecondition(net.eusashead.parquet.util.Option<ETag> eTag,
net.eusashead.parquet.util.Option<HttpDate> lastModified,
PreconditionSuccessHandler handler)
Check precondition before
executing the
PreconditionSuccessHandler
Check value of If-Match, If-Unmodified-Since
If-None-Match and If-Modified-Since and return
either 412 or 304 (for GET or HEAD only)
if the precondition fails. |
void |
checkPrecondition(net.eusashead.parquet.util.Option<ETag> eTag,
net.eusashead.parquet.util.Option<HttpDate> lastModified,
PreconditionSuccessHandler handler,
boolean require) |
ResponseBuilderImpl |
embed(java.lang.String rel,
net.eusashead.parquet.entity.Entity entity) |
<T> ResponseBuilderImpl |
embed(java.lang.String rel,
T target,
net.eusashead.parquet.entity.EntityConverter<T> converter) |
net.eusashead.parquet.entity.EntityFactory |
entityFactory()
Get the
EntityFactory
used to build the body
of this response |
ResponseBuilderImpl |
eTag()
Set a weak validating
ETag using a hash of the
embedded entity.
|
ResponseBuilderImpl |
eTag(ETag eTag)
Set the ETag header
|
ResponseBuilderImpl |
expires(java.lang.Long millis)
Set the expiry time in milliseconds
that this resource should be cached for
Sets Date, CacheControl and Expires headers
|
<T> ResponseBuilderImpl |
forEach(java.lang.String rel,
java.lang.Iterable<T> target,
net.eusashead.parquet.entity.EntityConverter<T> converter) |
ResponseBuilderImpl |
lastModified(HttpDate lastModified)
Set the Last-Modified header
to the specified
Date |
ResponseBuilderImpl |
link(net.eusashead.parquet.entity.Link link) |
ResponseBuilderImpl |
location(java.net.URI location)
Add the supplied methods
to the Allow header
|
ResponseBuilderImpl |
message(java.lang.String message) |
ResponseBuilderImpl |
property(java.lang.String name,
java.lang.Object value) |
ResponseBuilderImpl |
property(java.lang.String name,
java.lang.Object value,
net.eusashead.parquet.entity.PropertyConverter<?,java.lang.Object> converter) |
Request |
request()
Get the underlying
Request |
void |
requirePrecondition(net.eusashead.parquet.util.Option<ETag> eTag,
net.eusashead.parquet.util.Option<HttpDate> lastModified,
PreconditionSuccessHandler handler)
Require a precondition check before
executing the
PreconditionSuccessHandler
returning an error if the check fails
or if the precondition headers are absent
Check value of If-Match, If-Unmodified-Since
If-None-Match and If-Modified-Since and return
either 412 or 304 (for GET or HEAD only)
if the precondition fails. |
protected Body |
serialize() |
ResponseBuilderImpl |
status(HttpStatus status)
HTTP status code to send
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsendprotected final Request request
protected final Response response
protected final Serializer serializer
protected final net.eusashead.parquet.entity.EntityFactory entityFactory
protected final net.eusashead.parquet.entity.EntityBuilder entityBuilder
protected final org.vertx.java.core.logging.Logger logger
protected final HashStrategy hashStrategy
public ResponseBuilderImpl(Request request, Response response, net.eusashead.parquet.entity.EntityFactory entityFactory, Serializer serializer, HashStrategy hashStrategy, org.vertx.java.core.logging.Logger logger)
public Request request()
ResponseBuilderRequestrequest in interface ResponseBuilderRequestpublic ResponseBuilderImpl status(HttpStatus status)
ResponseBuilderstatus in interface DeleteResponseBuilderstatus in interface ErrorResponseBuilderstatus in interface GetResponseBuilderstatus in interface OptionsResponseBuilderstatus in interface PatchResponseBuilderstatus in interface PostResponseBuilderstatus in interface PutResponseBuilderstatus in interface ResponseBuilderstatus - HttpStatus to useResponseBuilderpublic ResponseBuilderImpl message(java.lang.String message)
message in interface ErrorResponseBuilderpublic ResponseBuilderImpl eTag()
ETagResponseBuilderHashStrategy
specified for this ResponseBuilder
on the string returned from the Entity
toString() method.
Note: If the Entity state is
modified after the ETag is created
it will not be valideTag in interface ETagResponseBuildereTag in interface GetResponseBuildereTag in interface PatchResponseBuildereTag in interface PostResponseBuildereTag in interface PutResponseBuilderETagResponseBuilderpublic ResponseBuilderImpl eTag(ETag eTag)
ETagResponseBuildereTag in interface ETagResponseBuildereTag in interface GetResponseBuildereTag in interface PatchResponseBuildereTag in interface PostResponseBuildereTag in interface PutResponseBuildereTag - ETagETagResponseBuilderpublic ResponseBuilderImpl lastModified(HttpDate lastModified)
ETagResponseBuilderDatelastModified in interface ETagResponseBuilderlastModified in interface GetResponseBuilderlastModified in interface PatchResponseBuilderlastModified in interface PostResponseBuilderlastModified in interface PutResponseBuilderlastModified - Date this entity last changedETagResponseBuilderpublic ResponseBuilderImpl expires(java.lang.Long millis)
GetResponseBuilderexpires in interface GetResponseBuildermillis - Long expiry time in millisecondsGetResponseBuilderpublic ResponseBuilderImpl location(java.net.URI location)
PostResponseBuilderlocation in interface PostResponseBuilderpublic OptionsResponseBuilder allow(HttpMethod... methods)
OptionsResponseBuilderallow in interface OptionsResponseBuilderpublic ResponseBuilderImpl property(java.lang.String name, java.lang.Object value)
property in interface net.eusashead.parquet.entity.MutableEntityproperty in interface DeleteResponseBuilderproperty in interface ErrorResponseBuilderproperty in interface GetResponseBuilderproperty in interface OptionsResponseBuilderproperty in interface PatchResponseBuilderproperty in interface PostResponseBuilderproperty in interface PutResponseBuilderproperty in interface ResponseBuilderpublic ResponseBuilderImpl property(java.lang.String name, java.lang.Object value, net.eusashead.parquet.entity.PropertyConverter<?,java.lang.Object> converter)
property in interface net.eusashead.parquet.entity.MutableEntityproperty in interface DeleteResponseBuilderproperty in interface ErrorResponseBuilderproperty in interface GetResponseBuilderproperty in interface OptionsResponseBuilderproperty in interface PatchResponseBuilderproperty in interface PostResponseBuilderproperty in interface PutResponseBuilderproperty in interface ResponseBuilderpublic ResponseBuilderImpl embed(java.lang.String rel, net.eusashead.parquet.entity.Entity entity)
embed in interface net.eusashead.parquet.entity.MutableEntityembed in interface DeleteResponseBuilderembed in interface ErrorResponseBuilderembed in interface GetResponseBuilderembed in interface OptionsResponseBuilderembed in interface PatchResponseBuilderembed in interface PostResponseBuilderembed in interface PutResponseBuilderembed in interface ResponseBuilderpublic <T> ResponseBuilderImpl embed(java.lang.String rel, T target, net.eusashead.parquet.entity.EntityConverter<T> converter)
embed in interface net.eusashead.parquet.entity.MutableEntityembed in interface DeleteResponseBuilderembed in interface ErrorResponseBuilderembed in interface GetResponseBuilderembed in interface OptionsResponseBuilderembed in interface PatchResponseBuilderembed in interface PostResponseBuilderembed in interface PutResponseBuilderembed in interface ResponseBuilderpublic <T> ResponseBuilderImpl forEach(java.lang.String rel, java.lang.Iterable<T> target, net.eusashead.parquet.entity.EntityConverter<T> converter)
forEach in interface net.eusashead.parquet.entity.MutableEntityforEach in interface DeleteResponseBuilderforEach in interface ErrorResponseBuilderforEach in interface GetResponseBuilderforEach in interface OptionsResponseBuilderforEach in interface PatchResponseBuilderforEach in interface PostResponseBuilderforEach in interface PutResponseBuilderforEach in interface ResponseBuilderpublic ResponseBuilderImpl link(net.eusashead.parquet.entity.Link link)
link in interface net.eusashead.parquet.entity.MutableEntitylink in interface DeleteResponseBuilderlink in interface ErrorResponseBuilderlink in interface GetResponseBuilderlink in interface OptionsResponseBuilderlink in interface PatchResponseBuilderlink in interface PostResponseBuilderlink in interface PutResponseBuilderlink in interface ResponseBuilderpublic ResponseBuilderImpl body(net.eusashead.parquet.entity.Entity entity)
ResponseBuilderEntitybody in interface DeleteResponseBuilderbody in interface ErrorResponseBuilderbody in interface GetResponseBuilderbody in interface OptionsResponseBuilderbody in interface PatchResponseBuilderbody in interface PostResponseBuilderbody in interface PutResponseBuilderbody in interface ResponseBuilderResponseBuilderpublic <T> ResponseBuilderImpl body(T target, net.eusashead.parquet.entity.EntityConverter<T> converter)
body in interface ErrorResponseBuilderbody in interface GetResponseBuilderbody in interface ResponseBuilderpublic net.eusashead.parquet.entity.EntityFactory entityFactory()
ResponseBuilderEntityFactory
used to build the body
of this responseentityFactory in interface ResponseBuilderEntityFactory for this ResponseBuilderpublic Response build()
ResponseBuilderResponsebuild in interface ResponseBuilderResponse objectprotected Body serialize()
public void checkPrecondition(net.eusashead.parquet.util.Option<ETag> eTag, net.eusashead.parquet.util.Option<HttpDate> lastModified, PreconditionSuccessHandler handler)
ResponseBuilderPreconditionSuccessHandler
Check value of If-Match, If-Unmodified-Since
If-None-Match and If-Modified-Since and return
either 412 or 304 (for GET or HEAD only)
if the precondition fails.checkPrecondition in interface ResponseBuildereTag - ETag value for current resourcelastModified - Last-Modified date for current resourcehandler - PreconditionSuccessHandler action to execute if precondition succeedspublic void requirePrecondition(net.eusashead.parquet.util.Option<ETag> eTag, net.eusashead.parquet.util.Option<HttpDate> lastModified, PreconditionSuccessHandler handler)
ResponseBuilderPreconditionSuccessHandler
returning an error if the check fails
or if the precondition headers are absent
Check value of If-Match, If-Unmodified-Since
If-None-Match and If-Modified-Since and return
either 412 or 304 (for GET or HEAD only)
if the precondition fails.
If none of the headers above are supplied
return a 428 error.requirePrecondition in interface ResponseBuildereTag - ETag value for current resourcelastModified - Last-Modified date for current resourcehandler - PreconditionSuccessHandler action to execute if precondition succeedspublic void checkPrecondition(net.eusashead.parquet.util.Option<ETag> eTag, net.eusashead.parquet.util.Option<HttpDate> lastModified, PreconditionSuccessHandler handler, boolean require)
protected void addVaryHeader()
request -