I have a Struts2 web application running on Tomcat 7.0.43 that uses Rest and Convention plugins to match all requests. Struts tries to match all queries on its own.
JSR 356 defines server endpoints using annotations such as
@ServerEndpoint(value = "/websocket/chat")
Now when broswer tries to connect to ws:/127.0.0.1:8080/websocket/chat, the request fails because the Struts handler intercepts the request.
Is there anything I can specify in the XML files so that the request reaches the right place?
EDIT:
As suggested, I added
<constant name="struts.action.excludePattern" value="/websocket.*?" />
into my Struts configuration, after which the URL / websocket / chat started to make a 404 error.
, ServerApplicationConfig. websocket , :
SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
:
public class Socket implements ServerApplicationConfig {
@Override
public Set<ServerEndpointConfig> getEndpointConfigs(Set<Class<? extends Endpoint>> scanned) {
Set<ServerEndpointConfig> result = new HashSet<ServerEndpointConfig>();
return result;
}
@Override
public Set<Class<?>> getAnnotatedEndpointClasses(Set<Class<?>> scanned) {
Set<Class<?>> results = new HashSet<Class<?>>();
for (Class<?> clazz : scanned) {
results.add(clazz);
}
return results;
}
}
?
. Struts Spring Spring .