gpt4 book ai didi

org.apache.tomcat.websocket.WsSession.getLocal()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 19:39:05 27 4
gpt4 key购买 nike

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

WsSession.getLocal介绍

暂无

代码示例

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

@Override
protected void sendMessageBinary(ByteBuffer msg, boolean last) throws WsIOException {
  ClassLoader cl = Thread.currentThread().getContextClassLoader();
  try {
    Thread.currentThread().setContextClassLoader(applicationClassLoader);
    // set connection local to the message handler so WSMessage will contain the connection
    ((DefaultWebSocketEndpoint) wsSession.getLocal()).setConnectionLocal((WebSocketConnection) wsSession.getUserProperties().get(WSConstants.WS_CONNECTION));
    // super!
    super.sendMessageBinary(msg, last);
  } finally {
    // clear thread local
    ((DefaultWebSocketEndpoint) wsSession.getLocal()).setConnectionLocal(null);
    Thread.currentThread().setContextClassLoader(cl);
  }
}

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

@Override
protected void sendMessageText(boolean last) throws WsIOException {
  ClassLoader cl = Thread.currentThread().getContextClassLoader();
  try {
    Thread.currentThread().setContextClassLoader(applicationClassLoader);
    // set connection local to the message handler so WSMessage will contain the connection
    ((DefaultWebSocketEndpoint) wsSession.getLocal()).setConnectionLocal((WebSocketConnection) wsSession.getUserProperties().get(WSConstants.WS_CONNECTION));
    // super!
    super.sendMessageText(last);
  } finally {
    // clear thread local
    ((DefaultWebSocketEndpoint) wsSession.getLocal()).setConnectionLocal(null);
    Thread.currentThread().setContextClassLoader(cl);
  }
}

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

@Override
  public final void onMessage(T message, boolean last) {
    if (params.length == 1 && params[0] instanceof DecodeException) {
      ((WsSession) session).getLocal().onError(session,
          (DecodeException) params[0]);
      return;
    }
    Object[] parameters = params.clone();
    if (indexBoolean != -1) {
      parameters[indexBoolean] = Boolean.valueOf(last);
    }
    if (indexSession != -1) {
      parameters[indexSession] = session;
    }
    if (convert) {
      parameters[indexPayload] = ((ByteBuffer) message).array();
    } else {
      parameters[indexPayload] = message;
    }
    Object result;
    try {
      result = method.invoke(pojo, parameters);
    } catch (IllegalAccessException | InvocationTargetException e) {
      throw new IllegalArgumentException(e);
    }
    processResult(result);
  }
}

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

@Override
  public final void onMessage(T message, boolean last) {
    if (params.length == 1 && params[0] instanceof DecodeException) {
      ((WsSession) session).getLocal().onError(session,
          (DecodeException) params[0]);
      return;
    }
    Object[] parameters = params.clone();
    if (indexBoolean != -1) {
      parameters[indexBoolean] = Boolean.valueOf(last);
    }
    if (indexSession != -1) {
      parameters[indexSession] = session;
    }
    if (convert) {
      parameters[indexPayload] = ((ByteBuffer) message).array();
    } else {
      parameters[indexPayload] = message;
    }
    Object result = null;
    try {
      result = method.invoke(pojo, parameters);
    } catch (IllegalAccessException | InvocationTargetException e) {
      handlePojoMethodException(e);
    }
    processResult(result);
  }
}

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

@Override
  public final void onMessage(T message, boolean last) {
    if (params.length == 1 && params[0] instanceof DecodeException) {
      ((WsSession) session).getLocal().onError(session,
          (DecodeException) params[0]);
      return;
    }
    Object[] parameters = params.clone();
    if (indexBoolean != -1) {
      parameters[indexBoolean] = Boolean.valueOf(last);
    }
    if (indexSession != -1) {
      parameters[indexSession] = session;
    }
    if (convert) {
      parameters[indexPayload] = ((ByteBuffer) message).array();
    } else {
      parameters[indexPayload] = message;
    }
    Object result = null;
    try {
      result = method.invoke(pojo, parameters);
    } catch (IllegalAccessException | InvocationTargetException e) {
      handlePojoMethodException(e);
    }
    processResult(result);
  }
}

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

((WsSession) session).getLocal().onError(session,
      (DecodeException) params[0]);
  return;
  payload = decode(message);
} catch (DecodeException de) {
  ((WsSession) session).getLocal().onError(session, de);
  return;

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

@SuppressWarnings("unchecked")
private void sendMessageText(boolean last) throws WsIOException {
  if (textMsgHandler instanceof WrappedMessageHandler) {
    long maxMessageSize =
        ((WrappedMessageHandler) textMsgHandler).getMaxMessageSize();
    if (maxMessageSize > -1 &&
        messageBufferText.remaining() > maxMessageSize) {
      throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG,
          sm.getString("wsFrame.messageTooBig",
              Long.valueOf(messageBufferText.remaining()),
              Long.valueOf(maxMessageSize))));
    }
  }
  try {
    if (textMsgHandler instanceof MessageHandler.Partial<?>) {
      ((MessageHandler.Partial<String>) textMsgHandler).onMessage(
          messageBufferText.toString(), last);
    } else {
      // Caller ensures last == true if this branch is used
      ((MessageHandler.Whole<String>) textMsgHandler).onMessage(
          messageBufferText.toString());
    }
  } catch (Throwable t) {
    ExceptionUtils.handleThrowable(t);
    wsSession.getLocal().onError(wsSession, t);
  } finally {
    messageBufferText.clear();
  }
}

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

@Override
  public final void onMessage(T message, boolean last) {
    if (params.length == 1 && params[0] instanceof DecodeException) {
      ((WsSession) session).getLocal().onError(session,
          (DecodeException) params[0]);
      return;
    }
    Object[] parameters = params.clone();
    if (indexBoolean != -1) {
      parameters[indexBoolean] = Boolean.valueOf(last);
    }
    if (indexSession != -1) {
      parameters[indexSession] = session;
    }
    if (convert) {
      parameters[indexPayload] = ((ByteBuffer) message).array();
    } else {
      parameters[indexPayload] = message;
    }
    Object result = null;
    try {
      result = method.invoke(pojo, parameters);
    } catch (IllegalAccessException e) {
      handlePojoMethodException(e);
    } catch (InvocationTargetException e) {
      handlePojoMethodException(e);
    }
    processResult(result);
  }
}

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

@Override
public final void onMessage(T message, boolean last) {
  if (params.length == 1 && params[0] instanceof DecodeException) {
    ((WsSession) session).getLocal().onError(session,
        (DecodeException) params[0]);
    return;

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

private void handleThrowableOnSend(Throwable t) throws WsIOException {
  ExceptionUtils.handleThrowable(t);
  wsSession.getLocal().onError(wsSession, t);
  CloseReason cr = new CloseReason(CloseCodes.CLOSED_ABNORMALLY,
      MESSAGES.closeAfterError());
  throw new WsIOException(cr);
}

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

private void handleThrowableOnSend(Throwable t) throws WsIOException {
  ExceptionUtils.handleThrowable(t);
  wsSession.getLocal().onError(wsSession, t);
  CloseReason cr = new CloseReason(CloseCodes.CLOSED_ABNORMALLY,
      sm.getString("wsFrame.ioeTriggeredClose"));
  throw new WsIOException(cr);
}

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

private void handleThrowableOnSend(Throwable t) throws WsIOException {
  ExceptionUtils.handleThrowable(t);
  wsSession.getLocal().onError(wsSession, t);
  CloseReason cr = new CloseReason(CloseCodes.CLOSED_ABNORMALLY,
      sm.getString("wsFrame.ioeTriggeredClose"));
  throw new WsIOException(cr);
}

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

private void handleThrowableOnSend(Throwable t) throws WsIOException {
  ExceptionUtils.handleThrowable(t);
  wsSession.getLocal().onError(wsSession, t);
  CloseReason cr = new CloseReason(CloseCodes.CLOSED_ABNORMALLY,
      sm.getString("wsFrame.ioeTriggeredClose"));
  throw new WsIOException(cr);
}

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

((WsSession) session).getLocal().onError(session,
      (DecodeException) params[0]);
  return;
  payload = decode(message);
} catch (DecodeException de) {
  ((WsSession) session).getLocal().onError(session, de);
  return;

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

((WsSession) session).getLocal().onError(session,
      (DecodeException) params[0]);
  return;
  payload = decode(message);
} catch (DecodeException de) {
  ((WsSession) session).getLocal().onError(session, de);
  return;

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

@SuppressWarnings("unchecked")
private void sendMessageBinary(ByteBuffer msg, boolean last)
    throws WsIOException {
  if (binaryMsgHandler instanceof WrappedMessageHandler) {
    long maxMessageSize =
        ((WrappedMessageHandler) binaryMsgHandler).getMaxMessageSize();
    if (maxMessageSize > -1 && msg.remaining() > maxMessageSize) {
      throw new WsIOException(new CloseReason(CloseCodes.TOO_BIG,
          sm.getString("wsFrame.messageTooBig",
              Long.valueOf(msg.remaining()),
              Long.valueOf(maxMessageSize))));
    }
  }
  try {
    if (binaryMsgHandler instanceof MessageHandler.Partial<?>) {
      ((MessageHandler.Partial<ByteBuffer>) binaryMsgHandler).onMessage(msg, last);
    } else {
      // Caller ensures last == true if this branch is used
      ((MessageHandler.Whole<ByteBuffer>) binaryMsgHandler).onMessage(msg);
    }
  } catch(Throwable t) {
    ExceptionUtils.handleThrowable(t);
    wsSession.getLocal().onError(wsSession, t);
  }
}

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

((WsSession) session).getLocal().onError(session,
      (DecodeException) params[0]);
  return;
  payload = decode(message);
} catch (DecodeException de) {
  ((WsSession) session).getLocal().onError(session, de);
  return;

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

((WsSession) session).getLocal().onError(session,
      (DecodeException) params[0]);
  return;
  payload = decode(message);
} catch (DecodeException de) {
  ((WsSession) session).getLocal().onError(session, de);
  return;

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

} catch (Throwable t) {
  ExceptionUtils.handleThrowable(t);
  wsSession.getLocal().onError(wsSession, t);
} finally {
  controlBufferBinary.clear();

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