All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.resteasy.plugins.delegates.CookieHeaderDelegate Maven / Gradle / Ivy

There is a newer version: 4.0.0.Beta5
Show newest version
package org.jboss.resteasy.plugins.delegates;

import javax.ws.rs.core.Cookie;
import javax.ws.rs.ext.RuntimeDelegate;
import org.jboss.resteasy.util.CookieParser;

/**
 * @author Bill Burke
 * @version $Revision: 1 $
 */
public class CookieHeaderDelegate implements RuntimeDelegate.HeaderDelegate
{

   public Cookie fromString(String value) throws IllegalArgumentException
   {
      return CookieParser.parseCookies(value).get(0);
   }

   public String toString(Cookie value)
   {
      StringBuffer buf = new StringBuffer();
      ServerCookie.appendCookieValue(buf, 0, value.getName(), value.getValue(), value.getPath(), value.getDomain(), null, -1, false);
      return buf.toString();
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy