Mercurial > hg > AnnotationManagerN4J
view src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsUiRestlet.java @ 93:3d1a00418b42 admin_ui_rel_links
starting web admin ui with relative links. doesn't fully work yet.
author | casties |
---|---|
date | Mon, 09 Feb 2015 12:55:51 +0100 |
parents | 25eb2e1df106 |
children |
line wrap: on
line source
package de.mpiwg.itgroup.annotations.restlet.annotations_ui; /* * #%L * AnnotationManager * %% * Copyright (C) 2012 - 2014 MPIWG Berlin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ import java.util.logging.Logger; 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.4"; public static Logger logger = Logger.getLogger("de.mpiwg.itgroup.annotations.restlet.annotations_ui.AnnotationsUiRestlet"); /* * (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("/annotations", AnnotationsResource.class); router.attach("/annotations/", AnnotationsResource.class); router.attach("/annotations/{id}", AnnotationResource.class); router.attach("/annotations/{id}/", AnnotationResource.class); router.attach("/", InfoResource.class); // use simple password verifier MapVerifier verifier = new MapVerifier(); // get user name and password String user = serverConfig.getProperty(BaseRestlet.ADMIN_USER_KEY); String pw = serverConfig.getProperty(BaseRestlet.ADMIN_PASSWORD_KEY); if (user != null && pw != null) { verifier.getLocalSecrets().put(user, pw.toCharArray()); } else { logger.severe("Admin user and password missing in serverconfig!"); } // Create a Guard ChallengeAuthenticator guard = new ChallengeAuthenticator(getContext(), ChallengeScheme.HTTP_BASIC, "Annotation Server"); guard.setVerifier(verifier); // put everything through guard guard.setNext(router); return guard; } @Override public String getVersion() { return version; } }