Author: jfrederic.clere(a)jboss.com
Date: 2010-08-18 12:27:58 -0400 (Wed, 18 Aug 2010)
New Revision: 1537
Modified:
sandbox/webapps/src/MyCookies.java
Log:
test for issue 1183773.
Modified: sandbox/webapps/src/MyCookies.java
===================================================================
--- sandbox/webapps/src/MyCookies.java 2010-08-18 15:14:24 UTC (rev 1536)
+++ sandbox/webapps/src/MyCookies.java 2010-08-18 16:27:58 UTC (rev 1537)
@@ -61,8 +61,8 @@
HttpServletResponse response)
throws IOException, ServletException
{
+ String action = request.getParameter("test");
-
response.setContentType("text/html");
Enumeration names = request.getHeaderNames();
@@ -79,6 +79,11 @@
String title = "sessions.title";
out.println("<title>" + title + "</title>");
+
+ if (action != null && action.compareToIgnoreCase("meta") == 0)
{
+ out.println("<meta http-equiv=\"set-cookie\"
content=\"RH-Test-Cookie=testcookie::aftercolon; expires=Fri, 31 Dec 2010 23:59:59
GMT; path=/\">");
+ }
+
out.println("</head>");
out.println("<body>");
@@ -87,7 +92,7 @@
/*
* create the name/value pairs
*/
- Test[] mytest = new Test[13];
+ Test[] mytest = new Test[14];
StringBuffer buffer = new StringBuffer();
buffer.append("<xml><name>John Doe</name><age
attribute=\"this breaks\">45</age></xml>");
mytest[0] = new Test("xmlCookie",buffer.toString());
@@ -105,6 +110,7 @@
mytest[11] = new Test("Quoted9","I am \r\n testing...");
// mytest[12] = new Test("Equal","P=I am =
Equal\n...&A=46164");
mytest[12] = new
Test("Equal","P=14662+26891+20253+28934+15744+22344+43641+13624+28974+15489+35353+47293+14662+26891+20253+28934+28596+27065+28648+22542&L=60766+6654+19186+43352+58684+61932+37440+23672&A=46164+56607+41861+51054&S=46164+56607+41861+51054&T=23922+55384+5601+51160+38643+36027+49212+16265+61873+55260+16665+53468&X=12795+26412+43746+37688&U=47207+55215+24609+16813+46164+56607+41861+51054&D=36080+20612+7827+5411+35188+54326+19636+46695+27748+646+37165+34626&C=11656+47389+63649+49622+46164+56607+41861+51054&");
+ mytest[13] = new Test("RH-Test-Cookie" , "testcookie::aftercolon;
expires=Fri, 31 Dec 2010 23:59:59 GMT; path=/");
Cookie[] cookies = request.getCookies();
if(cookies != null) {
for(int i=0;i<cookies.length;i++) {
@@ -116,17 +122,19 @@
}
/* create the cookies */
- for (int i=0; i<mytest.length; i++) {
- try {
- Cookie cookie = CreateCookie(mytest[i]);
+ if (action == null || (action != null &&
action.compareToIgnoreCase("meta") != 0)) {
+ for (int i=0; i<mytest.length; i++) {
+ try {
+ Cookie cookie = CreateCookie(mytest[i]);
+ response.addCookie(cookie);
+ } catch (Exception ex) {
+ out.println("Cookie test: " + i + "
Failed<br>");
+ }
+ }
+ Cookie cookie = new Cookie("commented", "commented
cookie");
+ cookie.setComment("This is a comment");
response.addCookie(cookie);
- } catch (Exception ex) {
- out.println("Cookie test: " + i + " Failed<br>");
- }
}
- Cookie cookie = new Cookie("commented", "commented cookie");
- cookie.setComment("This is a comment");
- response.addCookie(cookie);
out.println("<hr>");
Show replies by date