@Override public String toString() { return "Cookie " + getName() + "=" + getValue() + " ; " + getVersion() + " " + getPath() + " " + getDomain(); }
@Nonnull protected String generateCookieString(final Cookie cookie) { final StringBuffer sb = new StringBuffer(); ServerCookie.appendCookieValue (sb, cookie.getVersion(), cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie.getComment(), cookie.getMaxAge(), cookie.getSecure(), true); final String setSessionCookieHeader = sb.toString(); return setSessionCookieHeader; }
/** * Transforms a {@link ServerCookie} (from Apache Tomcat) into a {@link Cookie} * (from commons httpclient). Both types of Cookie hold the same data but the * {@link ServerCookie} is the type that you get when parsing cookies as a * Server. */ protected static Cookie transformServerCookieToClientCookie(ServerCookie serverCookie) { Cookie clientCookie = new Cookie(serverCookie.getDomain().toString(), serverCookie.getName() .toString(), serverCookie.getValue().toString(), serverCookie.getPath().toString(), serverCookie.getMaxAge(), serverCookie.getSecure()); clientCookie.setComment(serverCookie.getComment().toString()); clientCookie.setVersion(serverCookie.getVersion()); return clientCookie; }
sc.getDomain().setBytes( bytes, valueStart, valueEnd-valueStart); sc.getPath().setBytes( bytes, valueStart, valueEnd-valueStart); sc.setVersion( version ); sc.getName().setBytes( bytes, nameStart, nameEnd-nameStart); sc.getValue().setBytes( bytes, valueStart, valueEnd-valueStart); if (isQuoted) { ServerCookie.unescapeDoubleQuotes( sc.getValue().getByteChunk()); sc.getValue().setString("");
/** * Recycle. */ public void recycle() { for( int i=0; i< cookieCount; i++ ) { if( scookies[i]!=null ) scookies[i].recycle(); } cookieCount=0; unprocessed=true; }
/** Register a new, initialized cookie. Cookies are recycled, and * most of the time an existing ServerCookie object is returned. * The caller can set the name/value and attributes for the cookie */ private ServerCookie addCookie() { if( cookieCount >= scookies.length ) { ServerCookie scookiesTmp[]=new ServerCookie[2*cookieCount]; System.arraycopy( scookies, 0, scookiesTmp, 0, cookieCount); scookies=scookiesTmp; } ServerCookie c = scookies[cookieCount]; if( c==null ) { c= new ServerCookie(); scookies[cookieCount]=c; } cookieCount++; return c; }
sc.getDomain().setBytes( bytes, valueStart, valueEnd-valueStart); sc.getPath().setBytes( bytes, valueStart, valueEnd-valueStart); sc.setVersion( version ); sc.getName().setBytes( bytes, nameStart, nameEnd-nameStart); sc.getValue().setBytes( bytes, valueStart, valueEnd-valueStart); if (isQuoted) { unescapeDoubleQuotes(sc.getValue().getByteChunk()); sc.getValue().setString("");
if (scookie.getName().equals(sessionCookieName)) { convertMB(scookie.getValue()); request.setRequestedSessionId (scookie.getValue().toString()); request.setRequestedSessionCookie(true); request.setRequestedSessionURL(false); if (!request.isRequestedSessionIdValid()) { convertMB(scookie.getValue()); request.setRequestedSessionId (scookie.getValue().toString());
/** * Recycle. */ public void recycle() { for( int i=0; i< cookieCount; i++ ) { if( scookies[i]!=null ) scookies[i].recycle(); } cookieCount=0; unprocessed=true; }
/** Register a new, initialized cookie. Cookies are recycled, and * most of the time an existing ServerCookie object is returned. * The caller can set the name/value and attributes for the cookie */ private ServerCookie addCookie() { if( cookieCount >= scookies.length ) { ServerCookie scookiesTmp[]=new ServerCookie[2*cookieCount]; System.arraycopy( scookies, 0, scookiesTmp, 0, cookieCount); scookies=scookiesTmp; } ServerCookie c = scookies[cookieCount]; if( c==null ) { c= new ServerCookie(); scookies[cookieCount]=c; } cookieCount++; return c; }
@Override public String toString() { return "Cookie " + getName() + "=" + getValue() + " ; " + getVersion() + " " + getPath() + " " + getDomain(); }
sc.getDomain().setBytes( bytes, valueStart, valueEnd-valueStart); sc.getPath().setBytes( bytes, valueStart, valueEnd-valueStart); sc.setVersion( version ); sc.getName().setBytes( bytes, nameStart, nameEnd-nameStart); sc.getValue().setBytes( bytes, valueStart, valueEnd-valueStart); if (isQuoted) { unescapeDoubleQuotes(sc.getValue().getByteChunk()); sc.getValue().setString("");
if (scookie.getName().equals(Globals.SESSION_COOKIE_NAME)) { convertMB(scookie.getValue()); request.setRequestedSessionId (scookie.getValue().toString()); request.setRequestedSessionCookie(true); request.setRequestedSessionURL(false); if (!request.isRequestedSessionIdValid()) { convertMB(scookie.getValue()); request.setRequestedSessionId (scookie.getValue().toString());
public Object run(){ ServerCookie.appendCookieValue (sb, cookie.getVersion(), cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie.getComment(), cookie.getMaxAge(), cookie.getSecure()); return null; } });
/** * Recycle. */ public void recycle() { for( int i=0; i< cookieCount; i++ ) { if( scookies[i]!=null ) { scookies[i].recycle(); } } cookieCount=0; unprocessed=true; }
/** Register a new, unitialized cookie. Cookies are recycled, and * most of the time an existing ServerCookie object is returned. * The caller can set the name/value and attributes for the cookie */ public ServerCookie addCookie() { if( cookieCount >= scookies.length ) { ServerCookie scookiesTmp[]=new ServerCookie[2*cookieCount]; System.arraycopy( scookies, 0, scookiesTmp, 0, cookieCount); scookies=scookiesTmp; } ServerCookie c = scookies[cookieCount]; if( c==null ) { c= new ServerCookie(); scookies[cookieCount]=c; } cookieCount++; return c; }
@Override public String toString() { return "Cookie " + getName() + "=" + getValue() + " ; " + getVersion() + " " + getPath() + " " + getDomain(); }
sc.getDomain().setBytes( bytes, valueStart, valueEnd-valueStart); sc.getPath().setBytes( bytes, valueStart, valueEnd-valueStart); sc.setVersion( version ); sc.getName().setBytes( bytes, nameStart, nameEnd-nameStart); sc.getValue().setBytes( bytes, valueStart, valueEnd-valueStart); if (isQuoted) { unescapeDoubleQuotes(sc.getValue().getByteChunk()); sc.getValue().setString("");
/** * Parse session id in URL. */ protected void parseSessionCookiesId(org.apache.coyote.Request req, Request request) { // Parse session id from cookies Cookies serverCookies = req.getCookies(); int count = serverCookies.getCookieCount(); if (count <= 0) return; for (int i = 0; i < count; i++) { ServerCookie scookie = serverCookies.getCookie(i); if (scookie.getName().equals(Globals.SESSION_COOKIE_NAME)) { // Override anything requested in the URL if (!request.isRequestedSessionIdFromCookie()) { // Accept only the first session id cookie convertMB(scookie.getValue()); request.setRequestedSessionId(scookie.getValue().toString()); request.setRequestedSessionCookie(true); request.setRequestedSessionURL(false); } else { if (!isSessionIdValid(request, request.getRequestedSessionId())) { // Replace the session id until one is valid convertMB(scookie.getValue()); request.setRequestedSessionId(scookie.getValue().toString()); } } } } }