首页 文章

Wicket REST功能适用于Jetty,但不适用于Tomcat

提问于
浏览
0

我创建了一个最近使用wicket REST functionality升级的Wicket应用程序 . 在开发它并通过Jetty运行时,我能够正确地将消息发布到REST服务 . 但是,当它部署到tomcat时,转到REST URL会产生404错误和'requested resource is not available'响应 .

Pom条目:wicketstuff-annotation,wicketstuff-restannotations,wicketstuff-restannotations-json(所有jar / compile,版本与wicket版本6.24.0相同)

其余类中的代码

public class Webhook extends AbstractRestResource<JsonWebSerialDeserial> {
    @MethodMapping(value="/notification", httpMethod=HttpMethod.POST, consumes= RestMimeTypes.APPLICATION_JSON, produces = RestMimeTypes.TEXT_PLAIN)
    public String notification( @RequestBody Notification data ) {

        // do some things

      return "received successfully";
    }

    @Override
    public String getMountPath() {
      return "/emailcampaign/webhook";
    }
}

REST类在WicketApplication中初始化:

public void init() {

  final Webhook hook = new Webhook();
  mountResource( hook.getMountPath(), new ResourceReference( hook.getClass().getSimpleName() ) {
     private static final long serialVersionUID = 1L;

     public IResource getResource() {
       return hook;
     }
   });   
}

tomcat localhost_access_logs有这个:

`XX.XX.XX.XX - - [01 / Feb / 2018:06:46:10 0000]“POST / emailcampaign / webhook / notification HTTP / 1.1”404 1041

系统正常启动,所以我似乎没有在部署时遗漏任何jar文件,所以我不知所措 . 有人可以帮忙吗?

Tomcat 7.0.67,Jetty 7.6.3,Wicket 6.24,Spring 4.1.4

编辑:这是web.xml的内容:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5">

    <display-name>system-ui</display-name>

    <context-param>
        <param-name>configuration</param-name>
        <param-value>deployment</param-value>
    </context-param>

    <filter>
        <filter-name>wicket.system-ui</filter-name>
        <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
        <init-param>
            <param-name>applicationClassName</param-name>
            <param-value>com.sw.system.ui.WicketApplication</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>wicket.system-ui</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

1 回答

相关问题