Search in sources :

Example 11 with Restlet

use of org.restlet.Restlet in project OpenAM by OpenRock.

the class ServiceEndpointApplication method createInboundRoot.

/**
     * Creates an inbound Restlet root for all registered REST Service endpoints.
     *
     * @return A Restlet for routing incoming REST Service endpoint requests.
     */
@Override
public Restlet createInboundRoot() {
    Restlet router = getRouter();
    router.setContext(getContext());
    return router;
}
Also used : Restlet(org.restlet.Restlet)

Example 12 with Restlet

use of org.restlet.Restlet in project OpenAM by OpenRock.

the class AbstractRestletAccessAuditFilterTest method setUp.

@BeforeMethod
public void setUp() throws Exception {
    restlet = mock(Restlet.class);
    AMAuditServiceConfiguration serviceConfig = new AMAuditServiceConfiguration(true);
    AuditServiceBuilder builder = AuditServiceBuilder.newAuditService().withConfiguration(serviceConfig);
    AMAuditService auditService = new DefaultAuditServiceProxy(builder.build(), serviceConfig);
    auditService.startup();
    auditServiceProvider = mock(AuditServiceProvider.class);
    when(auditServiceProvider.getDefaultAuditService()).thenReturn(auditService);
    eventFactory = new AuditEventFactory();
    eventPublisher = mock(AuditEventPublisher.class);
    auditFilter = new RestletAccessAuditFilterTest(restlet, eventPublisher, eventFactory, null, null);
}
Also used : AuditServiceBuilder(org.forgerock.audit.AuditServiceBuilder) DefaultAuditServiceProxy(org.forgerock.openam.audit.DefaultAuditServiceProxy) AuditServiceProvider(org.forgerock.openam.audit.AuditServiceProvider) Restlet(org.restlet.Restlet) AMAuditService(org.forgerock.openam.audit.AMAuditService) AuditEventFactory(org.forgerock.openam.audit.AuditEventFactory) AMAuditServiceConfiguration(org.forgerock.openam.audit.configuration.AMAuditServiceConfiguration) AuditEventPublisher(org.forgerock.openam.audit.AuditEventPublisher) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 13 with Restlet

use of org.restlet.Restlet in project helix by apache.

the class RestAdminApplication method createInboundRoot.

@Override
public Restlet createInboundRoot() {
    Router router = new Router(getContext());
    router.setDefaultMatchingMode(Template.MODE_EQUALS);
    router.attach("/clusters", ClustersResource.class);
    router.attach("/clusters/{clusterName}", ClusterResource.class);
    router.attach("/clusters/{clusterName}/resourceGroups", ResourceGroupsResource.class);
    router.attach("/clusters/{clusterName}/resourceGroups/{resourceName}", ResourceGroupResource.class);
    router.attach("/clusters/{clusterName}/workflows", WorkflowsResource.class);
    router.attach("/clusters/{clusterName}/jobQueues", JobQueuesResource.class);
    router.attach("/clusters/{clusterName}/jobQueues/{jobQueue}", JobQueueResource.class);
    router.attach("/clusters/{clusterName}/jobQueues/{jobQueue}/{job}", JobResource.class);
    router.attach("/clusters/{clusterName}/instances", InstancesResource.class);
    router.attach("/clusters/{clusterName}/instances/{instanceName}", InstanceResource.class);
    router.attach("/clusters/{clusterName}/instances/{instanceName}/currentState/{resourceName}", CurrentStateResource.class);
    router.attach("/clusters/{clusterName}/instances/{instanceName}/statusUpdate/{resourceName}", StatusUpdateResource.class);
    router.attach("/clusters/{clusterName}/instances/{instanceName}/errors/{resourceName}", ErrorResource.class);
    router.attach("/clusters/{clusterName}/instances/{instanceName}/currentState", CurrentStatesResource.class);
    router.attach("/clusters/{clusterName}/instances/{instanceName}/statusUpdate", StatusUpdatesResource.class);
    router.attach("/clusters/{clusterName}/instances/{instanceName}/errors", ErrorsResource.class);
    router.attach("/clusters/{clusterName}/resourceGroups/{resourceName}/idealState", IdealStateResource.class);
    router.attach("/clusters/{clusterName}/resourceGroups/{resourceName}/externalView", ExternalViewResource.class);
    router.attach("/clusters/{clusterName}/StateModelDefs/{modelName}", StateModelResource.class);
    router.attach("/clusters/{clusterName}/StateModelDefs", StateModelsResource.class);
    router.attach("/clusters/{clusterName}/SchedulerTasks", SchedulerTasksResource.class);
    router.attach("/clusters/{clusterName}/Controller", ControllerResource.class);
    router.attach("/clusters/{clusterName}/Controller/statusUpdates/{MessageType}/{MessageId}", ControllerStatusUpdateResource.class);
    router.attach("/clusters/{clusterName}/configs", ConfigResource.class);
    router.attach("/clusters/{clusterName}/configs/{scope}", ConfigResource.class);
    router.attach("/clusters/{clusterName}/configs/{scope}/{scopeKey1}", ConfigResource.class);
    router.attach("/clusters/{clusterName}/configs/{scope}/{scopeKey1}/{scopeKey2}", ConfigResource.class);
    router.attach("/clusters/{clusterName}/constraints/{constraintType}", ConstraintResource.class);
    router.attach("/clusters/{clusterName}/constraints/{constraintType}/{constraintId}", ConstraintResource.class);
    router.attach("/zkPath", ZkPathResource.class).setMatchingMode(Template.MODE_STARTS_WITH);
    router.attach("/zkChild", ZkChildResource.class).setMatchingMode(Template.MODE_STARTS_WITH);
    Restlet mainpage = new Restlet() {

        @Override
        public void handle(Request request, Response response) {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("<html>");
            stringBuilder.append("<head><title>Restlet Cluster Management page</title></head>");
            stringBuilder.append("<body bgcolor=white>");
            stringBuilder.append("<table border=\"0\">");
            stringBuilder.append("<tr>");
            stringBuilder.append("<td>");
            stringBuilder.append("<h1>Rest cluster management interface V1</h1>");
            stringBuilder.append("</td>");
            stringBuilder.append("</tr>");
            stringBuilder.append("</table>");
            stringBuilder.append("</body>");
            stringBuilder.append("</html>");
            response.setEntity(new StringRepresentation(stringBuilder.toString(), MediaType.TEXT_HTML));
        }
    };
    router.attach("", mainpage);
    return router;
}
Also used : Response(org.restlet.Response) Restlet(org.restlet.Restlet) StringRepresentation(org.restlet.representation.StringRepresentation) ZkPathResource(org.apache.helix.webapp.resources.ZkPathResource) Request(org.restlet.Request) Router(org.restlet.routing.Router) ZkChildResource(org.apache.helix.webapp.resources.ZkChildResource)

Aggregations

Restlet (org.restlet.Restlet)13 Request (org.restlet.Request)5 Response (org.restlet.Response)5 Router (org.restlet.routing.Router)5 StringRepresentation (org.restlet.representation.StringRepresentation)3 SSOToken (com.iplanet.sso.SSOToken)2 File (java.io.File)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 HttpRequest (org.restlet.engine.adapter.HttpRequest)2 BeforeMethod (org.testng.annotations.BeforeMethod)2 Test (org.testng.annotations.Test)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 FileSystemResourceFactory (io.milton.http.fs.FileSystemResourceFactory)1 FsMemoryLockManager (io.milton.http.fs.FsMemoryLockManager)1 NullSecurityManager (io.milton.http.fs.NullSecurityManager)1 SimpleFileContentService (io.milton.http.fs.SimpleFileContentService)1 WebDavRestlet (io.milton.restlet.WebDavRestlet)1 Exchange (org.apache.camel.Exchange)1 ZkChildResource (org.apache.helix.webapp.resources.ZkChildResource)1 ZkPathResource (org.apache.helix.webapp.resources.ZkPathResource)1