Atmopshere中的@PathParam为null

时间:2016-06-12 17:01:19

标签: javascript java spring atmosphere atmosphere.js

我正试图通过气氛实现多房间聊天。为此我创建了一个带有path =“apis / chat / {email}”的ManagedService。在代码中,我尝试设置路径参数,如

@PathParam("email")
private String email;

我的问题是,即使请求URI在URI中具有电子邮件值,电子邮件的值也始终为NULL。

我的Java课程AtmosphereChat

@ManagedService(path = "apis/chat/{email}", atmosphereConfig = MAX_INACTIVE    + "=120000")
public class AtmosphereChat {

  private final Logger logger = LoggerFactory.getLogger(AtmosphereChat.class);

  @Autowired
  private AtmosphereUUID uuid;

  @PathParam("email")
  private String email;
}

Web.xml

<!-- Chat Servlet using Atmosphere -->
<servlet>
    <description>ChatServlet</description>
    <servlet-name>ChatServlet</servlet-name>
    <servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
    <init-param>
        <param-name>org.atmosphere.cpr.packages</param-name>
        <param-value>com.supporton.blackcarbon.web.chat</param-value>
    </init-param>
    <init-param> 
            <param-name>org.atmosphere.cpr.objectFactory</param-name> 
            <param-value>org.atmosphere.spring.SpringWebObjectFactory</param-value> 
    </init-param>  
    <init-param>
        <param-name>org.atmosphere.websocket.messageContentType</param-name>
        <param-value>application/json</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.interceptor.HeartbeatInterceptor.clientHeartbeatFrequencyInSeconds</param-name>
        <param-value>10</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.cpr.broadcaster.shareableThreadPool</param-name>
        <param-value>true</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.cpr.broadcaster.maxProcessingThreads</param-name>
        <param-value>10</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.cpr.broadcaster.maxAsyncWriteThreads</param-name>
        <param-value>10</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.cpr.broadcasterLifeCyclePolicy</param-name>
        <param-value>EMPTY</param-value>
    </init-param>

    <load-on-startup>0</load-on-startup>
    <async-supported>true</async-supported>
</servlet>
<servlet-mapping>
    <servlet-name>ChatServlet</servlet-name>
    <url-pattern>/*</url-pattern><!-- Broadcast default will lookup this -->
</servlet-mapping>

我使用的是Spring 4.2.6和Atmoshpere 2.4.2。可能是我做错了什么?任何帮助将非常感谢!

0 个答案:

没有答案