(zz)jetty 运行时怎么修改css html等文件

html-css07

(zz)jetty 运行时怎么修改css html等文件,第1张

在Windows下面,使用内存映射文件会导致文件被锁定。解决方案是不使用内存映射文件来做缓存。步骤如下:

1)在所使用Jetty版本的jar中找到webdefault.xml,把它拷贝到项目中,比如src/main/resources/webdefault.xml。

对jetty6,jar文件在$maven_repo$/org/mortbay/jetty/jetty/6.x/jetty-6.x.jar,webdefault.xml文件在包org\mortbay\jetty\webapp里;

对jetty7,jar文件在$maven_repo$/org/eclipse/jetty/jetty-webapp/7.x/jetty-webapp-7.x.jar\,webdefault.xml文件在包org\eclipse\jetty\webapp里。

2)找到webdefault.xml文件里的useFileMappedBuffer参数,把值设成false。

3)在pom.xml中,设置jetty使用更新过的webdefault.xml文件。

jetty6:<groupIdorg.mortbay.jetty</groupId

<artifactIdmaven-jetty-plugin</artifactId

<version6.x</version

<configuration

<webDefaultXmlsrc/main/resources/webdefault.xml</webDefaultXml

</configurationjetty7:<groupIdorg.mortbay.jetty</groupId

<artifactIdjetty-maven-plugin</artifactId

<version7.x</version

<configuration

<webAppConfig

<defaultsDescriptorsrc/main/resources/webdefault.xml</defaultsDescriptor

</webAppConfig

</configuration

这样在运行时就可以修改js、css等文件了。

<link rel="stylesheet" type="text/css" href="ext/css/ext-all.css">改写成

<link rel="stylesheet" type="text/css" href="/ext/css/ext-all.css">试一下,如果还不行,你把静态资源的完整请求路径帖出来,我看看是什么问题。查看请求路径可以参见下面的方法:谷歌浏览器,按F12,切换“网络(Network)”标签,就可以查看了。参见图片。

1.首先在Remote Java Application 勾选上Allow termination of remote VM选项

2.选择Debug视图就可以关闭启动中的jetty