简体   繁体   English

Jetty,Maven插件-如何配置默认文档?

[英]Jetty, Maven plugin - how to configure default document?

We're using Jetty 6.x, and Maven-2. 我们正在使用Jetty 6.x和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 / ). 我的意思是-在访问应用程序根目录(浏览/ )时,有一个默认值/index.html或它的等效项。

And there should be a settings to control that. 并且应该有一个设置来控制它。 (there is in tomcat and in IIS for example...) (例如,tomcat和IIS中都有...)

So 1 - how do I tell it to Jetty? 所以1-我如何告诉码头?

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. 我知道Jetty家伙为几乎可以配置所有东西而感到自豪-必须有一种方法来做到这一点,这只是文档不佳的问题,这就是我的直觉告诉我的。

And 2 - how do I do that using Maven plugin ? 2-如何使用Maven插件做到这一点?

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. 如果您仅告诉我如何使用Jetty进行操作,这实际上是一个“奖励”问题-我希望最终也能找到使用Maven进行操作的方法。 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. 它与JettyMaven无关,尽管我确定Jetty可以提供其自己的替代程序配置或默认值或其他内容。

It was hard to find because they don't call it default document , but welcome-files . 很难找到,因为他们没有将其称为默认文档 ,而是welcome-files It's a part of the JSP Servlet deffinitions, and is working with the file: /META-INF/web.xml 它是JSP Servlet定义的一部分,并且正在使用以下文件: /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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM