Moving JSON:API reply separate methods
This commit is contained in:
parent
cbcb4804b7
commit
2d9f469a46
|
@ -39,11 +39,21 @@ public class License extends REST<CKANLicense> implements org.gcube.gcat.api.int
|
||||||
* @responseExample application/json classpath:/api-docs-examples/license/list-license-response.json
|
* @responseExample application/json classpath:/api-docs-examples/license/list-license-response.json
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Produces({MediaType.APPLICATION_JSON, GCatConstants.APPLICATION_JSON_API})
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public String list() throws WebServiceException {
|
public String list() throws WebServiceException {
|
||||||
|
return super.list(-1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the json array containing the licenses available in the catalogue
|
||||||
|
*
|
||||||
|
* @pathExample /licenses
|
||||||
|
* @responseExample application/json classpath:/api-docs-examples/license/list-license-response.json
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Produces(GCatConstants.APPLICATION_JSON_API)
|
||||||
|
public String listAsJsonAPI() throws WebServiceException {
|
||||||
String ret = super.list(-1, -1);
|
String ret = super.list(-1, -1);
|
||||||
String accept = httpHeaders.getHeaderString("Accept");
|
|
||||||
if(accept.startsWith(GCatConstants.APPLICATION_JSON_API)) {
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
ObjectNode objectNode = objectMapper.createObjectNode();
|
ObjectNode objectNode = objectMapper.createObjectNode();
|
||||||
try {
|
try {
|
||||||
|
@ -53,7 +63,6 @@ public class License extends REST<CKANLicense> implements org.gcube.gcat.api.int
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
throw new InternalServerErrorException(e);
|
throw new InternalServerErrorException(e);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue