Wildfly 15和resteasy 3.x中的此URL不支持HTTP方法POST。

时间:2019-04-08 00:43:40

标签: java post wildfly resteasy

在提交index.html页面时,此URL不支持HTTP方法POST。这在Widlfly 15中,该应用程序使用resteasy 3.6。

我的应用程序在Wildfly 15上运行,其网址为:http://localhost:8080/joblist/index.html 提交此页面时,错误是:此URL不支持HTTP方法POST。 我的期望是,在提交index.html页面(URL:http://localhost:8080/joblist/index.html)时,将执行JobsList.createJob()方法。我在JobsList.createJob()中添加了记录程序语句,但它们未显示在服务器日志中-似乎表明该应用程序无法识别POST方法。 对于我所缺少的任何建议,我们将不胜感激。

web.xml是:

<listener>
    <display-name>JobManager</display-name>
    <listener-class>com.job.JobManager</listener-class>
</listener>

<servlet-mapping>
    <servlet-name>javax.ws.rs.core.Application</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

执行GET和POST方法的相关类为:


@Path("/lists")
public class JobsList {

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response statusList() throws Exception {

        return Response.ok(result).build();
    }


    @POST
    @Path("/")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    @Produces(MediaType.TEXT_HTML)
    public StreamingOutput createJob(MultipartFormDataInput multiPart) {

    }
}
```
I also have a jboss-web.xml where the context is defined:
<jboss-web>
    <context-root>/joblist</context-root>

The index.html is:
```
<form id="newJob" action="./lists" method="post" enctype="multipart/form-data" target="_blank">

<button>Submit</button>  
</form>
````


This is in Wildfly 15 and the app uses rest easy 3.5. 
Any suggestions to fix this is appreciated.

0 个答案:

没有答案