Commit 4dda87bc authored by Matija Obreza's avatar Matija Obreza

Get accession by DOI at /api/v1/acn/{doi}

parent b72fe332
......@@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.HandlerMapping;
......@@ -69,7 +70,7 @@ public class AccessionController {
* @param uuid the uuid
* @return the subset
*/
@GetMapping(value = "/{UUID}", produces = { MediaType.APPLICATION_JSON_VALUE })
@GetMapping(value = "/{UUID:\\w{8}\\-\\w{4}.+}", produces = { MediaType.APPLICATION_JSON_VALUE })
public Accession getByUuid(@PathVariable("UUID") final UUID uuid) {
return accessionService.getByUuid(uuid);
}
......@@ -81,10 +82,10 @@ public class AccessionController {
* @param uuid the uuid
* @return the subset
*/
@GetMapping(value = "/10.{dummy:[0-9]+}/**}", produces = { MediaType.APPLICATION_JSON_VALUE })
@RequestMapping(value = "/10.{dummy:[0-9]+}/**", method=RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE })
public Accession getByDoi(HttpServletRequest request) {
final String fullpath = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
final String doi = fullpath.substring(1);
final String doi = fullpath.substring(API_BASE.length()+1);
return accessionService.getByDoi(doi);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment