Re: Resource factories

2009-03-26 Thread Tal Liron




Thanks
to all who replied on this. After a discussion on the code list, it
became clear that the Restlety solution to configuring resources is to
use the Context. The Context has a ConcurrentMap of attributes,
described as so:

"This is a convenient mean[s] to provide common objects to all
the
Restlets and Resources composing an Application."



So,
that's it! The nice thing about contexts, too, is that they pass
through restlets along the way. So, even if you configure your
Application context in a certain way, you can apply filters or whatnot
along the way to adapt the configuration. For example, a
DebuggingFilter might enable all the configuration aspects that have to
do with debugging. It's then easy to add/remove such a filter, even
on-the-fly, without reconfiguring the whole application.




-Tal








RE: Restlet Jax-RS extension and OSGi

2009-03-26 Thread Jerome Louvel
Hi David,

As mentioned in the code list, I've added your first long term workaround.
I agree that the second one would be even better, so I've entered a RFE:

Improve setting of JAX-RS API implementation
http://restlet.tigris.org/issues/show_bug.cgi?id=767

Regarding the JAX-RS implementation, we definitely want to maintain it,
complete it and upgrade to JAX-RS 1.1 when it is released. It's a strategic
piece for the project, so no question about that.

Stephan has lacked time in the past months due to a new job and moving into
a new place. On my side, I've started to get more involved in the code of
the extension but I've got so many other things to do that I would warmly
welcome any help until Stephan can jump on this again. 

So, YES, your contributions would be welcome! :)
 
Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com
 

-Message d'origine-
De : David Fogel [mailto:carrotsa...@gmail.com] 
Envoyé : lundi 23 mars 2009 17:01
À : discuss@restlet.tigris.org
Objet : Re: Restlet Jax-RS extension and OSGi

Hi Stephan-

Thanks for taking a look at this.

Yes, I did see that it would be possible to get the Providers object
injected into my resource classes.  However I don't think that is the
recommended way to accomplish this with Jax-Rs.  (from what I remember, I
think the Providers object is often meant to be injected into other Provider
classes that need to make use of pre-existing Providers, but I'm not sure.)

Is there any plan or timeframe for continuing development of the Restlet
JAX-RS implementation?  Would it make sense for me to put some time
contributing some patches to this implementation?

Thanks again,

  - Dave Fogel

On Mon, Mar 23, 2009 at 4:37 AM, Stephan Koops stephan.ko...@web.de wrote:
 Hi David,

 I've had no time to look into my own code or work with it, so I 
 forget, that the injection was changed.
 Use a field (or parameter) of type javax.ws.rs.ext.Providers, annotate 
 it with @Context and use method getContextResolver(...) .

 I hope, that's the right solution. As said, I've long time no time to 
 keep me busy with Restlet and JAX-RS. Sorry for the wrong information
first.

 best regards
   Stephan

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

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


RE: Resource factories

2009-03-26 Thread Jerome Louvel
Hi all,
 
I've just found time to read this thread and enjoyed it very much. It's hard
to find the best balance between so much points of views and ways to deal
with instantiations, wiring of objects, etc. so it's nice to hear that the
current design has more advantages than drawbacks.
 
As Tal mentioned, we are redesigning the Resource API to support client-side
resources and focused use of annotations. I didn't intend to change the way
resources are instantiated though. But, if we can adjust the new design to
accommodate more use cases, I would be interested to explore. 
 
Currently, we are working on Restlet 1.2 M2 which will give you a chance to
play with the new resource API and provide feed-back.
 
Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~  http://www.restlet.org/
http://www.restlet.org
Noelios Technologies ~ Co-founder ~  http://www.noelios.com/
http://www.noelios.com
 

  _  

De : Tal Liron [mailto:tal.li...@threecrickets.com] 
Envoyé : jeudi 26 mars 2009 08:49
À : discuss@restlet.tigris.org
Objet : Re: Resource factories



Thanks to all who replied on this. After a discussion on the code list, it
became clear that the Restlety solution to configuring resources is to use
the Context. The Context has a ConcurrentMap of attributes, described as so:

This is a convenient mean[s] to provide common objects to all the Restlets
and Resources composing an Application.





So, that's it! The nice thing about contexts, too, is that they pass through
restlets along the way. So, even if you configure your Application context
in a certain way, you can apply filters or whatnot along the way to adapt
the configuration. For example, a DebuggingFilter might enable all the
configuration aspects that have to do with debugging. It's then easy to
add/remove such a filter, even on-the-fly, without reconfiguring the whole
application.




-Tal

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

RE: Re: EJB and restlet

2009-03-26 Thread Jerome Louvel
Hi Runar,

Glasfish is a JEE server which contains both a Servlet Web Container and an
EJB Container. See this page for details:
http://java.sun.com/javaee/5/docs/tutorial/doc/bnaay.html#bnabh

It's been a while since I coded EJBs, but it seems that you should be able
to lookup your EJBs using JNDI from your Restlets/Resources. Again more
details here:
http://java.sun.com/javaee/5/docs/tutorial/doc/bnbnp.html
 
Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-Message d'origine-
De : Runar Halse Kristiansen [mailto:runa...@gmail.com] 
Envoyé : mercredi 25 mars 2009 07:22
À : discuss@restlet.tigris.org
Objet : RE: Re: EJB and restlet

Thanks for your input. 

I'm running the restlet on Glassfish. My web-xml is configured to run in a
servlet container with a servlet of the class
com.noelios.restlet.ext.servlet.ServerServlet.
This is how the firststeps example on restlet.org page describes it. 
So this means that the restlet is running in a ejb container since Glassfish
is one, right?
If the ejb injection is not supposed to work, how can I get it to work in
the setting I schetched above?

Thanks:)

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

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


firstResource example problem

2009-03-26 Thread hudarsono
Dear all,

I just starting to learn restlet, and found this problem. I'm following 
firstResource tutorial with eclipse and glassfish integrated to eclipse.
After write all the code,and importing :
- org.restlet.jar
- com.noelios.restlet.jar
- com.noelios.restlet.ext.servlet_2.5.jar

and run the servlet, I got the following error :

javax.servlet.ServletException: PWC1397: Wrapper cannot find servlet class 
com.noelios.restlet.ext.servlet.ServerServlet or a class it depends on
root cause

java.lang.ClassNotFoundException: com.noelios.restlet.ext.servlet.ServerServlet
note The full stack traces of the exception and its root causes are available 
in the Sun GlassFish Enterprise Server v2.1 logs.

But when I was deploying .war example downloaded from the site, it was deployed 
successfully. Does anybody know what cause this problem?

THanks
-- 
View this message in context: 
http://n2.nabble.com/firstResource-example-problem-tp2538870p2538870.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: web.xml and JAX-RS

2009-03-26 Thread Alexander J. Perez Tchernov
Sorry, I'm completely wrong. I just have used old versions or
inconsistent set of libraries. JaxRsApplication doesn't cast to
Application as for now. So I just create a wrapper class
JaxRsApplicationBridge extends Application aroung jaxrsapplication
object. This wrapperoverrides some Application methods and delegates
invokes to jaxrs object.

Thus my CustomServletServlet looks like
@Override
protected org.restlet.Application createApplication(Context context) {

final JaxRsApplication jaxrsApplication = new 
JaxRsApplication(context
.createChildContext());

// attach ApplicationConfig
jaxrsApplication.add(new NotificationRestApplication());

return new JaxRsAppliactionBridge(jaxrApplication);
}

The rest of code and web.xml remains the same..




On Wed, Mar 25, 2009 at 8:13 PM, Xasima Xirohata xas...@gmail.com wrote:
 What is the right web.xml to use to deploy JAX-RS restlet-based
 service in JEE-container ?

 I just hook this by placing custom servlet in web.xml as follow

 !-- Restlet adapter --
    servlet
            servlet-nameServerServlet/servlet-name
            servlet-classcom.my.CustomServletServlet/servlet-class
    /servlet

    !-- Catch all requests --
    servlet-mapping
            servlet-nameServerServlet/servlet-name
            url-pattern/*/url-pattern
    /servlet-mapping

 And specifying

 import org.restlet.Application;
 import org.restlet.Context;
 import org.restlet.ext.jaxrs.JaxRsApplication;

 public class CustomServletServlet extends ServerServlet {
    public Application createApplication(Context context) {
        final JaxRsApplication application = new
 JaxRsApplication(context.createChildContext());

        // attach ApplicationConfig
        application.add(new ActualRestApplication());
        return application;
        }
 }

 where

 import javax.ws.rs.core.Application;
 public class ActualRestApplication extends  Application{
 �...@override
  public SetClass? getClasses() {
    final SetClass? rrcs = new HashSetClass?();
    rrcs.add(ActualJAXRSResource.class);
    return rrcs;
  }

 }


 But I suspect that it's not the proper way to deploy. Any hints or examples?

 --
 Best regards,
     ~ Xasima Xirohata ~




-- 
Best regards,
 ~ Xasima Xirohata ~

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