/** * Return a textual representation of the cookie. * * @return string. */ public String toExternalForm() { CookieSpec spec = CookiePolicy.getCookieSpec(CookiePolicy.RFC_2965); return spec.formatCookie(this); }
String s = matcher.formatCookie(cookies[i]); getRequestHeaderGroup().addHeader(new Header("Cookie", s, true));
/** * Return a string suitable for sending in a <tt>"Cookie"</tt> header as * defined in RFC 2965 * @param cookie a {@link org.apache.commons.httpclient.Cookie} to be formatted as string * @return a string suitable for sending in a <tt>"Cookie"</tt> header. */ public String formatCookie(final Cookie cookie) { LOG.trace("enter RFC2965Spec.formatCookie(Cookie)"); if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof Cookie2) { Cookie2 cookie2 = (Cookie2) cookie; int version = cookie2.getVersion(); final StringBuffer buffer = new StringBuffer(); this.formatter.format(buffer, new NameValuePair("$Version", Integer.toString(version))); buffer.append("; "); doFormatCookie2(cookie2, buffer); return buffer.toString(); } else { // old-style cookies are formatted according to the old rules return this.rfc2109.formatCookie(cookie); } }
/** * Return a textual representation of the cookie. * * @return string. */ public String toExternalForm() { CookieSpec spec = null; if (getVersion() > 0) { spec = CookiePolicy.getDefaultSpec(); } else { spec = CookiePolicy.getCookieSpec(CookiePolicy.NETSCAPE); } return spec.formatCookie(this); }
if (LOG.isDebugEnabled()) { LOG.debug("Cookie accepted: \"" + parser.formatCookie(cookie) + "\""); LOG.warn("Cookie rejected: \"" + parser.formatCookie(cookie) + "\". " + e.getMessage());
/** * Return a textual representation of the cookie. * * @return string. */ public String toExternalForm() { CookieSpec spec = CookiePolicy.getCookieSpec(CookiePolicy.RFC_2965); return spec.formatCookie(this); }
/** * Return a textual representation of the cookie. * * @return string. */ public String toExternalForm() { CookieSpec spec = CookiePolicy.getCookieSpec(CookiePolicy.RFC_2965); return spec.formatCookie(this); }
/** * Return a textual representation of the cookie. * * @return string. */ public String toExternalForm() { CookieSpec spec = CookiePolicy.getCookieSpec(CookiePolicy.RFC_2965); return spec.formatCookie(this); }
/** * Return a textual representation of the cookie. * * @return string. */ public String toExternalForm() { CookieSpec spec = CookiePolicy.getCookieSpec(CookiePolicy.RFC_2965); return spec.formatCookie(this); }
/** * Return a string suitable for sending in a <tt>"Cookie"</tt> header as * defined in RFC 2965 * @param cookie a {@link org.apache.commons.httpclient.Cookie} to be formatted as string * @return a string suitable for sending in a <tt>"Cookie"</tt> header. */ public String formatCookie(final Cookie cookie) { LOG.trace("enter RFC2965Spec.formatCookie(Cookie)"); if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof Cookie2) { Cookie2 cookie2 = (Cookie2) cookie; int version = cookie2.getVersion(); final StringBuffer buffer = new StringBuffer(); this.formatter.format(buffer, new NameValuePair("$Version", Integer.toString(version))); buffer.append("; "); doFormatCookie2(cookie2, buffer); return buffer.toString(); } else { // old-style cookies are formatted according to the old rules return this.rfc2109.formatCookie(cookie); } }
/** * Return a string suitable for sending in a <tt>"Cookie"</tt> header as * defined in RFC 2965 * @param cookie a {@link org.apache.commons.httpclient.Cookie} to be formatted as string * @return a string suitable for sending in a <tt>"Cookie"</tt> header. */ public String formatCookie(final Cookie cookie) { LOG.trace("enter RFC2965Spec.formatCookie(Cookie)"); if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof Cookie2) { Cookie2 cookie2 = (Cookie2) cookie; int version = cookie2.getVersion(); final StringBuffer buffer = new StringBuffer(); this.formatter.format(buffer, new NameValuePair("$Version", Integer.toString(version))); buffer.append("; "); doFormatCookie2(cookie2, buffer); return buffer.toString(); } else { // old-style cookies are formatted according to the old rules return this.rfc2109.formatCookie(cookie); } }
/** * Return a string suitable for sending in a <tt>"Cookie"</tt> header as * defined in RFC 2965 * @param cookie a {@link org.apache.commons.httpclient.Cookie} to be formatted as string * @return a string suitable for sending in a <tt>"Cookie"</tt> header. */ public String formatCookie(final Cookie cookie) { LOG.trace("enter RFC2965Spec.formatCookie(Cookie)"); if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof Cookie2) { Cookie2 cookie2 = (Cookie2) cookie; int version = cookie2.getVersion(); final StringBuffer buffer = new StringBuffer(); this.formatter.format(buffer, new NameValuePair("$Version", Integer.toString(version))); buffer.append("; "); doFormatCookie2(cookie2, buffer); return buffer.toString(); } else { // old-style cookies are formatted according to the old rules return this.rfc2109.formatCookie(cookie); } }
/** * Return a string suitable for sending in a <tt>"Cookie"</tt> header as * defined in RFC 2965 * @param cookie a {@link org.apache.commons.httpclient.Cookie} to be formatted as string * @return a string suitable for sending in a <tt>"Cookie"</tt> header. */ public String formatCookie(final Cookie cookie) { LOG.trace("enter RFC2965Spec.formatCookie(Cookie)"); if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof Cookie2) { Cookie2 cookie2 = (Cookie2) cookie; int version = cookie2.getVersion(); final StringBuffer buffer = new StringBuffer(); this.formatter.format(buffer, new NameValuePair("$Version", Integer.toString(version))); buffer.append("; "); doFormatCookie2(cookie2, buffer); return buffer.toString(); } else { // old-style cookies are formatted according to the old rules return this.rfc2109.formatCookie(cookie); } }
/** * Return a textual representation of the cookie. * * @return string. */ public String toExternalForm() { CookieSpec spec = null; if (getVersion() > 0) { spec = CookiePolicy.getDefaultSpec(); } else { spec = CookiePolicy.getCookieSpec(CookiePolicy.NETSCAPE); } return spec.formatCookie(this); }
/** * Return a textual representation of the cookie. * * @return string. */ public String toExternalForm() { CookieSpec spec = null; if (getVersion() > 0) { spec = CookiePolicy.getDefaultSpec(); } else { spec = CookiePolicy.getCookieSpec(CookiePolicy.NETSCAPE); } return spec.formatCookie(this); }
/** * Return a textual representation of the cookie. * * @return string. */ public String toExternalForm() { CookieSpec spec = null; if (getVersion() > 0) { spec = CookiePolicy.getDefaultSpec(); } else { spec = CookiePolicy.getCookieSpec(CookiePolicy.NETSCAPE); } return spec.formatCookie(this); }
/** * Return a textual representation of the cookie. * * @return string. */ public String toExternalForm() { CookieSpec spec = null; if (getVersion() > 0) { spec = CookiePolicy.getDefaultSpec(); } else { spec = CookiePolicy.getCookieSpec(CookiePolicy.NETSCAPE); } return spec.formatCookie(this); }
/** * Parses the cookies from the given connection and stores them in httpState. * Invalid cookies are ignored and logged. */ private void readCookies(IRtXMASessionClient session, URL url,HttpURLConnection conn) { String headerName=""; for(int i=1;headerName!=null;i++) { headerName = conn.getHeaderFieldKey(i); if(Statics.HTTP_SET_COOKIE.equals(headerName)) { try { Cookie[] cookies = cookieSpec.parse(url.getHost(),getPort(url),url.getPath(),"https".equals(url.getProtocol()),conn.getHeaderField(i)); if(cookies!=null) { for(int j=0;j<cookies.length;j++) { try { cookieSpec.validate(url.getHost(),getPort(url),url.getPath(),"https".equals(url.getProtocol()),cookies[j]); getHttpState(session).addCookie(cookies[j]); if(session!=null && "JSESSIONID".equals(cookies[j].getName())) { session.setId(cookies[j].getName()+"="+cookies[j].getValue()); } } catch (MalformedCookieException e) { log_.log(LogLevel.WARNING,"cookie rejected: \""+cookieSpec.formatCookie(cookies[j])+"\". "+e.getMessage()); } } } } catch (MalformedCookieException e) { log_.log(LogLevel.WARNING,"Invalid cookie header: \""+conn.getHeaderField(i)+"\". "+e.getMessage()); } } } }
if (LOG.isDebugEnabled()) { LOG.debug("Cookie accepted: \"" + parser.formatCookie(cookie) + "\""); LOG.warn("Cookie rejected: \"" + parser.formatCookie(cookie) + "\". " + e.getMessage());
String s = matcher.formatCookie(cookies[i]); getRequestHeaderGroup().addHeader(new Header(HttpHeader.COOKIE, s, true));