Jetty, Maven plugin - how to configure default document?

1.1k views Asked by At

We're using Jetty 6.x, and Maven-2.

Anybody knows how to configure the default document?

I mean - there's a default that serves /index.html or any of it's equivalents when accessing the application root (browse to /).

And there should be a settings to control that. (there is in tomcat and in IIS for example...)

So 1 - how do I tell it to Jetty?

I know the Jetty guys are proud in letting almost everything to be configured - there has to be a way to do that, it's just a problem of a poor documentation, that's what my instinct tells me.

And 2 - how do I do that using Maven plugin ?

This is actually a "bonus" question, if you only tell me how to do it with Jetty - I hope'll find eventually how to do it with Maven too. But in case anybody knows - it will be a great help :)

1

There are 1 answers

0
Radagast the Brown On BEST ANSWER

Ok, I found it. It has nothing to do with Jetty or Maven, although I'm sure that Jetty can provide it's own overrider configuration or defaults or something.

It was hard to find because they don't call it default document, but welcome-files. It's a part of the JSP Servlet deffinitions, and is working with the file: /META-INF/web.xml

And here's what needs to be inside

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">


<welcome-file-list>
    <welcome-file>customDefaultDocument.html</welcome-file> 
</welcome-file-list>


</web-app>