I've started to use embedded Jetty Server to start some 3rd-party WAR. So I use WebAppContext:
Server server = new Server(port);
WebAppContext ctx = new WebAppContext();
ctx.setContextPath("/samplePath");
ctx.setWar(<PATH_TO_WAR>);
server.setHandler(ctx);
server.start();
server.join();
This code works (I've omitted exception handling for the sake of brevity here), however now I would like to add some functionality to the war which I want to leave intact (I mean, don't extract change and compress again). My functionality should include an integration with some custom SSO solution which should add the following:
- A Context Listener
- A Filter
- Some Context Param Variables definitions that should be read by these Filter and listener
I can't change this SSO solution because its not developed by our team, we rather take it as a thirdparty.
So I thought that adding all this to module with web-fragment would be the best approach.
My question is: what is the best way to make Jetty's web context to be 'aware' of this web fragment? A working code snippet would be great :)
Of course if there is a better alternative than web fragments for this, I'll be glad to know
The version of Jetty I currently use is (from my pom.xml): 9.2.10.v20150310
Thanks a lot in advance!
Here is the way you can specify a web app as well as a filter