org.eclipse.jetty 静态资源锁定的设置

<plugin>

<groupId>org.eclipse.jetty</groupId>

<artifactId>jetty-maven-plugin</artifactId>

<version>${plugin.jetty.version}</version>

<configuration>

<scanIntervalSeconds>1</scanIntervalSeconds>

</configuration>

</plugin>

但在修改js与css时资源被锁定,必须先停止jetty才能修改保存。网上大部分是关于mortbay的设置,其实用eclipse的jetty设置很简单,只要web.xml中加入这句就可以了:

<!--这些资源访问不进会任何框架start-->

<servlet-mapping>

<servlet-name>default</servlet-name>

<url-pattern>*.jpg</url-pattern>

</servlet-mapping>

<servlet-mapping>

<servlet-name>default</servlet-name>

<url-pattern>*.js</url-pattern>

</servlet-mapping>

<servlet-mapping>

<servlet-name>default</servlet-name>

<url-pattern>*.css</url-pattern>

</servlet-mapping>

<servlet-mapping>

<servlet-name>default</servlet-name>

<url-pattern>*.png</url-pattern>

</servlet-mapping>

<servlet-mapping>

<servlet-name>default</servlet-name>

<url-pattern>*.gif</url-pattern>

</servlet-mapping>

<!--这些资源访问不进会任何框架end-->

<servlet>

<servlet-name>default</servlet-name>

<servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>

<init-param>

<param-name>useFileMappedBuffer</param-name>

<param-value>false</param-value>

</init-param>

</servlet>

相关推荐