0

How does one decode Client Cookies strings jax-rs? What I mean by this is how do you convert a String cookie value into a javax.ws.rs.core.Cookie?

Here is an example of how to do it in Netty:

Cookie myCookie = ClientCookieDecoder.LAX.decode("my cookie string here")

Does anyone know of a useful utility method equivalent of this for jax rs?

Nicholas DiPiazza
  • 10,029
  • 11
  • 83
  • 152
  • Why are *you* trying to do this? The Jax-RS runtime will do it for you, i.e. it will decode the cookie header of the incoming request and make the `Cookie` available to you. You just need to add `Cookie` parameter to your handler method. – Andreas Nov 16 '18 at 19:26
  • the cookie stored via string from a third party system. i want to turn it into a cookie to send thru jersey now – Nicholas DiPiazza Nov 16 '18 at 20:04
  • Where is the string coming from? – Paul Samsotha Nov 17 '18 at 05:30

1 Answers1

0

Here is the method that works:

Cookie cookie = RuntimeDelegate.getInstance().createHeaderDelegate(Cookie.class).fromString(cookieStringValue);

Note: Don't use

Cookie.valueOf(cookieStringValue) 

because it is deprecated.

Nicholas DiPiazza
  • 10,029
  • 11
  • 83
  • 152