如何注释我的方法以绕过“此 URL 不支持 HTTP 方法 POST”?

问题描述

我的 Web 应用程序中有一系列有效的 REST GET 方法,并且正在尝试添加 POST 方法。当我使用

调用时,我收到“此 URL 不支持 HTTP 方法 POST”
http://localhost:8080/RestJbpm/startProcessWithPeople

我意识到有很多关于此错误消息的帖子,但我很难将其应用于我的情况。这是来自我的 web.xml

<web-app>
  <display-name>Archetype Created Web Application</display-name>
  <context-param>
       <param-name>resteasy.wider.request.matching</param-name>
       <param-value>true</param-value>
    </context-param>
</web-app>

我的 RestEasy 依赖项是

        <dependency>
                <groupId>org.jboss.resteasy</groupId>
                <artifactId>resteasy-jaxrs</artifactId>
                <version>2.3.1.GA</version>
                <scope>provided</scope>
        </dependency>
    
        <dependency>
                <groupId>org.jboss.resteasy</groupId>
                <artifactId>resteasy-jaxb-provider</artifactId>
                <version>2.3.1.GA</version>
                <scope>provided</scope>
        </dependency>
        <dependency>
                <groupId>org.jboss.resteasy</groupId>
                <artifactId>jaxrs-api</artifactId>
                <version>3.0.12.Final</version>
                <scope>provided</scope>
        </dependency>
        <dependency>
                <groupId>org.jboss.resteasy</groupId>
                <artifactId>resteasy-servlet-initializer</artifactId>
                <version>3.0.19.Final</version>
                <scope>provided</scope>
                <exclusions>
                    <exclusion>
                        <artifactId>resteasy-jaxrs</artifactId>
                        <groupId>org.jboss.resteasy</groupId>
                    </exclusion>
                </exclusions>
        </dependency>

还有我的方法

    @SuppressWarnings("unchecked")
    @POST
    @Path("/startProcessWithPeople") 
    @Consumes(MediaType.APPLICATION_JSON)
    public Response startAndAssignPeople(MyRequestClass request)

如何更改我的 web.xml、注释我的方法或更改我的 POST 请求以获取接受 MyRequestClass 实例作为 POST 操作的方法?我认为这不是依赖性问题,但以前是错误的。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)