jetty-maven-plugin web工程中,运行编码报编码错,我用的GBK,tomcat中可以
我在eclipse中使用jetty-maven-plugin,但是报了
HTTP ERROR 500
Problem accessing /nav/submit.html. Reason:
!utf8
Caused by:
java.lang.IllegalArgumentException: !utf8
at org.eclipse.jetty.util.Utf8StringBuilder.append(Utf8StringBuilder.java:119)
at org.eclipse.jetty.util.UrlEncoded.decodeUtf8To(UrlEncoded.java:462)
at org.eclipse.jetty.util.UrlEncoded.decodeTo(UrlEncoded.java:509)
at org.eclipse.jetty.server.Request.extractParameters(Request.java:255)
at org.eclipse.jetty.server.Request.getParameterNames(Request.java:672)
at org.springframework.web.util.WebUtils.getParametersStartingWith(WebUtils.java:605)
at org.springframework.web.bind.ServletRequestParameterPropertyValues.<init>(ServletRequestParameterPropertyValues.java:76)
at org.springframework.web.bind.ServletRequestParameterPropertyValues.<init>(ServletRequestParameterPropertyValues.java:51)
at org.springframework.web.bind.ServletRequestDataBinder.bind(ServletRequestDataBinder.java:105)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.doBind(AnnotationMethodHandlerAdapter.java:566)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:213)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:132)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:326)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:313)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
我配置的plugin:<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.1.6.v20100715</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppConfig>
<contextPath>/nav</contextPath>
</webAppConfig>
<systemProperties>
<systemProperty>
<name>org.eclipse.jetty.util.URI.charset</name>
<value>GBK</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
这样配置无效,工程用的GBK,请问怎样设置jetty启动运行时为GBK呢
java.lang.IllegalArgumentException: !utf8
at org.eclipse.jetty.util.Utf8StringBuilder.append(Utf8StringBuilder.java:119)
at org.eclipse.jetty.util.UrlEncoded.decodeUtf8To(UrlEncoded.java:462)
第三句说jetty-maven-plugin的饥兄UrlEncoded属烂蔽袭性配置错误,没有叫utf8这种编码的,应该是 utf-8 吧,看一下jetty-maven-plugin配置文件里UrlEncoded这个属性的并启配置,改成utf-8或者gbk试试
改成UTF-8