43
43
import java .net .URI ;
44
44
import java .nio .Buffer ;
45
45
import java .nio .ByteBuffer ;
46
+ import java .util .Enumeration ;
46
47
import java .util .HashMap ;
47
48
import java .util .HashSet ;
48
49
import java .util .List ;
49
50
import java .util .Map ;
50
51
import java .util .Set ;
51
52
import java .util .concurrent .Callable ;
53
+ import java .util .concurrent .ConcurrentHashMap ;
52
54
53
55
import static org .atmosphere .cpr .ApplicationConfig .ALLOW_QUERYSTRING_AS_REQUEST ;
54
56
@@ -224,6 +226,13 @@ public void onOpen(Session session, final EndpointConfig endpointConfig) {
224
226
cookies .addAll (CookieUtil .ServerCookieDecoder .STRICT .decode (cookieHeader ));
225
227
}
226
228
229
+ Enumeration <String > attributeNames = handshakeSession .getAttributeNames ();
230
+ Map <String , Object > attributes = new ConcurrentHashMap <>();
231
+ while (attributeNames .hasMoreElements ()) {
232
+ String attributeName = attributeNames .nextElement ();
233
+ attributes .put (attributeName , handshakeSession .getAttribute (attributeName ));
234
+ }
235
+
227
236
request = new AtmosphereRequestImpl .Builder ()
228
237
.requestURI (uri .getPath ())
229
238
.requestURL (requestURL )
@@ -237,6 +246,7 @@ public void onOpen(Session session, final EndpointConfig endpointConfig) {
237
246
.userPrincipal (session .getUserPrincipal ())
238
247
.remoteInetSocketAddress ((Callable <InetSocketAddress >) () -> (InetSocketAddress ) endpointConfig .getUserProperties ().get (JAVAX_WEBSOCKET_ENDPOINT_REMOTE_ADDRESS ))
239
248
.localInetSocketAddress ((Callable <InetSocketAddress >) () -> (InetSocketAddress ) endpointConfig .getUserProperties ().get (JAVAX_WEBSOCKET_ENDPOINT_LOCAL_ADDRESS ))
249
+ .attributes (attributes )
240
250
.build ()
241
251
.queryString (session .getQueryString ());
242
252
0 commit comments