
import javax.servlet.http.HttpSession;
import javax.websocket.HandshakeResponse;
import javax.websocket.server.HandshakeRequest;
import javax.websocket.server.ServerEndpointConfig;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author apple
 */
public class WSKonfigurator extends ServerEndpointConfig.Configurator {

    @Override
    public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest req, HandshakeResponse res) {
        super.modifyHandshake(sec, req, res); 
        UzytkownikBean ub = (UzytkownikBean)((HttpSession)req.getHttpSession()).getAttribute("uzytkownikBean");
        sec.getUserProperties().put("uzytkownik", ub.getLogin());
    }
    
}
