/** * */ package de.mpiwg.itgroup.annotations.restlet.annotations_ui; import org.apache.log4j.Logger; import org.restlet.Context; import org.restlet.Restlet; import org.restlet.data.ChallengeScheme; import org.restlet.routing.Router; import org.restlet.security.ChallengeAuthenticator; import org.restlet.security.MapVerifier; import de.mpiwg.itgroup.annotations.restlet.BaseRestlet; /** * @author casties * */ public class AnnotationsUiRestlet extends BaseRestlet { public final String version = "AnnotationManagerN4J/AnnotationsUI 0.2"; public static Logger logger = Logger.getLogger(AnnotationsUiRestlet.class); public AnnotationsUiRestlet(Context context) { super(context); logger.debug("StoreRestlet!"); } /* * (non-Javadoc) * * @see org.restlet.Application#createInboundRoot() */ @Override public Restlet createInboundRoot() { // this.authenticator = createAuthenticator(); Router router = new Router(getContext()); router.attach("/groups", GroupsResource.class); router.attach("/groups/", GroupsResource.class); router.attach("/groups/{id}", GroupResource.class); router.attach("/groups/{id}/", GroupResource.class); router.attach("/groups/{id}/members", GroupMembersResource.class); router.attach("/persons", PersonsResource.class); router.attach("/persons/", PersonsResource.class); router.attach("/persons/{id}", PersonResource.class); router.attach("/persons/{id}/", PersonResource.class); router.attach("/", InfoResource.class); // Create a simple password verifier MapVerifier verifier = new MapVerifier(); verifier.getLocalSecrets().put("scott", "tiger".toCharArray()); // Create a Guard ChallengeAuthenticator guard = new ChallengeAuthenticator(getContext(), ChallengeScheme.HTTP_BASIC, "Tutorial"); guard.setVerifier(verifier); // put everything through guard guard.setNext(router); return guard; } @Override public String getVersion() { return version; } }