DATAREST-34 - PUT and POST request now consider Accept header by default.
By default, whether to return response bodies for PUT and POST is determined by the presence of an Accept header, unless explicitly activated or deactivated in RepositoryRestConfiguration. Original pull request: #167.
This commit is contained in:
committed by
Oliver Gierke
parent
4f8298c711
commit
f3c74ac9db
@@ -46,8 +46,8 @@ public class RepositoryRestConfiguration {
|
||||
private String sortParamName = "sort";
|
||||
private MediaType defaultMediaType = MediaTypes.HAL_JSON;
|
||||
private boolean useHalAsDefaultJsonMediaType = true;
|
||||
private boolean returnBodyOnCreate = false;
|
||||
private boolean returnBodyOnUpdate = false;
|
||||
private Boolean returnBodyOnCreate = Boolean.FALSE;
|
||||
private Boolean returnBodyOnUpdate = Boolean.FALSE;
|
||||
private List<Class<?>> exposeIdsFor = new ArrayList<Class<?>>();
|
||||
private ResourceMappingConfiguration domainMappings = new ResourceMappingConfiguration();
|
||||
private ResourceMappingConfiguration repoMappings = new ResourceMappingConfiguration();
|
||||
@@ -296,19 +296,21 @@ public class RepositoryRestConfiguration {
|
||||
/**
|
||||
* Whether to return a response body after creating an entity.
|
||||
*
|
||||
* @return {@literal true} to return a body on create, {@literal false} otherwise.
|
||||
* @return {@link java.lang.Boolean#TRUE} to return a body on create, {@link java.lang.Boolean#FALSE} otherwise.
|
||||
* If {@literal null}, defer to HTTP Accept header
|
||||
*/
|
||||
public boolean isReturnBodyOnCreate() {
|
||||
public Boolean isReturnBodyOnCreate() {
|
||||
return returnBodyOnCreate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether to return a response body after creating an entity.
|
||||
*
|
||||
* @param returnBodyOnCreate {@literal true} to return a body on create, {@literal false} otherwise.
|
||||
* @param returnBodyOnCreate {@link java.lang.Boolean#TRUE} to return a body on create, {@link java.lang.Boolean#FALSE} otherwise.
|
||||
* If {@literal null}, defer to HTTP Accept header
|
||||
* @return {@literal this}
|
||||
*/
|
||||
public RepositoryRestConfiguration setReturnBodyOnCreate(boolean returnBodyOnCreate) {
|
||||
public RepositoryRestConfiguration setReturnBodyOnCreate(Boolean returnBodyOnCreate) {
|
||||
this.returnBodyOnCreate = returnBodyOnCreate;
|
||||
return this;
|
||||
}
|
||||
@@ -316,19 +318,21 @@ public class RepositoryRestConfiguration {
|
||||
/**
|
||||
* Whether to return a response body after updating an entity.
|
||||
*
|
||||
* @return {@literal true} to return a body on update, {@literal false} otherwise.
|
||||
* @return {@link java.lang.Boolean#TRUE} to return a body on update, {@link java.lang.Boolean#FALSE} otherwise.
|
||||
* If {@literal null}, defer to HTTP Accept header
|
||||
*/
|
||||
public boolean isReturnBodyOnUpdate() {
|
||||
public Boolean isReturnBodyOnUpdate() {
|
||||
return returnBodyOnUpdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to return a response body after updating an entity.
|
||||
*
|
||||
* @param returnBodyOnUpdate
|
||||
* @return
|
||||
* Set whether to return a response body after updating an entity.
|
||||
*
|
||||
* @param returnBodyOnUpdate {@link java.lang.Boolean#TRUE} to return a body on update, {@link java.lang.Boolean#FALSE} otherwise.
|
||||
* If {@literal null}, defer to HTTP Accept header
|
||||
* @return {@literal this}
|
||||
*/
|
||||
public RepositoryRestConfiguration setReturnBodyOnUpdate(boolean returnBodyOnUpdate) {
|
||||
public RepositoryRestConfiguration setReturnBodyOnUpdate(Boolean returnBodyOnUpdate) {
|
||||
this.returnBodyOnUpdate = returnBodyOnUpdate;
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user