Search in sources :

Example 1 with ForumAssembler

use of org.qi4j.samples.forum.assembler.ForumAssembler in project qi4j-sdk by Qi4j.

the class Main method main.

public static void main(String[] args) throws Exception {
    Energy4Java is = new Energy4Java();
    Server server = new Server(Protocol.HTTP, 8888);
    Application app = is.newApplication(new ForumAssembler(), new MetadataService());
    app.activate();
    ContextRestlet restlet = app.findModule("REST", "Restlet").newObject(ContextRestlet.class, new org.restlet.Context());
    ChallengeAuthenticator guard = new ChallengeAuthenticator(null, ChallengeScheme.HTTP_BASIC, "testRealm");
    MapVerifier mapVerifier = new MapVerifier();
    mapVerifier.getLocalSecrets().put("rickard", "secret".toCharArray());
    guard.setVerifier(mapVerifier);
    guard.setNext(restlet);
    server.setNext(restlet);
    server.start();
}
Also used : ContextRestlet(org.qi4j.library.rest.server.api.ContextRestlet) Server(org.restlet.Server) ForumAssembler(org.qi4j.samples.forum.assembler.ForumAssembler) Energy4Java(org.qi4j.bootstrap.Energy4Java) ChallengeAuthenticator(org.restlet.security.ChallengeAuthenticator) MapVerifier(org.restlet.security.MapVerifier) Application(org.qi4j.api.structure.Application) MetadataService(org.restlet.service.MetadataService)

Aggregations

Application (org.qi4j.api.structure.Application)1 Energy4Java (org.qi4j.bootstrap.Energy4Java)1 ContextRestlet (org.qi4j.library.rest.server.api.ContextRestlet)1 ForumAssembler (org.qi4j.samples.forum.assembler.ForumAssembler)1 Server (org.restlet.Server)1 ChallengeAuthenticator (org.restlet.security.ChallengeAuthenticator)1 MapVerifier (org.restlet.security.MapVerifier)1 MetadataService (org.restlet.service.MetadataService)1