Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] sending cookie with websocket clientupgraderequest

Unfortunately that is not it.   I have also have cookie.setPath and cookie.setMaxAge.

I am looking up the cookie in the OnConnect call
session.getUpgradeRequest().getCookies()

Is this bug or incorrect usage ?

which leads to the bigger question I have. Which is the right place to examine the  cookies, parameters and any attributes
added by filters to the upgradeRequest.

The getUpgradeRequest() method is available on the session, but the upgradeRequest for example lacks a getAttributes method.

The createWebSocket method of the WebSocketCreator interface gets passed a ServletUpgradeRequest which seems to another place
one can examine the upgrade request.

If you can suggest a working approach to examine the upgrade request, that would be great.

regards



On Thu, Jul 31, 2014 at 2:34 AM, Neil Williams <neil@xxxxxxxxxxx> wrote:
Missing adding the cookie into the list by the looks of it.

HttpCookie cookie = new HttpCookie("username","user1") ;

List<HttpCookie> cookies = new ArrayList<HttpCookie>() ;
cookies.add(cookie);


On Thu, Jul 31, 2014 at 12:17 AM, Manoj Khangaonkar <khangaonkar@xxxxxxxxx> wrote:
Hi ,

I am trying to send some data as a cookie with the websocket

WebSocketClient client = new WebSocketClient();
ClientUpgradeRequest request = new ClientUpgradeRequest();
      HttpCookie cookie = new HttpCookie("username","user1") ;
      List<HttpCookie> cookies = new ArrayList<HttpCookie>() ;
      request.setCookies(cookies);
      client.connect(socket, echoUri, request);


On the serverside I do not get the cookie either using getCookies or using the headers.
headers as printed from the server.
Header Cache-Control == no-cache,
Header Connection == Upgrade,
Header Host == localhost:8080,
Header Pragma == no-cache,
Header Sec-WebSocket-Key == SAAtlNIjOCvrE+lHSIUCFw==,
Header Sec-WebSocket-Version == 13,
Header Upgrade == websocket,

Is something wrong with the above code ?

 

regards


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
http://khangaonkar.blogspot.com/

Back to the top