Package org.eclipse.jetty.websocket.servlet

Examples of org.eclipse.jetty.websocket.servlet.WebSocketCreator


        factory.getPolicy().setIdleTimeout(Integer.MAX_VALUE);
      } else {
        factory.getPolicy().setIdleTimeout(websocketMaxIdleTime);
      }
      factory.getPolicy().setMaxTextMessageSize(websocketMaxMessageSize * 1024 * 1024);
      factory.setCreator(new WebSocketCreator() {
        @Override
        public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp) {
          ParticipantId loggedInUser =
              provider.sessionManager.getLoggedInUser(req.getSession());

View Full Code Here


        final WebSocketProcessor webSocketProcessor = WebSocketProcessorFactory.getDefault().getWebSocketProcessor(config.framework());

        webSocketFactory = new WebSocketServerFactory(policy) {
            @Override
            public boolean acceptWebSocket(final HttpServletRequest request, final HttpServletResponse response) throws IOException {
                setCreator(new WebSocketCreator() {

                    // @Override  9.0.x
                    public Object createWebSocket(UpgradeRequest upgradeRequest, UpgradeResponse upgradeResponse) {

                        ServletWebSocketRequest r = ServletWebSocketRequest.class.cast(upgradeRequest);
View Full Code Here

                    chain.doFilter(request,response);
                    return;
                }
                LOG.debug("WebSocket Upgrade detected on {} for endpoint {}",target,resource);

                WebSocketCreator creator = resource.getResource();

                // Store PathSpec resource mapping as request attribute
                httpreq.setAttribute(PathSpec.class.getName(),resource.getPathSpec());

                // We have an upgrade request
View Full Code Here

                // no match.
                response.sendError(HttpServletResponse.SC_NOT_FOUND,"No websocket endpoint matching path: " + target);
                return;
            }

            WebSocketCreator creator = resource.getResource();

            // Store PathSpec resource mapping as request attribute
            request.setAttribute(PathSpec.class.getName(),resource);

            // We have an upgrade request
View Full Code Here

      if (max != null)
        serverPolicy.setMaxMessageSize(Integer.parseInt(max));

      _webSocketFactory = new WebSocketServerFactory(serverPolicy);

      _webSocketFactory.setCreator(new WebSocketCreator()
      {
        @Override
        public Object createWebSocket(UpgradeRequest upgradeRequest,
          UpgradeResponse upgradeResponse)
        {
View Full Code Here

   * {@link WebSocketServerFactory#getPolicy()}.
   */
  public JettyRequestUpgradeStrategy(WebSocketServerFactory factory) {
    Assert.notNull(factory, "WebSocketServerFactory must not be null");
    this.factory = factory;
    this.factory.setCreator(new WebSocketCreator() {
      @Override
      public Object createWebSocket(ServletUpgradeRequest request, ServletUpgradeResponse response) {
        // Cast to avoid infinite recursion
        return createWebSocket((UpgradeRequest) request, (UpgradeResponse) response);
      }
View Full Code Here

      this.server.addConnector(connector);
      this.server.setHandler(new org.eclipse.jetty.websocket.server.WebSocketHandler() {
        @Override
        public void configure(WebSocketServletFactory factory) {
          factory.setCreator(new WebSocketCreator() {
            @Override
            public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp) {
              if (!CollectionUtils.isEmpty(req.getSubProtocols())) {
                resp.setAcceptedSubProtocol(req.getSubProtocols().get(0));
              }
View Full Code Here

    this.logSocketProvider = logSocketProvider;
  }

  @Override
  public void configure(WebSocketServletFactory factory) {
    factory.setCreator(new WebSocketCreator() {

      @Override
      public Object createWebSocket(ServletUpgradeRequest servletUpgradeRequest,
                                    ServletUpgradeResponse servletUpgradeResponse) {
        return logSocketProvider.get();
View Full Code Here

        long idleTimeout = getOption(IDLE_TIMEOUT_OPTION, policy.getIdleTimeout());
        policy.setIdleTimeout((int)idleTimeout);

        for (String mapping : normalizeURLMapping(cometdURLMapping))
        {
            wsFilter.addMapping(new ServletPathSpec(mapping), new WebSocketCreator()
            {
                @Override
                public Object createWebSocket(ServletUpgradeRequest request, ServletUpgradeResponse response)
                {
                    String origin = request.getHeader("Origin");
View Full Code Here

                    chain.doFilter(request,response);
                    return;
                }
                LOG.debug("WebSocket Upgrade detected on {} for endpoint {}",target,resource);

                WebSocketCreator creator = resource.getResource();

                // Store PathSpec resource mapping as request attribute
                httpreq.setAttribute(PathSpec.class.getName(),resource.getPathSpec());

                // We have an upgrade request
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.websocket.servlet.WebSocketCreator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.