Re: Re: how to set default route in jax-rs

2009-03-16 Thread Ty
Thanks,  I'll give it a try.


From: "Alexander J. Perez Tchernov" 
Sent: Sunday, March 15, 2009 11:03 PM
To: discuss@restlet.tigris.org
Subject: Re: Re: how to set default route in jax-rs 

An simple solution might be to introduce JAX-RS resource that catch
"any url" addressing  with help of reg-exp.
something like
@Path(value = "/{resource:.*}")
public class CatchAll {
public CatchAll (@PathParam("resource") String resource ) {}
}

On Sun, Mar 15, 2009 at 12:34 AM, Ty  wrote:
> Hi,
> Thanks again for the god advice.  This seems to be the call you are referring 
> to:
>
> // create JAX-RS runtime environment
> final JaxRsApplication application = new 
> JaxRsApplication(comp.getContext().createChildContext());
>
> // set the Default restlet
> application.getJaxRsRestlet().attachDefault(myDefaultRestlet);
>
> Unfortunately this feels like I'm mixing the restlet style of API with the 
> jax-rs style of API.  I really would prefer to keep the code a bit cleaner 
> than that.  e.g. I have to manage the resources directly in the 
> myDefaultRestlet class rather than using the annotations like in my jax-rs 
> classes.
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1323594
>

-- 
Best regards,
 ~ Xasima Xirohata ~

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1326594

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1332166

Re: Re: how to set default route in jax-rs

2009-03-15 Thread Alexander J. Perez Tchernov
An simple solution might be to introduce JAX-RS resource that catch
"any url" addressing  with help of reg-exp.
something like
@Path(value = "/{resource:.*}")
public class CatchAll {
public CatchAll (@PathParam("resource") String resource ) {}
}


On Sun, Mar 15, 2009 at 12:34 AM, Ty  wrote:
> Hi,
> Thanks again for the god advice.  This seems to be the call you are referring 
> to:
>
> // create JAX-RS runtime environment
> final JaxRsApplication application = new 
> JaxRsApplication(comp.getContext().createChildContext());
>
> // set the Default restlet
> application.getJaxRsRestlet().attachDefault(myDefaultRestlet);
>
> Unfortunately this feels like I'm mixing the restlet style of API with the 
> jax-rs style of API.  I really would prefer to keep the code a bit cleaner 
> than that.  e.g. I have to manage the resources directly in the 
> myDefaultRestlet class rather than using the annotations like in my jax-rs 
> classes.
>
> --
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1323594
>



-- 
Best regards,
 ~ Xasima Xirohata ~

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1326594


RE: Re: how to set default route in jax-rs

2009-03-15 Thread Ty
Hi,
Thanks again for the god advice.  This seems to be the call you are referring 
to:

// create JAX-RS runtime environment
final JaxRsApplication application = new 
JaxRsApplication(comp.getContext().createChildContext());

// set the Default restlet
application.getJaxRsRestlet().attachDefault(myDefaultRestlet);

Unfortunately this feels like I'm mixing the restlet style of API with the 
jax-rs style of API.  I really would prefer to keep the code a bit cleaner than 
that.  e.g. I have to manage the resources directly in the myDefaultRestlet 
class rather than using the annotations like in my jax-rs classes.

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1323594


Re: how to set default route in jax-rs

2009-03-14 Thread Stephan Koops
hi Ty,

you could set a default Restlet in the JaxRsRouter (or in the 
JaxRsApplication)

best regards
   Stephan

Ty schrieb:
> Hi,
> Does anyone know how to set a default router (catch-all route) using jax-rs.  
> In standard restlet I'd do this:
>
>   final Router myRouter = new Router(getContext());
>   myRouter.attachDefault(CatchAll.class);
>
> Is there a way to get the same functionality using jax-rs?

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1322611