Index: modules/utils/src/main/java/com/sun/grizzly/tcp/Response.java =================================================================== --- modules/utils/src/main/java/com/sun/grizzly/tcp/Response.java (revision 2369) +++ modules/utils/src/main/java/com/sun/grizzly/tcp/Response.java (working copy) @@ -701,6 +701,11 @@ headers.removeHeader("Set-Cookie", Constants.SESSION_COOKIE_NAME); } + public boolean containsSessionCookie() { + int ret = headers.findHeader("Set-Cookie", Constants.SESSION_COOKIE_NAME + "="); + return ret != -1; + } + /** * Set the underlying {@link SocketChannel} */ Index: modules/utils/src/main/java/com/sun/grizzly/util/http/MimeHeaders.java =================================================================== --- modules/utils/src/main/java/com/sun/grizzly/util/http/MimeHeaders.java (revision 2369) +++ modules/utils/src/main/java/com/sun/grizzly/util/http/MimeHeaders.java (working copy) @@ -227,6 +227,26 @@ return -1; } + /** + * Finds the header with the given name whose value starts with the + * given string. + * + * @param name The name of the header to search for + * @param str The string to search the header value for + * @return position of the string in the header value; -1 if not found + */ + public int findHeader( String name, String str ) { + for (int i = 0; i < count; i++) { + if (headers[i].getName(). equalsIgnoreCase(name) + && getValue(i) != null + && getValue(i).toString() != null + && getValue(i).startsWith(str)) { + return i; + } + } + return -1; + } + // -------------------- -------------------- /**