Hi Achim I use war bundle. I have a simple web.xml which contains only <filter>,<filter-mapping>,<servlet>,<servlet-mapping>,<error-page>,<mime-mapping> settings. There is no a word about websocket. Besides, when I don't require configurator websockets work. The problem appeared when I wanted in endpoint additionally to get http session.
Best regards четверг, 29 сентября 2016 г., 22:00:28 UTC+3 пользователь Achim Nierbeck написал: > > Hi, > > can you give us a bit more details? > Did you use it with a WAB or are you trying to use the Whiteboard Extender > approach? > In case of the WAB, how is your configuration in the web.xml? > > regards, Achim > > > 2016-09-29 6:27 GMT+02:00 iJava <[email protected] <javascript:>>: > >> Hi all >> I use osgi, jetty 9.3.11 and pax-web 6.0.0. >> >> I try to get http session in Endpoint. I followed this recomendations >> http://stackoverflow.com/a/17994303 . Thats why I did: >> >> public class MyConfigurator extends ServerEndpointConfig.Configurator{ >> @Override >> public void modifyHandshake(ServerEndpointConfig config, >> HandshakeRequest request, >> HandshakeResponse response) >> { >> HttpSession httpSession = (HttpSession)request.getHttpSession(); >> >> config.getUserProperties().put(HttpSession.class.getName(),httpSession); >> }} >> >> and >> >> @ServerEndpoint(value = "/foo", configurator = MyConfigurator.class)public >> class MyEndpoint { >> private Session wsSession; >> private HttpSession httpSession; >> @OnOpen >> public void open(final Session session,EndpointConfig config) { >> this.wsSession=session; >> this.httpSession = (HttpSession) >> config.getUserProperties().get(HttpSession.class.getName()); >> }} >> >> However I got runtime exception (see below). Could anyone say - It is the >> problem in pax-web and if yes, how to solve it? >> >> >> >> java.lang.RuntimeException: Cannot load platform configurator >> at >> javax.websocket.server.ServerEndpointConfig$Configurator.fetchContainerDefaultConfigurator(ServerEndpointConfig.java:123) >> at >> javax.websocket.server.ServerEndpointConfig$Configurator.getContainerDefaultConfigurator(ServerEndpointConfig.java:128) >> at >> javax.websocket.server.ServerEndpointConfig$Configurator.checkOrigin(ServerEndpointConfig.java:192) >> at >> org.eclipse.jetty.websocket.jsr356.server.JsrCreator.createWebSocket(JsrCreator.java:88) >> at >> org.eclipse.jetty.websocket.server.WebSocketServerFactory.acceptWebSocket(WebSocketServerFactory.java:187) >> at >> org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:207) >> at >> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676) >> at >> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581) >> at >> org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:70) >> at >> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) >> at >> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) >> at >> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) >> at >> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) >> at >> org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:276) >> at >> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511) >> at >> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) >> at >> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) >> at >> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) >> at >> org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) >> at >> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) >> at org.eclipse.jetty.server.Server.handle(Server.java:524) >> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319) >> at >> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253) >> at >> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273) >> at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95) >> at >> org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) >> at >> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) >> at >> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) >> at >> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) >> at >> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) >> at >> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) >> at java.lang.Thread.run(Thread.java:745) >> >> >> >> -- >> -- >> ------------------ >> OPS4J - http://www.ops4j.org - [email protected] <javascript:> >> >> --- >> You received this message because you are subscribed to the Google Groups >> "OPS4J" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > > Apache Member > Apache Karaf <http://karaf.apache.org/> Committer & PMC > OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & > Project Lead > blog <http://notizblog.nierbeck.de/> > Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS> > > Software Architect / Project Manager / Scrum Master > > -- -- ------------------ OPS4J - http://www.ops4j.org - [email protected] --- You received this message because you are subscribed to the Google Groups "OPS4J" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
