JBossWeb SVN: r543 - trunk.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-03-25 11:43:14 -0400 (Tue, 25 Mar 2008)
New Revision: 543
Modified:
trunk/build.properties.default
trunk/build.xml
Log:
- Remove tomcat-native.tgz from the build.
Modified: trunk/build.properties.default
===================================================================
--- trunk/build.properties.default 2008-03-25 15:42:59 UTC (rev 542)
+++ trunk/build.properties.default 2008-03-25 15:43:14 UTC (rev 543)
@@ -42,11 +42,6 @@
jdt.jar=${jdt.lib}/org.eclipse.jdt.core_3.3.1.v_780_R33x.jar
jdt.loc=http://www.eclipse.org/downloads/download.php?file=/eclipse/downl...
-# ----- Tomcat native library -----
-tomcat-native.home=${base.path}/tomcat-native-1.1.12
-tomcat-native.tar.gz=${tomcat-native.home}/tomcat-native.tar.gz
-tomcat-native.loc=${base-tomcat.loc}/tomcat-connectors/native/tomcat-native-1.1.12-src.tar.gz
-
# ----- Commons DBCP, version 1.1 or later -----
commons-dbcp.version=1.2.2
commons-dbcp.home=${base.path}/commons-dbcp-1.2.2-src
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2008-03-25 15:42:59 UTC (rev 542)
+++ trunk/build.xml 2008-03-25 15:43:14 UTC (rev 543)
@@ -528,9 +528,6 @@
<target name="deploy" depends="build-only,build-docs">
- <copy tofile="${tomcat.build}/bin/tomcat-native.tar.gz"
- file="${tomcat-native.tar.gz}" />
-
<copy todir="${tomcat.build}/bin" file="${commons-daemon.jar}" />
<copy todir="${tomcat.build}/bin" file="${commons-daemon.jsvc.tar.gz}" />
@@ -670,12 +667,6 @@
<target name="download"
description="Builds and download dependent components">
- <antcall target="downloadfile">
- <param name="sourcefile" value="${tomcat-native.loc}"/>
- <param name="destfile" value="${tomcat-native.tar.gz}"/>
- <param name="destdir" value="${tomcat-native.home}"/>
- </antcall>
-
<antcall target="downloadgz">
<param name="sourcefile" value="${commons-daemon.loc}"/>
<param name="destfile" value="${commons-daemon.jar}"/>
16 years, 9 months
JBossWeb SVN: r542 - trunk/webapps/docs.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-03-25 11:42:59 -0400 (Tue, 25 Mar 2008)
New Revision: 542
Modified:
trunk/webapps/docs/changelog.xml
Log:
Missing in r541.
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-03-25 15:38:51 UTC (rev 541)
+++ trunk/webapps/docs/changelog.xml 2008-03-25 15:42:59 UTC (rev 542)
@@ -37,6 +37,9 @@
<subsection name="Coyote">
<changelog>
<fix>
+ Fix for JBWEB-105. (jfclere)
+ </fix>
+ <fix>
Better fix for cookie path quoting scenario. (markt)
</fix>
<fix>
16 years, 9 months
JBossWeb SVN: r541 - trunk/java/org/apache/tomcat/util/http.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-03-25 11:38:51 -0400 (Tue, 25 Mar 2008)
New Revision: 541
Modified:
trunk/java/org/apache/tomcat/util/http/Parameters.java
Log:
Fix for JBWEB-105.
Modified: trunk/java/org/apache/tomcat/util/http/Parameters.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/Parameters.java 2008-03-25 14:49:56 UTC (rev 540)
+++ trunk/java/org/apache/tomcat/util/http/Parameters.java 2008-03-25 15:38:51 UTC (rev 541)
@@ -503,17 +503,13 @@
public void processParameters( MessageBytes data, String encoding ) {
if( data==null || data.isNull() || data.getLength() <= 0 ) return;
- if( data.getType() == MessageBytes.T_BYTES ) {
- ByteChunk bc=data.getByteChunk();
- processParameters( bc.getBytes(), bc.getOffset(),
- bc.getLength(), encoding);
- } else {
- if (data.getType()!= MessageBytes.T_CHARS )
- data.toChars();
- CharChunk cc=data.getCharChunk();
- processParameters( cc.getChars(), cc.getOffset(),
- cc.getLength());
+ System.out.println("Parameters.processParameters: " + data.getType());
+ if (data.getType() != MessageBytes.T_BYTES) {
+ data.toBytes();
}
+ ByteChunk bc=data.getByteChunk();
+ processParameters( bc.getBytes(), bc.getOffset(),
+ bc.getLength(), encoding);
}
/** Debug purpose
16 years, 9 months
JBossWeb SVN: r540 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-03-25 10:49:56 -0400 (Tue, 25 Mar 2008)
New Revision: 540
Modified:
trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
trunk/webapps/docs/changelog.xml
Log:
- Allow specifying a default value for property lookup.
Modified: trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
===================================================================
--- trunk/java/org/apache/tomcat/util/IntrospectionUtils.java 2008-03-25 08:17:56 UTC (rev 539)
+++ trunk/java/org/apache/tomcat/util/IntrospectionUtils.java 2008-03-25 14:49:56 UTC (rev 540)
@@ -498,7 +498,15 @@
prev = value.length();
continue;
}
- String n = value.substring(pos + 2, endName);
+ int endName2 = value.indexOf(':', pos);
+ String n = null;
+ String d = null;
+ if (endName2 > 0 && endName2 < endName) {
+ n = value.substring(pos + 2, endName2);
+ d = value.substring(endName2 + 1, endName);
+ } else {
+ n = value.substring(pos + 2, endName);
+ }
String v = null;
if (staticProp != null) {
v = (String) ((Hashtable) staticProp).get(n);
@@ -511,8 +519,13 @@
}
}
}
- if (v == null)
- v = "${" + n + "}";
+ if (v == null) {
+ if (d == null) {
+ v = "${" + n + "}";
+ } else {
+ v = d;
+ }
+ }
sb.append(v);
prev = endName + 1;
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-03-25 08:17:56 UTC (rev 539)
+++ trunk/webapps/docs/changelog.xml 2008-03-25 14:49:56 UTC (rev 540)
@@ -48,6 +48,9 @@
<fix>
Comet state recycling. (remm)
</fix>
+ <update>
+ Add support for specifying defaults for properties (format is ${property:default}). (remm)
+ </update>
</changelog>
</subsection>
</section>
16 years, 9 months
JBossWeb SVN: r539 - in trunk/res/procrun: amd64 and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2008-03-25 04:17:56 -0400 (Tue, 25 Mar 2008)
New Revision: 539
Modified:
trunk/res/procrun/amd64/jbossweb.exe
trunk/res/procrun/amd64/jbosswebw.exe
trunk/res/procrun/ia64/jbossweb.exe
trunk/res/procrun/ia64/jbosswebw.exe
trunk/res/procrun/jbossweb.exe
trunk/res/procrun/jbosswebw.exe
Log:
Update latest binaries
Modified: trunk/res/procrun/amd64/jbossweb.exe
===================================================================
(Binary files differ)
Modified: trunk/res/procrun/amd64/jbosswebw.exe
===================================================================
(Binary files differ)
Modified: trunk/res/procrun/ia64/jbossweb.exe
===================================================================
(Binary files differ)
Modified: trunk/res/procrun/ia64/jbosswebw.exe
===================================================================
(Binary files differ)
Modified: trunk/res/procrun/jbossweb.exe
===================================================================
(Binary files differ)
Modified: trunk/res/procrun/jbosswebw.exe
===================================================================
(Binary files differ)
16 years, 9 months
JBossWeb SVN: r538 - in trunk: test/webapps/reader and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-03-24 13:51:46 -0400 (Mon, 24 Mar 2008)
New Revision: 538
Added:
trunk/test/webapps/reader/index.html
trunk/test/webapps/reader/test.jsp
Removed:
trunk/test/webapps/reader/index.jsp
trunk/test/webapps/reader/indexAscii.jsp
Modified:
trunk/build.properties.default
trunk/test/webapps/reader/read.jsp
trunk/test/webapps/reader/readCharB.jsp
trunk/test/webapps/reader/readLine.jsp
Log:
- New version of the test.
Modified: trunk/build.properties.default
===================================================================
--- trunk/build.properties.default 2008-03-23 12:58:58 UTC (rev 537)
+++ trunk/build.properties.default 2008-03-24 17:51:46 UTC (rev 538)
@@ -12,7 +12,7 @@
# ----- Version Control Flags -----
version.major=2
version.minor=1
-version.build=0
+version.build=1
version.patch=0
version.tag=SNAPSHOT
Added: trunk/test/webapps/reader/index.html
===================================================================
--- trunk/test/webapps/reader/index.html (rev 0)
+++ trunk/test/webapps/reader/index.html 2008-03-24 17:51:46 UTC (rev 538)
@@ -0,0 +1,23 @@
+<HTML>
+<HEAD>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<TITLE>request#getReader test.</TITLE>
+</HEAD>
+<BODY>
+<FORM method="GET" action="test.jsp" >
+Characters size:<input type="text" name="size" value="8192" /><BR>
+Use MultiByte Character:
+<input value="false" type="radio" checked name="ascii"/>yes
+<input value="true" type="radio" name="ascii"/>no
+<BR>
+<input type="submit" value="send" /></FORM>
+<HR>
+Note:
+ The real post body will be added followings:<BR>
+<ul>
+<li>multipart boundary.
+<li>Content-Disposition: form-data; name="[text form area name]"
+<li>Some CR/LFs.
+</ul>
+</BODY>
+</HTML>
Deleted: trunk/test/webapps/reader/index.jsp
===================================================================
--- trunk/test/webapps/reader/index.jsp 2008-03-23 12:58:58 UTC (rev 537)
+++ trunk/test/webapps/reader/index.jsp 2008-03-24 17:51:46 UTC (rev 538)
@@ -1,42 +0,0 @@
-<%@ page pageEncoding="UTF-8"%>
-<%@ page import="java.io.*"%>
-<HTML>
-<HEAD>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<TITLE>request#getReader test.</TITLE>
-</HEAD>
-<BODY>
-
-<%!
- int charSize = 8193;
- char character = 'あ';
-%>
-
-<%
-response.setContentType("text/html; charset=UTF-8");
-StringBuffer sb = new StringBuffer(charSize);
-for(int i=0 ; i < charSize ; i++){
- sb.append(character);
-}
-%>
-
-<FORM method="POST" action="readLine.jsp" enctype="text/plain">
-request#getReader()#readLine test<BR>
-<input type="text" name="thetext" value="<%= sb.toString()+sb.toString()+sb.toString() %>"/>
-<input type="submit" value="send" />
-</FORM>
-
-<FORM method="POST" action="read.jsp" enctype="text/plain">
-request#getReader()#read() test<BR>
-<input type="text" name="thetext" value="<%= sb.toString() %>"/>
-<input type="submit" value="send" />
-</FORM>
-
-<FORM method="POST" action="readCharB.jsp" enctype="text/plain">
-request#getReader()#read(char[1]) test<BR>
-<input type="text" name="thetext" value="<%= sb.toString() %>"/>
-<input type="submit" value="send" />
-</FORM>
-
-</BODY>
-</HTML>
\ No newline at end of file
Deleted: trunk/test/webapps/reader/indexAscii.jsp
===================================================================
--- trunk/test/webapps/reader/indexAscii.jsp 2008-03-23 12:58:58 UTC (rev 537)
+++ trunk/test/webapps/reader/indexAscii.jsp 2008-03-24 17:51:46 UTC (rev 538)
@@ -1,42 +0,0 @@
-<%@ page pageEncoding="UTF-8"%>
-<%@ page import="java.io.*"%>
-<HTML>
-<HEAD>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<TITLE>request#getReader test.</TITLE>
-</HEAD>
-<BODY>
-
-<%!
- int charSize = 8193;
- char character = 'a';
-%>
-
-<%
-response.setContentType("text/html; charset=UTF-8");
-StringBuffer sb = new StringBuffer(charSize);
-for(int i=0 ; i < charSize ; i++){
- sb.append(character);
-}
-%>
-
-<FORM method="POST" action="readLine.jsp" enctype="text/plain">
-request#getReader()#readLine test<BR>
-<input type="text" name="thetext" value="<%= sb.toString()+sb.toString()+sb.toString() %>"/>
-<input type="submit" value="send" />
-</FORM>
-
-<FORM method="POST" action="read.jsp" enctype="text/plain">
-request#getReader()#read() test<BR>
-<input type="text" name="thetext" value="<%= sb.toString() %>"/>
-<input type="submit" value="send" />
-</FORM>
-
-<FORM method="POST" action="readCharB.jsp" enctype="text/plain">
-request#getReader()#read(char[1]) test<BR>
-<input type="text" name="thetext" value="<%= sb.toString() %>"/>
-<input type="submit" value="send" />
-</FORM>
-
-</BODY>
-</HTML>
\ No newline at end of file
Modified: trunk/test/webapps/reader/read.jsp
===================================================================
--- trunk/test/webapps/reader/read.jsp 2008-03-23 12:58:58 UTC (rev 537)
+++ trunk/test/webapps/reader/read.jsp 2008-03-24 17:51:46 UTC (rev 538)
@@ -10,34 +10,43 @@
<HR>
<%
- request.setCharacterEncoding("UTF-8");
- response.setContentType("text/html; charset=UTF-8");
- BufferedReader reader = request.getReader();
- StringBuffer sb = new StringBuffer();
+String expected = (String) session.getAttribute("expected");
+String formName = (String) session.getAttribute("formName");
+request.setCharacterEncoding("UTF-8");
+response.setContentType("text/html; charset=UTF-8");
+BufferedReader reader = request.getReader();
+StringBuffer sb = new StringBuffer();
read(reader, sb);
- // TODO check if the read data is correct.
//outln(out,sb.toString());
- outln(out,"Content-Type:" + request.getContentType());
- outln(out,"Character Encoding:" + request.getCharacterEncoding());
- outln(out, "Content-Length:"+ request.getContentLength());
- outln(out, "read:" + sb.length()); // includes form text area name "thetext="
-
+
+ String boundary = null;
+ String contentType = request.getContentType();
+ if(contentType != null){
+ int delim = contentType.indexOf("boundary=");
+ boundary = contentType.substring(delim+9).trim();
+ }
+ expected = "--"+boundary+"\r\nContent-Disposition: form-data; name=\""+formName+"\"\r\n\r\n"+expected+"\r\n--"+boundary+"--\r\n";
+
+ outln(out, "Content-Type:" + request.getContentType());
+ outln(out, "Character Encoding:" + request.getCharacterEncoding());
+ outln(out, "Content-Length:" + request.getContentLength());
+ outln(out, "expected:" + expected.length());
+ outln(out, "real read:" + sb.length());
+ outln(out, "isSame:" + (sb.toString().equals(expected)));
%>
</BODY>
</HTML>
-<%!
- void read(BufferedReader br, StringBuffer sb) throws IOException{
- int read = 0;
- while((read = br.read())!= -1){
- sb.append((char)read);
- }
+<%!void read(BufferedReader br, StringBuffer sb) throws IOException {
+ int read = 0;
+ while ((read = br.read()) != -1) {
+ sb.append((char) read);
+ }
}
- void outln(JspWriter out, String str) throws IOException{
- out.println(str+"<BR>");
- System.out.println(str);
- }
-%>
\ No newline at end of file
+ void outln(JspWriter out, String str) throws IOException {
+ out.println(str + "<BR>");
+ System.out.println(str);
+ }%>
Modified: trunk/test/webapps/reader/readCharB.jsp
===================================================================
--- trunk/test/webapps/reader/readCharB.jsp 2008-03-23 12:58:58 UTC (rev 537)
+++ trunk/test/webapps/reader/readCharB.jsp 2008-03-24 17:51:46 UTC (rev 538)
@@ -10,37 +10,45 @@
<HR>
<%
- request.setCharacterEncoding("UTF-8");
- response.setContentType("text/html; charset=UTF-8");
- BufferedReader reader = request.getReader();
- StringBuffer sb = new StringBuffer();
+String expected = (String) session.getAttribute("expected");
+String formName = (String) session.getAttribute("formName");
+request.setCharacterEncoding("UTF-8");
+response.setContentType("text/html; charset=UTF-8");
+BufferedReader reader = request.getReader();
+StringBuffer sb = new StringBuffer();
readCharB(reader, sb, 1);
+
+ //outln(out,sb.toString());
- // TODO check if the read data is correct.
+ String boundary = null;
+ String contentType = request.getContentType();
+ if(contentType != null){
+ int delim = contentType.indexOf("boundary=");
+ boundary = contentType.substring(delim+9).trim();
+ }
+ expected = "--"+boundary+"\r\nContent-Disposition: form-data; name=\""+formName+"\"\r\n\r\n"+expected+"\r\n--"+boundary+"--\r\n";
- //outln(out,sb.toString());
- outln(out,"Content-Type:" + request.getContentType());
- outln(out,"Character Encoding:" + request.getCharacterEncoding());
- outln(out, "Content-Length:"+ request.getContentLength());
- outln(out, "read:" + sb.length()); // includes form text area name "thetext=" and last CR/LF
-
+ outln(out, "Content-Type:" + request.getContentType());
+ outln(out, "Character Encoding:" + request.getCharacterEncoding());
+ outln(out, "Content-Length:" + request.getContentLength());
+ outln(out, "expected:" + expected.length());
+ outln(out, "real read:" + sb.length());
+ outln(out, "isSame:" + (sb.toString().equals(expected)));
%>
</BODY>
</HTML>
-<%!
-
- void readCharB(BufferedReader br, StringBuffer sb, int bufferSize) throws IOException{
- char[] buf = new char[bufferSize];
- int read = 0;
- while((read = br.read(buf))!= -1){
- sb.append(buf, 0, read);
- }
- }
-
- void outln(JspWriter out, String str) throws IOException{
- out.println(str+"<BR>");
- System.out.println(str);
- }
-%>
\ No newline at end of file
+<%!void readCharB(BufferedReader br, StringBuffer sb, int bufferSize)
+ throws IOException {
+ char[] buf = new char[bufferSize];
+ int read = 0;
+ while ((read = br.read(buf)) != -1) {
+ sb.append(buf, 0, read);
+ }
+ }
+
+ void outln(JspWriter out, String str) throws IOException {
+ out.println(str + "<BR>");
+ System.out.println(str);
+ }%>
Modified: trunk/test/webapps/reader/readLine.jsp
===================================================================
--- trunk/test/webapps/reader/readLine.jsp 2008-03-23 12:58:58 UTC (rev 537)
+++ trunk/test/webapps/reader/readLine.jsp 2008-03-24 17:51:46 UTC (rev 538)
@@ -10,36 +10,43 @@
<HR>
<%
+ String expected = (String) session.getAttribute("expected");
+ String formName = (String) session.getAttribute("formName");
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");
BufferedReader reader = request.getReader();
StringBuffer sb = new StringBuffer();
-
+
readLine(reader, sb);
+
+ //outln(out,sb.toString());
- // TODO check if the read data is correct.
+ String boundary = null;
+ String contentType = request.getContentType();
+ if(contentType != null){
+ int delim = contentType.indexOf("boundary=");
+ boundary = contentType.substring(delim+9).trim();
+ }
+ expected = "--"+boundary+"\r\nContent-Disposition: form-data; name=\""+formName+"\"\r\n\r\n"+expected+"\r\n--"+boundary+"--\r\n";
- //outln(out,sb.toString());
- outln(out,"Content-Type:" + request.getContentType());
- outln(out,"Character Encoding:" + request.getCharacterEncoding());
- outln(out, "Content-Length:"+ request.getContentLength());
- outln(out, "read:" + sb.length()); // includes form text area name "thetext=" and last CR/LF
-
+ outln(out, "Content-Type:" + request.getContentType());
+ outln(out, "Character Encoding:" + request.getCharacterEncoding());
+ outln(out, "Content-Length:" + request.getContentLength());
+ outln(out, "expected:" + expected.length());
+ outln(out, "real read:" + sb.length());
+ outln(out, "isSame:" + (sb.toString().equals(expected)));
%>
</BODY>
</HTML>
-<%!
+<%!void readLine(BufferedReader br, StringBuffer sb) throws IOException {
+ String read = null;
+ while ((read = br.readLine()) != null) {
+ sb.append(read+"\r\n");
+ }
+ }
- void readLine(BufferedReader br, StringBuffer sb) throws IOException{
- String read = null;
- while((read = br.readLine())!=null){
- sb.append(read);// CR/LF lost.
- }
- }
-
- void outln(JspWriter out, String str) throws IOException{
- out.println(str+"<BR>");
- System.out.println(str);
- }
-%>
\ No newline at end of file
+ void outln(JspWriter out, String str) throws IOException {
+ out.println(str + "<BR>");
+ System.out.println(str);
+ }%>
Added: trunk/test/webapps/reader/test.jsp
===================================================================
--- trunk/test/webapps/reader/test.jsp (rev 0)
+++ trunk/test/webapps/reader/test.jsp 2008-03-24 17:51:46 UTC (rev 538)
@@ -0,0 +1,64 @@
+<%@ page pageEncoding="UTF-8"%>
+<%@ page import="java.io.*"%>
+<HTML>
+<HEAD>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<TITLE>request#getReader test.</TITLE>
+</HEAD>
+<BODY>
+
+<%!static char JP[] = "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよわゐゑをん"
+ .toCharArray();
+
+ static char ASCII[] = "abcdefghijklmnopqrstuvwxyz".toCharArray();
+
+ static String formName = "n";%>
+
+<%
+ response.setContentType("text/html; charset=UTF-8");
+
+ int size = 8192;
+ String sizeS = request.getParameter("size");
+ if (sizeS != null) {
+ size = Integer.parseInt(sizeS);
+ }
+
+ boolean isAscii = true;
+ String ascii = request.getParameter("ascii");
+ if (ascii != null) {
+ isAscii = Boolean.parseBoolean(ascii);
+ }
+
+ char[] chars = isAscii ? ASCII : JP;
+
+ StringBuffer sb = new StringBuffer(size + formName.length() + 1
+ + chars.length);
+ while (sb.length() < size) {
+ sb.append(chars);
+ }
+ if (sb.length() > size) {
+ sb.delete(size, sb.length());
+ }
+%>
+
+<FORM method="POST" action="<%= response.encodeURL("readLine.jsp") %>" enctype="multipart/form-data">
+request#getReader()#readLine test<BR>
+<input type="text" name="<%= formName %>" value="<%= sb.toString() %>" />
+<input type="submit" value="send" /></FORM>
+
+<FORM method="POST" action="<%= response.encodeURL("read.jsp") %>" enctype="multipart/form-data">
+request#getReader()#read() test<BR>
+<input type="text" name="<%= formName %>" value="<%= sb.toString() %>" />
+<input type="submit" value="send" /></FORM>
+
+<FORM method="POST" action="<%= response.encodeURL("readCharB.jsp") %>" enctype="multipart/form-data" >
+request#getReader()#read(char[1]) test<BR>
+<input type="text" name="<%= formName %>" value="<%= sb.toString() %>" />
+<input type="submit" value="send" /></FORM>
+
+<%
+ session.setAttribute("expected", sb.toString());
+ session.setAttribute("formName", formName);
+%>
+</BODY>
+</HTML>
16 years, 9 months
JBossWeb SVN: r537 - in trunk/test/java: org and 5 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-03-23 08:58:58 -0400 (Sun, 23 Mar 2008)
New Revision: 537
Added:
trunk/test/java/org/
trunk/test/java/org/apache/
trunk/test/java/org/apache/jboss/
trunk/test/java/org/apache/jboss/web/
trunk/test/java/org/apache/jboss/web/comet/
trunk/test/java/org/apache/jboss/web/comet/CometServletTest1.java
trunk/test/java/org/apache/jboss/web/rewrite/
trunk/test/java/org/apache/jboss/web/rewrite/RewriteTestCase.java
Log:
- Reorganize tests.
Added: trunk/test/java/org/apache/jboss/web/comet/CometServletTest1.java
===================================================================
--- trunk/test/java/org/apache/jboss/web/comet/CometServletTest1.java (rev 0)
+++ trunk/test/java/org/apache/jboss/web/comet/CometServletTest1.java 2008-03-23 12:58:58 UTC (rev 537)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.jboss.web.comet;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+
+import org.jboss.web.comet.CometEvent;
+import org.jboss.web.comet.CometProcessor;
+
+public class CometServletTest1 extends HttpServlet implements CometProcessor {
+
+ int count = 0;
+
+ public void event(CometEvent event) throws IOException, ServletException {
+ System.out.println("[" + event.getHttpServletRequest().getSession(true).getId() + "] " + event.getType());
+ switch (event.getType()) {
+ case BEGIN:
+ //event.suspend();
+ break;
+ case END:
+ break;
+ case ERROR:
+ event.close();
+ break;
+ case EVENT:
+ ServletOutputStream os = event.getHttpServletResponse().getOutputStream();
+ // Using while (true): Not checking if the connection is available to writing immediately
+ // will cause the write to be performed in blocking mode.
+ // boolean b = true;
+ // while (b) {
+ while (event.ready()) {
+ if (count % 100 == 0) {
+ os.println((count++) + " ");
+ } else {
+ os.print((count++) + " ");
+ }
+ }
+ //if (event.ready())
+ // os.flush();
+ break;
+ case READ:
+ ServletInputStream is = event.getHttpServletRequest().getInputStream();
+ // Using while (true): Not checking if input is available will trigger a blocking
+ // read. No other event should be triggered (the current READ event will be in progress
+ // until the read timeouts, which will trigger an ERROR event due to an IOException).
+ // while (true) {
+ while (is.available() > 0) {
+ int c = is.read();
+ if (c > 0) {
+ System.out.print((char) c);
+ } else {
+ System.out.print(c);
+ break;
+ }
+ }
+ System.out.println();
+ break;
+ case TIMEOUT:
+ // This will cause a generic event to be sent to the servlet every time the connection is idle for
+ // a while.
+ event.resume();
+ break;
+ case WRITE:
+ break;
+ }
+ }
+
+}
Added: trunk/test/java/org/apache/jboss/web/rewrite/RewriteTestCase.java
===================================================================
--- trunk/test/java/org/apache/jboss/web/rewrite/RewriteTestCase.java (rev 0)
+++ trunk/test/java/org/apache/jboss/web/rewrite/RewriteTestCase.java 2008-03-23 12:58:58 UTC (rev 537)
@@ -0,0 +1,212 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.jboss.web.rewrite;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class RewriteTestCase extends TestCase {
+
+ protected class TestResolver extends Resolver {
+
+ public String resolve(String key) {
+ return "server_variable_value[" + key + "]";
+ }
+
+ public String resolveHttp(String key) {
+ return "http_header_value[" + key + "]";
+ }
+
+ public String resolveSsl(String key) {
+ return "ssl_property_value[" + key + "]";
+ }
+
+ public boolean resolveResource(int type, String name) {
+ return true;
+ }
+
+ }
+
+ /**
+ * Construct a new instance of this test case.
+ *
+ * @param name Name of the test case
+ */
+ public RewriteTestCase(String name) {
+ super(name);
+ }
+
+ /**
+ * Set up instance variables required by this test case.
+ */
+ public void setUp() {
+ }
+
+ /**
+ * Return the tests included in this test suite.
+ */
+ public static Test suite() {
+ return (new TestSuite(RewriteTestCase.class));
+ }
+
+ /**
+ * Tear down instance variables required by this test case.
+ */
+ public void tearDown() {
+ }
+
+ public void testCanonicalUrl() {
+ Resolver resolver = new TestResolver();
+
+ RewriteRule rule1 = new RewriteRule();
+ rule1.setPatternString("^/~([^/]+)/?(.*)");
+ rule1.setSubstitutionString("/u/$1/$2");
+
+ RewriteRule rule2 = new RewriteRule();
+ rule2.setPatternString("^/([uge])/([^/]+)$");
+ rule2.setSubstitutionString("/$1/$2/");
+
+ RewriteRule[] rules = new RewriteRule[2];
+ rules[0] = rule1;
+ rules[1] = rule2;
+ for (int i = 0; i < rules.length; i++) {
+ rules[i].parse(null);
+ }
+
+ String result = rewriteUrl("/~user/foo/bar", resolver, rules).toString();
+ assertEquals("/u/user/foo/bar", result);
+ result = rewriteUrl("/u/user", resolver, rules).toString();
+ assertEquals("/u/user/", result);
+ }
+
+ public void testCanonicalHostname() {
+ Resolver resolver = new TestResolver();
+
+ RewriteRule rule = new RewriteRule();
+ rule.setPatternString("^/(.*)");
+ rule.setSubstitutionString("http://fully.qualified.domain.name:%{SERVER_PORT}/$1");
+ RewriteRule[] rules = new RewriteRule[1];
+ rules[0] = rule;
+
+ RewriteCond cond1 = new RewriteCond();
+ cond1.setTestString("%{HTTP_HOST}");
+ cond1.setCondPattern("!^fully\\.qualified\\.domain\\.name");
+ cond1.setNocase(true);
+
+ RewriteCond cond2 = new RewriteCond();
+ cond2.setTestString("%{HTTP_HOST}");
+ cond2.setCondPattern("!^$");
+
+ RewriteCond cond3 = new RewriteCond();
+ cond3.setTestString("%{SERVER_PORT}");
+ cond3.setCondPattern("!^80$");
+
+ rule.addCondition(cond1);
+ rule.addCondition(cond2);
+ rule.addCondition(cond3);
+
+ for (int i = 0; i < rules.length; i++) {
+ rules[i].parse(null);
+ }
+
+ String result = rewriteUrl("/foo/bar", resolver, rules).toString();
+ assertEquals("http://fully.qualified.domain.name:server_variable_value[SERVER_PORT]/foo...", result);
+ }
+
+ public void testMovedDocumentRoot() {
+ Resolver resolver = new TestResolver();
+
+ RewriteRule rule = new RewriteRule();
+ rule.setPatternString("^/$");
+ rule.setSubstitutionString("/about/");
+
+ RewriteRule[] rules = new RewriteRule[1];
+ rules[0] = rule;
+ for (int i = 0; i < rules.length; i++) {
+ rules[i].parse(null);
+ }
+
+ String result = rewriteUrl("/", resolver, rules).toString();
+ assertEquals("/about/", result);
+ }
+
+ public void testParsing() {
+ Object result = null;
+ String test = null;
+ RewriteRule resultRule = null;
+ RewriteCond resultCond = null;
+
+ test = "RewriteRule ^/~([^/]+)/?(.*) /u/$1/$2 [R]";
+ result = RewriteValve.parse(test);
+ if (result instanceof RewriteRule) {
+ resultRule = (RewriteRule) result;
+ }
+ assertNotNull(resultRule);
+ assertTrue(resultRule.isRedirect());
+ assertEquals(resultRule.getPatternString(), "^/~([^/]+)/?(.*)");
+ assertEquals(resultRule.getSubstitutionString(), "/u/$1/$2");
+ resultRule = null;
+
+ test = "RewriteRule ^/(.*) http://fully.qualified.domain.name:%{SERVER_PORT}/$1 [L,R]";
+ result = RewriteValve.parse(test);
+ if (result instanceof RewriteRule) {
+ resultRule = (RewriteRule) result;
+ }
+ assertNotNull(resultRule);
+ assertTrue(resultRule.isRedirect());
+ assertTrue(resultRule.isLast());
+ assertEquals(resultRule.getPatternString(), "^/(.*)");
+ assertEquals(resultRule.getSubstitutionString(), "http://fully.qualified.domain.name:%{SERVER_PORT}/$1");
+ resultRule = null;
+
+ test = "RewriteCond %{HTTP_HOST} !^fully\\.qualified\\.domain\\.name [NC]";
+ result = RewriteValve.parse(test);
+ if (result instanceof RewriteCond) {
+ resultCond = (RewriteCond) result;
+ }
+ assertNotNull(resultCond);
+ assertTrue(resultCond.isNocase());
+ assertEquals(resultCond.getTestString(), "%{HTTP_HOST}");
+ assertEquals(resultCond.getCondPattern(), "!^fully\\.qualified\\.domain\\.name");
+ resultCond = null;
+
+ }
+
+
+ public static CharSequence rewriteUrl(CharSequence url, Resolver resolver, RewriteRule[] rules) {
+ if (rules == null)
+ return url;
+ for (int i = 0; i < rules.length; i++) {
+ CharSequence newurl = rules[i].evaluate(url, resolver);
+ if (newurl != null) {
+ // Check some extra flags, including redirect, proxying, etc
+ // FIXME
+ url = newurl;
+ }
+ }
+ return url;
+ }
+
+}
16 years, 9 months
JBossWeb SVN: r536 - in trunk: java/org/jboss/web/cluster and 5 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-03-22 17:31:36 -0400 (Sat, 22 Mar 2008)
New Revision: 536
Added:
trunk/java/org/jboss/web/cluster/
trunk/java/org/jboss/web/cluster/ClusterListener.java
trunk/java/org/jboss/web/cluster/Constants.java
trunk/test/java/
trunk/test/webapps/
trunk/test/webapps/reader/
trunk/test/webapps/reader/META-INF/
trunk/test/webapps/reader/META-INF/MANIFEST.MF
trunk/test/webapps/reader/WEB-INF/
trunk/test/webapps/reader/WEB-INF/web.xml
trunk/test/webapps/reader/index.jsp
trunk/test/webapps/reader/indexAscii.jsp
trunk/test/webapps/reader/read.jsp
trunk/test/webapps/reader/readCharB.jsp
trunk/test/webapps/reader/readLine.jsp
Removed:
trunk/test/org/
Log:
- Reorganize tests.
- Add input test (will remove if it's useless).
Added: trunk/java/org/jboss/web/cluster/ClusterListener.java
===================================================================
--- trunk/java/org/jboss/web/cluster/ClusterListener.java (rev 0)
+++ trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-03-22 21:31:36 UTC (rev 536)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.jboss.web.cluster;
+
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleEvent;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.util.StringManager;
+import org.apache.tomcat.jni.Library;
+import org.jboss.logging.Logger;
+import org.jboss.logging.Logger;
+
+
+
+/**
+ * Implementation of <code>LifecycleListener</code> that will init and
+ * and destroy APR.
+ *
+ * @author Remy Maucherat
+ * @author Filip Hanik
+ * @version $Revision: 515 $ $Date: 2008-03-17 22:02:23 +0100 (Mon, 17 Mar 2008) $
+ * @since 4.1
+ */
+
+public class ClusterListener
+ implements LifecycleListener {
+
+ private static Logger log = Logger.getLogger(ClusterListener.class);
+
+ /**
+ * The string manager for this package.
+ */
+ protected StringManager sm =
+ StringManager.getManager(Constants.Package);
+
+
+ // ---------------------------------------------- Constants
+
+
+ // ---------------------------------------------- Properties
+
+
+ // ---------------------------------------------- LifecycleListener Methods
+
+ /**
+ * Primary entry point for startup and shutdown events.
+ *
+ * @param event The event that has occurred
+ */
+ public void lifecycleEvent(LifecycleEvent event) {
+
+ if (Lifecycle.START_EVENT.equals(event.getType())) {
+
+ } else if (Lifecycle.STOP_EVENT.equals(event.getType())) {
+
+ }
+
+ }
+
+}
Property changes on: trunk/java/org/jboss/web/cluster/ClusterListener.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/java/org/jboss/web/cluster/Constants.java
===================================================================
--- trunk/java/org/jboss/web/cluster/Constants.java (rev 0)
+++ trunk/java/org/jboss/web/cluster/Constants.java 2008-03-22 21:31:36 UTC (rev 536)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.jboss.web.cluster;
+
+
+public class Constants {
+
+ public static final String Package = "org.jboss.web.cluster";
+
+}
Property changes on: trunk/java/org/jboss/web/cluster/Constants.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/test/webapps/reader/META-INF/MANIFEST.MF
===================================================================
--- trunk/test/webapps/reader/META-INF/MANIFEST.MF (rev 0)
+++ trunk/test/webapps/reader/META-INF/MANIFEST.MF 2008-03-22 21:31:36 UTC (rev 536)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Created-By: 1.5.0_11 (Sun Microsystems Inc.)
+
Added: trunk/test/webapps/reader/WEB-INF/web.xml
===================================================================
--- trunk/test/webapps/reader/WEB-INF/web.xml (rev 0)
+++ trunk/test/webapps/reader/WEB-INF/web.xml 2008-03-22 21:31:36 UTC (rev 536)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+</web-app>
Added: trunk/test/webapps/reader/index.jsp
===================================================================
--- trunk/test/webapps/reader/index.jsp (rev 0)
+++ trunk/test/webapps/reader/index.jsp 2008-03-22 21:31:36 UTC (rev 536)
@@ -0,0 +1,42 @@
+<%@ page pageEncoding="UTF-8"%>
+<%@ page import="java.io.*"%>
+<HTML>
+<HEAD>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<TITLE>request#getReader test.</TITLE>
+</HEAD>
+<BODY>
+
+<%!
+ int charSize = 8193;
+ char character = 'あ';
+%>
+
+<%
+response.setContentType("text/html; charset=UTF-8");
+StringBuffer sb = new StringBuffer(charSize);
+for(int i=0 ; i < charSize ; i++){
+ sb.append(character);
+}
+%>
+
+<FORM method="POST" action="readLine.jsp" enctype="text/plain">
+request#getReader()#readLine test<BR>
+<input type="text" name="thetext" value="<%= sb.toString()+sb.toString()+sb.toString() %>"/>
+<input type="submit" value="send" />
+</FORM>
+
+<FORM method="POST" action="read.jsp" enctype="text/plain">
+request#getReader()#read() test<BR>
+<input type="text" name="thetext" value="<%= sb.toString() %>"/>
+<input type="submit" value="send" />
+</FORM>
+
+<FORM method="POST" action="readCharB.jsp" enctype="text/plain">
+request#getReader()#read(char[1]) test<BR>
+<input type="text" name="thetext" value="<%= sb.toString() %>"/>
+<input type="submit" value="send" />
+</FORM>
+
+</BODY>
+</HTML>
\ No newline at end of file
Added: trunk/test/webapps/reader/indexAscii.jsp
===================================================================
--- trunk/test/webapps/reader/indexAscii.jsp (rev 0)
+++ trunk/test/webapps/reader/indexAscii.jsp 2008-03-22 21:31:36 UTC (rev 536)
@@ -0,0 +1,42 @@
+<%@ page pageEncoding="UTF-8"%>
+<%@ page import="java.io.*"%>
+<HTML>
+<HEAD>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<TITLE>request#getReader test.</TITLE>
+</HEAD>
+<BODY>
+
+<%!
+ int charSize = 8193;
+ char character = 'a';
+%>
+
+<%
+response.setContentType("text/html; charset=UTF-8");
+StringBuffer sb = new StringBuffer(charSize);
+for(int i=0 ; i < charSize ; i++){
+ sb.append(character);
+}
+%>
+
+<FORM method="POST" action="readLine.jsp" enctype="text/plain">
+request#getReader()#readLine test<BR>
+<input type="text" name="thetext" value="<%= sb.toString()+sb.toString()+sb.toString() %>"/>
+<input type="submit" value="send" />
+</FORM>
+
+<FORM method="POST" action="read.jsp" enctype="text/plain">
+request#getReader()#read() test<BR>
+<input type="text" name="thetext" value="<%= sb.toString() %>"/>
+<input type="submit" value="send" />
+</FORM>
+
+<FORM method="POST" action="readCharB.jsp" enctype="text/plain">
+request#getReader()#read(char[1]) test<BR>
+<input type="text" name="thetext" value="<%= sb.toString() %>"/>
+<input type="submit" value="send" />
+</FORM>
+
+</BODY>
+</HTML>
\ No newline at end of file
Added: trunk/test/webapps/reader/read.jsp
===================================================================
--- trunk/test/webapps/reader/read.jsp (rev 0)
+++ trunk/test/webapps/reader/read.jsp 2008-03-22 21:31:36 UTC (rev 536)
@@ -0,0 +1,43 @@
+<%@ page pageEncoding="UTF-8"%>
+<%@ page import="java.io.*"%>
+<HTML>
+<HEAD>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<TITLE>request#getReader test.</TITLE>
+</HEAD>
+<BODY>
+read.jsp is called.
+<HR>
+
+<%
+ request.setCharacterEncoding("UTF-8");
+ response.setContentType("text/html; charset=UTF-8");
+ BufferedReader reader = request.getReader();
+ StringBuffer sb = new StringBuffer();
+
+ read(reader, sb);
+
+ // TODO check if the read data is correct.
+ //outln(out,sb.toString());
+ outln(out,"Content-Type:" + request.getContentType());
+ outln(out,"Character Encoding:" + request.getCharacterEncoding());
+ outln(out, "Content-Length:"+ request.getContentLength());
+ outln(out, "read:" + sb.length()); // includes form text area name "thetext="
+
+%>
+
+</BODY>
+</HTML>
+<%!
+ void read(BufferedReader br, StringBuffer sb) throws IOException{
+ int read = 0;
+ while((read = br.read())!= -1){
+ sb.append((char)read);
+ }
+ }
+
+ void outln(JspWriter out, String str) throws IOException{
+ out.println(str+"<BR>");
+ System.out.println(str);
+ }
+%>
\ No newline at end of file
Added: trunk/test/webapps/reader/readCharB.jsp
===================================================================
--- trunk/test/webapps/reader/readCharB.jsp (rev 0)
+++ trunk/test/webapps/reader/readCharB.jsp 2008-03-22 21:31:36 UTC (rev 536)
@@ -0,0 +1,46 @@
+<%@ page pageEncoding="UTF-8"%>
+<%@ page import="java.io.*"%>
+<HTML>
+<HEAD>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<TITLE>request#getReader test.</TITLE>
+</HEAD>
+<BODY>
+readCharb.jsp is called.
+<HR>
+
+<%
+ request.setCharacterEncoding("UTF-8");
+ response.setContentType("text/html; charset=UTF-8");
+ BufferedReader reader = request.getReader();
+ StringBuffer sb = new StringBuffer();
+
+ readCharB(reader, sb, 1);
+
+ // TODO check if the read data is correct.
+
+ //outln(out,sb.toString());
+ outln(out,"Content-Type:" + request.getContentType());
+ outln(out,"Character Encoding:" + request.getCharacterEncoding());
+ outln(out, "Content-Length:"+ request.getContentLength());
+ outln(out, "read:" + sb.length()); // includes form text area name "thetext=" and last CR/LF
+
+%>
+
+</BODY>
+</HTML>
+<%!
+
+ void readCharB(BufferedReader br, StringBuffer sb, int bufferSize) throws IOException{
+ char[] buf = new char[bufferSize];
+ int read = 0;
+ while((read = br.read(buf))!= -1){
+ sb.append(buf, 0, read);
+ }
+ }
+
+ void outln(JspWriter out, String str) throws IOException{
+ out.println(str+"<BR>");
+ System.out.println(str);
+ }
+%>
\ No newline at end of file
Added: trunk/test/webapps/reader/readLine.jsp
===================================================================
--- trunk/test/webapps/reader/readLine.jsp (rev 0)
+++ trunk/test/webapps/reader/readLine.jsp 2008-03-22 21:31:36 UTC (rev 536)
@@ -0,0 +1,45 @@
+<%@ page pageEncoding="UTF-8"%>
+<%@ page import="java.io.*"%>
+<HTML>
+<HEAD>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<TITLE>request#getReader test.</TITLE>
+</HEAD>
+<BODY>
+readLine.jsp is called.
+<HR>
+
+<%
+ request.setCharacterEncoding("UTF-8");
+ response.setContentType("text/html; charset=UTF-8");
+ BufferedReader reader = request.getReader();
+ StringBuffer sb = new StringBuffer();
+
+ readLine(reader, sb);
+
+ // TODO check if the read data is correct.
+
+ //outln(out,sb.toString());
+ outln(out,"Content-Type:" + request.getContentType());
+ outln(out,"Character Encoding:" + request.getCharacterEncoding());
+ outln(out, "Content-Length:"+ request.getContentLength());
+ outln(out, "read:" + sb.length()); // includes form text area name "thetext=" and last CR/LF
+
+%>
+
+</BODY>
+</HTML>
+<%!
+
+ void readLine(BufferedReader br, StringBuffer sb) throws IOException{
+ String read = null;
+ while((read = br.readLine())!=null){
+ sb.append(read);// CR/LF lost.
+ }
+ }
+
+ void outln(JspWriter out, String str) throws IOException{
+ out.println(str+"<BR>");
+ System.out.println(str);
+ }
+%>
\ No newline at end of file
16 years, 9 months
JBossWeb SVN: r535 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-03-21 20:02:21 -0400 (Fri, 21 Mar 2008)
New Revision: 535
Modified:
trunk/java/org/apache/tomcat/util/http/ServerCookie.java
trunk/webapps/docs/changelog.xml
Log:
- Apply latest cookie patch.
Modified: trunk/java/org/apache/tomcat/util/http/ServerCookie.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/ServerCookie.java 2008-03-21 15:40:49 UTC (rev 534)
+++ trunk/java/org/apache/tomcat/util/http/ServerCookie.java 2008-03-22 00:02:21 UTC (rev 535)
@@ -38,9 +38,6 @@
public class ServerCookie implements Serializable {
- protected static final boolean USE_V1_COOKIES =
- !Boolean.valueOf(System.getProperty("org.apache.catalina.STRICT_SERVLET_COMPLIANCE", "false")).booleanValue();
-
// Version 0 (Netscape) attributes
private MessageBytes name=MessageBytes.newInstance();
private MessageBytes value=MessageBytes.newInstance();
@@ -54,6 +51,13 @@
private int maxAge = -1;
private int version = 0;
+ /**
+ * If set to true, we parse cookies according to the servlet spec,
+ */
+ public static final boolean STRICT_SERVLET_COMPLIANCE =
+ Boolean.valueOf(System.getProperty("org.apache.catalina.STRICT_SERVLET_COMPLIANCE", "false")).booleanValue();
+
+
// Note: Servlet Spec =< 2.5 only refers to Netscape and RFC2109,
// not RFC2965
@@ -251,20 +255,8 @@
buf.append("=");
// Servlet implementation does not check anything else
- version = maybeQuote2(version, buf, value);
+ version = maybeQuote2(version, buf, value,true);
- // Add domain information, if present
- if (domain!=null) {
- buf.append("; Domain=");
- version = maybeQuote2(version, buf, domain);
- }
-
- // Path=path
- if (path!=null) {
- buf.append ("; Path=");
- version = maybeQuote2(version, buf, path);
- }
-
// Add version 1 specific information
if (version == 1) {
// Version=1 ... required
@@ -277,6 +269,12 @@
}
}
+ // Add domain information, if present
+ if (domain!=null) {
+ buf.append("; Domain=");
+ maybeQuote2(version, buf, domain);
+ }
+
// Max-Age=secs ... or use old "Expires" format
// TODO RFC2965 Discard
if (maxAge >= 0) {
@@ -298,6 +296,12 @@
}
}
+ // Path=path
+ if (path!=null) {
+ buf.append ("; Path=");
+ maybeQuote2(version, buf, path);
+ }
+
// Secure
if (isSecure) {
buf.append ("; Secure");
@@ -333,6 +337,10 @@
* @param value
*/
public static int maybeQuote2 (int version, StringBuffer buf, String value) {
+ return maybeQuote2(version,buf,value,false);
+ }
+
+ public static int maybeQuote2 (int version, StringBuffer buf, String value, boolean allowVersionSwitch) {
if (value==null || value.length()==0) {
buf.append("\"\"");
}else if (containsCTL(value,version))
@@ -341,7 +349,7 @@
buf.append('"');
buf.append(escapeDoubleQuotes(value,1,value.length()-1));
buf.append('"');
- } else if (USE_V1_COOKIES && version==0 && !isToken2(value)) {
+ } else if (allowVersionSwitch && (!STRICT_SERVLET_COMPLIANCE) && version==0 && !isToken2(value)) {
buf.append('"');
buf.append(escapeDoubleQuotes(value,0,value.length()));
buf.append('"');
@@ -354,7 +362,7 @@
buf.append('"');
buf.append(escapeDoubleQuotes(value,0,value.length()));
buf.append('"');
- } else {
+ }else {
buf.append(value);
}
return version;
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-03-21 15:40:49 UTC (rev 534)
+++ trunk/webapps/docs/changelog.xml 2008-03-22 00:02:21 UTC (rev 535)
@@ -45,6 +45,9 @@
<fix>
Improve accuracy of typical timeout values. (remm)
</fix>
+ <fix>
+ Comet state recycling. (remm)
+ </fix>
</changelog>
</subsection>
</section>
16 years, 9 months
JBossWeb SVN: r534 - in trunk/java/org/apache/coyote/http11: filters and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2008-03-21 11:40:49 -0400 (Fri, 21 Mar 2008)
New Revision: 534
Modified:
trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
Log:
- Fix comet state recycling (not too problematic, it will cause up to one useless event after begin).
- Tested EOF with chunking: works but the chunk parser doesn't handle non blocking: it must get the whole chunk
header in a single read, or it will complain. This shouldn't cause many problems in the real world, but
but it could be improved.
Modified: trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2008-03-21 01:39:06 UTC (rev 533)
+++ trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2008-03-21 15:40:49 UTC (rev 534)
@@ -328,7 +328,6 @@
protected boolean readNotifications = true;
protected boolean writeNotification = false;
protected boolean resumeNotification = false;
- protected boolean nonBlocking = true;
protected boolean cometProcessing = false;
@@ -360,11 +359,6 @@
}
- public boolean getNonBlocking() {
- return nonBlocking;
- }
-
-
public int getCometTimeout() {
return cometTimeout;
}
@@ -815,11 +809,13 @@
if (error) {
inputBuffer.nextRequest();
outputBuffer.nextRequest();
+ recycleComet();
recycle();
return SocketState.CLOSED;
} else if (!comet) {
inputBuffer.nextRequest();
outputBuffer.nextRequest();
+ recycleComet();
recycle();
return SocketState.OPEN;
} else {
@@ -1023,6 +1019,15 @@
}
+ public void recycleComet() {
+ cometTimeout = -1;
+ readNotifications = true;
+ writeNotification = false;
+ resumeNotification = false;
+ cometProcessing = false;
+ }
+
+
// ----------------------------------------------------- ActionHook Methods
Modified: trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
===================================================================
--- trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java 2008-03-21 01:39:06 UTC (rev 533)
+++ trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java 2008-03-21 15:40:49 UTC (rev 534)
@@ -221,6 +221,7 @@
pos = 0;
lastValid = 0;
endChunk = false;
+ needCRLFParse = false;
}
16 years, 9 months