gpt4 book ai didi

org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.configureContext()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-23 15:57:05 27 4
gpt4 key购买 nike

本文整理了Java中org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.configureContext()方法的一些代码示例,展示了WebSocketUpgradeFilter.configureContext()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebSocketUpgradeFilter.configureContext()方法的具体详情如下:
包路径:org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter
类名称:WebSocketUpgradeFilter
方法名:configureContext

WebSocketUpgradeFilter.configureContext介绍

暂无

代码示例

代码示例来源:origin: perwendel/spark

try {
  webSocketServletContextHandler = new ServletContextHandler(null, "/", true, false);
  WebSocketUpgradeFilter webSocketUpgradeFilter = WebSocketUpgradeFilter.configureContext(webSocketServletContextHandler);
  if (webSocketIdleTimeoutMillis.isPresent()) {
    webSocketUpgradeFilter.getFactory().getPolicy().setIdleTimeout(webSocketIdleTimeoutMillis.get());

代码示例来源:origin: org.eclipse.jetty.websocket/websocket-server

/**
 * @deprecated use {@link #configureContext(ServletContextHandler)} instead
 * @param context the ServletContext to use
 * @return a configured {@link WebSocketUpgradeFilter} instance
 * @throws ServletException if the filer cannot be configured
 */
@Deprecated
public static WebSocketUpgradeFilter configureContext(ServletContext context) throws ServletException
{
  ContextHandler handler = ContextHandler.getContextHandler(context);
  
  if (handler == null)
  {
    throw new ServletException("Not running on Jetty, WebSocket support unavailable");
  }
  
  if (!(handler instanceof ServletContextHandler))
  {
    throw new ServletException("Not running in Jetty ServletContextHandler, WebSocket support via " + WebSocketUpgradeFilter.class.getName() + " unavailable");
  }
  
  return configureContext((ServletContextHandler) handler);
}

代码示例来源:origin: biezhi/java-library-examples

WebSocketUpgradeFilter wsfilter = WebSocketUpgradeFilter.configureContext(context);

代码示例来源:origin: com.sparkjava/spark-core

try {
  webSocketServletContextHandler = new ServletContextHandler(null, "/", true, false);
  WebSocketUpgradeFilter webSocketUpgradeFilter = WebSocketUpgradeFilter.configureContext(webSocketServletContextHandler);
  if (webSocketIdleTimeoutMillis.isPresent()) {
    webSocketUpgradeFilter.getFactory().getPolicy().setIdleTimeout(webSocketIdleTimeoutMillis.get());

代码示例来源:origin: com.liveperson/dropwizard-websockets

public static ServerContainer configureContext(final MutableServletContextHandler context, final MetricRegistry metrics) throws ServletException {
    WebSocketUpgradeFilter filter = WebSocketUpgradeFilter.configureContext(context);
    NativeWebSocketConfiguration wsConfig = filter.getConfiguration();
    
    ServerContainer wsContainer = new ServerContainer(wsConfig, context.getServer().getThreadPool());
    EventDriverFactory edf = wsConfig.getFactory().getEventDriverFactory();
    edf.clearImplementations();

    edf.addImplementation(new InstJsrServerEndpointImpl(metrics));
    edf.addImplementation(new InstJsrServerExtendsEndpointImpl(metrics));
    context.addBean(wsContainer);
    context.setAttribute(javax.websocket.server.ServerContainer.class.getName(), wsContainer);
    context.setAttribute(WebSocketUpgradeFilter.class.getName(), filter);
    return wsContainer;
  }
}

代码示例来源:origin: LivePersonInc/dropwizard-websockets

public static ServerContainer configureContext(final MutableServletContextHandler context, final MetricRegistry metrics) throws ServletException {
    WebSocketUpgradeFilter filter = WebSocketUpgradeFilter.configureContext(context);
    NativeWebSocketConfiguration wsConfig = filter.getConfiguration();
    
    ServerContainer wsContainer = new ServerContainer(wsConfig, context.getServer().getThreadPool());
    EventDriverFactory edf = wsConfig.getFactory().getEventDriverFactory();
    edf.clearImplementations();

    edf.addImplementation(new InstJsrServerEndpointImpl(metrics));
    edf.addImplementation(new InstJsrServerExtendsEndpointImpl(metrics));
    context.addBean(wsContainer);
    context.setAttribute(javax.websocket.server.ServerContainer.class.getName(), wsContainer);
    context.setAttribute(WebSocketUpgradeFilter.class.getName(), filter);
    return wsContainer;
  }
}

代码示例来源:origin: adamkewley/jobson

final WebSocketUpgradeFilter wsFilter = WebSocketUpgradeFilter.configureContext(environment.getApplicationContext());
wsFilter.getFactory().getPolicy().setIdleTimeout(WEBSOCKET_TCP_IDLE_TIMEOUT_IN_MILLISECONDS);

代码示例来源:origin: org.eclipse.jetty.websocket/javax-websocket-server-impl

WebSocketUpgradeFilter wsuf = WebSocketUpgradeFilter.configureContext(context);
context.setAttribute(instanceKey, wsuf);

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com