Restlet Default Route?
I'm trying to setup a couple routes with the restlet framework, but I can't seem to figure out how to setup a "default route".
I tried this:
@Override
public Restlet createInboundRoot() {
Router router = new Router( getContext() );
router.attach( "http://localhost:8111/", TestActionResourc开发者_如何转开发e.class );
router.attach( "http://localhost:8111/echo", EchoResource.class );
router.setDefaultRoute( router.getRoutes().get( 0 ) );
return router;
}
But when I try something like:
http://localhost:8111/something
I get a "not found" error message.
Is there an easy way to default pages that are not found from the router?
Thanks.
I almost had it, this is it:
@Override
public Restlet createInboundRoot() {
Router router = new Router( getContext() );
router.attachDefault( TestActionResource.class );
router.attach( "http://localhost:8111/echo", EchoResource.class );
return router;
}
精彩评论