Hi there,
I've just tried the following code with the latest from SVN trunk:
package test;
import javax.servlet.ServletContext;
import org.restlet.Application;
import org.restlet.Request;
import org.restlet.Response;
import org.restlet.data.MediaType;
public class MyApplication1 extends Application {
@Override
public void handle(Request request, Response response) {
ServletContext sc = (ServletContext)
getContext().getAttributes().get(
"org.restlet.ext.servlet.ServletContext");
response.setEntity("hello1: " + sc.getServerInfo(),
MediaType.TEXT_PLAIN);
}
}
And it displayed the following in my browser:
hello1: Apache Tomcat/6.0.18
I guess, you might be using an older version of Restlet without the fix.
Could you try again with a recent snapshot?
Note that while fixing a life cycle issue on 10/28, I broke ServerServlet.
This has just been fixed in SVN trunk today, but this wasn't related to
ServletContext however.
Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~
http://www.restlet.orgNoelios Technologies ~ Co-founder ~
http://www.noelios.com-----Message d'origine-----
De :
[hidden email] [mailto:
[hidden email]]
Envoyé : vendredi 16 octobre 2009 15:06
À :
[hidden email]
Objet : RE: spring context - webapplication context in restlet 2
No, it doesn't work.
I have some spring beans I exported to the servlet context. In my debugger,
I can see that the context.parentContext.attributes does contain my exported
beans but I can't get to them through the api.
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2408215
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2413654