Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Testing web.xml filters from IDE launch
Testing web.xml filters from IDE launch [message #1752886] Mon, 30 January 2017 06:06 Go to next message
Eclipse UserFriend
Hi all,
is there a way to test/debub the behavior of a filter in web.xml from the IDE launch, that is, without having to deploy the RAP war into a Servlet container?
Thank you very much
Vincenzo
Re: Testing web.xml filters from IDE launch [message #1752887 is a reply to message #1752886] Mon, 30 January 2017 06:10 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
In RAP Launch Configuration dialog you can specify to run RAP application from web.xml.
HTH,
Ivan
Re: Testing web.xml filters from IDE launch [message #1752908 is a reply to message #1752887] Mon, 30 January 2017 09:21 Go to previous messageGo to next message
Eclipse UserFriend
Thank you Ivan,
but I omitted to write that we are using the RAP Launcher.
We have RAP applications based on OSGi, with all the classic 3.x workbench, and we have always used the RAP Launcher up to now.

As far that I can see only the RWT Launcher provides a way to specify a web.xml.
Is it possible to use the RWT Launcher also in our scenario?
Thanks
Vincenzo
Re: Testing web.xml filters from IDE launch [message #1753040 is a reply to message #1752908] Wed, 01 February 2017 05:37 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
no... currently it's not possible.
Regards,
Ivan
Re: Testing web.xml filters from IDE launch [message #1753973 is a reply to message #1753040] Mon, 13 February 2017 09:26 Go to previous messageGo to next message
Eclipse UserFriend
Thank you Ivan,
but maybe I could do with an intermediate solution where you can help us.
Let me explain.
In a classic JSP page I can do this:

getServletContext().getInitParameter("PARAM1")

and I can retrieve the PARAM1 value defined in web.xml like this

  <context-param>
    <param-name>PARAM1</param-name>
    <param-value>TEST</param-value>
  </context-param>


Now, in a RAP (with workbench) application, let's say I dare to do this:

RWT.getRequest().getServletContext().getInitParameter("PARAM1");


where does it look for in order to resolve the value?
Could I put some file with a given name in some internal RAP runtime folder in such a way it can resolve an find the value?

Thank you very much
Vincenzo
Re: Testing web.xml filters from IDE launch [message #1754015 is a reply to message #1753973] Mon, 13 February 2017 14:31 Go to previous messageGo to next message
Eclipse UserFriend
It looks at the embedded Jetty instance

You might be able to create a bundle that looks for a service called javax.servlet.http.HttpServlet
From that object you can get a ServletContext and call setInitParameter

I don't know if that would be the correct context, but it's worth a shot. It would keep your dev code completely separate in it's own bundle.
Re: Testing web.xml filters from IDE launch [message #1754072 is a reply to message #1754015] Tue, 14 February 2017 06:51 Go to previous messageGo to next message
Eclipse UserFriend
Thank you Chris,
it seems a good idea.
However now when if I try to set a parameter:
httpServlet.getServletContext().setInitParameter(...)

I get this error
java.lang.IllegalStateException
	at org.eclipse.jetty.servlet.ServletContextHandler$Context.setInitParameter(ServletContextHandler.java:1132)

I also tried to do this in a JEE thread
	RWT.requestThreadExec(new Runnable() {
			@Override
			public void run() {
				httpServlet.getServletContext().setInitParameter("PARAM1", "AAA");
			}
		});

but the result it's the same.
Re: Testing web.xml filters from IDE launch [message #1754164 is a reply to message #1754072] Tue, 14 February 2017 16:45 Go to previous message
Eclipse UserFriend
Ok, so turns out jetty won't let init params be set unless it is in the starting state.
Previous Topic:Snippit wanted: Inline editing with Nebula GridViewer
Next Topic:Send event to server with ClientScripting?
Goto Forum:
  


Current Time: Thu Jul 10 10:42:26 EDT 2025

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

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

Back to the top