Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 11:06 Go to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 190
Registered: January 2012
Senior Member
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 11:10 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2262
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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 14:21 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 190
Registered: January 2012
Senior Member
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 10:37 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2262
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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 14:26 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 190
Registered: January 2012
Senior Member
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 19:31 Go to previous messageGo to next message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 192
Registered: February 2011
Senior Member
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 11:51 Go to previous messageGo to next message
Vincenzo Caselli is currently offline Vincenzo CaselliFriend
Messages: 190
Registered: January 2012
Senior Member
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 21:45 Go to previous message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 192
Registered: February 2011
Senior Member
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: Sun Feb 18 08:46:10 GMT 2018

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

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