Example usage for javax.websocket.server HandshakeRequest getUserPrincipal

List of usage examples for javax.websocket.server HandshakeRequest getUserPrincipal

Introduction

In this page you can find the example usage for javax.websocket.server HandshakeRequest getUserPrincipal.

Prototype

Principal getUserPrincipal();

Source Link

Usage

From source file:freddo.dtalk2.broker.servlet.DTalkServerEndpoint.java

@OnOpen
public void onOpen(Session session, EndpointConfig config) {
    LOG.trace(">>> onOpen: {}, userProperties: {}", session.getId(), config.getUserProperties());

    mConfig = config;/*  w  ww  .  j  a va2s.co m*/
    mSession = session;

    if (LOG.isDebugEnabled()) {
        HandshakeRequest req = getHandshakeRequest();
        HttpSession httpSession = (HttpSession) req.getHttpSession();
        LOG.debug("=================================");
        LOG.debug("QueryString   : {}", req.getQueryString());
        LOG.debug("RequestURI    : {}", req.getRequestURI());
        LOG.debug("Headers       : {}", req.getHeaders());
        LOG.debug("UserPrincipal : {}", req.getUserPrincipal());
        LOG.debug("ParameterMap  : {}", req.getParameterMap());
        LOG.debug("=================================");
        if (httpSession != null) {
            Enumeration<String> e = httpSession.getAttributeNames();
            while (e.hasMoreElements()) {
                final String attr = e.nextElement();
                LOG.debug("Session[{}]: {}", attr, httpSession.getAttribute(attr));
            }
            LOG.debug("=================================");
        }
    }

    // TODO register connection & notify context listener

}