开发者

Jetty, Maven plugin - how to configure default document?

开发者 https://www.devze.com 2023-02-22 21:07 出处:网络
We\'re using Jetty 6.x, and Maven-2. Anybody knows how 开发者_JAVA技巧to configure the default document?

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

Anybody knows how 开发者_JAVA技巧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 :)


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号