Mercurial > hg > AnnotationManagerN4J
diff src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsUiRestlet.java @ 94:fcb6fe10e08c
added config option for webapp URL prefix.
author | casties |
---|---|
date | Tue, 10 Feb 2015 17:45:56 +0100 |
parents | 25eb2e1df106 |
children | 434264e1839a |
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsUiRestlet.java Sun Feb 08 18:09:00 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsUiRestlet.java Tue Feb 10 17:45:56 2015 +0100 @@ -34,6 +34,7 @@ import org.restlet.security.MapVerifier; import de.mpiwg.itgroup.annotations.restlet.BaseRestlet; +import de.mpiwg.itgroup.annotations.restlet.utils.UrlPrefixFilter; /** * @author casties @@ -53,9 +54,9 @@ @Override public Restlet createInboundRoot() { // this.authenticator = createAuthenticator(); - + Restlet root = null; + Router router = new Router(getContext()); - router.attach("/groups", GroupsResource.class); router.attach("/groups/", GroupsResource.class); router.attach("/groups/{id}", GroupResource.class); @@ -69,8 +70,16 @@ router.attach("/annotations/", AnnotationsResource.class); router.attach("/annotations/{id}", AnnotationResource.class); router.attach("/annotations/{id}/", AnnotationResource.class); - router.attach("/", InfoResource.class); + root = router; + + if (this.webappUriPrefix != null) { + // add prefix path to url + UrlPrefixFilter prefixFilter = new UrlPrefixFilter(); + prefixFilter.setPrefix(this.webappUriPrefix);; + prefixFilter.setNext(root); + root = prefixFilter; + } // use simple password verifier MapVerifier verifier = new MapVerifier(); @@ -86,8 +95,10 @@ ChallengeAuthenticator guard = new ChallengeAuthenticator(getContext(), ChallengeScheme.HTTP_BASIC, "Tutorial"); guard.setVerifier(verifier); // put everything through guard - guard.setNext(router); - return guard; + guard.setNext(root); + root = guard; + + return root; } @Override