Skip to content

Commit

Permalink
Fix webpage for v1
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus-87 authored and clorenz committed Jan 23, 2019
1 parent e5fac30 commit 92d19cc
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,27 @@ public class V1WebpageController {
private WebpageService<Webpage, Identifiable> webpageService;

@ApiMethod(description = "get a webpage as JSON (Version 1), depending on extension or <tt>format</tt> request parameter or accept header")
@RequestMapping(value = {"/v1/webpages/{uuid}.json"}, produces = {MediaType.APPLICATION_JSON_VALUE}, method = RequestMethod.GET)
@RequestMapping(value = {"/v1/webpages/{uuid}.json", "/v1/webpages/{uuid}"}, produces = {MediaType.APPLICATION_JSON_VALUE}, method = RequestMethod.GET)
@ApiResponseObject
public ResponseEntity<String> getWebpageV1Json(
@ApiPathParam(description = "UUID of the webpage, e.g. <tt>599a120c-2dd5-11e8-b467-0ed5f89f718b</tt>") @PathVariable("uuid") UUID uuid,
@ApiQueryParam(name = "pLocale", description = "Desired locale, e.g. <tt>de_DE</tt>. If unset, contents in all languages will be returned")
@RequestParam(name = "pLocale", required = false) Locale pLocale
@ApiPathParam(description = "UUID of the webpage, e.g. <tt>599a120c-2dd5-11e8-b467-0ed5f89f718b</tt>") @PathVariable("uuid") UUID uuid,
@ApiQueryParam(name = "pLocale", description = "Desired locale, e.g. <tt>de_DE</tt>. If unset, contents in all languages will be returned")
@RequestParam(name = "pLocale", required = false) Locale pLocale
) throws IdentifiableServiceException, JsonProcessingException {

Webpage webpage = loadWebpage(pLocale, uuid);
String result = v1ObjectMapper.writeValueAsString(webpage);
result = result.replaceAll("ENTITY_PART", "RESOURCE");
return new ResponseEntity<>(result, HttpStatus.OK);
}

@ApiMethod(description = "get a webpage as JSON or XML (Version 1), depending on extension or <tt>format</tt> request parameter or accept header")
@RequestMapping(value = {"/v1/webpages/{uuid}.xml"}, produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE}, method = RequestMethod.GET)
@ApiResponseObject
public ResponseEntity<String> getWebpageV1Xml(
@ApiPathParam(description = "UUID of the webpage, e.g. <tt>599a120c-2dd5-11e8-b467-0ed5f89f718b</tt>") @PathVariable("uuid") UUID uuid,
@ApiQueryParam(name = "pLocale", description = "Desired locale, e.g. <tt>de_DE</tt>. If unset, contents in all languages will be returned")
@RequestParam(name = "pLocale", required = false) Locale pLocale
@ApiPathParam(description = "UUID of the webpage, e.g. <tt>599a120c-2dd5-11e8-b467-0ed5f89f718b</tt>") @PathVariable("uuid") UUID uuid,
@ApiQueryParam(name = "pLocale", description = "Desired locale, e.g. <tt>de_DE</tt>. If unset, contents in all languages will be returned")
@RequestParam(name = "pLocale", required = false) Locale pLocale
) throws IdentifiableServiceException, JsonProcessingException, XmlMappingException, IOException {

Webpage webpage = loadWebpage(pLocale, uuid);
Expand Down

0 comments on commit 92d19cc

Please sign in to comment.