|Re: [jetty-users] Another newbie-9.x-user question|
On 01/02/2017 12:52, Simone Bordet wrote:
If not, because you always use specific virtual hosts for your webapps, then you can have a super-simple webapp deployed at "/" with no virtual hosts whose only page displays a 404 message.
Thanks Simone,This seems to solve my problem. I set up a second webapp with a single servlet-mapping for "/*", and deployed it using the following XML:
<Configure class="org.eclipse.jetty.webapp.WebAppContext"> <Set name="contextPath">/</Set> <Set name="war"><Property name="jetty.webapps" default="."/>/404app</Set> </Configure>This does exactly the trick, but it feels a bit fragile to my paranoid mind -- since I now have two webapps mapped to "/", one with a virtual host list and one without, what guarantees that the one with the host list gets invoked when a valid hostname is given, and prevents the other one swallowing all the requests whether the host name is valid or not? In other words, what defines the search order for a matching webapp?
Since it works I should probably just trust it, but I'm a bit wary of deploying things I don't fully understand in case it suddenly breaks later... so if you can just explain this last point to me I will finally be able to sleep easy... :)
But thanks for the solution! -- John English
Back to the top