Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » accessing the HttpServlet or ServletContext
accessing the HttpServlet or ServletContext [message #81852] Mon, 07 April 2008 13:08 Go to next message
Eclipse UserFriend
Originally posted by: pfischer06.fast-mail.org

Hello all,

I need to access the HttpServlet or ServletContext of the running
BridgeServlet before the first request. That's why I can't use
org.eclipse.rwt.RWT.
Is there an easy way to get one of them in my own bundle?

regards
Peter
Re: accessing the HttpServlet or ServletContext [message #82047 is a reply to message #81852] Wed, 09 April 2008 11:57 Go to previous messageGo to next message
Stefan   is currently offline Stefan Friend
Messages: 316
Registered: July 2009
Senior Member
Hi Peter,
can you explain what you want to do? I'm not sure whether I understand
your question but you can use
RWT.getRequest().getSession().getServletContext() to get the servlet
context. However this only works if you are within a request.

Regards,
Stefan.


Peter Fischer schrieb:
> Hello all,
>
> I need to access the HttpServlet or ServletContext of the running
> BridgeServlet before the first request. That's why I can't use
> org.eclipse.rwt.RWT.
> Is there an easy way to get one of them in my own bundle?
>
> regards
> Peter
>
Re: accessing the HttpServlet or ServletContext [message #82149 is a reply to message #82047] Wed, 09 April 2008 17:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi Peter,

unfortunately I don't have an answer to your question right away. But as
the problem you're describing is nothing special to RAP, but belongs to
every servlet mapped to osgi's http-service, you may have a look at the
equinox mailinglist/newsgroup whether this question has already been
raised there.


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Stefan Röck [mailto:stefan.roeck@cas.de]
Bereitgestellt: Mittwoch, 9. April 2008 13:58
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: accessing the HttpServlet or ServletContext
Betreff: Re: accessing the HttpServlet or ServletContext


Hi Peter,
can you explain what you want to do? I'm not sure whether I understand
your question but you can use
RWT.getRequest().getSession().getServletContext() to get the servlet
context. However this only works if you are within a request.

Regards,
Stefan.


Peter Fischer schrieb:
> Hello all,
>
> I need to access the HttpServlet or ServletContext of the running
> BridgeServlet before the first request. That's why I can't use
> org.eclipse.rwt.RWT.
> Is there an easy way to get one of them in my own bundle?
>
> regards
> Peter
>
Re: accessing the HttpServlet or ServletContext [message #82992 is a reply to message #82047] Tue, 15 April 2008 11:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: pfischer06.fast-mail.org

Hello Stefan,

we use rap as frontend of a non osgied system. Beside rap with the
servletbridge, we start a spring context inside the same webapp. Now we
would like to provide this spring-context, which is contained in the
ServletContext, to our rap-ui-bundles inside the osgi-runtime. This has to
be done bevore the first request, maybe in a bundle activator.

regards,
Peter
Re: accessing the HttpServlet or ServletContext [message #83021 is a reply to message #82992] Tue, 15 April 2008 12:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

the bundle Activator seems to be a reasonable choice. If your spring
context is loaded using the webapp classloader you can configure the
web.xml to make the necessary classes available within the RAP app. See
'extendedFrameworkExports' in the org.eclipse.rap.demo.feature's web.xml
for more information. Note that you must use package import instead of
bundle-dependencies to provide the according types at development time.


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Peter Fischer [mailto:pfischer06@fast-mail.org]
Bereitgestellt: Dienstag, 15. April 2008 13:30
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: accessing the HttpServlet or ServletContext
Betreff: Re: accessing the HttpServlet or ServletContext


Hello Stefan,

we use rap as frontend of a non osgied system. Beside rap with the
servletbridge, we start a spring context inside the same webapp. Now we
would like to provide this spring-context, which is contained in the
ServletContext, to our rap-ui-bundles inside the osgi-runtime. This has
to be done bevore the first request, maybe in a bundle activator.

regards,
Peter
Re: accessing the HttpServlet or ServletContext [message #83118 is a reply to message #83021] Tue, 15 April 2008 17:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: pfischer06.fast-mail.org

Hello Frank,

Frank Appel wrote:
> the bundle Activator seems to be a reasonable choice. If your spring
> context is loaded using the webapp classloader you can configure the
> web.xml to make the necessary classes available within the RAP app. See
> 'extendedFrameworkExports' in the org.eclipse.rap.demo.feature's web.xml
> for more information. Note that you must use package import instead of
> bundle-dependencies to provide the according types at development time.

This way we can use the classes deployed outside the osgi. That's it how
we use it now with the sping context as static member of one imported
class.

This works fine, but how about non static access to the spring-context. I
thougt it would be a better way to get the instance contained in the
ServletContext direct?

regards,
Peter
Re: accessing the HttpServlet or ServletContext [message #83202 is a reply to message #83118] Wed, 16 April 2008 04:08 Go to previous message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi Peter,

I'm not sure if I really understand, but you can access the OSGi
provided HttpContext using:

ServiceReference reference ...
String name = HttpContextExtensionService.class.getName();
ServiceReference serviceRef = context.getServiceReference( name );
HttpContextExtensionService service
= ( HttpContextExtensionService )context.getService( serviceRef );
HttpContext rapContext
= service.getHttpContext( reference, "org.eclipse.rap.httpcontext" );

Unfortunately I don't know a way to get to the ServletContext object
this maps to. As this belongs to the equinox stuff, maybe there is more
information available in the equinox newsgroup/mailinglist.


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Peter Fischer [mailto:pfischer06@fast-mail.org]
Bereitgestellt: Dienstag, 15. April 2008 19:31
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: accessing the HttpServlet or ServletContext
Betreff: Re: accessing the HttpServlet or ServletContext


Hello Frank,

Frank Appel wrote:
> the bundle Activator seems to be a reasonable choice. If your spring
> context is loaded using the webapp classloader you can configure the
> web.xml to make the necessary classes available within the RAP app.
> See 'extendedFrameworkExports' in the org.eclipse.rap.demo.feature's
> web.xml for more information. Note that you must use package import
> instead of bundle-dependencies to provide the according types at
development time.

This way we can use the classes deployed outside the osgi. That's it how
we use it now with the sping context as static member of one imported
class.

This works fine, but how about non static access to the spring-context.
I thougt it would be a better way to get the instance contained in the
ServletContext direct?

regards,
Peter
Previous Topic:call for help . setShowStatusLine seems not working outside the preWindowOpen
Next Topic:[ANN] RAP 1.1 M3 released
Goto Forum:
  


Current Time: Thu Mar 28 13:28:25 GMT 2024

Powered by FUDForum. Page generated in 0.08147 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top