5858import org .xml .sax .SAXException ;
5959
6060@ RestController
61+ @ RequestMapping ("rest" )
6162public class RestBase extends CORSDecorator {
6263 static String personURI = "http://somewhere/JohnSmith" ;
6364 static String fullName = "John Smith" ;
@@ -86,7 +87,7 @@ public void postConstruct() {
8687 return ErrorResponse .HOST_NOT_CONFIGURED ;
8788 }
8889
89- @ RequestMapping (method = RequestMethod .GET , value = "rest/ ediml/requestId" , produces = MediaType .APPLICATION_JSON_VALUE )
90+ @ RequestMapping (method = RequestMethod .GET , value = "ediml/requestId" , produces = MediaType .APPLICATION_JSON_VALUE )
9091 @ ResponseBody
9192 public Metadata getNewId (HttpServletRequest request , @ RequestHeader ("Host" ) String host ) throws HostNotConfiguredException {
9293 if ( service .getHostName () == null ) {
@@ -99,7 +100,7 @@ public Metadata getNewId(HttpServletRequest request, @RequestHeader("Host") Stri
99100 return md ;
100101 }
101102
102- @ RequestMapping (method = RequestMethod .POST , value = "rest/ metadata" , produces = MediaType .APPLICATION_JSON_VALUE , consumes = MediaType .APPLICATION_XML_VALUE )
103+ @ RequestMapping (method = RequestMethod .POST , value = "metadata" , produces = MediaType .APPLICATION_JSON_VALUE , consumes = MediaType .APPLICATION_XML_VALUE )
103104 @ ResponseBody
104105 public ResponseEntity <PostMetadataResponse > postMetadataNG (HttpServletRequest req , @ RequestHeader (value = "X-Forwarded-For" , required = false ) String ip , @ RequestBody String xml , @ RequestHeader (value = "api_key" , required = false ) String apiKey ) {
105106 log .info ("xml: " + xml );
@@ -205,14 +206,14 @@ public ResponseEntity<PostMetadataResponse> postMetadataNG(HttpServletRequest re
205206 return new ResponseEntity <PostMetadataResponse >(response , HttpStatus .INTERNAL_SERVER_ERROR );
206207 }
207208
208- @ RequestMapping (method = RequestMethod .OPTIONS , value = "rest/ metadata" , produces = MediaType .APPLICATION_JSON_VALUE , consumes = MediaType .APPLICATION_XML_VALUE )
209+ @ RequestMapping (method = RequestMethod .OPTIONS , value = "metadata" , produces = MediaType .APPLICATION_JSON_VALUE , consumes = MediaType .APPLICATION_XML_VALUE )
209210 @ ResponseBody
210211 public ResponseEntity <PostMetadataResponse > optionsPostMetadata (String xml ) {
211212 return new ResponseEntity <PostMetadataResponse >(HttpStatus .OK );
212213 }
213214
214215
215- @ RequestMapping (method = RequestMethod .GET , value = "/rest/ xml/{id}.{suffix}" , produces = MediaType .APPLICATION_XML_VALUE )
216+ @ RequestMapping (method = RequestMethod .GET , value = "/xml/{id}.{suffix}" , produces = MediaType .APPLICATION_XML_VALUE )
216217 @ ResponseBody
217218 public HttpEntity <byte []> getXml (@ PathVariable int id , @ PathVariable String suffix ) {
218219 log .info ("getXml " + id + ", " + suffix );
@@ -227,7 +228,7 @@ public HttpEntity<byte[]> getXml(@PathVariable int id, @PathVariable String suff
227228 return new HttpEntity <byte []>(md .getOutput ().getBytes (), header );
228229 }
229230
230- @ RequestMapping (method = RequestMethod .GET , value = "/rest/ edimlFile/{id}.{suffix}" , produces = MediaType .APPLICATION_XML_VALUE )
231+ @ RequestMapping (method = RequestMethod .GET , value = "/edimlFile/{id}.{suffix}" , produces = MediaType .APPLICATION_XML_VALUE )
231232 @ ResponseBody
232233 public HttpEntity <byte []> getEdimlFile (@ PathVariable int id , @ PathVariable String suffix ) {
233234 log .info ("getEdimlFile " + id + ", " + suffix );
@@ -248,15 +249,15 @@ public HttpEntity<byte[]> getEdimlFile(@PathVariable int id, @PathVariable Strin
248249 return new HttpEntity <byte []>(doc .toString ().getBytes (), header );
249250 }
250251
251- @ RequestMapping (method = RequestMethod .GET , value = "/rest/ ediml/{id}" , produces = MediaType .APPLICATION_XML_VALUE )
252+ @ RequestMapping (method = RequestMethod .GET , value = "/ediml/{id}" , produces = MediaType .APPLICATION_XML_VALUE )
252253 @ ResponseBody
253254 public String getEDIMLXml (@ PathVariable int id ) {
254255 log .info ("getEDIMLXml " + id );
255256 Metadata md = service .getMetadata (id );
256257 return md .getInput ();
257258 }
258259
259- @ RequestMapping (method = RequestMethod .GET , value = "/rest/ ediml/{id}" , produces = MediaType .APPLICATION_JSON_VALUE )
260+ @ RequestMapping (method = RequestMethod .GET , value = "/ediml/{id}" , produces = MediaType .APPLICATION_JSON_VALUE )
260261 @ ResponseBody
261262 public TemplateElementList getEDIML (@ PathVariable int id ) {
262263 log .info ("getEDIML " + id );
@@ -310,19 +311,19 @@ public TemplateElementList getEDIML(@PathVariable int id) {
310311 return elementList ;
311312 }
312313
313- @ RequestMapping (method = RequestMethod .GET , value = "rest/ metadata/sync" , produces = MediaType .APPLICATION_JSON_VALUE )
314+ @ RequestMapping (method = RequestMethod .GET , value = "metadata/sync" , produces = MediaType .APPLICATION_JSON_VALUE )
314315 public ServiceResponse syncMetadata () {
315316 return service .syncMetadata ();
316317 }
317318
318- @ RequestMapping (method = RequestMethod .GET , value = "rest/ test" , produces = MediaType .APPLICATION_JSON_VALUE )
319+ @ RequestMapping (method = RequestMethod .GET , value = "test" , produces = MediaType .APPLICATION_JSON_VALUE )
319320 public String test (HttpServletRequest request ) {
320321 String restOfTheUrl = (String ) request .getAttribute (
321322 HandlerMapping .PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE );
322323 return "{\" url\" : \" " + request .getRequestURL ().toString () + "\" , \" forwarded\" :\" " + request .getHeader ("X-Forwarded-Host" ) + "\" }" ;
323324 }
324325
325- @ RequestMapping (method = RequestMethod .GET , value = "rest/ whoami" , produces = MediaType .APPLICATION_JSON_VALUE )
326+ @ RequestMapping (method = RequestMethod .GET , value = "whoami" , produces = MediaType .APPLICATION_JSON_VALUE )
326327 public String getWhoAmIFromGeoSK () throws IOException {
327328 String result = "" ;
328329
0 commit comments