gpt4 book ai didi

org.apache.tomcat.websocket.WsWebSocketContainer类的使用及代码示例

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

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

WsWebSocketContainer介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

public TomcatWebSocketClient() {
  this(new WsWebSocketContainer());
}

代码示例来源:origin: org.apache.tomcat.embed/tomcat-embed-websocket

sa = new InetSocketAddress(host, port);
} else {
  proxyConnect = createProxyRequest(host, port);
Map<String, List<String>> reqHeaders = createRequestHeaders(host, port,
    clientEndpointConfiguration);
clientEndpointConfiguration.getConfigurator().beforeRequest(reqHeaders);
ByteBuffer request = createRequest(path, reqHeaders);
  socketChannel = AsynchronousSocketChannel.open(getAsynchronousChannelGroup());
} catch (IOException ioe) {
  throw new DeploymentException(sm.getString(
ByteBuffer response = ByteBuffer.allocate(getDefaultMaxBinaryMessageBufferSize());
String subProtocol;
boolean success = false;
    writeRequest(channel, proxyConnect, timeout);
    HttpResponse httpResponse = processResponse(response, channel, timeout);
    if (httpResponse.getStatus() != 200) {
      throw new DeploymentException(sm.getString(
  SSLEngine sslEngine = createSSLEngine(userProperties, host, port);
  channel = new AsyncChannelWrapperSecure(socketChannel, sslEngine);
} else if (channel == null) {
  writeRequest(channel, request, timeout);

代码示例来源:origin: codefollower/Tomcat-Research

Map<String,List<String>> reqHeaders = createRequestHeaders(host, port,
    clientEndpointConfiguration.getPreferredSubprotocols(),
    clientEndpointConfiguration.getExtensions());
    beforeRequest(reqHeaders);
ByteBuffer request = createRequest(path, reqHeaders);
  SSLEngine sslEngine = createSSLEngine(
      clientEndpointConfiguration.getUserProperties());
  channel = new AsyncChannelWrapperSecure(socketChannel, sslEngine);
      processResponse(response, channel, timeout);
  clientEndpointConfiguration.getConfigurator().
      afterResponse(handshakeResponse);
    clientEndpointConfiguration);
endpoint.onOpen(wsSession, clientEndpointConfiguration);
registerSession(endpoint, wsSession);

代码示例来源:origin: org.jboss.web/jbossweb

wsKeyValues.add(generateWsKeyValue());
headers.put(Constants.WS_KEY_HEADER_NAME, wsKeyValues);
      generateExtensionHeaders(extensions));

代码示例来源:origin: Red5/red5-plugins

/**
 * {@inheritDoc}
 *
 * Overridden to make it visible to other classes in this package.
 */
@Override
protected void unregisterSession(Endpoint endpoint, WsSession wsSession) {
  if (wsSession.getUserPrincipal() != null && wsSession.getHttpSessionId() != null) {
    unregisterAuthenticatedSession(wsSession, wsSession.getHttpSessionId());
  }
  super.unregisterSession(endpoint, wsSession);
  log.debug("unregisterSession: {} endpoint: {}", wsSession.getId(), endpoint);
}

代码示例来源:origin: org.apache.tomcat.embed/tomcat-embed-websocket

@Override
public Session connectToServer(Class<?> annotatedEndpointClass, URI path)
    throws DeploymentException {
  Object pojo;
  try {
    pojo = annotatedEndpointClass.getConstructor().newInstance();
  } catch (ReflectiveOperationException e) {
    throw new DeploymentException(sm.getString(
        "wsWebSocketContainer.endpointCreateFail",
        annotatedEndpointClass.getName()), e);
  }
  return connectToServer(pojo, path);
}

代码示例来源:origin: Red5/red5-plugins

/**
 * {@inheritDoc}
 *
 * Overridden to make it visible to other classes in this package.
 */
@Override
protected void registerSession(Endpoint endpoint, WsSession wsSession) {
  super.registerSession(endpoint, wsSession);
  if (wsSession.isOpen() && wsSession.getUserPrincipal() != null && wsSession.getHttpSessionId() != null) {
    registerAuthenticatedSession(wsSession, wsSession.getHttpSessionId());
  }
  log.debug("registerSession: {} endpoint: {}", wsSession, endpoint);
}

代码示例来源:origin: org.apache.tomcat/tomcat7-websocket

private static ByteBuffer createRequest(URI uri, Map<String,List<String>> reqHeaders) {
  ByteBuffer result = ByteBuffer.allocate(4 * 1024);
  // Request line
  result.put(GET_BYTES);
  byte[] path = (null == uri.getPath() || "".equals(uri.getPath()))
      ? ROOT_URI_BYTES : uri.getRawPath().getBytes(StandardCharsets.ISO_8859_1);
  result.put(path);
  String query = uri.getRawQuery();
  if (query != null) {
    result.put((byte) '?');
    result.put(query.getBytes(StandardCharsets.ISO_8859_1));
  }
  result.put(HTTP_VERSION_BYTES);
  // Headers
  for (Entry<String, List<String>> entry : reqHeaders.entrySet()) {
    result = addHeader(result, entry.getKey(), entry.getValue());
  }
  // Terminating CRLF
  result.put(CRLF);
  result.flip();
  return result;
}

代码示例来源:origin: org.apache.tomcat/tomcat-websocket

sa = new InetSocketAddress(host, port);
} else {
  proxyConnect = createProxyRequest(host, port);
Map<String, List<String>> reqHeaders = createRequestHeaders(host, port,
    clientEndpointConfiguration);
clientEndpointConfiguration.getConfigurator().beforeRequest(reqHeaders);
ByteBuffer request = createRequest(path, reqHeaders);
  socketChannel = AsynchronousSocketChannel.open(getAsynchronousChannelGroup());
} catch (IOException ioe) {
  throw new DeploymentException(sm.getString(
ByteBuffer response = ByteBuffer.allocate(getDefaultMaxBinaryMessageBufferSize());
String subProtocol;
boolean success = false;
    writeRequest(channel, proxyConnect, timeout);
    HttpResponse httpResponse = processResponse(response, channel, timeout);
    if (httpResponse.getStatus() != 200) {
      throw new DeploymentException(sm.getString(
  SSLEngine sslEngine = createSSLEngine(userProperties, host, port);
  channel = new AsyncChannelWrapperSecure(socketChannel, sslEngine);
} else if (channel == null) {
  writeRequest(channel, request, timeout);

代码示例来源:origin: org.jboss.web/jbossweb

Map<String,List<String>> reqHeaders = createRequestHeaders(host, port,
    clientEndpointConfiguration.getPreferredSubprotocols(),
    clientEndpointConfiguration.getExtensions());
    beforeRequest(reqHeaders);
ByteBuffer request = createRequest(path, reqHeaders);
  socketChannel = AsynchronousSocketChannel.open(getAsynchronousChannelGroup());
} catch (IOException ioe) {
  throw new DeploymentException(MESSAGES.connectionFailed(), ioe);
  SSLEngine sslEngine = createSSLEngine(
      clientEndpointConfiguration.getUserProperties());
  channel = new AsyncChannelWrapperSecure(socketChannel, sslEngine);
      processResponse(response, channel, timeout);
  clientEndpointConfiguration.getConfigurator().
      afterResponse(handshakeResponse);
registerSession(endpoint, wsSession);

代码示例来源:origin: codefollower/Tomcat-Research

wsKeyValues.add(generateWsKeyValue());
headers.put(Constants.WS_KEY_HEADER_NAME, wsKeyValues);
      generateExtensionHeaders(extensions));

代码示例来源:origin: org.apache.tomcat.embed/tomcat-embed-websocket

/**
 * {@inheritDoc}
 *
 * Overridden to make it visible to other classes in this package.
 */
@Override
protected void unregisterSession(Endpoint endpoint, WsSession wsSession) {
  if (wsSession.getUserPrincipal() != null &&
      wsSession.getHttpSessionId() != null) {
    unregisterAuthenticatedSession(wsSession,
        wsSession.getHttpSessionId());
  }
  super.unregisterSession(endpoint, wsSession);
}

代码示例来源:origin: org.apache.tomcat/tomcat-websocket

@Override
public Session connectToServer(Class<?> annotatedEndpointClass, URI path)
    throws DeploymentException {
  Object pojo;
  try {
    pojo = annotatedEndpointClass.getConstructor().newInstance();
  } catch (ReflectiveOperationException e) {
    throw new DeploymentException(sm.getString(
        "wsWebSocketContainer.endpointCreateFail",
        annotatedEndpointClass.getName()), e);
  }
  return connectToServer(pojo, path);
}

代码示例来源:origin: org.jboss.web/jbossweb

/**
 * {@inheritDoc}
 *
 * Overridden to make it visible to other classes in this package.
 */
@Override
protected void registerSession(Endpoint endpoint, WsSession wsSession) {
  super.registerSession(endpoint, wsSession);
  if (wsSession.isOpen() &&
      wsSession.getUserPrincipal() != null &&
      wsSession.getHttpSessionId() != null) {
    registerAuthenticatedSession(wsSession,
        wsSession.getHttpSessionId());
  }
}

代码示例来源:origin: org.jboss.web/jbossweb

private ByteBuffer createRequest(URI uri,
    Map<String,List<String>> reqHeaders) {
  ByteBuffer result = ByteBuffer.allocate(4 * 1024);
  // Request line
  result.put("GET ".getBytes(StandardCharsets.ISO_8859_1));
  result.put(uri.getRawPath().getBytes(StandardCharsets.ISO_8859_1));
  String query = uri.getRawQuery();
  if (query != null) {
    result.put((byte) '?');
    result.put(query.getBytes(StandardCharsets.ISO_8859_1));
  }
  result.put(" HTTP/1.1\r\n".getBytes(StandardCharsets.ISO_8859_1));
  // Headers
  Iterator<Entry<String,List<String>>> iter =
      reqHeaders.entrySet().iterator();
  while (iter.hasNext()) {
    Entry<String,List<String>> entry = iter.next();
    addHeader(result, entry.getKey(), entry.getValue());
  }
  // Terminating CRLF
  result.put(crlf);
  result.flip();
  return result;
}

代码示例来源:origin: org.apache.tomcat/tomcat7-websocket

sa = new InetSocketAddress(host, port);
} else {
  proxyConnect = createProxyRequest(host, port);
Map<String, List<String>> reqHeaders = createRequestHeaders(host, port,
    clientEndpointConfiguration);
clientEndpointConfiguration.getConfigurator().beforeRequest(reqHeaders);
ByteBuffer request = createRequest(path, reqHeaders);
  socketChannel = AsynchronousSocketChannel.open(getAsynchronousChannelGroup());
} catch (IOException ioe) {
  throw new DeploymentException(sm.getString(
ByteBuffer response = ByteBuffer.allocate(getDefaultMaxBinaryMessageBufferSize());
String subProtocol;
boolean success = false;
    writeRequest(channel, proxyConnect, timeout);
    HttpResponse httpResponse = processResponse(response, channel, timeout);
    if (httpResponse.getStatus() != 200) {
      throw new DeploymentException(sm.getString(
  SSLEngine sslEngine = createSSLEngine(userProperties, host, port);
  channel = new AsyncChannelWrapperSecure(socketChannel, sslEngine);
} else if (channel == null) {
  writeRequest(channel, request, timeout);

代码示例来源:origin: org.apache.tomcat/tomcat7-websocket

wsKeyValues.add(generateWsKeyValue());
headers.put(Constants.WS_KEY_HEADER_NAME, wsKeyValues);
      generateExtensionHeaders(extensions));

代码示例来源:origin: org.jboss.web/jbossweb

/**
 * {@inheritDoc}
 *
 * Overridden to make it visible to other classes in this package.
 */
@Override
protected void unregisterSession(Endpoint endpoint, WsSession wsSession) {
  if (wsSession.getUserPrincipal() != null &&
      wsSession.getHttpSessionId() != null) {
    unregisterAuthenticatedSession(wsSession,
        wsSession.getHttpSessionId());
  }
  super.unregisterSession(endpoint, wsSession);
}

代码示例来源:origin: org.apache.tomcat/tomcat-websocket

@Override
public Session connectToServer(Class<? extends Endpoint> clazz,
    ClientEndpointConfig clientEndpointConfiguration, URI path)
    throws DeploymentException {
  Endpoint endpoint;
  try {
    endpoint = clazz.getConstructor().newInstance();
  } catch (ReflectiveOperationException e) {
    throw new DeploymentException(sm.getString(
        "wsWebSocketContainer.endpointCreateFail", clazz.getName()),
        e);
  }
  return connectToServer(endpoint, clientEndpointConfiguration, path);
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
  protected WebSocketContainer getContainer() {
    return new WsWebSocketContainer();
  }
}

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