org.restlet.resource.Finder Java Examples

The following examples show how to use org.restlet.resource.Finder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WorkspaceApplicationTest.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void should_attach_inbound_route_to_application() throws Exception {
    final Router inboundRoot = (Router) workspaceApplication.createInboundRoot();

    assertThat(inboundRoot).isNotNull();
    assertThat(inboundRoot.getRoutes()).hasSize(3);
    final TemplateRoute route1 = (TemplateRoute) inboundRoot.getRoutes().get(0);
    assertThat(route1.getTemplate().getPattern()).isEqualTo("/workspace/{filePath}/{action}");
    assertThat(((Finder) route1.getNext()).getTargetClass()).isEqualTo(WorkspaceServerResource.class);
    final TemplateRoute route2 = (TemplateRoute) inboundRoot.getRoutes().get(1);
    assertThat(route2.getTemplate().getPattern()).isEqualTo("/workspace/{action}");
    assertThat(((Finder) route2.getNext()).getTargetClass()).isEqualTo(WorkspaceServerResource.class);
    final TemplateRoute route3 = (TemplateRoute) inboundRoot.getRoutes().get(2);
    assertThat(route3.getTemplate().getPattern()).isEqualTo("/workspace/status/");
    assertThat(((Finder) route3.getNext()).getTargetClass()).isEqualTo(APIStatus.class);
}
 
Example #2
Source File: APIInfoResource.java    From ontopia with Apache License 2.0 5 votes vote down vote up
private void describe(StringBuilder b, Restlet restlet, String path) {
	if (restlet instanceof Router) {
		describeRoutes(b, (Router) restlet, path);
	} else if (restlet instanceof Finder) {
		Finder f = (Finder) restlet;
		b.append(path).append(" = ").append(ClassUtils.collapsedName(f.getTargetClass())).append("\n");
	} else if (restlet instanceof Filter) {
		describe(b, ((Filter)restlet).getNext(), path);
	}
}
 
Example #3
Source File: RestApplication.java    From attic-polygene-java with Apache License 2.0 4 votes vote down vote up
private Finder newFinder( Class<? extends ServerResource> resource )
{
    Finder finder = objectFactory.newObject( Finder.class );
    finder.setTargetClass( resource );
    return finder;
}
 
Example #4
Source File: APIInfoResource.java    From ontopia with Apache License 2.0 4 votes vote down vote up
public boolean isFinder(Restlet restlet) {
	return restlet instanceof Finder;
}