JBossWeb SVN: r286 - trunk/java/org/apache/catalina/core.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2007-09-30 18:34:24 -0400 (Sun, 30 Sep 2007)
New Revision: 286
Modified:
trunk/java/org/apache/catalina/core/StandardContext.java
Log:
- Strange error when building with javac (the annotations are
useless, so it's best to remove them).
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2007-09-28 15:08:44 UTC (rev 285)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2007-09-30 22:34:24 UTC (rev 286)
@@ -5688,19 +5688,16 @@
protected class DummyAnnotationProcessor implements AnnotationProcessor {
- @Override
public void postConstruct(Object instance)
throws IllegalAccessException, InvocationTargetException {
// Do nothing
}
- @Override
public void preDestroy(Object instance) throws IllegalAccessException,
InvocationTargetException {
getInstanceManager().destroyInstance(instance);
}
- @Override
public void processAnnotations(Object instance)
throws IllegalAccessException, InvocationTargetException,
NamingException {
17 years, 3 months
JBossWeb SVN: r285 - tags.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2007-09-28 11:08:44 -0400 (Fri, 28 Sep 2007)
New Revision: 285
Added:
tags/JBOSSWEB_2_0_1_GA/
Log:
- JBoss Web 2.0.1 GA for JBoss AS 4.2.2.
Copied: tags/JBOSSWEB_2_0_1_GA (from rev 284, branches/2.0.x)
17 years, 3 months
JBossWeb SVN: r284 - trunk/java/org/apache/tomcat/util/http.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2007-09-25 18:31:25 -0400 (Tue, 25 Sep 2007)
New Revision: 284
Modified:
trunk/java/org/apache/tomcat/util/http/Cookies.java
Log:
- Cookie parser update.
- Remove debugger style logging.
Modified: trunk/java/org/apache/tomcat/util/http/Cookies.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/Cookies.java 2007-09-25 10:28:47 UTC (rev 283)
+++ trunk/java/org/apache/tomcat/util/http/Cookies.java 2007-09-25 22:31:25 UTC (rev 284)
@@ -35,9 +35,6 @@
*/
public final class Cookies { // extends MultiMap {
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger(Cookies.class );
-
// expected average number of cookies per request
public static final int INITIAL_SIZE=4;
ServerCookie scookies[]=new ServerCookie[INITIAL_SIZE];
@@ -45,7 +42,28 @@
boolean unprocessed=true;
MimeHeaders headers;
-
+
+ /*
+ List of Separator Characters (see isSeparator())
+ Excluding the '/' char violates the RFC, but
+ it looks like a lot of people put '/'
+ in unquoted values: '/': ; //47
+ '\t':9 ' ':32 '\"':34 '\'':39 '(':40 ')':41 ',':44 ':':58 ';':59 '<':60
+ '=':61 '>':62 '?':63 '@':64 '[':91 '\\':92 ']':93 '{':123 '}':125
+ */
+ public static final char SEPARATORS[] = { '\t', ' ', '\"', '\'', '(', ')', ',',
+ ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '{', '}' };
+
+ protected static final boolean separators[] = new boolean[128];
+ static {
+ for (int i = 0; i < 128; i++) {
+ separators[i] = false;
+ }
+ for (int i = 0; i < SEPARATORS.length; i++) {
+ separators[SEPARATORS[i]] = true;
+ }
+ }
+
/**
* Construct a new cookie collection, that will extract
* the information from headers.
@@ -169,194 +187,17 @@
// Uncomment to test the new parsing code
if( cookieValue.getType() == MessageBytes.T_BYTES ) {
- if( dbg>0 ) log( "Parsing b[]: " + cookieValue.toString());
ByteChunk bc=cookieValue.getByteChunk();
processCookieHeader( bc.getBytes(),
bc.getOffset(),
bc.getLength());
} else {
- if( dbg>0 ) log( "Parsing S: " + cookieValue.toString());
processCookieHeader( cookieValue.toString() );
}
pos++;// search from the next position
}
}
- /** Process a byte[] header - allowing fast processing of the
- * raw data
- */
- void processCookieHeader( byte bytes[], int off, int len )
- {
- if( len<=0 || bytes==null ) return;
- int end=off+len;
- int pos=off;
-
- int version=0; //sticky
- ServerCookie sc=null;
-
-
- while( pos<end ) {
- byte cc;
- // [ skip_spaces name skip_spaces "=" skip_spaces value EXTRA ; ] *
- if( dbg>0 ) log( "Start: " + pos + " " + end );
-
- pos=skipSpaces(bytes, pos, end);
- if( pos>=end )
- return; // only spaces
- int startName=pos;
- if( dbg>0 ) log( "SN: " + pos );
-
- // Version should be the first token
- boolean isSpecial=false;
- if(bytes[pos]=='$') { pos++; isSpecial=true; }
-
- pos= findDelim1( bytes, startName, end); // " =;,"
- int endName=pos;
- // current = "=" or " " or DELIM
- pos= skipSpaces( bytes, endName, end );
- if( dbg>0 ) log( "DELIM: " + endName + " " + (char)bytes[pos]);
-
- if(pos >= end ) {
- // it's a name-only cookie ( valid in RFC2109 )
- if( ! isSpecial ) {
- sc=addCookie();
- sc.getName().setBytes( bytes, startName,
- endName-startName );
- sc.getValue().setString("");
- sc.setVersion( version );
- if( dbg>0 ) log( "Name only, end: " + startName + " " +
- endName);
- }
- return;
- }
-
- cc=bytes[pos];
- pos++;
- if( cc==';' || cc==',' || pos>=end ) {
- if( ! isSpecial && startName!= endName ) {
- sc=addCookie();
- sc.getName().setBytes( bytes, startName,
- endName-startName );
- sc.getValue().setString("");
- sc.setVersion( version );
- if( dbg>0 ) log( "Name only: " + startName + " " + endName);
- }
- continue;
- }
-
- // we should have "=" ( tested all other alternatives )
- int startValue=skipSpaces( bytes, pos, end);
- int endValue=startValue;
-
- cc=bytes[pos];
- if( cc=='"' ) {
- endValue=findDelim3( bytes, startValue+1, end, cc );
- if (endValue == -1) {
- endValue=findDelim2( bytes, startValue+1, end );
- } else startValue++;
- pos=endValue+1; // to skip to next cookie
- } else {
- endValue=findDelim2( bytes, startValue, end );
- pos=endValue+1;
- }
-
- // if not $Version, etc
- if( ! isSpecial ) {
- sc=addCookie();
- sc.getName().setBytes( bytes, startName, endName-startName );
- sc.getValue().setBytes( bytes, startValue, endValue-startValue);
- sc.setVersion( version );
- if( dbg>0 ) {
- log( "New: " + sc.getName() + "X=X" + sc.getValue());
- }
- continue;
- }
-
- // special - Path, Version, Domain, Port
- if( dbg>0 ) log( "Special: " + startName + " " + endName);
- // XXX TODO
- if( equals( "$Version", bytes, startName, endName ) ) {
- if(dbg>0 ) log( "Found version " );
- if( bytes[startValue]=='1' && endValue==startValue+1 ) {
- version=1;
- if(dbg>0 ) log( "Found version=1" );
- }
- continue;
- }
- if( sc==null ) {
- // Path, etc without a previous cookie
- continue;
- }
- if( equals( "$Path", bytes, startName, endName ) ) {
- sc.getPath().setBytes( bytes,
- startValue,
- endValue-startValue );
- }
- if( equals( "$Domain", bytes, startName, endName ) ) {
- sc.getDomain().setBytes( bytes,
- startValue,
- endValue-startValue );
- }
- if( equals( "$Port", bytes, startName, endName ) ) {
- // sc.getPort().setBytes( bytes,
- // startValue,
- // endValue-startValue );
- }
- }
- }
-
- // -------------------- Utils --------------------
- public static int skipSpaces( byte bytes[], int off, int end ) {
- while( off < end ) {
- byte b=bytes[off];
- if( b!= ' ' ) return off;
- off ++;
- }
- return off;
- }
-
- public static int findDelim1( byte bytes[], int off, int end )
- {
- while( off < end ) {
- byte b=bytes[off];
- if( b==' ' || b=='=' || b==';' || b==',' )
- return off;
- off++;
- }
- return off;
- }
-
- public static int findDelim2( byte bytes[], int off, int end )
- {
- while( off < end ) {
- byte b=bytes[off];
- if( b==';' || b==',' )
- return off;
- off++;
- }
- return off;
- }
-
- /*
- * search for cc but skip \cc as required by rfc2616
- * (according to rfc2616 cc should be ")
- */
- public static int findDelim3( byte bytes[], int off, int end, byte cc )
- {
- while( off < end ) {
- byte b=bytes[off];
- if ( b== '\\' ) {
- off++;
- off++;
- continue;
- }
- if( b==cc )
- return off;
- off++;
- }
- return -1;
- }
-
// XXX will be refactored soon!
public static boolean equals( String s, byte b[], int start, int end) {
int blen = end-start;
@@ -378,7 +219,7 @@
private void processCookieHeader( String cookieString )
{
- if( dbg>0 ) log( "Parsing cookie header " + cookieString );
+
// normal cookie, with a string value.
// This is the original code, un-optimized - it shouldn't
// happen in normal case
@@ -402,7 +243,7 @@
cookie.getName().setString(name);
cookie.getValue().setString(value);
- if( dbg > 0 ) log( "Add cookie " + name + "=" + value);
+
} else {
// we have a bad cookie.... just let it go
}
@@ -433,49 +274,291 @@
}
- // log
- static final int dbg=0;
- public void log(String s ) {
- if (log.isDebugEnabled())
- log.debug("Cookies: " + s);
+ /**
+ * Returns true if the byte is a separator character as
+ * defined in RFC2619. Since this is called often, this
+ * function should be organized with the most probable
+ * outcomes first.
+ * JVK
+ */
+ public static final boolean isSeparator(final byte c) {
+ if (c > 0 && c < 126)
+ return separators[c];
+ else
+ return false;
}
+
+ /**
+ * Returns true if the byte is a whitespace character as
+ * defined in RFC2619
+ * JVK
+ */
+ public static final boolean isWhiteSpace(final byte c) {
+ // This switch statement is slightly slower
+ // for my vm than the if statement.
+ // Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-164)
+ /*
+ switch (c) {
+ case ' ':;
+ case '\t':;
+ case '\n':;
+ case '\r':;
+ case '\f':;
+ return true;
+ default:;
+ return false;
+ }
+ */
+ if (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f')
+ return true;
+ else
+ return false;
+ }
- /*
- public static void main( String args[] ) {
- test("foo=bar; a=b");
- test("foo=bar;a=b");
- test("foo=bar;a=b;");
- test("foo=bar;a=b; ");
- test("foo=bar;a=b; ;");
- test("foo=;a=b; ;");
- test("foo;a=b; ;");
- // v1
- test("$Version=1; foo=bar;a=b");
- test("$Version=\"1\"; foo='bar'; $Path=/path; $Domain=\"localhost\"");
- test("$Version=1;foo=bar;a=b; ; ");
- test("$Version=1;foo=;a=b; ; ");
- test("$Version=1;foo= ;a=b; ; ");
- test("$Version=1;foo;a=b; ; ");
- test("$Version=1;foo=\"bar\";a=b; ; ");
- test("$Version=1;foo=\"bar\";$Path=/examples;a=b; ; ");
- test("$Version=1;foo=\"bar\";$Domain=apache.org;a=b");
- test("$Version=1;foo=\"bar\";$Domain=apache.org;a=b;$Domain=yahoo.com");
- // rfc2965
- test("$Version=1;foo=\"bar\";$Domain=apache.org;$Port=8080;a=b");
+ /**
+ * Parses a cookie header after the initial "Cookie:"
+ * [WS][$]token[WS]=[WS](token|QV)[;|,]
+ * RFC 2965
+ * JVK
+ */
+ public final void processCookieHeader(byte bytes[], int off, int len){
+ if( len<=0 || bytes==null ) return;
+ int end=off+len;
+ int pos=off;
+ int nameStart=0;
+ int nameEnd=0;
+ int valueStart=0;
+ int valueEnd=0;
+ int version = 0;
+ ServerCookie sc=null;
+ boolean isSpecial;
- // wrong
- test("$Version=1;foo=\"bar\";$Domain=apache.org;$Port=8080;a=b");
+ while (pos < end) {
+ isSpecial = false;
+
+ // Skip whitespace and non-token characters (separators)
+ while (pos < end &&
+ (isSeparator(bytes[pos]) || isWhiteSpace(bytes[pos])))
+ {pos++; }
+
+ if (pos >= end)
+ return;
+
+ // Detect Special cookies
+ if (bytes[pos] == '$') {
+ isSpecial = true;
+ pos++;
+ }
+
+ // Get the cookie name. This must be a token
+ valueEnd = valueStart = nameStart = pos;
+ pos = nameEnd = getTokenEndPosition(bytes,pos,end);
+
+ // Skip whitespace
+ while (pos < end && isWhiteSpace(bytes[pos])) {pos++; };
+
+
+ // Check for an '=' -- This could also be a name-only
+ // cookie at the end of the cookie header, so if we
+ // are past the end of the header, but we have a name
+ // skip to the name-only part.
+ if (pos < end && bytes[pos] == '=') {
+
+ // Skip whitespace
+ do {
+ pos++;
+ } while (pos < end && isWhiteSpace(bytes[pos]));
+
+ if (pos >= end)
+ return;
+
+ // Determine what type of value this is, quoted value,
+ // token, name-only with an '=', or other (bad)
+ switch (bytes[pos]) {
+ case '"':; // Quoted Value
+ valueStart=pos + 1; // strip "
+ // getQuotedValue returns the position before
+ // at the last qoute. This must be dealt with
+ // when the bytes are copied into the cookie
+ valueEnd=getQuotedValueEndPosition(bytes,
+ valueStart, end);
+ // We need pos to advance
+ pos = valueEnd;
+ // Handles cases where the quoted value is
+ // unterminated and at the end of the header,
+ // e.g. [myname="value]
+ if (pos >= end)
+ return;
+ break;
+ case ';':
+ case ',':
+ // Name-only cookie with an '=' after the name token
+ // This may not be RFC compliant
+ valueStart = valueEnd = -1;
+ // The position is OK (On a delimiter)
+ break;
+ default:;
+ if (!isSeparator(bytes[pos])) {
+ // Token
+ valueStart=pos;
+ // getToken returns the position at the delimeter
+ // or other non-token character
+ valueEnd=getTokenEndPosition(bytes, valueStart, end);
+ // We need pos to advance
+ pos = valueEnd;
+ } else {
+ // INVALID COOKIE, advance to next delimiter
+ // The starting character of the cookie value was
+ // not valid.
+ while (pos < end && bytes[pos] != ';' &&
+ bytes[pos] != ',')
+ {pos++; };
+ pos++;
+ // Make sure no special avpairs can be attributed to
+ // the previous cookie by setting the current cookie
+ // to null
+ sc = null;
+ continue;
+ }
+ }
+ } else {
+ // Name only cookie
+ valueStart = valueEnd = -1;
+ pos = nameEnd;
+
+ }
+
+ // We should have an avpair or name-only cookie at this
+ // point. Perform some basic checks to make sure we are
+ // in a good state.
+
+ // Skip whitespace
+ while (pos < end && isWhiteSpace(bytes[pos])) {pos++; };
+
+
+ // Make sure that after the cookie we have a separator. This
+ // is only important if this is not the last cookie pair
+ while (pos < end && bytes[pos] != ';' && bytes[pos] != ',') {
+ pos++;
+ }
+
+ pos++;
+
+ /*
+ if (nameEnd <= nameStart || valueEnd < valueStart ) {
+ // Something is wrong, but this may be a case
+ // of having two ';' characters in a row.
+ // log("Cookie name/value does not conform to RFC 2965");
+ // Advance to next delimiter (ignoring everything else)
+ while (pos < end && bytes[pos] != ';' && bytes[pos] != ',')
+ { pos++; };
+ pos++;
+ // Make sure no special cookies can be attributed to
+ // the previous cookie by setting the current cookie
+ // to null
+ sc = null;
+ continue;
+ }
+ */
+
+ // All checks passed. Add the cookie, start with the
+ // special avpairs first
+ if (isSpecial) {
+ isSpecial = false;
+ // $Version must be the first avpair in the cookie header
+ // (sc must be null)
+ if (equals( "Version", bytes, nameStart, nameEnd) &&
+ sc == null) {
+ // Set version
+ if( bytes[valueStart] =='1' && valueEnd == valueStart) {
+ version=1;
+ } else {
+ // unknown version (Versioning is not very strict)
+ }
+ continue;
+ }
+
+ // We need an active cookie for Path/Port/etc.
+ if (sc == null) {
+ continue;
+ }
+
+ // Domain is more common, so it goes first
+ if (equals( "Domain", bytes, nameStart, nameEnd)) {
+ sc.getDomain().setBytes( bytes,
+ valueStart,
+ valueEnd-valueStart);
+ continue;
+ }
+
+ if (equals( "Path", bytes, nameStart, nameEnd)) {
+ sc.getPath().setBytes( bytes,
+ valueStart,
+ valueEnd-valueStart);
+ continue;
+ }
+
+
+ if (equals( "Port", bytes, nameStart, nameEnd)) {
+ // sc.getPort is not currently implemented.
+ // sc.getPort().setBytes( bytes,
+ // valueStart,
+ // valueEnd-valueStart );
+ continue;
+ }
+
+ // Unknown cookie
+
+ } else { // Normal Cookie
+ sc = addCookie();
+ sc.setVersion( version );
+ sc.getName().setBytes( bytes, nameStart,
+ nameEnd-nameStart);
+
+ if (valueStart != -1) { // Normal AVPair
+ sc.getValue().setBytes( bytes, valueStart,
+ valueEnd-valueStart);
+ } else {
+ // Name Only
+ sc.getValue().setString("");
+ }
+ continue;
+ }
+ }
}
- public static void test( String s ) {
- System.out.println("Processing " + s );
- Cookies cs=new Cookies(null);
- cs.processCookieHeader( s.getBytes(), 0, s.length());
- for( int i=0; i< cs.getCookieCount() ; i++ ) {
- System.out.println("Cookie: " + cs.getCookie( i ));
+ /**
+ * Given the starting position of a token, this gets the end of the
+ * token, with no separator characters in between.
+ * JVK
+ */
+ public static final int getTokenEndPosition(byte bytes[], int off, int end){
+ int pos = off;
+ while (pos < end && !isSeparator(bytes[pos])) {pos++; };
+
+ if (pos > end)
+ return end;
+ return pos;
+ }
+
+ /**
+ * Given a starting position after an initial quote chracter, this gets
+ * the position of the end quote. This escapes anything after a '\' char
+ * JVK RFC 2616
+ */
+ public static final int getQuotedValueEndPosition(byte bytes[], int off, int end){
+ int pos = off;
+ while (pos < end) {
+ if (bytes[pos] == '"') {
+ return pos;
+ } else if (bytes[pos] == '\\' && pos < (end - 1)) {
+ pos+=2;
+ } else {
+ pos++;
+ }
}
-
+ // Error, we have reached the end of the header w/o a end quote
+ return end;
}
- */
}
17 years, 3 months
JBossWeb SVN: r283 - in sandbox/webapps: html/error and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2007-09-25 06:28:47 -0400 (Tue, 25 Sep 2007)
New Revision: 283
Added:
sandbox/webapps/html/error/
sandbox/webapps/html/error/404.html
Modified:
sandbox/webapps/src/TestServlet.java
Log:
Add error page handling, well add:
+++
<error-page>
<error-code>404</error-code>
<location>/error/404.html</location>
</error-page>
+++
conf/web.xml to test it.
Added: sandbox/webapps/html/error/404.html
===================================================================
--- sandbox/webapps/html/error/404.html (rev 0)
+++ sandbox/webapps/html/error/404.html 2007-09-25 10:28:47 UTC (rev 283)
@@ -0,0 +1 @@
+A test 404 error page ;-)
Modified: sandbox/webapps/src/TestServlet.java
===================================================================
--- sandbox/webapps/src/TestServlet.java 2007-09-24 10:29:20 UTC (rev 282)
+++ sandbox/webapps/src/TestServlet.java 2007-09-25 10:28:47 UTC (rev 283)
@@ -56,9 +56,21 @@
HttpServletResponse response)
throws IOException, ServletException
{
+ /* errorcode is set */
+ String errcodeValue = request.getParameter("errcodevalue");
+ int ierrcode = 0;
+ if (errcodeValue != null) {
+ Integer iwait = new Integer(errcodeValue);
+ ierrcode = iwait.intValue();
+ if (ierrcode < 0) {
+ response.sendError(-ierrcode);
+ return;
+ }
+ }
+
response.setContentType("text/html");
+ PrintWriter out = response.getWriter();
- PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body bgcolor=\"white\">");
out.println("<head>");
@@ -103,15 +115,13 @@
String dataValue = request.getParameter("datavalue");
String waitValue = request.getParameter("waitvalue");
String countValue = request.getParameter("countvalue");
- String errcodeValue = request.getParameter("errcodevalue");
if (dataName != null && dataValue != null) {
session.setAttribute(dataName, dataValue);
}
+
/* errorcode is set */
- if (errcodeValue != null) {
- Integer iwait = new Integer(errcodeValue);
- int ierrcode = iwait.intValue();
+ if (ierrcode != 0) {
response.setStatus(ierrcode);
}
@@ -144,6 +154,7 @@
out.println("param: waitvalue " + waitValue);
out.println("param: create " + createValue);
out.println("param: errcodevalue " + errcodeValue);
+ out.println("negative errcodevalue should display the error page (404.html)");
out.println("<P>");
out.println("sessions.data<br>");
out.println("<P>");
17 years, 3 months
JBossWeb SVN: r282 - in trunk/java/org/apache: catalina/core and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2007-09-24 06:29:20 -0400 (Mon, 24 Sep 2007)
New Revision: 282
Modified:
trunk/java/org/apache/catalina/Context.java
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/el/lang/FunctionMapperImpl.java
Log:
- Remove unused findStatusPages.
- Fix CNFE and NPE in function mapper (bug 41797).
Modified: trunk/java/org/apache/catalina/Context.java
===================================================================
--- trunk/java/org/apache/catalina/Context.java 2007-09-24 08:15:46 UTC (rev 281)
+++ trunk/java/org/apache/catalina/Context.java 2007-09-24 10:29:20 UTC (rev 282)
@@ -764,15 +764,6 @@
/**
- * Return the context-relative URI of the error page for the specified
- * HTTP status code, if any; otherwise return <code>null</code>.
- *
- * @param status HTTP status code to look up
- */
- public String findStatusPage(int status);
-
-
- /**
* Return the set of HTTP status codes for which error pages have
* been specified. If none are specified, a zero-length array
* is returned.
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2007-09-24 08:15:46 UTC (rev 281)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2007-09-24 10:29:20 UTC (rev 282)
@@ -2963,19 +2963,6 @@
/**
- * Return the context-relative URI of the error page for the specified
- * HTTP status code, if any; otherwise return <code>null</code>.
- *
- * @param status HTTP status code to look up
- */
- public String findStatusPage(int status) {
-
- return ((String) statusPages.get(new Integer(status)));
-
- }
-
-
- /**
* Return the set of HTTP status codes for which error pages have
* been specified. If none are specified, a zero-length array
* is returned.
Modified: trunk/java/org/apache/el/lang/FunctionMapperImpl.java
===================================================================
--- trunk/java/org/apache/el/lang/FunctionMapperImpl.java 2007-09-24 08:15:46 UTC (rev 281)
+++ trunk/java/org/apache/el/lang/FunctionMapperImpl.java 2007-09-24 10:29:20 UTC (rev 282)
@@ -32,7 +32,7 @@
/**
* @author Jacob Hookom [jacob(a)hookom.net]
- * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: markt $
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: funkman $
*/
public class FunctionMapperImpl extends FunctionMapper implements
Externalizable {
@@ -120,9 +120,16 @@
public void writeExternal(ObjectOutput out) throws IOException {
out.writeUTF((this.prefix != null) ? this.prefix : "");
out.writeUTF(this.localName);
- out.writeUTF(this.m.getDeclaringClass().getName());
- out.writeUTF(this.m.getName());
- out.writeObject(ReflectionUtil.toTypeNameArray(this.m.getParameterTypes()));
+ out.writeUTF((this.owner != null) ?
+ this.owner :
+ this.m.getDeclaringClass().getName());
+ out.writeUTF((this.name != null) ?
+ this.name :
+ this.m.getName());
+ out.writeObject((this.types != null) ?
+ this.types :
+ ReflectionUtil.toTypeNameArray(this.m.getParameterTypes()));
+
}
/*
@@ -144,7 +151,7 @@
public Method getMethod() {
if (this.m == null) {
try {
- Class t = Class.forName(this.owner);
+ Class t = ReflectionUtil.forName(this.owner);
Class[] p = ReflectionUtil.toTypeArray(this.types);
this.m = t.getMethod(this.name, p);
} catch (Exception e) {
17 years, 3 months
JBossWeb SVN: r280 - tags and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2007-09-24 04:00:26 -0400 (Mon, 24 Sep 2007)
New Revision: 280
Added:
branches/JBOSSWEB_2_0_0_GA_CP/
Removed:
tags/JBOSSWEB_2_0_0_GA_CP01/
Log:
Use a CP branche like in jbossas.
Copied: branches/JBOSSWEB_2_0_0_GA_CP (from rev 279, tags/JBOSSWEB_2_0_0_GA_CP01)
17 years, 3 months
JBossWeb SVN: r279 - tags/JBOSSWEB_2_0_0_GA_CP01.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2007-09-23 04:04:35 -0400 (Sun, 23 Sep 2007)
New Revision: 279
Added:
tags/JBOSSWEB_2_0_0_GA_CP01/README.brew
Log:
It seems brew misses r274.
Added: tags/JBOSSWEB_2_0_0_GA_CP01/README.brew
===================================================================
--- tags/JBOSSWEB_2_0_0_GA_CP01/README.brew (rev 0)
+++ tags/JBOSSWEB_2_0_0_GA_CP01/README.brew 2007-09-23 08:04:35 UTC (rev 279)
@@ -0,0 +1 @@
+brew is r236.
17 years, 3 months
JBossWeb SVN: r278 - trunk/java/org/apache/juli.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2007-09-14 15:07:56 -0400 (Fri, 14 Sep 2007)
New Revision: 278
Added:
trunk/java/org/apache/juli/JdkLoggerFormatter.java
Log:
- Add compact formatter (just in case it is useful, which is
not likely).
Added: trunk/java/org/apache/juli/JdkLoggerFormatter.java
===================================================================
--- trunk/java/org/apache/juli/JdkLoggerFormatter.java (rev 0)
+++ trunk/java/org/apache/juli/JdkLoggerFormatter.java 2007-09-14 19:07:56 UTC (rev 278)
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.juli;
+
+import java.util.logging.Formatter;
+import java.util.logging.LogRecord;
+
+
+
+/**
+ * A more compact formatter.
+ *
+ * Equivalent log4j config:
+ * <pre>
+ * log4j.rootCategory=WARN, A1
+ * log4j.appender.A1=org.apache.log4j.ConsoleAppender
+ * log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+ * log4j.appender.A1.Target=System.err
+ * log4j.appender.A1.layout.ConversionPattern=%r %-15.15c{2} %-1.1p %m %n
+ * </pre>
+ *
+ * Example:
+ * 1130122891846 Http11BaseProtocol I Initializing Coyote HTTP/1.1 on http-8800
+ *
+ *
+ * @author Costin Manolache
+ */
+public class JdkLoggerFormatter extends Formatter {
+ // values from JDK Level
+ public static final int LOG_LEVEL_TRACE = 400;
+ public static final int LOG_LEVEL_DEBUG = 500;
+ public static final int LOG_LEVEL_INFO = 800;
+ public static final int LOG_LEVEL_WARN = 900;
+ public static final int LOG_LEVEL_ERROR = 1000;
+ public static final int LOG_LEVEL_FATAL = 1000;
+
+ public String format(LogRecord record) {
+ Throwable t=record.getThrown();
+ int level=record.getLevel().intValue();
+ String name=record.getLoggerName();
+ long time=record.getMillis();
+ String message=formatMessage(record);
+
+
+ if( name.indexOf(".") >= 0 )
+ name = name.substring(name.lastIndexOf(".") + 1);
+
+ // Use a string buffer for better performance
+ StringBuffer buf = new StringBuffer();
+
+ buf.append(time);
+ buf.append(" ");
+
+ // pad to 8 to make it more readable
+ for( int i=0; i<8-buf.length(); i++ ) { buf.append(" "); }
+
+ // Append a readable representation of the log level.
+ switch(level) {
+ case LOG_LEVEL_TRACE: buf.append(" T "); break;
+ case LOG_LEVEL_DEBUG: buf.append(" D "); break;
+ case LOG_LEVEL_INFO: buf.append(" I "); break;
+ case LOG_LEVEL_WARN: buf.append(" W "); break;
+ case LOG_LEVEL_ERROR: buf.append(" E "); break;
+ //case : buf.append(" F "); break;
+ default: buf.append(" ");
+ }
+
+
+ // Append the name of the log instance if so configured
+ buf.append(name);
+
+ // pad to 20 chars
+ for( int i=0; i<8-buf.length(); i++ ) { buf.append(" "); }
+
+ // Append the message
+ buf.append(message);
+
+ // Append stack trace if not null
+ if(t != null) {
+ buf.append(" \n");
+
+ java.io.StringWriter sw= new java.io.StringWriter(1024);
+ java.io.PrintWriter pw= new java.io.PrintWriter(sw);
+ t.printStackTrace(pw);
+ pw.close();
+ buf.append(sw.toString());
+ }
+
+ buf.append("\n");
+ // Print to the appropriate destination
+ return buf.toString();
+ }
+
+}
17 years, 3 months
JBossWeb SVN: r277 - in trunk: java/org/apache/catalina/session and 4 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2007-09-14 15:01:03 -0400 (Fri, 14 Sep 2007)
New Revision: 277
Modified:
trunk/java/org/apache/catalina/connector/OutputBuffer.java
trunk/java/org/apache/catalina/connector/Response.java
trunk/java/org/apache/catalina/session/ManagerBase.java
trunk/java/org/apache/catalina/session/mbeans-descriptors.xml
trunk/java/org/apache/catalina/valves/AccessLogValve.java
trunk/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java
trunk/java/org/apache/juli/ClassLoaderLogManager.java
trunk/webapps/docs/changelog.xml
trunk/webapps/docs/config/valve.xml
Log:
- Port from Tomcat 6.0.
- Better large file support in access log valves.
- Access to session creation time.
- Improved property replacement in logging configuration.
Modified: trunk/java/org/apache/catalina/connector/OutputBuffer.java
===================================================================
--- trunk/java/org/apache/catalina/connector/OutputBuffer.java 2007-09-12 10:18:02 UTC (rev 276)
+++ trunk/java/org/apache/catalina/connector/OutputBuffer.java 2007-09-14 19:01:03 UTC (rev 277)
@@ -70,13 +70,13 @@
/**
* Number of bytes written.
*/
- private int bytesWritten = 0;
+ private long bytesWritten = 0;
/**
* Number of chars written.
*/
- private int charsWritten = 0;
+ private long charsWritten = 0;
/**
@@ -169,7 +169,7 @@
* @param coyoteResponse Associated Coyote response
*/
public void setResponse(Response coyoteResponse) {
- this.coyoteResponse = coyoteResponse;
+ this.coyoteResponse = coyoteResponse;
}
@@ -351,7 +351,7 @@
* @throws IOException An underlying IOException occurred
*/
public void realWriteBytes(byte buf[], int off, int cnt)
- throws IOException {
+ throws IOException {
if (closed)
return;
@@ -552,22 +552,32 @@
}
-
public int getBytesWritten() {
- return bytesWritten;
+ if (bytesWritten < Integer.MAX_VALUE) {
+ return (int) bytesWritten;
+ }
+ return -1;
}
-
public int getCharsWritten() {
- return charsWritten;
+ if (charsWritten < Integer.MAX_VALUE) {
+ return (int) charsWritten;
+ }
+ return -1;
}
+ public int getContentWritten() {
+ long size = bytesWritten + charsWritten ;
+ if (size < Integer.MAX_VALUE) {
+ return (int) size;
+ }
+ return -1;
+ }
- public int getContentWritten() {
+ public long getContentWrittenLong() {
return bytesWritten + charsWritten;
}
-
-
+
/**
* True if this buffer hasn't been used ( since recycle() ) -
* i.e. no chars or bytes have been added to the buffer.
Modified: trunk/java/org/apache/catalina/connector/Response.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Response.java 2007-09-12 10:18:02 UTC (rev 276)
+++ trunk/java/org/apache/catalina/connector/Response.java 2007-09-14 19:01:03 UTC (rev 277)
@@ -58,7 +58,7 @@
*
* @author Remy Maucherat
* @author Craig R. McClanahan
- * @version $Revision: 542491 $ $Date: 2007-05-29 13:24:13 +0200 (mar., 29 mai 2007) $
+ * @version $Revision: 575478 $ $Date: 2007-09-13 23:56:30 +0200 (Thu, 13 Sep 2007) $
*/
public class Response
@@ -305,8 +305,14 @@
public int getContentCount() {
return outputBuffer.getContentWritten();
}
+
+ /**
+ * Return the number of bytes actually written to the output stream.
+ */
+ public long getContentCountLong() {
+ return outputBuffer.getContentWrittenLong();
+ }
-
/**
* Set the application commit flag.
*
Modified: trunk/java/org/apache/catalina/session/ManagerBase.java
===================================================================
--- trunk/java/org/apache/catalina/session/ManagerBase.java 2007-09-12 10:18:02 UTC (rev 276)
+++ trunk/java/org/apache/catalina/session/ManagerBase.java 2007-09-14 19:01:03 UTC (rev 277)
@@ -61,7 +61,7 @@
* be subclassed to create more sophisticated Manager implementations.
*
* @author Craig R. McClanahan
- * @version $Revision: 542185 $ $Date: 2007-05-28 12:06:31 +0200 (lun., 28 mai 2007) $
+ * @version $Revision: 573964 $ $Date: 2007-09-09 11:04:27 +0200 (Sun, 09 Sep 2007) $
*/
public abstract class ManagerBase implements Manager, MBeanRegistration {
@@ -1207,12 +1207,22 @@
public String getLastAccessedTime( String sessionId ) {
Session s=(Session)sessions.get(sessionId);
if( s==null ) {
- log.info("Session not found " + sessionId);
+ if(log.isInfoEnabled())
+ log.info("Session not found " + sessionId);
return "";
}
return new Date(s.getLastAccessedTime()).toString();
}
+ public String getCreationTime( String sessionId ) {
+ Session s=(Session)sessions.get(sessionId);
+ if( s==null ) {
+ if(log.isInfoEnabled())
+ log.info("Session not found " + sessionId);
+ return "";
+ }
+ return new Date(s.getCreationTime()).toString();
+ }
// -------------------- JMX and Registration --------------------
protected String domain;
Modified: trunk/java/org/apache/catalina/session/mbeans-descriptors.xml
===================================================================
--- trunk/java/org/apache/catalina/session/mbeans-descriptors.xml 2007-09-12 10:18:02 UTC (rev 276)
+++ trunk/java/org/apache/catalina/session/mbeans-descriptors.xml 2007-09-14 19:01:03 UTC (rev 277)
@@ -135,6 +135,15 @@
type="java.lang.String"/>
</operation>
+ <operation name="getCreationTime"
+ description="Get the creation time"
+ impact="ACTION"
+ returnType="java.lang.String">
+ <parameter name="sessionId"
+ description="Id of the session"
+ type="java.lang.String"/>
+ </operation>
+
</mbean>
<mbean name="PersistentManager"
@@ -287,6 +296,15 @@
type="java.lang.String"/>
</operation>
+ <operation name="getCreationTime"
+ description="Get the creation time"
+ impact="ACTION"
+ returnType="java.lang.String">
+ <parameter name="sessionId"
+ description="Id of the session"
+ type="java.lang.String"/>
+ </operation>
+
</mbean>
</mbeans-descriptors>
Modified: trunk/java/org/apache/catalina/valves/AccessLogValve.java
===================================================================
--- trunk/java/org/apache/catalina/valves/AccessLogValve.java 2007-09-12 10:18:02 UTC (rev 276)
+++ trunk/java/org/apache/catalina/valves/AccessLogValve.java 2007-09-14 19:01:03 UTC (rev 277)
@@ -43,8 +43,8 @@
import org.apache.catalina.connector.Response;
import org.apache.catalina.util.LifecycleSupport;
import org.apache.catalina.util.StringManager;
+import org.apache.coyote.RequestInfo;
import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
/**
@@ -79,6 +79,7 @@
* <li><b>%v</b> - Local server name
* <li><b>%D</b> - Time taken to process the request, in millis
* <li><b>%T</b> - Time taken to process the request, in seconds
+ * <li><b>%I</b> - current Request thread name (can compare later with stacktraces)
* </ul>
* <p>In addition, the caller can specify one of the following aliases for
* commonly utilized patterns:</p>
@@ -94,6 +95,7 @@
* It is modeled after the apache syntax:
* <ul>
* <li><code>%{xxx}i</code> for incoming headers
+ * <li><code>%{xxx}o</code> for outgoing response headers
* <li><code>%{xxx}c</code> for a specific cookie
* <li><code>%{xxx}r</code> xxx is an attribute in the ServletRequest
* <li><code>%{xxx}s</code> xxx is an attribute in the HttpSession
@@ -111,7 +113,9 @@
* @author Jason Brittain
* @author Remy Maucherat
* @author Takayuki Kaneko
- * @version $Revision: 539787 $ $Date: 2007-01-04 12:17:11 +0900
+ * @author Peter Rossbach
+ *
+ * @version $Revision: 575475 $ $Date: 2007-09-13 23:43:22 +0200 (Thu, 13 Sep 2007) $
*/
public class AccessLogValve
@@ -140,7 +144,7 @@
* The descriptive information about this implementation.
*/
protected static final String info =
- "org.apache.catalina.valves.AccessLogValve/2.0";
+ "org.apache.catalina.valves.AccessLogValve/2.1";
/**
@@ -890,6 +894,7 @@
.getString("accessLogValve.notStarted"));
lifecycle.fireLifecycleEvent(STOP_EVENT, null);
started = false;
+
close();
}
@@ -903,6 +908,21 @@
}
/**
+ * write thread name - %I
+ */
+ protected class ThreadNameElement implements AccessLogElement {
+ public void addElement(StringBuffer buf, Date date, Request request,
+ Response response, long time) {
+ RequestInfo info = request.getCoyoteRequest().getRequestProcessor();
+ if(info != null) {
+ buf.append(info.getWorkerThreadName());
+ } else {
+ buf.append("-");
+ }
+ }
+ }
+
+ /**
* write local IP address - %A
*/
protected class LocalAddrElement implements AccessLogElement {
@@ -1078,7 +1098,7 @@
public void addElement(StringBuffer buf, Date date, Request request,
Response response, long time) {
- int length = response.getContentCount();
+ long length = response.getContentCountLong() ;
if (length <= 0 && conversion) {
buf.append('-');
} else {
@@ -1248,6 +1268,34 @@
}
/**
+ * write a specific response header - %{xxx}o
+ */
+ protected class ResponseHeaderElement implements AccessLogElement {
+ private String header;
+
+ public ResponseHeaderElement(String header) {
+ this.header = header;
+ }
+
+ public void addElement(StringBuffer buf, Date date, Request request,
+ Response response, long time) {
+ if (null != response) {
+ String[] values = response.getHeaderValues(header);
+ if(values.length > 0) {
+ for (int i = 0; i < values.length; i++) {
+ String string = values[i];
+ buf.append(string) ;
+ if(i+1<values.length)
+ buf.append(",");
+ }
+ return ;
+ }
+ }
+ buf.append("-");
+ }
+ }
+
+ /**
* write an attribute in the ServletRequest - %{xxx}r
*/
protected class RequestAttributeElement implements AccessLogElement {
@@ -1370,10 +1418,12 @@
return new HeaderElement(header);
case 'c':
return new CookieElement(header);
+ case 'o':
+ return new ResponseHeaderElement(header);
case 'r':
return new RequestAttributeElement(header);
case 's':
- return new SessionAttributeElement(header);
+ return new SessionAttributeElement(header);
default:
return new StringElement("???");
}
@@ -1422,6 +1472,8 @@
return new RequestURIElement();
case 'v':
return new LocalServerNameElement();
+ case 'I':
+ return new ThreadNameElement();
default:
return new StringElement("???" + pattern + "???");
}
Modified: trunk/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
===================================================================
--- trunk/java/org/apache/catalina/valves/ExtendedAccessLogValve.java 2007-09-12 10:18:02 UTC (rev 276)
+++ trunk/java/org/apache/catalina/valves/ExtendedAccessLogValve.java 2007-09-14 19:01:03 UTC (rev 277)
@@ -64,6 +64,7 @@
* <li><code>time-taken</code>: Time (in seconds) taken to serve the request</li>
* <li><code>x-A(XXX)</code>: Pull XXX attribute from the servlet context </li>
* <li><code>x-C(XXX)</code>: Pull the first cookie of the name XXX </li>
+ * <li><code>x-O(XXX)</code>: Pull the all response header values XXX </li>
* <li><code>x-R(XXX)</code>: Pull XXX attribute from the servlet request </li>
* <li><code>x-S(XXX)</code>: Pull XXX attribute from the session </li>
* <li><code>x-P(...)</code>: Call request.getParameter(...)
@@ -122,7 +123,9 @@
*
*
* @author Tim Funk
- * @version $Revision: 522854 $ $Date: 2007-03-27 12:10:45 +0200 (mar., 27 mars 2007) $
+ * @author Peter Rossbach
+ *
+ * @version $Revision: 575411 $ $Date: 2007-09-13 21:31:16 +0200 (Thu, 13 Sep 2007) $
*/
public class ExtendedAccessLogValve
@@ -138,7 +141,7 @@
* The descriptive information about this implementation.
*/
protected static final String extendedAccessLogInfo =
- "org.apache.catalina.valves.ExtendedAccessLogValve/1.0";
+ "org.apache.catalina.valves.ExtendedAccessLogValve/2.1";
// ------------------------------------------------------------- Properties
@@ -209,7 +212,7 @@
super.open();
if (currentLogFile.length()==0) {
writer.println("#Fields: " + pattern);
- writer.println("#Version: 1.0");
+ writer.println("#Version: 2.0");
writer.println("#Software: " + ServerInfo.getServerInfo());
}
}
@@ -331,6 +334,36 @@
}
}
+ /**
+ * write a specific response header - x-O(xxx)
+ */
+ protected class ResponseAllHeaderElement implements AccessLogElement {
+ private String header;
+
+ public ResponseAllHeaderElement(String header) {
+ this.header = header;
+ }
+
+ public void addElement(StringBuffer buf, Date date, Request request,
+ Response response, long time) {
+ if (null != response) {
+ String[] values = response.getHeaderValues(header);
+ if(values.length > 0) {
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < values.length; i++) {
+ String string = values[i];
+ buffer.append(string) ;
+ if(i+1<values.length)
+ buffer.append(",");
+ }
+ buf.append(wrap(buffer.toString()));
+ return ;
+ }
+ }
+ buf.append("-");
+ }
+ }
+
protected class RequestAttributeElement implements AccessLogElement {
private String attribute;
@@ -718,6 +751,8 @@
return getServletRequestElement(parameter);
} else if ("P".equals(token)) {
return new RequestParameterElement(parameter);
+ } else if ("O".equals(token)) {
+ return new ResponseAllHeaderElement(parameter);
}
log.error("x param for servlet request, couldn't decode value: "
+ token);
Modified: trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java
===================================================================
--- trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java 2007-09-12 10:18:02 UTC (rev 276)
+++ trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java 2007-09-14 19:01:03 UTC (rev 277)
@@ -45,11 +45,11 @@
* To use, copy into the server/classes directory of the Tomcat installation
* and configure in server.xml as:
* <pre>
- * <Valve className="org.apache.catalina.valves.JDBCAccessLogValve"
- * driverName="<i>your_jdbc_driver</i>"
- * connectionURL="<i>your_jdbc_url</i>"
- * pattern="combined" resolveHosts="false"
- * />
+ * <Valve className="org.apache.catalina.valves.JDBCAccessLogValve"
+ * driverName="<i>your_jdbc_driver</i>"
+ * connectionURL="<i>your_jdbc_url</i>"
+ * pattern="combined" resolveHosts="false"
+ * />
* </pre>
* </p>
* <p>
@@ -93,6 +93,11 @@
* INDEX (userAgent)
* );
* </pre>
+ * <p>Set JDBCAccessLogValve attribute useLongContentLength="true" as you have more then 4GB outputs.
+ * Please, use long SQL datatype at access.bytes attribute.
+ * The datatype of bytes at oracle is <i>number</i> and other databases use <i>bytes BIGINT NOT NULL</i>.
+ * </p>
+ *
* <p>
* If the table is created as above, its name and the field names don't need
* to be defined.
@@ -120,21 +125,21 @@
* Class constructor. Initializes the fields with the default values.
* The defaults are:
* <pre>
- * driverName = null;
- * connectionURL = null;
- * tableName = "access";
- * remoteHostField = "remoteHost";
- * userField = "userName";
- * timestampField = "timestamp";
- * virtualHostField = "virtualHost";
- * methodField = "method";
- * queryField = "query";
- * statusField = "status";
- * bytesField = "bytes";
- * refererField = "referer";
- * userAgentField = "userAgent";
- * pattern = "common";
- * resolveHosts = false;
+ * driverName = null;
+ * connectionURL = null;
+ * tableName = "access";
+ * remoteHostField = "remoteHost";
+ * userField = "userName";
+ * timestampField = "timestamp";
+ * virtualHostField = "virtualHost";
+ * methodField = "method";
+ * queryField = "query";
+ * statusField = "status";
+ * bytesField = "bytes";
+ * refererField = "referer";
+ * userAgentField = "userAgent";
+ * pattern = "common";
+ * resolveHosts = false;
* </pre>
*/
public JDBCAccessLogValve() {
@@ -162,8 +167,13 @@
// ----------------------------------------------------- Instance Variables
-
/**
+ * Use long contentLength as you have more 4 GB output.
+ * @since 6.0.15
+ */
+ protected boolean useLongContentLength = false ;
+
+ /**
* The connection username to use when trying to connect to the database.
*/
protected String connectionName = null;
@@ -419,6 +429,19 @@
this.resolveHosts = new Boolean(resolveHosts).booleanValue();
}
+ /**
+ * get useLongContentLength
+ */
+ public boolean getUseLongContentLength() {
+ return this.useLongContentLength ;
+ }
+
+ /**
+ * @param useLongContentLength the useLongContentLength to set
+ */
+ public void setUseLongContentLength(boolean useLongContentLength) {
+ this.useLongContentLength = useLongContentLength;
+ }
// --------------------------------------------------------- Public Methods
@@ -435,37 +458,35 @@
*/
public void invoke(Request request, Response response)
throws IOException, ServletException {
-
+ final String EMPTY = "" ;
+
getNext().invoke(request, response);
- String remoteHost = "";
+ String remoteHost = EMPTY;
if(resolveHosts)
remoteHost = request.getRemoteHost();
else
remoteHost = request.getRemoteAddr();
- String user = "";
+ String user = EMPTY;
if(request != null)
user = request.getRemoteUser();
String query="";
if(request != null)
query = request.getRequestURI();
- int bytes = response.getContentCount();
+
+ long bytes = response.getContentCountLong() ;
if(bytes < 0)
bytes = 0;
int status = response.getStatus();
- if (pattern.equals("combined")) {
- String virtualHost = "";
- if(request != null)
- virtualHost = request.getServerName();
- String method = "";
- if(request != null)
- method = request.getMethod();
- String referer = "";
- if(request != null)
- referer = request.getHeader("referer");
- String userAgent = "";
- if(request != null)
- userAgent = request.getHeader("user-agent");
+ String virtualHost = EMPTY;
+ String method = EMPTY;
+ String referer = EMPTY;
+ String userAgent = EMPTY;
+ if (pattern.equals("combined") && request != null) {
+ virtualHost = request.getServerName();
+ method = request.getMethod();
+ referer = request.getHeader("referer");
+ userAgent = request.getHeader("user-agent");
}
synchronized (this) {
int numberOfTries = 2;
@@ -478,21 +499,15 @@
ps.setTimestamp(3, new Timestamp(getCurrentTimeMillis()));
ps.setString(4, query);
ps.setInt(5, status);
- ps.setInt(6, bytes);
+
+ if(useLongContentLength) {
+ ps.setLong(6, bytes);
+ } else {
+ if (bytes > Integer.MAX_VALUE)
+ bytes = -1 ;
+ ps.setInt(6, (int) bytes);
+ }
if (pattern.equals("combined")) {
-
- String virtualHost = "";
- if(request != null)
- virtualHost = request.getServerName();
- String method = "";
- if(request != null)
- method = request.getMethod();
- String referer = "";
- if(request != null)
- referer = request.getHeader("referer");
- String userAgent = "";
- if(request != null)
- userAgent = request.getHeader("user-agent");
ps.setString(7, virtualHost);
ps.setString(8, method);
ps.setString(9, referer);
@@ -508,11 +523,11 @@
if (conn != null)
close();
}
- numberOfTries--;
+ numberOfTries--;
}
}
- }
+ }
/**
@@ -666,7 +681,7 @@
started = false;
close() ;
-
+
}
Modified: trunk/java/org/apache/juli/ClassLoaderLogManager.java
===================================================================
--- trunk/java/org/apache/juli/ClassLoaderLogManager.java 2007-09-12 10:18:02 UTC (rev 276)
+++ trunk/java/org/apache/juli/ClassLoaderLogManager.java 2007-09-14 19:01:03 UTC (rev 277)
@@ -442,13 +442,19 @@
*/
protected String replace(String str) {
String result = str;
- if (result.startsWith("${")) {
- int pos = result.indexOf('}');
- if (pos != -1) {
- String propName = result.substring(2, pos);
+ int pos_start = result.indexOf("${");
+ if (pos_start != -1) {
+ int pos_end = result.indexOf('}');
+ if (pos_end != -1) {
+ String propName = result.substring(pos_start + 2, pos_end);
String replacement = System.getProperty(propName);
if (replacement != null) {
- result = replacement + result.substring(pos + 1);
+ if(pos_start >0) {
+ result = result.substring(0,pos_start) +
+ replacement + replace(result.substring(pos_end + 1));
+ } else {
+ result = replacement + replace(result.substring(pos_end + 1));
+ }
}
}
}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2007-09-12 10:18:02 UTC (rev 276)
+++ trunk/webapps/docs/changelog.xml 2007-09-14 19:01:03 UTC (rev 277)
@@ -68,6 +68,11 @@
<subsection name="Catalina">
<changelog>
<fix>
+ <bug>30949</bug>: Improve previous fix. Ensure requests are re-cycled
+ on cross-context includes and forwards when an exception occurs in the
+ target page. (markt)
+ </fix>
+ <fix>
<bug>42944</bug>: Correctly handle servlet mappings that use a '+'
character as part of the url pattern. (markt)
</fix>
@@ -87,14 +92,31 @@
Takayuki Kaneko. (markt)
</fix>
<fix>
- <bug>43216</bug>: Set correct StandardSession#accessCount as StandardSession.ACTIVITY_CHECK is true.
- Patch provided by Takayuki Kaneko (pero)
+ <bug>43216</bug>: Set correct StandardSession#accessCount as StandardSession.ACTIVITY_CHECK is true.
+ Patch provided by Takayuki Kaneko (pero)
</fix>
+ <add>
+ Made session createTime accessible for all SessionManager via JMX (pero)
+ </add>
+ <update>
+ <bug>43129</bug>: Support logging of all response header values at AccessLogValve (ex. add %{Set-Cookie}o to your pattern). (pero)
+ </update>
+ <add>
+ Support logging of all response header values at ExtendedAccessLogValve (ex. add x-O(Set-Cookie) to your pattern). (pero)
+ </add>
+ <add>
+ Support logging of current thread name at AccessLogValve (ex. add %I to your pattern).
+ Usefull to compare access logging entry later with a stacktraces. (pero)
+ </add>
<fix>
- <bug>30949</bug>: Improve previous fix. Ensure requests are re-cycled
- on cross-context includes and forwards when an exception occurs in the
- target page. (markt)
- </fix>
+ Improve large-file support (more then 4 Gb) at all AccessLogValves, backport from 5.5.25. (pero)
+ </fix>
+ <update>
+ Optimized JDBCAccessLogValve combined pattern request attribute access. (pero)
+ </update>
+ <fix>
+ o.a.juli.ClassLoaderLogManager handle more then one system property replacement at file logging.properties. (pero)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
@@ -127,7 +149,9 @@
</fix>
</changelog>
</subsection>
+
</section>
+
<section name="Tomcat 6.0.14 (remm)">
<subsection name="General">
<changelog>
Modified: trunk/webapps/docs/config/valve.xml
===================================================================
--- trunk/webapps/docs/config/valve.xml 2007-09-12 10:18:02 UTC (rev 276)
+++ trunk/webapps/docs/config/valve.xml 2007-09-14 19:01:03 UTC (rev 277)
@@ -163,6 +163,7 @@
<li><b>%v</b> - Local server name</li>
<li><b>%D</b> - Time taken to process the request, in millis</li>
<li><b>%T</b> - Time taken to process the request, in seconds</li>
+ <li><b>%I</b> - current request thread name (can compare later with stacktraces)</li>
</ul>
<p>
@@ -171,6 +172,7 @@
It is modeled after the apache syntax:
<ul>
<li><b><code>%{xxx}i</code></b> for incoming headers</li>
+ <li><b><code>%{xxx}o</code></b> for outgoing response headers</li>
<li><b><code>%{xxx}c</code></b> for a specific cookie</li>
<li><b><code>%{xxx}r</code></b> xxx is an attribute in the ServletRequest</li>
<li><b><code>%{xxx}s</code></b> xxx is an attribute in the HttpSession</li>
@@ -381,7 +383,10 @@
rechecking with the <strong>Realm</strong>.</p>
</attribute>
-
+ <attribute name="cookieDomain" required="false">
+ <p>Sets the host domain to be used for sso cookies.</p>
+ </attribute>
+
</attributes>
</subsection>
17 years, 3 months