JBossWeb SVN: r1009 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-16 12:11:07 -0400 (Thu, 16 Apr 2009)
New Revision: 1009
Modified:
trunk/java/org/apache/jasper/runtime/PageContextImpl.java
trunk/webapps/docs/changelog.xml
Log:
- Port patch.
Modified: trunk/java/org/apache/jasper/runtime/PageContextImpl.java
===================================================================
--- trunk/java/org/apache/jasper/runtime/PageContextImpl.java 2009-04-15 10:15:38 UTC (rev 1008)
+++ trunk/java/org/apache/jasper/runtime/PageContextImpl.java 2009-04-16 16:11:07 UTC (rev 1009)
@@ -421,8 +421,13 @@
return REQUEST_SCOPE;
if (session != null) {
- if (session.getAttribute(name) != null)
- return SESSION_SCOPE;
+ try {
+ if (session.getAttribute(name) != null)
+ return SESSION_SCOPE;
+ } catch(IllegalStateException ise) {
+ // Session has been invalidated.
+ // Ignore and fall through to application scope.
+ }
}
if (context.getAttribute(name) != null)
@@ -464,7 +469,12 @@
return o;
if (session != null) {
- o = session.getAttribute(name);
+ try {
+ o = session.getAttribute(name);
+ } catch(IllegalStateException ise) {
+ // Session has been invalidated.
+ // Ignore and fall through to application scope.
+ }
if (o != null)
return o;
}
@@ -528,17 +538,17 @@
}
private void doRemoveAttribute(String name) {
- try {
- removeAttribute(name, PAGE_SCOPE);
- removeAttribute(name, REQUEST_SCOPE);
- if (session != null) {
- removeAttribute(name, SESSION_SCOPE);
- }
- removeAttribute(name, APPLICATION_SCOPE);
- } catch (Exception ex) {
- // we remove as much as we can, and
- // simply ignore possible exceptions
- }
+ removeAttribute(name, PAGE_SCOPE);
+ removeAttribute(name, REQUEST_SCOPE);
+ if( session != null ) {
+ try {
+ removeAttribute(name, SESSION_SCOPE);
+ } catch(IllegalStateException ise) {
+ // Session has been invalidated.
+ // Ignore and fall throw to application scope.
+ }
+ }
+ removeAttribute(name, APPLICATION_SCOPE);
}
public JspWriter getOut() {
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-04-15 10:15:38 UTC (rev 1008)
+++ trunk/webapps/docs/changelog.xml 2009-04-16 16:11:07 UTC (rev 1009)
@@ -95,6 +95,9 @@
<bug>42390</bug>: Correct JSP compilation error with nested tagfile tags with variables with "AT_BEGIN" scope.
Patch provided by Konstantin Kolinko. (markt)
</fix>
+ <fix>
+ <bug>37929</bug>: Fix session access to an invalidated session. (markt)
+ </fix>
</changelog>
</subsection>
</section>
15 years
JBossWeb SVN: r1008 - in branches/JBOSSWEB_2_0_0_GA_CP: src/share/classes/org/apache/catalina/connector and 8 other directories.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-04-15 06:15:38 -0400 (Wed, 15 Apr 2009)
New Revision: 1008
Added:
branches/JBOSSWEB_2_0_0_GA_CP/test/
branches/JBOSSWEB_2_0_0_GA_CP/test/build.xml
branches/JBOSSWEB_2_0_0_GA_CP/test/org/
branches/JBOSSWEB_2_0_0_GA_CP/test/org/apache/
branches/JBOSSWEB_2_0_0_GA_CP/test/org/apache/catalina/
branches/JBOSSWEB_2_0_0_GA_CP/test/org/apache/catalina/tomcat/
branches/JBOSSWEB_2_0_0_GA_CP/test/org/apache/catalina/tomcat/util/
branches/JBOSSWEB_2_0_0_GA_CP/test/org/apache/catalina/tomcat/util/http/
branches/JBOSSWEB_2_0_0_GA_CP/test/org/apache/catalina/tomcat/util/http/TestCookies.java
Modified:
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/connector/Request.java
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/connector/Response.java
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/tomcat/util/http/Cookies.java
branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/tomcat/util/http/ServerCookie.java
Log:
Port the fixes and tests for the cookies.
Modified: branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/connector/Request.java
===================================================================
--- branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/connector/Request.java 2009-04-14 16:35:14 UTC (rev 1007)
+++ branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/connector/Request.java 2009-04-15 10:15:38 UTC (rev 1008)
@@ -2334,6 +2334,25 @@
}
}
+ protected String unescape(String s) {
+ if (s==null)
+ return null;
+ if (s.indexOf('\\') == -1)
+ return s;
+ StringBuffer buf = new StringBuffer();
+ for (int i=0; i<s.length(); i++) {
+ char c = s.charAt(i);
+ if (c!='\\') buf.append(c);
+ else {
+ if (++i >= s.length())
+ throw new IllegalArgumentException();//invalid escape, hence invalid cookie
+ c = s.charAt(i);
+ buf.append(c);
+ }
+ }
+ return buf.toString();
+ }
+
/**
* Parse cookies.
*/
@@ -2352,14 +2371,19 @@
for (int i = 0; i < count; i++) {
ServerCookie scookie = serverCookies.getCookie(i);
try {
- Cookie cookie = new Cookie(scookie.getName().toString(),
- scookie.getValue().toString());
- cookie.setPath(scookie.getPath().toString());
- cookie.setVersion(scookie.getVersion());
+ /*
+ we must unescape the '\\' escape character
+ */
+ Cookie cookie = new Cookie(scookie.getName().toString(),null);
+ int version = scookie.getVersion();
+ cookie.setVersion(version);
+ cookie.setValue(unescape(scookie.getValue().toString()));
+ cookie.setPath(unescape(scookie.getPath().toString()));
String domain = scookie.getDomain().toString();
- if (domain != null) {
- cookie.setDomain(scookie.getDomain().toString());
- }
+ if (domain!=null)
+ cookie.setDomain(unescape(domain));//avoid NPE
+ String comment = scookie.getComment().toString();
+ cookie.setComment(version==1?unescape(comment):null);
cookies[idx++] = cookie;
} catch(IllegalArgumentException e) {
// Ignore bad cookie
Modified: branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/connector/Response.java
===================================================================
--- branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/connector/Response.java 2009-04-14 16:35:14 UTC (rev 1007)
+++ branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/catalina/connector/Response.java 2009-04-15 10:15:38 UTC (rev 1008)
@@ -949,9 +949,9 @@
if (isCommitted())
return;
- cookies.add(cookie);
-
final StringBuffer sb = new StringBuffer();
+ // web application code can receive a IllegalArgumentException
+ // from the appendCookieValue invocation
if (SecurityUtil.isPackageProtectionEnabled()) {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run(){
@@ -969,12 +969,13 @@
cookie.getPath(), cookie.getDomain(), cookie.getComment(),
cookie.getMaxAge(), cookie.getSecure());
}
-
+ // if we reached here, no exception, cookie is valid
// the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
// RFC2965 is not supported by browsers and the Servlet spec
// asks for 2109.
addHeader("Set-Cookie", sb.toString());
+ cookies.add(cookie);
}
Modified: branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/tomcat/util/http/Cookies.java
===================================================================
--- branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/tomcat/util/http/Cookies.java 2009-04-14 16:35:14 UTC (rev 1007)
+++ branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/tomcat/util/http/Cookies.java 2009-04-15 10:15:38 UTC (rev 1008)
@@ -45,7 +45,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.
@@ -182,181 +203,6 @@
}
}
- /** 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;
@@ -440,42 +286,302 @@
log.debug("Cookies: " + s);
}
- /*
- 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");
- // wrong
- test("$Version=1;foo=\"bar\";$Domain=apache.org;$Port=8080;a=b");
+ /**
+ * 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 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 ));
+ /**
+ * 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;
+ boolean isQuoted;
+
+ while (pos < end) {
+ isSpecial = false;
+ isQuoted = 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
+ isQuoted = true;
+ 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.
+ log("Invalid cookie. Value not a token or quoted value");
+ 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+1)) {
+ 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, complain
+ log("Unknown Special 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);
+ if (isQuoted) {
+ // We know this is a byte value so this is safe
+ ServerCookie.unescapeDoubleQuotes(
+ sc.getValue().getByteChunk());
+ }
+ } else {
+ // Name Only
+ sc.getValue().setString("");
+ }
+ continue;
+ }
}
-
}
- */
+ /**
+ * 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;
+ }
+
}
Modified: branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/tomcat/util/http/ServerCookie.java
===================================================================
--- branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/tomcat/util/http/ServerCookie.java 2009-04-14 16:35:14 UTC (rev 1007)
+++ branches/JBOSSWEB_2_0_0_GA_CP/src/share/classes/org/apache/tomcat/util/http/ServerCookie.java 2009-04-15 10:15:38 UTC (rev 1008)
@@ -21,13 +21,14 @@
import java.text.FieldPosition;
import java.util.Date;
+import org.apache.tomcat.util.buf.ByteChunk;
import org.apache.tomcat.util.buf.DateTool;
import org.apache.tomcat.util.buf.MessageBytes;
/**
* Server-side cookie representation.
- * Allows recycling and uses MessageBytes as low-level
+ * Allows recycling and uses MessageBytes as low-level
* representation ( and thus the byte-> char conversion can be delayed
* until we know the charset ).
*
@@ -40,309 +41,410 @@
private static org.apache.commons.logging.Log log=
org.apache.commons.logging.LogFactory.getLog(ServerCookie.class );
+ // Version 0 (Netscape) attributes
private MessageBytes name=MessageBytes.newInstance();
private MessageBytes value=MessageBytes.newInstance();
+ // Expires - Not stored explicitly. Generated from Max-Age (see V1)
+ private MessageBytes path=MessageBytes.newInstance();
+ private MessageBytes domain=MessageBytes.newInstance();
+ private boolean secure;
+
+ // Version 1 (RFC2109) attributes
+ private MessageBytes comment=MessageBytes.newInstance();
+ private int maxAge = -1;
+ private int version = 0;
- private MessageBytes comment=MessageBytes.newInstance(); // ;Comment=VALUE
- private MessageBytes domain=MessageBytes.newInstance(); // ;Domain=VALUE ...
+ /**
+ * 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();
- private int maxAge = -1; // ;Max-Age=VALUE
- // ;Discard ... implied by maxAge < 0
- // RFC2109: maxAge=0 will end a session
- private MessageBytes path=MessageBytes.newInstance(); // ;Path=VALUE .
- private boolean secure; // ;Secure
- private int version = 0; // ;Version=1
- //XXX CommentURL, Port -> use notes ?
-
+ // Note: Servlet Spec =< 2.5 only refers to Netscape and RFC2109,
+ // not RFC2965
+
+ // Version 1 (RFC2965) attributes
+ // TODO Add support for CommentURL
+ // Discard - implied by maxAge <0
+ // TODO Add support for Port
+
public ServerCookie() {
-
}
public void recycle() {
path.recycle();
- name.recycle();
- value.recycle();
- comment.recycle();
- maxAge=-1;
- path.recycle();
+ name.recycle();
+ value.recycle();
+ comment.recycle();
+ maxAge=-1;
+ path.recycle();
domain.recycle();
- version=0;
- secure=false;
+ version=0;
+ secure=false;
}
public MessageBytes getComment() {
- return comment;
+ return comment;
}
public MessageBytes getDomain() {
- return domain;
+ return domain;
}
public void setMaxAge(int expiry) {
- maxAge = expiry;
+ maxAge = expiry;
}
public int getMaxAge() {
- return maxAge;
+ return maxAge;
}
-
public MessageBytes getPath() {
- return path;
+ return path;
}
public void setSecure(boolean flag) {
- secure = flag;
+ secure = flag;
}
public boolean getSecure() {
- return secure;
+ return secure;
}
public MessageBytes getName() {
- return name;
+ return name;
}
public MessageBytes getValue() {
- return value;
+ return value;
}
public int getVersion() {
- return version;
+ return version;
}
-
public void setVersion(int v) {
- version = v;
+ version = v;
}
// -------------------- utils --------------------
public String toString() {
- return "Cookie " + getName() + "=" + getValue() + " ; "
- + getVersion() + " " + getPath() + " " + getDomain();
+ return "Cookie " + getName() + "=" + getValue() + " ; "
+ + getVersion() + " " + getPath() + " " + getDomain();
}
- // Note -- disabled for now to allow full Netscape compatibility
- // from RFC 2068, token special case characters
- //
- // private static final String tspecials = "()<>@,;:\\\"/[]?={} \t";
private static final String tspecials = ",; ";
- private static final String tspecials2 = ",; \"";
+ private static final String tspecials2 = "()<>@,;:\\\"/[]?={} \t";
+ private static final String tspecials2NoSlash = "()<>@,;:\\\"[]?={} \t";
/*
* Tests a string and returns true if the string counts as a
* reserved token in the Java language.
*
- * @param value the <code>String</code> to be tested
+ * @param value the <code>String</code> to be tested
*
- * @return <code>true</code> if the <code>String</code> is
- * a reserved token; <code>false</code>
- * if it is not
+ * @return <code>true</code> if the <code>String</code> is a reserved
+ * token; <code>false</code> if it is not
*/
public static boolean isToken(String value) {
- if( value==null) return true;
- int len = value.length();
+ return isToken(value,null);
+ }
+
+ public static boolean isToken(String value, String literals) {
+ String tspecials = (literals==null?ServerCookie.tspecials:literals);
+ if( value==null) return true;
+ int len = value.length();
- for (int i = 0; i < len; i++) {
- char c = value.charAt(i);
+ for (int i = 0; i < len; i++) {
+ char c = value.charAt(i);
- if (c < 0x20 || c >= 0x7f || tspecials.indexOf(c) != -1)
- return false;
- }
- return true;
+ if (tspecials.indexOf(c) != -1)
+ return false;
+ }
+ return true;
}
+ public static boolean containsCTL(String value, int version) {
+ if( value==null) return false;
+ int len = value.length();
+ for (int i = 0; i < len; i++) {
+ char c = value.charAt(i);
+ if (c < 0x20 || c >= 0x7f) {
+ if (c == 0x09)
+ continue; //allow horizontal tabs
+ return true;
+ }
+ }
+ return false;
+ }
+
public static boolean isToken2(String value) {
- if( value==null) return true;
- int len = value.length();
+ return isToken2(value,null);
+ }
- for (int i = 0; i < len; i++) {
- char c = value.charAt(i);
+ public static boolean isToken2(String value, String literals) {
+ String tspecials2 = (literals==null?ServerCookie.tspecials2:literals);
+ if( value==null) return true;
+ int len = value.length();
- if (c < 0x20 || c >= 0x7f || tspecials2.indexOf(c) != -1)
- return false;
- }
- return true;
+ for (int i = 0; i < len; i++) {
+ char c = value.charAt(i);
+ if (tspecials2.indexOf(c) != -1)
+ return false;
+ }
+ return true;
}
+ /**
+ * @deprecated - Not used
+ */
public static boolean checkName( String name ) {
- if (!isToken(name)
- || name.equalsIgnoreCase("Comment") // rfc2019
- || name.equalsIgnoreCase("Discard") // 2019++
- || name.equalsIgnoreCase("Domain")
- || name.equalsIgnoreCase("Expires") // (old cookies)
- || name.equalsIgnoreCase("Max-Age") // rfc2019
- || name.equalsIgnoreCase("Path")
- || name.equalsIgnoreCase("Secure")
- || name.equalsIgnoreCase("Version")
- ) {
- return false;
- }
- return true;
+ if (!isToken(name)
+ || name.equalsIgnoreCase("Comment") // rfc2019
+ || name.equalsIgnoreCase("Discard") // rfc2965
+ || name.equalsIgnoreCase("Domain") // rfc2019
+ || name.equalsIgnoreCase("Expires") // Netscape
+ || name.equalsIgnoreCase("Max-Age") // rfc2019
+ || name.equalsIgnoreCase("Path") // rfc2019
+ || name.equalsIgnoreCase("Secure") // rfc2019
+ || name.equalsIgnoreCase("Version") // rfc2019
+ // TODO remaining RFC2965 attributes
+ ) {
+ return false;
+ }
+ return true;
}
// -------------------- Cookie parsing tools
- /** Return the header name to set the cookie, based on cookie
- * version
+ /**
+ * Return the header name to set the cookie, based on cookie version.
*/
public String getCookieHeaderName() {
- return getCookieHeaderName(version);
+ return getCookieHeaderName(version);
}
- /** Return the header name to set the cookie, based on cookie
- * version
+ /**
+ * Return the header name to set the cookie, based on cookie version.
*/
public static String getCookieHeaderName(int version) {
- if( dbg>0 ) log( (version==1) ? "Set-Cookie2" : "Set-Cookie");
+ // TODO Re-enable logging when RFC2965 is implemented
+ // log( (version==1) ? "Set-Cookie2" : "Set-Cookie");
if (version == 1) {
- // RFC2109
- return "Set-Cookie";
- // XXX RFC2965 is not standard yet, and Set-Cookie2
- // is not supported by Netscape 4, 6, IE 3, 5 .
- // It is supported by Lynx, and there is hope
- // return "Set-Cookie2";
+ // XXX RFC2965 not referenced in Servlet Spec
+ // Set-Cookie2 is not supported by Netscape 4, 6, IE 3, 5
+ // Set-Cookie2 is supported by Lynx and Opera
+ // Need to check on later IE and FF releases but for now...
+ // RFC2109
+ return "Set-Cookie";
+ // return "Set-Cookie2";
} else {
- // Old Netscape
- return "Set-Cookie";
+ // Old Netscape
+ return "Set-Cookie";
}
}
- private static final String ancientDate=DateTool.formatOldCookie(new Date(10000));
+ private static final String ancientDate =
+ DateTool.formatOldCookie(new Date(10000));
- public static void appendCookieValue( StringBuffer buf,
- int version,
- String name,
- String value,
- String path,
- String domain,
- String comment,
- int maxAge,
- boolean isSecure )
+ // TODO RFC2965 fields also need to be passed
+ public static void appendCookieValue( StringBuffer headerBuf,
+ int version,
+ String name,
+ String value,
+ String path,
+ String domain,
+ String comment,
+ int maxAge,
+ boolean isSecure )
{
- // this part is the same for all cookies
- buf.append( name );
+ StringBuffer buf = new StringBuffer();
+ // Servlet implementation checks name
+ buf.append( name );
buf.append("=");
- maybeQuote2(version, buf, value);
+ // Servlet implementation does not check anything else
+
+ version = maybeQuote2(version, buf, value,true);
- // XXX Netscape cookie: "; "
- // add version 1 specific information
- if (version == 1) {
- // Version=1 ... required
- buf.append ("; Version=1");
+ // Add version 1 specific information
+ if (version == 1) {
+ // Version=1 ... required
+ buf.append ("; Version=1");
- // Comment=comment
- if ( comment!=null ) {
- buf.append ("; Comment=");
- maybeQuote (version, buf, comment);
- }
- }
-
- // add domain information, if present
+ // Comment=comment
+ if ( comment!=null ) {
+ buf.append ("; Comment=");
+ maybeQuote2(version, buf, comment);
+ }
+ }
+
+ // Add domain information, if present
+ if (domain!=null) {
+ buf.append("; Domain=");
+ maybeQuote2(version, buf, domain);
+ }
- if (domain!=null) {
- buf.append("; Domain=");
- maybeQuote (version, buf, domain);
- }
-
- // Max-Age=secs/Discard ... or use old "Expires" format
- if (maxAge >= 0) {
- if (version == 0) {
- // XXX XXX XXX We need to send both, for
- // interoperatibility (long word )
- buf.append ("; Expires=");
- // Wdy, DD-Mon-YY HH:MM:SS GMT ( Expires netscape format )
- // To expire we need to set the time back in future
- // ( pfrieden(a)dChain.com )
+ // Max-Age=secs ... or use old "Expires" format
+ // TODO RFC2965 Discard
+ if (maxAge >= 0) {
+ if (version == 0) {
+ // Wdy, DD-Mon-YY HH:MM:SS GMT ( Expires Netscape format )
+ buf.append ("; Expires=");
+ // To expire immediately we need to set the time in past
if (maxAge == 0)
- buf.append( ancientDate );
- else
+ buf.append( ancientDate );
+ else
DateTool.formatOldCookie
(new Date( System.currentTimeMillis() +
maxAge *1000L), buf,
new FieldPosition(0));
- } else {
- buf.append ("; Max-Age=");
- buf.append (maxAge);
- }
- }
+ } else {
+ buf.append ("; Max-Age=");
+ buf.append (maxAge);
+ }
+ }
- // Path=path
- if (path!=null) {
- buf.append ("; Path=");
- maybeQuote (version, buf, path);
- }
+ // Path=path
+ if (path!=null) {
+ buf.append ("; Path=");
+ if (version==0) {
+ maybeQuote2(version, buf, path);
+ } else {
+ maybeQuote2(version, buf, path, ServerCookie.tspecials2NoSlash, false);
+ }
+ }
- // Secure
- if (isSecure) {
- buf.append ("; Secure");
- }
-
-
+ // Secure
+ if (isSecure) {
+ buf.append ("; Secure");
+ }
+
+ headerBuf.append(buf);
}
- public static void maybeQuote (int version, StringBuffer buf,
- String value) {
+ /**
+ * @deprecated - Not used
+ */
+ @Deprecated
+ public static void maybeQuote (int version, StringBuffer buf,String value) {
// special case - a \n or \r shouldn't happen in any case
if (isToken(value)) {
buf.append(value);
} else {
buf.append('"');
- buf.append(escapeDoubleQuotes(value));
+ buf.append(escapeDoubleQuotes(value,0,value.length()));
buf.append('"');
}
}
- public static void maybeQuote2 (int version, StringBuffer buf,
- String value) {
- // special case - a \n or \r shouldn't happen in any case
- if (isToken2(value)) {
- buf.append(value);
- } else {
+
+ public static boolean alreadyQuoted (String value) {
+ if (value==null || value.length()==0) return false;
+ return (value.charAt(0)=='\"' && value.charAt(value.length()-1)=='\"');
+ }
+
+ /**
+ * Quotes values using rules that vary depending on Cookie version.
+ * @param version
+ * @param buf
+ * @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) {
+ return maybeQuote2(version,buf,value,null,allowVersionSwitch);
+ }
+
+ public static int maybeQuote2 (int version, StringBuffer buf, String value, String literals, boolean allowVersionSwitch) {
+ if (value==null || value.length()==0) {
+ buf.append("\"\"");
+ }else if (containsCTL(value,version))
+ throw new IllegalArgumentException("Control character in cookie value, consider BASE64 encoding your value");
+ else if (alreadyQuoted(value)) {
buf.append('"');
- buf.append(escapeDoubleQuotes(value));
+ buf.append(escapeDoubleQuotes(value,1,value.length()-1));
buf.append('"');
+ } else if (allowVersionSwitch && (!STRICT_SERVLET_COMPLIANCE) && version==0 && !isToken2(value, literals)) {
+ buf.append('"');
+ buf.append(escapeDoubleQuotes(value,0,value.length()));
+ buf.append('"');
+ version = 1;
+ } else if (version==0 && !isToken(value,literals)) {
+ buf.append('"');
+ buf.append(escapeDoubleQuotes(value,0,value.length()));
+ buf.append('"');
+ } else if (version==1 && !isToken2(value,literals)) {
+ buf.append('"');
+ buf.append(escapeDoubleQuotes(value,0,value.length()));
+ buf.append('"');
+ }else {
+ buf.append(value);
}
+ return version;
}
- // log
- static final int dbg=1;
- public static void log(String s ) {
- if (log.isDebugEnabled())
- log.debug("ServerCookie: " + s);
- }
-
/**
* Escapes any double quotes in the given string.
*
* @param s the input string
- *
+ * @param beginIndex start index inclusive
+ * @param endIndex exclusive
* @return The (possibly) escaped string
*/
- private static String escapeDoubleQuotes(String s) {
+ private static String escapeDoubleQuotes(String s, int beginIndex, int endIndex) {
if (s == null || s.length() == 0 || s.indexOf('"') == -1) {
return s;
}
StringBuffer b = new StringBuffer();
- char p = s.charAt(0);
- for (int i = 0; i < s.length(); i++) {
+ for (int i = beginIndex; i < endIndex; i++) {
char c = s.charAt(i);
- if (c == '"' && p != '\\')
+ if (c == '\\' ) {
+ b.append(c);
+ //ignore the character after an escape, just append it
+ if (++i>=endIndex) throw new IllegalArgumentException("Invalid escape character in cookie value.");
+ b.append(s.charAt(i));
+ } else if (c == '"')
b.append('\\').append('"');
else
b.append(c);
- p = c;
}
return b.toString();
}
+ /**
+ * Unescapes any double quotes in the given cookie value.
+ *
+ * @param bc The cookie value to modify
+ */
+ public static void unescapeDoubleQuotes(ByteChunk bc) {
+
+ if (bc == null || bc.getLength() == 0 || bc.indexOf('"', 0) == -1) {
+ return;
+ }
+
+ int src = bc.getStart();
+ int end = bc.getEnd();
+ int dest = src;
+ byte[] buffer = bc.getBuffer();
+
+ while (src < end) {
+ if (buffer[src] == '\\' && src < end && buffer[src+1] == '"') {
+ src++;
+ }
+ buffer[dest] = buffer[src];
+ dest ++;
+ src ++;
+ }
+ bc.setEnd(dest);
+ }
}
-
Added: branches/JBOSSWEB_2_0_0_GA_CP/test/build.xml
===================================================================
--- branches/JBOSSWEB_2_0_0_GA_CP/test/build.xml (rev 0)
+++ branches/JBOSSWEB_2_0_0_GA_CP/test/build.xml 2009-04-15 10:15:38 UTC (rev 1008)
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<project name="Tomcat 6.0" default="all" basedir=".">
+
+ <!-- See "build.properties.sample" in the top level directory for all -->
+ <!-- property values you must customize for successful building!!! -->
+ <property file="${user.home}/build.properties"/>
+ <property file="build.properties"/>
+
+ <property file="build.properties.default"/>
+
+ <property name="test.classes" value="${basedir}/output/classes"/>
+ <property name="tomcat.build" value="${basedir}/../output"/>
+
+ <property name="compile.source" value="1.5"/>
+ <property name="compile.debug" value="true"/>
+
+ <property name="junit.jar" value="${junit.home}/junit.jar"/>
+ <property name="test.runner" value="junit.textui.TestRunner"/>
+
+ <path id="tomcat.test.classpath">
+ <pathelement location="${test.classes}"/>
+ <pathelement location="${junit.jar}"/>
+ <fileset dir="${tomcat.build}/jars/">
+ <include name="jbossweb.jar"/>
+ </fileset>
+ <fileset dir="${tomcat.build}/../lib">
+ <include name="commons-logging.jar"/>
+ </fileset>
+ </path>
+
+ <target name="compile">
+
+ <mkdir dir="${test.classes}"/>
+
+ <!-- Compile -->
+ <javac srcdir="." destdir="${test.classes}"
+ debug="${compile.debug}"
+ deprecation="${compile.deprecation}"
+ source="${compile.source}"
+ optimize="${compile.optimize}">
+ <classpath refid="tomcat.test.classpath" />
+ <include name="org/apache/catalina/tomcat/util/**" />
+ </javac>
+
+ </target>
+
+ <target name="all" depends="compile">
+ <java dir="${test.classes}" classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
+ <arg value="org.apache.catalina.tomcat.util.http.TestCookies"/>
+ <classpath refid="tomcat.test.classpath"/>
+ </java>
+
+ </target>
+</project>
Added: branches/JBOSSWEB_2_0_0_GA_CP/test/org/apache/catalina/tomcat/util/http/TestCookies.java
===================================================================
--- branches/JBOSSWEB_2_0_0_GA_CP/test/org/apache/catalina/tomcat/util/http/TestCookies.java (rev 0)
+++ branches/JBOSSWEB_2_0_0_GA_CP/test/org/apache/catalina/tomcat/util/http/TestCookies.java 2009-04-15 10:15:38 UTC (rev 1008)
@@ -0,0 +1,280 @@
+/*
+ * 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.catalina.tomcat.util.http;
+
+import org.apache.tomcat.util.http.Cookies;
+import org.apache.tomcat.util.http.ServerCookie;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import java.lang.Exception;
+
+
+public class TestCookies extends TestCase {
+ public static void main( String args[] ) {
+ TestRunner.run(suite());
+ }
+ public static Test suite() {
+ TestSuite suite = new TestSuite();
+ suite.addTest(new TestSuite(TestCookies.class));
+ return suite;
+ }
+/*
+ int i = 10000000;
+ // These tests are not really representative
+ while (i-- > 0) {
+ test("session=1234567890;name=\"John Q. Public\";");
+ }
+// runtests();
+ }
+ */
+
+ public void testCookies() throws Exception {
+ test("foo=bar; a=b", "foo", "bar", "a", "b");
+ test("foo=bar;a=b", "foo", "bar", "a", "b");
+ test("foo=bar;a=b;", "foo", "bar", "a", "b");
+ test("foo=bar;a=b; ", "foo", "bar", "a", "b");
+ test("foo=bar;a=b; ;", "foo", "bar", "a", "b");
+ test("foo=;a=b; ;", "foo", "", "a", "b");
+ test("foo;a=b; ;", "foo", "", "a", "b");
+ // v1
+ test("$Version=1; foo=bar;a=b", "foo", "bar", "a", "b");
+
+ // OK
+ test("$Version=1;foo=bar;a=b; ; ", "foo", "bar", "a", "b");
+ test("$Version=1;foo=;a=b; ; ", "foo", "", "a", "b");
+ test("$Version=1;foo= ;a=b; ; ", "foo", "", "a", "b");
+ test("$Version=1;foo;a=b; ; ", "foo", "", "a", "b");
+ test("$Version=1;foo=\"bar\";a=b; ; ", "foo", "bar", "a", "b");
+
+ test("$Version=1;foo=\"bar\";$Domain=apache.org;a=b", "foo", "bar", "a", "b");
+ test("$Version=1;foo=\"bar\";$Domain=apache.org;a=b;$Domain=yahoo.com", "foo", "bar", "a", "b");
+ // rfc2965
+ test("$Version=1;foo=\"bar\";$Domain=apache.org;$Port=8080;a=b", "foo", "bar", "a", "b");
+
+ // make sure these never split into two cookies - JVK
+ test("$Version=1;foo=\"b\"ar\";$Domain=apache.org;$Port=8080;a=b", "foo", "b", "a", "b"); // Incorrectly escaped.
+ test("$Version=1;foo=\"b\\\"ar\";$Domain=apache.org;$Port=8080;a=b", "foo", "b\"ar", "a", "b"); // correctly escaped.
+ test("$Version=1;foo=\"b'ar\";$Domain=apache.org;$Port=8080;a=b", "foo", "b'ar", "a", "b");
+ // JFC: sure it is "b" and not b'ar ?
+ test("$Version=1;foo=b'ar;$Domain=apache.org;$Port=8080;a=b", "foo", "b", "a", "b");
+
+ // Ends in quoted value
+ test("foo=bar;a=\"b\"", "foo", "bar", "a", "b");
+ test("foo=bar;a=\"b\";", "foo", "bar", "a", "b");
+
+ // Last character is an escape character
+ test("$Version=1;foo=b'ar;$Domain=\"apache.org\";$Port=8080;a=\"b\\\"", "foo", "b");
+ test("$Version=1;foo=b'ar;$Domain=\"apache.org\";$Port=8080;a=\"b\\", "foo", "b");
+
+ // Bad... a token cannot be quoted with ' chars
+ test("$Version=\"1\"; foo='bar'; $Path=/path; $Domain=\"localhost\"");
+
+ // wrong, path should not have '/' JVK
+ test("$Version=1;foo=\"bar\";$Path=/examples;a=b; ; ", "foo", "bar", "a", "b");
+
+ // wrong
+ test("$Version=1;foo=\"bar\";$Domain=apache.org;$Port=8080;a=b", "foo", "bar", "a", "b");
+
+ // Test name-only at the end of the header
+ test("foo;a=b;bar", "foo", "", "a", "b", "bar", "");
+ test("foo;a=b;bar;", "foo", "", "a", "b", "bar", "");
+ test("foo;a=b;bar ", "foo", "", "a", "b", "bar", "");
+ test("foo;a=b;bar ;", "foo", "", "a", "b", "bar", "");
+
+ // Multiple delimiters next to each other
+
+ // BUG -- the ' ' needs to be skipped.
+ test("foo;a=b; ;bar", "foo", "", "a", "b", "bar", "");
+ // BUG -- ';' needs skipping
+ test("foo;a=b;;bar", "foo", "", "a", "b", "bar", "");
+ test("foo;a=b; ;;bar=rab", "foo", "", "a", "b", "bar", "rab");
+ // These pass currently
+ test("foo;a=b;; ;bar=rab", "foo", "", "a", "b", "bar", "rab");
+
+ // '#' is a valid cookie name (not a separator)
+ test("foo;a=b;;#;bar=rab","foo", "", "a", "b", "#", "", "bar", "rab");
+
+
+ test("foo;a=b;;\\;bar=rab", "foo", "", "a", "b", "bar", "rab");
+
+ // Try all the separators of version1 in version0 cookie.
+ // Won't work we only parse version1 cookie result 1 cookie.
+ test("a=()<>@:\\\"/[]?={}\t; foo=bar", "foo", "bar");
+
+ // Test the version.
+ test("$Version=1;foo=bar", 1);
+ test("$Version=0;foo=bar", 0);
+ }
+
+ public static void test( String s, int val ) throws Exception {
+ System.out.println("Processing [" + s + "]");
+ Cookies cs=new Cookies(null);
+ cs.processCookieHeader( s.getBytes(), 0, s.length());
+ int num = cs.getCookieCount();
+ if (num != 1)
+ throw new Exception("wrong number of cookies " + num);
+ ServerCookie co = cs.getCookie(0);
+ System.out.println("One Cookie: " + co);
+ if (co.getVersion() != val)
+ throw new Exception("wrong version " + co.getVersion() + " != " + val);
+ }
+ public static void test( String s ) throws Exception {
+ System.out.println("Processing [" + s + "]");
+ Cookies cs=new Cookies(null);
+ cs.processCookieHeader( s.getBytes(), 0, s.length());
+
+ int num = cs.getCookieCount();
+ for( int i=0; i< num ; i++ ) {
+ System.out.println("Cookie: " + cs.getCookie( i ));
+ }
+ if (num != 0)
+ throw new Exception("wrong number of cookies " + num);
+ }
+ public static void test( String s, String name, String val ) throws Exception {
+ System.out.println("Processing [" + s + "]");
+ Cookies cs=new Cookies(null);
+ cs.processCookieHeader( s.getBytes(), 0, s.length());
+
+ int num = cs.getCookieCount();
+ if (num != 1)
+ throw new Exception("wrong number of cookies " + num);
+ ServerCookie co = cs.getCookie(0);
+ System.out.println("One Cookie: " + co);
+ String coname = co.getName().toString();
+ String coval = co.getValue().toString();
+ if ( ! name.equals(coname))
+ throw new Exception("wrong name " + coname + " != " + name);
+ if ( ! val.equals(coval))
+ throw new Exception("wrong value " + coval + " != " + val);
+ }
+ public static void test( String s, String name, String val, String name2, String val2 ) throws Exception {
+ System.out.println("Processing [" + s + "]");
+ Cookies cs=new Cookies(null);
+ cs.processCookieHeader( s.getBytes(), 0, s.length());
+
+ int num = cs.getCookieCount();
+ if (num != 2)
+ throw new Exception("wrong number of cookies " + num);
+ ServerCookie co = cs.getCookie(0);
+ System.out.println("1 - Cookie: " + co);
+ ServerCookie co2 = cs.getCookie(1);
+ System.out.println("2 - Cookie: " + co2);
+
+ String coname = co.getName().toString();
+ String coval = co.getValue().toString();
+ if ( ! name.equals(coname))
+ throw new Exception("1 - wrong name " + coname + " != " + name);
+ if ( ! val.equals(coval))
+ throw new Exception("1 - wrong value " + coval + " != " + val);
+
+ String coname2 = co2.getName().toString();
+ String coval2 = co2.getValue().toString();
+ if ( ! name2.equals(coname2))
+ throw new Exception("2 - wrong name " + coname2 + " != " + name2);
+ if ( ! val2.equals(coval2))
+ throw new Exception("2 - wrong value " + coval2 + " != " + val2);
+ }
+ public static void test( String s, String name, String val, String name2,
+ String val2, String name3, String val3 ) throws Exception {
+ System.out.println("Processing [" + s + "]");
+ Cookies cs=new Cookies(null);
+ cs.processCookieHeader( s.getBytes(), 0, s.length());
+
+ int num = cs.getCookieCount();
+ if (num != 3)
+ throw new Exception("wrong number of cookies " + num);
+ ServerCookie co = cs.getCookie(0);
+ System.out.println("1 - Cookie: " + co);
+ ServerCookie co2 = cs.getCookie(1);
+ System.out.println("2 - Cookie: " + co2);
+ ServerCookie co3 = cs.getCookie(2);
+ System.out.println("3 - Cookie: " + co3);
+
+ String coname = co.getName().toString();
+ String coval = co.getValue().toString();
+ if ( ! name.equals(coname))
+ throw new Exception("1 - wrong name " + coname + " != " + name);
+ if ( ! val.equals(coval))
+ throw new Exception("1 - wrong value " + coval + " != " + val);
+
+ String coname2 = co2.getName().toString();
+ String coval2 = co2.getValue().toString();
+ if ( ! name2.equals(coname2))
+ throw new Exception("2 - wrong name " + coname2 + " != " + name2);
+ if ( ! val2.equals(coval2))
+ throw new Exception("2 - wrong value " + coval2 + " != " + val2);
+
+ String coname3 = co3.getName().toString();
+ String coval3 = co3.getValue().toString();
+ if ( ! name3.equals(coname3))
+ throw new Exception("3 - wrong name " + coname3 + " != " + name3);
+ if ( ! val2.equals(coval2))
+ throw new Exception("3 - wrong value " + coval3 + " != " + val3);
+ }
+ public static void test( String s, String name, String val, String name2,
+ String val2, String name3, String val3,
+ String name4, String val4 ) throws Exception {
+ System.out.println("Processing [" + s + "]");
+ Cookies cs=new Cookies(null);
+ cs.processCookieHeader( s.getBytes(), 0, s.length());
+
+ int num = cs.getCookieCount();
+ if (num != 4)
+ throw new Exception("wrong number of cookies " + num);
+ ServerCookie co = cs.getCookie(0);
+ System.out.println("1 - Cookie: " + co);
+ ServerCookie co2 = cs.getCookie(1);
+ System.out.println("2 - Cookie: " + co2);
+ ServerCookie co3 = cs.getCookie(2);
+ System.out.println("3 - Cookie: " + co3);
+ ServerCookie co4 = cs.getCookie(3);
+ System.out.println("4 - Cookie: " + co4);
+
+ String coname = co.getName().toString();
+ String coval = co.getValue().toString();
+ if ( ! name.equals(coname))
+ throw new Exception("1 - wrong name " + coname + " != " + name);
+ if ( ! val.equals(coval))
+ throw new Exception("1 - wrong value " + coval + " != " + val);
+
+ String coname2 = co2.getName().toString();
+ String coval2 = co2.getValue().toString();
+ if ( ! name2.equals(coname2))
+ throw new Exception("2 - wrong name " + coname2 + " != " + name2);
+ if ( ! val2.equals(coval2))
+ throw new Exception("2 - wrong value " + coval2 + " != " + val2);
+
+ String coname3 = co3.getName().toString();
+ String coval3 = co3.getValue().toString();
+ if ( ! name3.equals(coname3))
+ throw new Exception("3 - wrong name " + coname3 + " != " + name3);
+ if ( ! val3.equals(coval3))
+ throw new Exception("3 - wrong value " + coval3 + " != " + val3);
+
+ String coname4 = co4.getName().toString();
+ String coval4 = co4.getValue().toString();
+ if ( ! name4.equals(coname4))
+ throw new Exception("4 - wrong name " + coname4 + " != " + name4);
+ if ( ! val4.equals(coval4))
+ throw new Exception("4 - wrong value " + coval4 + " != " + val4);
+ }
+}
15 years
JBossWeb SVN: r1007 - in trunk/java/javax/servlet: resources and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-14 12:35:14 -0400 (Tue, 14 Apr 2009)
New Revision: 1007
Added:
trunk/java/javax/servlet/jsp/resources/jsp_2_2.xsd
trunk/java/javax/servlet/resources/web-app_3_0.xsd
trunk/java/javax/servlet/resources/web-common_3_0.xsd
trunk/java/javax/servlet/resources/web-fragment_3_0.xsd
Log:
- Descriptors update.
Added: trunk/java/javax/servlet/jsp/resources/jsp_2_2.xsd
===================================================================
--- trunk/java/javax/servlet/jsp/resources/jsp_2_2.xsd (rev 0)
+++ trunk/java/javax/servlet/jsp/resources/jsp_2_2.xsd 2009-04-14 16:35:14 UTC (rev 1007)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<!--
+ ** The actual Sun XSD for this stripped down XSD can be found at
+ ** http://java.sun.com/xml/ns/javaee/jsp_2_1.xsd
+ ** This XSD contains only the functional elements for programatic use.
+-->
+
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://java.sun.com/xml/ns/javaee"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="2.2">
+
+ <xsd:include schemaLocation="javaee_5.xsd" />
+
+ <xsd:complexType name="jsp-configType">
+ <xsd:sequence>
+ <xsd:element name="taglib" type="javaee:taglibType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="jsp-property-group" type="javaee:jsp-property-groupType" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID" />
+ </xsd:complexType>
+
+ <xsd:complexType name="jsp-fileType">
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:pathType" />
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="jsp-property-groupType">
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="url-pattern" type="javaee:url-patternType" maxOccurs="unbounded" />
+ <xsd:element name="el-ignored" type="javaee:true-falseType" minOccurs="0" />
+ <xsd:element name="page-encoding" type="javaee:string" minOccurs="0" />
+ <xsd:element name="scripting-invalid" type="javaee:true-falseType" minOccurs="0" />
+ <xsd:element name="is-xml" type="javaee:true-falseType" minOccurs="0" />
+ <xsd:element name="include-prelude" type="javaee:pathType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="include-coda" type="javaee:pathType" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="deferred-syntax-allowed-as-literal" type="javaee:true-falseType" minOccurs="0" />
+ <xsd:element name="trim-directive-whitespaces" type="javaee:true-falseType" minOccurs="0" />
+ <xsd:element name="default-content-type" type="javaee:string" minOccurs="0" />
+ <xsd:element name="buffer" type="javaee:string" minOccurs="0" />
+ <xsd:element name="error-on-undeclared-namespace" type="javaee:true-falseType" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID" />
+ </xsd:complexType>
+
+ <xsd:complexType name="taglibType">
+ <xsd:sequence>
+ <xsd:element name="taglib-uri" type="javaee:string" />
+ <xsd:element name="taglib-location" type="javaee:pathType" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID" />
+ </xsd:complexType>
+</xsd:schema>
Added: trunk/java/javax/servlet/resources/web-app_3_0.xsd
===================================================================
--- trunk/java/javax/servlet/resources/web-app_3_0.xsd (rev 0)
+++ trunk/java/javax/servlet/resources/web-app_3_0.xsd 2009-04-14 16:35:14 UTC (rev 1007)
@@ -0,0 +1,290 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://java.sun.com/xml/ns/javaee"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="3.0">
+ <xsd:annotation>
+ <xsd:documentation>
+ @(#)web-app_3_0.xsds 1.68 07/03/09
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 2003-2007 Sun Microsystems, Inc. All rights reserved.
+
+ The contents of this file are subject to the terms of either the
+ GNU General Public License Version 2 only ("GPL") or the Common
+ Development and Distribution License("CDDL") (collectively, the
+ "License"). You may not use this file except in compliance with
+ the License. You can obtain a copy of the License at
+ https://glassfish.dev.java.net/public/CDDL+GPL.html or
+ glassfish/bootstrap/legal/LICENSE.txt. See the License for the
+ specific language governing permissions and limitations under the
+ License.
+
+ When distributing the software, include this License Header
+ Notice in each file and include the License file at
+ glassfish/bootstrap/legal/LICENSE.txt. Sun designates this
+ particular file as subject to the "Classpath" exception as
+ provided by Sun in the GPL Version 2 section of the License file
+ that accompanied this code. If applicable, add the following
+ below the License Header, with the fields enclosed by brackets []
+ replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ If you wish your version of this file to be governed by only the
+ CDDL or only the GPL Version 2, indicate your decision by adding
+ "[Contributor] elects to include this software in this
+ distribution under the [CDDL or GPL Version 2] license." If you
+ don't indicate a single choice of license, a recipient has the
+ option to distribute your version of this file under either the
+ CDDL, the GPL Version 2 or to extend the choice of license to its
+ licensees as provided above. However, if you add GPL Version 2
+ code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such
+ option by the copyright holder.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ This is the XML Schema for the Servlet 3.0 deployment descriptor.
+ The deployment descriptor must be named "WEB-INF/web.xml" in the
+ web application's war file. All Servlet deployment descriptors
+ must indicate the web application schema by using the Java EE
+ namespace:
+
+ http://java.sun.com/xml/ns/javaee
+
+ and by indicating the version of the schema by
+ using the version element as shown below:
+
+ <web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="..."
+ version="3.0">
+ ...
+ </web-app>
+
+ The instance documents may indicate the published version of
+ the schema using the xsi:schemaLocation attribute for Java EE
+ namespace with the following location:
+
+ http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The following conventions apply to all Java EE
+ deployment descriptor elements unless indicated otherwise.
+
+ - In elements that specify a pathname to a file within the
+ same JAR file, relative filenames (i.e., those not
+ starting with "/") are considered relative to the root of
+ the JAR file's namespace. Absolute filenames (i.e., those
+ starting with "/") also specify names in the root of the
+ JAR file's namespace. In general, relative names are
+ preferred. The exception is .war files where absolute
+ names are preferred for consistency with the Servlet API.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:include schemaLocation="web-common_3_0.xsd"/>
+
+
+<!-- **************************************************** -->
+
+ <xsd:element name="web-app" type="javaee:web-appType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The web-app element is the root of the deployment
+ descriptor for a web application. Note that the sub-elements
+ of this element can be in the arbitrary order. Because of
+ that, the multiplicity of the elements of distributable,
+ session-config, welcome-file-list, jsp-config, login-config,
+ and locale-encoding-mapping-list was changed from "?" to "*"
+ in this schema. However, the deployment descriptor instance
+ file must not contain multiple elements of session-config,
+ jsp-config, and login-config. When there are multiple elements of
+ welcome-file-list or locale-encoding-mapping-list, the container
+ must concatenate the element contents. The multiple occurence
+ of the element distributable is redundant and the container
+ treats that case exactly in the same way when there is only
+ one distributable.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:unique name="web-common-servlet-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The servlet element contains the name of a servlet.
+ The name must be unique within the web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:servlet"/>
+ <xsd:field xpath="javaee:servlet-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-common-filter-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The filter element contains the name of a filter.
+ The name must be unique within the web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:filter"/>
+ <xsd:field xpath="javaee:filter-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-common-ejb-local-ref-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-local-ref-name element contains the name of an EJB
+ reference. The EJB reference is an entry in the web
+ application's environment and is relative to the
+ java:comp/env context. The name must be unique within
+ the web application.
+
+ It is recommended that name is prefixed with "ejb/".
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:ejb-local-ref"/>
+ <xsd:field xpath="javaee:ejb-ref-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-common-ejb-ref-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-ref-name element contains the name of an EJB
+ reference. The EJB reference is an entry in the web
+ application's environment and is relative to the
+ java:comp/env context. The name must be unique within
+ the web application.
+
+ It is recommended that name is prefixed with "ejb/".
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:ejb-ref"/>
+ <xsd:field xpath="javaee:ejb-ref-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-common-resource-env-ref-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The resource-env-ref-name element specifies the name of
+ a resource environment reference; its value is the
+ environment entry name used in the web application code.
+ The name is a JNDI name relative to the java:comp/env
+ context and must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:resource-env-ref"/>
+ <xsd:field xpath="javaee:resource-env-ref-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-common-message-destination-ref-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-ref-name element specifies the name of
+ a message destination reference; its value is the
+ environment entry name used in the web application code.
+ The name is a JNDI name relative to the java:comp/env
+ context and must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:message-destination-ref"/>
+ <xsd:field xpath="javaee:message-destination-ref-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-common-res-ref-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-ref-name element specifies the name of a
+ resource manager connection factory reference. The name
+ is a JNDI name relative to the java:comp/env context.
+ The name must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:resource-ref"/>
+ <xsd:field xpath="javaee:res-ref-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-common-env-entry-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The env-entry-name element contains the name of a web
+ application's environment entry. The name is a JNDI
+ name relative to the java:comp/env context. The name
+ must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:selector xpath="javaee:env-entry"/>
+ <xsd:field xpath="javaee:env-entry-name"/>
+ </xsd:unique>
+
+ <xsd:key name="web-common-role-name-key">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ A role-name-key is specified to allow the references
+ from the security-role-refs.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:security-role"/>
+ <xsd:field xpath="javaee:role-name"/>
+ </xsd:key>
+
+ <xsd:keyref name="web-common-role-name-references"
+ refer="javaee:web-common-role-name-key">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The keyref indicates the references from
+ security-role-ref to a specified role-name.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:servlet/javaee:security-role-ref"/>
+ <xsd:field xpath="javaee:role-link"/>
+ </xsd:keyref>
+ </xsd:element>
+
+</xsd:schema>
+
Added: trunk/java/javax/servlet/resources/web-common_3_0.xsd
===================================================================
--- trunk/java/javax/servlet/resources/web-common_3_0.xsd (rev 0)
+++ trunk/java/javax/servlet/resources/web-common_3_0.xsd 2009-04-14 16:35:14 UTC (rev 1007)
@@ -0,0 +1,1488 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://java.sun.com/xml/ns/javaee"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="3.0">
+ <xsd:annotation>
+ <xsd:documentation>
+ @(#)web-common_3_0.xsds 1.68 08/26/08
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 2003-2007 Sun Microsystems, Inc. All rights reserved.
+
+ The contents of this file are subject to the terms of either the
+ GNU General Public License Version 2 only ("GPL") or the Common
+ Development and Distribution License("CDDL") (collectively, the
+ "License"). You may not use this file except in compliance with
+ the License. You can obtain a copy of the License at
+ https://glassfish.dev.java.net/public/CDDL+GPL.html or
+ glassfish/bootstrap/legal/LICENSE.txt. See the License for the
+ specific language governing permissions and limitations under the
+ License.
+
+ When distributing the software, include this License Header
+ Notice in each file and include the License file at
+ glassfish/bootstrap/legal/LICENSE.txt. Sun designates this
+ particular file as subject to the "Classpath" exception as
+ provided by Sun in the GPL Version 2 section of the License file
+ that accompanied this code. If applicable, add the following
+ below the License Header, with the fields enclosed by brackets []
+ replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ If you wish your version of this file to be governed by only the
+ CDDL or only the GPL Version 2, indicate your decision by adding
+ "[Contributor] elects to include this software in this
+ distribution under the [CDDL or GPL Version 2] license." If you
+ don't indicate a single choice of license, a recipient has the
+ option to distribute your version of this file under either the
+ CDDL, the GPL Version 2 or to extend the choice of license to its
+ licensees as provided above. However, if you add GPL Version 2
+ code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such
+ option by the copyright holder.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ This is the common XML Schema for the Servlet 3.0 deployment descriptor.
+ This file is in turn used by web.xml and web-fragment.xml
+ web application's war file. All Servlet deployment descriptors
+ must indicate the web common schema by using the Java EE
+ namespace:
+
+ http://java.sun.com/xml/ns/javaee
+
+ and by indicating the version of the schema by
+ using the version element as shown below:
+
+ <web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="..."
+ version="3.0">
+ ...
+ </web-app>
+
+ The instance documents may indicate the published version of
+ the schema using the xsi:schemaLocation attribute for Java EE
+ namespace with the following location:
+
+ http://java.sun.com/xml/ns/javaee/web-common_3_0.xsd
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The following conventions apply to all Java EE
+ deployment descriptor elements unless indicated otherwise.
+
+ - In elements that specify a pathname to a file within the
+ same JAR file, relative filenames (i.e., those not
+ starting with "/") are considered relative to the root of
+ the JAR file's namespace. Absolute filenames (i.e., those
+ starting with "/") also specify names in the root of the
+ JAR file's namespace. In general, relative names are
+ preferred. The exception is .war files where absolute
+ names are preferred for consistency with the Servlet API.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:include schemaLocation="javaee_5.xsd"/>
+ <xsd:include schemaLocation="jsp_2_2.xsd"/>
+
+ <xsd:attributeGroup name="web-common-attributes">
+ <xsd:attribute name="version"
+ use="required"/>
+ <xsd:attribute name="id" type="xsd:ID"/>
+
+ <xsd:attribute name="metadata-complete" type="xsd:boolean">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The metadata-complete attribute defines whether this
+ deployment descriptor and other related deployment
+ descriptors for this module (e.g., web service
+ descriptors) are complete, or whether the class
+ files available to this module and packaged with
+ this application should be examined for annotations
+ that specify deployment information.
+
+ If metadata-complete is set to "true", the deployment
+ tool must ignore any annotations that specify deployment
+ information, which might be present in the class files
+ of the application.
+
+ If metadata-complete is not specified or is set to
+ "false", the deployment tool must examine the class
+ files of the application for annotations, as
+ specified by the specifications.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:attributeGroup>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="absoluteOrderingType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Please see section 8.2.2 of the specification for details.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="name"
+ type="javaee:java-identifierType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="others"
+ type="javaee:ordering-othersType"
+ minOccurs="0"
+ maxOccurs="1" />
+ </xsd:choice>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="auth-constraintType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The auth-constraintType indicates the user roles that
+ should be permitted access to this resource
+ collection. The role-name used here must either correspond
+ to the role-name of one of the security-role elements
+ defined for this web application, or be the specially
+ reserved role-name "*" that is a compact syntax for
+ indicating all roles in the web application. If both "*"
+ and rolenames appear, the container interprets this as all
+ roles. If no roles are defined, no user is allowed access
+ to the portion of the web application described by the
+ containing security-constraint. The container matches
+ role names case sensitively when determining access.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="role-name"
+ type="javaee:role-nameType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="auth-methodType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The auth-methodType is used to configure the authentication
+ mechanism for the web application. As a prerequisite to
+ gaining access to any web resources which are protected by
+ an authorization constraint, a user must have authenticated
+ using the configured mechanism. Legal values are "BASIC",
+ "DIGEST", "FORM", "CLIENT-CERT", or a vendor-specific
+ authentication scheme.
+
+ Used in: login-config
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="cookie-commentType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The comment that will be assigned to any session tracking
+ cookies created by this web application.
+
+ Used in: cookie-config
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:nonEmptyStringType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="cookie-configType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The cookie-configType defines the configuration for the
+ session tracking cookies of this web application.
+
+ Used in: session-config
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="name"
+ type="javaee:cookie-nameType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The name that will be assigned to any session tracking
+ cookies created by this web application.
+ The default is JSESSIONID
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="domain"
+ type="javaee:cookie-domainType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The domain name that will be assigned to any session tracking
+ cookies created by this web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="path"
+ type="javaee:cookie-pathType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The path that will be assigned to any session tracking
+ cookies created by this web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="comment"
+ type="javaee:cookie-commentType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The comment that will be assigned to any session tracking
+ cookies created by this web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="http-only"
+ type="javaee:true-falseType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Specifies whether any session tracking cookies created
+ by this web application will be marked as HttpOnly
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="secure"
+ type="javaee:true-falseType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Specifies whether any session tracking cookies created
+ by this web application will be marked as secure
+ even if the request that initiated the corresponding session
+ is using plain HTTP instead of HTTPS
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="max-age"
+ type="javaee:xsdIntegerType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The lifetime (in seconds) that will be assigned to any
+ session tracking cookies created by this web application.
+ Default is -1
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="cookie-domainType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The domain name that will be assigned to any session tracking
+ cookies created by this web application.
+
+ Used in: cookie-config
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:nonEmptyStringType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="cookie-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The name that will be assigned to any session tracking
+ cookies created by this web application.
+ The default is JSESSIONID
+
+ Used in: cookie-config
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:nonEmptyStringType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="cookie-pathType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The path that will be assigned to any session tracking
+ cookies created by this web application.
+
+ Used in: cookie-config
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:nonEmptyStringType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="dispatcherType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The dispatcher has five legal values: FORWARD, REQUEST,
+ INCLUDE, ASYNC, and ERROR.
+
+ A value of FORWARD means the Filter will be applied under
+ RequestDispatcher.forward() calls.
+ A value of REQUEST means the Filter will be applied under
+ ordinary client calls to the path or servlet.
+ A value of INCLUDE means the Filter will be applied under
+ RequestDispatcher.include() calls.
+ A value of ASYNC means the Filter will be applied under
+ calls dispatched from an AsyncContext.
+ A value of ERROR means the Filter will be applied under the
+ error page mechanism.
+
+ The absence of any dispatcher elements in a filter-mapping
+ indicates a default of applying filters only under ordinary
+ client calls to the path or servlet.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="FORWARD"/>
+ <xsd:enumeration value="INCLUDE"/>
+ <xsd:enumeration value="REQUEST"/>
+ <xsd:enumeration value="ASYNC"/>
+ <xsd:enumeration value="ERROR"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="encodingType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The encodingType defines IANA character sets.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="[^\s]+"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="error-codeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The error-code contains an HTTP error code, ex: 404
+
+ Used in: error-page
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:xsdPositiveIntegerType">
+ <xsd:pattern value="\d{3}"/>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="error-pageType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The error-pageType contains a mapping between an error code
+ or exception type to the path of a resource in the web
+ application.
+
+ Error-page declarations using the exception-type element in
+ the deployment descriptor must be unique up to the class name of
+ the exception-type. Similarly, error-page declarations using the
+ status-code element must be unique in the deployment descriptor
+ up to the status code.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:choice minOccurs="0" maxOccurs="1">
+ <xsd:element name="error-code"
+ type="javaee:error-codeType"/>
+
+ <xsd:element name="exception-type"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The exception-type contains a fully qualified class
+ name of a Java exception type.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:choice>
+
+ <xsd:element name="location"
+ type="javaee:war-pathType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The location element contains the location of the
+ resource in the web application relative to the root of
+ the web application. The value of the location must have
+ a leading `/'.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="filter-mappingType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Declaration of the filter mappings in this web
+ application is done by using filter-mappingType.
+ The container uses the filter-mapping
+ declarations to decide which filters to apply to a request,
+ and in what order. The container matches the request URI to
+ a Servlet in the normal way. To determine which filters to
+ apply it matches filter-mapping declarations either on
+ servlet-name, or on url-pattern for each filter-mapping
+ element, depending on which style is used. The order in
+ which filters are invoked is the order in which
+ filter-mapping declarations that match a request URI for a
+ servlet appear in the list of filter-mapping elements.The
+ filter-name value must be the value of the filter-name
+ sub-elements of one of the filter declarations in the
+ deployment descriptor.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="filter-name"
+ type="javaee:filter-nameType"/>
+ <xsd:choice minOccurs="1" maxOccurs="unbounded">
+ <xsd:element name="url-pattern"
+ type="javaee:url-patternType"/>
+ <xsd:element name="servlet-name"
+ type="javaee:servlet-nameType"/>
+ </xsd:choice>
+ <xsd:element name="dispatcher"
+ type="javaee:dispatcherType"
+ minOccurs="0" maxOccurs="5"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="filter-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The logical name of the filter is declare
+ by using filter-nameType. This name is used to map the
+ filter. Each filter name is unique within the web
+ application.
+
+ Used in: filter, filter-mapping
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:nonEmptyStringType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="filterType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The filterType is used to declare a filter in the web
+ application. The filter is mapped to either a servlet or a
+ URL pattern in the filter-mapping element, using the
+ filter-name value to reference. Filters can access the
+ initialization parameters declared in the deployment
+ descriptor at runtime via the FilterConfig interface.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="filter-name"
+ type="javaee:filter-nameType"/>
+ <xsd:element name="filter-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The fully qualified classname of the filter.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="async-supported"
+ type="javaee:true-falseType"
+ minOccurs="0"/>
+
+ <xsd:element name="init-param"
+ type="javaee:param-valueType"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The init-param element contains a name/value pair as
+ an initialization param of a servlet filter
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="form-login-configType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The form-login-configType specifies the login and error
+ pages that should be used in form based login. If form based
+ authentication is not used, these elements are ignored.
+
+ Used in: login-config
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+
+ <xsd:element name="form-login-page"
+ type="javaee:war-pathType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The form-login-page element defines the location in the web
+ app where the page that can be used for login can be
+ found. The path begins with a leading / and is interpreted
+ relative to the root of the WAR.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="form-error-page"
+ type="javaee:war-pathType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The form-error-page element defines the location in
+ the web app where the error page that is displayed
+ when login is not successful can be found.
+ The path begins with a leading / and is interpreted
+ relative to the root of the WAR.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="http-methodType">
+ <xsd:annotation>
+
+ <xsd:documentation>
+
+ A HTTP method type as defined in HTTP 1.1 section 2.2.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="[!-~-[\(\)<>@,;:"/\[\]?=\{\}\\\p{Z}]]+"/>
+ </xsd:restriction>
+
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="load-on-startupType">
+ <xsd:union memberTypes="javaee:null-charType xsd:integer"/>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="locale-encoding-mapping-listType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The locale-encoding-mapping-list contains one or more
+ locale-encoding-mapping(s).
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="locale-encoding-mapping"
+ type="javaee:locale-encoding-mappingType"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="locale-encoding-mappingType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The locale-encoding-mapping contains locale name and
+ encoding name. The locale name must be either "Language-code",
+ such as "ja", defined by ISO-639 or "Language-code_Country-code",
+ such as "ja_JP". "Country code" is defined by ISO-3166.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="locale"
+ type="javaee:localeType"/>
+ <xsd:element name="encoding"
+ type="javaee:encodingType"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="localeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The localeType defines valid locale defined by ISO-639-1
+ and ISO-3166.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="[a-z]{2}(_|-)?([\p{L}\-\p{Nd}]{2})?"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="login-configType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The login-configType is used to configure the authentication
+ method that should be used, the realm name that should be
+ used for this application, and the attributes that are
+ needed by the form login mechanism.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="auth-method"
+ type="javaee:auth-methodType"
+ minOccurs="0"/>
+ <xsd:element name="realm-name"
+ type="javaee:string" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The realm name element specifies the realm name to
+ use in HTTP Basic authorization.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="form-login-config"
+ type="javaee:form-login-configType"
+ minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="mime-mappingType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The mime-mappingType defines a mapping between an extension
+ and a mime type.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The extension element contains a string describing an
+ extension. example: "txt"
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:element name="extension"
+ type="javaee:string"/>
+ <xsd:element name="mime-type"
+ type="javaee:mime-typeType"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="mime-typeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The mime-typeType is used to indicate a defined mime type.
+
+ Example:
+ "text/plain"
+
+ Used in: mime-mapping
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:pattern value="[^\p{Cc}^\s]+/[^\p{Cc}^\s]+"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="nonEmptyStringType">
+ <xsd:annotation>
+ <xsd:documentation>
+ This type defines a string which contains at least one
+ character.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:minLength value="1"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="null-charType">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value=""/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ordering-orderingType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This element contains a sequence of "name" elements, each of
+which
+ refers to an application configuration resource by the "name"
+ declared on its web.xml fragment. This element can also contain
+ a single "others" element which specifies that this document
+comes
+ before or after other documents within the application.
+ See section 8.2.2 of the specification for details.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="name"
+ type="javaee:java-identifierType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="others"
+ type="javaee:ordering-othersType"
+ minOccurs="0" maxOccurs="1" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ordering-othersType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This element indicates that the ordering sub-element in which
+ it was placed should take special action regarding the ordering
+ of this application resource relative to other application
+ configuration resources.
+ See section 8.2.2 of the specification for details.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="orderingType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Please see section 8.2.2 of the specification for details.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="after"
+ type="javaee:ordering-orderingType"
+ minOccurs="0"
+ maxOccurs="1"/>
+ <xsd:element name="before"
+ type="javaee:ordering-orderingType"
+ minOccurs="0"
+ maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="security-constraintType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The security-constraintType is used to associate
+ security constraints with one or more web resource
+ collections
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="display-name"
+ type="javaee:display-nameType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="web-resource-collection"
+ type="javaee:web-resource-collectionType"
+ maxOccurs="unbounded"/>
+ <xsd:element name="auth-constraint"
+ type="javaee:auth-constraintType"
+ minOccurs="0"/>
+ <xsd:element name="user-data-constraint"
+ type="javaee:user-data-constraintType"
+ minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="servlet-mappingType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The servlet-mappingType defines a mapping between a
+ servlet and a url pattern.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="servlet-name"
+ type="javaee:servlet-nameType"/>
+ <xsd:element name="url-pattern"
+ type="javaee:url-patternType"
+ minOccurs="1" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="servlet-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The servlet-name element contains the canonical name of the
+ servlet. Each servlet name is unique within the web
+ application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:nonEmptyStringType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="servletType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The servletType is used to declare a servlet.
+ It contains the declarative data of a
+ servlet. If a jsp-file is specified and the load-on-startup
+ element is present, then the JSP should be precompiled and
+ loaded.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="servlet-name"
+ type="javaee:servlet-nameType"/>
+ <xsd:choice>
+ <xsd:element name="servlet-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The servlet-class element contains the fully
+ qualified class name of the servlet.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="jsp-file"
+ type="javaee:jsp-fileType"/>
+
+ </xsd:choice>
+
+ <xsd:element name="init-param"
+ type="javaee:param-valueType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="load-on-startup"
+ type="javaee:load-on-startupType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The load-on-startup element indicates that this
+ servlet should be loaded (instantiated and have
+ its init() called) on the startup of the web
+ application. The optional contents of these
+ element must be an integer indicating the order in
+ which the servlet should be loaded. If the value
+ is a negative integer, or the element is not
+ present, the container is free to load the servlet
+ whenever it chooses. If the value is a positive
+ integer or 0, the container must load and
+ initialize the servlet as the application is
+ deployed. The container must guarantee that
+ servlets marked with lower integers are loaded
+ before servlets marked with higher integers. The
+ container may choose the order of loading of
+ servlets with the same load-on-start-up value.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="enabled"
+ type="javaee:true-falseType"
+ minOccurs="0"/>
+ <xsd:element name="async-supported"
+ type="javaee:true-falseType"
+ minOccurs="0"/>
+ <xsd:element name="run-as"
+ type="javaee:run-asType"
+ minOccurs="0"/>
+ <xsd:element name="security-role-ref"
+ type="javaee:security-role-refType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="session-configType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The session-configType defines the session parameters
+ for this web application.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="session-timeout"
+ type="javaee:xsdIntegerType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The session-timeout element defines the default
+ session timeout interval for all sessions created
+ in this web application. The specified timeout
+ must be expressed in a whole number of minutes.
+ If the timeout is 0 or less, the container ensures
+ the default behaviour of sessions is never to time
+ out. If this element is not specified, the container
+ must set its default timeout period.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="cookie-config"
+ type="javaee:cookie-configType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The cookie-config element defines the configuration of the
+ session tracking cookies created by this web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="tracking-mode"
+ type="javaee:tracking-modeType"
+ minOccurs="0" maxOccurs="3">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The tracking-mode element defines the tracking modes
+ for sessions created by this web application
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="tracking-modeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The tracking modes for sessions created by this web
+ application
+
+ Used in: session-config
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="COOKIE"/>
+ <xsd:enumeration value="URL"/>
+ <xsd:enumeration value="SSL"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="transport-guaranteeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The transport-guaranteeType specifies that the communication
+ between client and server should be NONE, INTEGRAL, or
+ CONFIDENTIAL. NONE means that the application does not
+ require any transport guarantees. A value of INTEGRAL means
+ that the application requires that the data sent between the
+ client and server be sent in such a way that it can't be
+ changed in transit. CONFIDENTIAL means that the application
+ requires that the data be transmitted in a fashion that
+ prevents other entities from observing the contents of the
+ transmission. In most cases, the presence of the INTEGRAL or
+ CONFIDENTIAL flag will indicate that the use of SSL is
+ required.
+
+ Used in: user-data-constraint
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="NONE"/>
+ <xsd:enumeration value="INTEGRAL"/>
+ <xsd:enumeration value="CONFIDENTIAL"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="user-data-constraintType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The user-data-constraintType is used to indicate how
+ data communicated between the client and container should be
+ protected.
+
+ Used in: security-constraint
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="transport-guarantee"
+ type="javaee:transport-guaranteeType"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="war-pathType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The elements that use this type designate a path starting
+ with a "/" and interpreted relative to the root of a WAR
+ file.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:pattern value="/.*"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:simpleType name="web-app-versionType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type contains the recognized versions of
+ web-application supported. It is used to designate the
+ version of the web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="3.0"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="web-appType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:group ref="javaee:web-commonType"/>
+ <xsd:element name="absolute-ordering"
+ type="javaee:absoluteOrderingType"/>
+ </xsd:choice>
+ <xsd:attributeGroup ref="javaee:web-common-attributes"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:group name="web-commonType">
+
+ <xsd:choice>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="name"
+ type="javaee:java-identifierType"/>
+ <xsd:element name="distributable"
+ type="javaee:emptyType"/>
+ <xsd:element name="context-param"
+ type="javaee:param-valueType">
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The context-param element contains the declaration
+ of a web application's servlet context
+ initialization parameters.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="filter"
+ type="javaee:filterType"/>
+ <xsd:element name="filter-mapping"
+ type="javaee:filter-mappingType"/>
+ <xsd:element name="listener"
+ type="javaee:listenerType"/>
+ <xsd:element name="servlet"
+ type="javaee:servletType"/>
+ <xsd:element name="servlet-mapping"
+ type="javaee:servlet-mappingType"/>
+ <xsd:element name="session-config"
+ type="javaee:session-configType"/>
+ <xsd:element name="mime-mapping"
+ type="javaee:mime-mappingType"/>
+ <xsd:element name="welcome-file-list"
+ type="javaee:welcome-file-listType"/>
+ <xsd:element name="error-page"
+ type="javaee:error-pageType"/>
+ <xsd:element name="jsp-config"
+ type="javaee:jsp-configType"/>
+ <xsd:element name="security-constraint"
+ type="javaee:security-constraintType"/>
+ <xsd:element name="login-config"
+ type="javaee:login-configType"/>
+ <xsd:element name="security-role"
+ type="javaee:security-roleType"/>
+ <xsd:group ref="javaee:jndiEnvironmentRefsGroup"/>
+ <xsd:element name="message-destination"
+ type="javaee:message-destinationType"/>
+ <xsd:element name="locale-encoding-mapping-list"
+ type="javaee:locale-encoding-mapping-listType"/>
+ </xsd:choice>
+
+ </xsd:group>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="web-fragmentType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:group ref="javaee:web-commonType"/>
+ <xsd:element name="ordering"
+ type="javaee:orderingType"/>
+ </xsd:choice>
+ <xsd:attributeGroup ref="javaee:web-common-attributes"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="web-resource-collectionType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The web-resource-collectionType is used to identify the
+ resources and HTTP methods on those resources to which a
+ security constraint applies. If no HTTP methods are specified,
+ then the security constraint applies to all HTTP methods.
+ If HTTP methods are specified by http-method-omission
+ elements, the security constraint applies to all methods
+ except those identified in the collection.
+ http-method-omission and http-method elements are never
+ mixed in the same collection.
+
+ Used in: security-constraint
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="web-resource-name"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The web-resource-name contains the name of this web
+ resource collection.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="url-pattern"
+ type="javaee:url-patternType"
+ maxOccurs="unbounded"/>
+ <xsd:choice minOccurs="0" maxOccurs="1">
+ <xsd:element name="http-method"
+ type="javaee:http-methodType"
+ minOccurs="1" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+ Each http-method names an HTTP method to which the
+ constraint applies.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="http-method-omission"
+ type="javaee:http-methodType"
+ minOccurs="1" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+ Each http-method-omission names an HTTP method to
+ which the constraint does not apply.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="welcome-file-listType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The welcome-file-list contains an ordered list of welcome
+ files elements.
+
+ Used in: web-app
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="welcome-file"
+ type="xsd:string"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The welcome-file element contains file name to use
+ as a default welcome file, such as index.html
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ </xsd:complexType>
+
+</xsd:schema>
+
Added: trunk/java/javax/servlet/resources/web-fragment_3_0.xsd
===================================================================
--- trunk/java/javax/servlet/resources/web-fragment_3_0.xsd (rev 0)
+++ trunk/java/javax/servlet/resources/web-fragment_3_0.xsd 2009-04-14 16:35:14 UTC (rev 1007)
@@ -0,0 +1,290 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://java.sun.com/xml/ns/javaee"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="3.0">
+ <xsd:annotation>
+ <xsd:documentation>
+ @(#)web-fragment_3_0.xsds
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 2003-2007 Sun Microsystems, Inc. All rights reserved.
+
+ The contents of this file are subject to the terms of either the
+ GNU General Public License Version 2 only ("GPL") or the Common
+ Development and Distribution License("CDDL") (collectively, the
+ "License"). You may not use this file except in compliance with
+ the License. You can obtain a copy of the License at
+ https://glassfish.dev.java.net/public/CDDL+GPL.html or
+ glassfish/bootstrap/legal/LICENSE.txt. See the License for the
+ specific language governing permissions and limitations under the
+ License.
+
+ When distributing the software, include this License Header
+ Notice in each file and include the License file at
+ glassfish/bootstrap/legal/LICENSE.txt. Sun designates this
+ particular file as subject to the "Classpath" exception as
+ provided by Sun in the GPL Version 2 section of the License file
+ that accompanied this code. If applicable, add the following
+ below the License Header, with the fields enclosed by brackets []
+ replaced by your own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Contributor(s):
+
+ If you wish your version of this file to be governed by only the
+ CDDL or only the GPL Version 2, indicate your decision by adding
+ "[Contributor] elects to include this software in this
+ distribution under the [CDDL or GPL Version 2] license." If you
+ don't indicate a single choice of license, a recipient has the
+ option to distribute your version of this file under either the
+ CDDL, the GPL Version 2 or to extend the choice of license to its
+ licensees as provided above. However, if you add GPL Version 2
+ code and therefore, elected the GPL Version 2 license, then the
+ option applies only if the new code is made subject to such
+ option by the copyright holder.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ This is the XML Schema for the Servlet 3.0 deployment descriptor.
+ The deployment descriptor must be named "META-INF/web-fragment.xml" in the
+ web fragment's jar file. All Servlet deployment descriptors
+ must indicate the web fragment schema by using the Java EE
+ namespace:
+
+ http://java.sun.com/xml/ns/javaee
+
+ and by indicating the version of the schema by
+ using the version element as shown below:
+
+ <web-fragment xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="..."
+ version="3.0">
+ ...
+ </web-fragment>
+
+ The instance documents may indicate the published version of
+ the schema using the xsi:schemaLocation attribute for Java EE
+ namespace with the following location:
+
+ http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The following conventions apply to all Java EE
+ deployment descriptor elements unless indicated otherwise.
+
+ - In elements that specify a pathname to a file within the
+ same JAR file, relative filenames (i.e., those not
+ starting with "/") are considered relative to the root of
+ the JAR file's namespace. Absolute filenames (i.e., those
+ starting with "/") also specify names in the root of the
+ JAR file's namespace. In general, relative names are
+ preferred. The exception is .war files where absolute
+ names are preferred for consistency with the Servlet API.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:include schemaLocation="web-common_3_0.xsd"/>
+
+
+<!-- **************************************************** -->
+
+ <xsd:element name="web-fragment" type="javaee:web-fragmentType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The web-fragment element is the root of the deployment
+ descriptor for a web fragment. Note that the sub-elements
+ of this element can be in the arbitrary order. Because of
+ that, the multiplicity of the elements of distributable,
+ session-config, welcome-file-list, jsp-config, login-config,
+ and locale-encoding-mapping-list was changed from "?" to "*"
+ in this schema. However, the deployment descriptor instance
+ file must not contain multiple elements of session-config,
+ jsp-config, and login-config. When there are multiple elements of
+ welcome-file-list or locale-encoding-mapping-list, the container
+ must concatenate the element contents. The multiple occurence
+ of the element distributable is redundant and the container
+ treats that case exactly in the same way when there is only
+ one distributable.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:unique name="web-common-servlet-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The servlet element contains the name of a servlet.
+ The name must be unique within the web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:servlet"/>
+ <xsd:field xpath="javaee:servlet-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-common-filter-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The filter element contains the name of a filter.
+ The name must be unique within the web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:filter"/>
+ <xsd:field xpath="javaee:filter-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-common-ejb-local-ref-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-local-ref-name element contains the name of an EJB
+ reference. The EJB reference is an entry in the web
+ application's environment and is relative to the
+ java:comp/env context. The name must be unique within
+ the web application.
+
+ It is recommended that name is prefixed with "ejb/".
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:ejb-local-ref"/>
+ <xsd:field xpath="javaee:ejb-ref-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-common-ejb-ref-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-ref-name element contains the name of an EJB
+ reference. The EJB reference is an entry in the web
+ application's environment and is relative to the
+ java:comp/env context. The name must be unique within
+ the web application.
+
+ It is recommended that name is prefixed with "ejb/".
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:ejb-ref"/>
+ <xsd:field xpath="javaee:ejb-ref-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-common-resource-env-ref-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The resource-env-ref-name element specifies the name of
+ a resource environment reference; its value is the
+ environment entry name used in the web application code.
+ The name is a JNDI name relative to the java:comp/env
+ context and must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:resource-env-ref"/>
+ <xsd:field xpath="javaee:resource-env-ref-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-common-message-destination-ref-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-ref-name element specifies the name of
+ a message destination reference; its value is the
+ environment entry name used in the web application code.
+ The name is a JNDI name relative to the java:comp/env
+ context and must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:message-destination-ref"/>
+ <xsd:field xpath="javaee:message-destination-ref-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-common-res-ref-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-ref-name element specifies the name of a
+ resource manager connection factory reference. The name
+ is a JNDI name relative to the java:comp/env context.
+ The name must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:resource-ref"/>
+ <xsd:field xpath="javaee:res-ref-name"/>
+ </xsd:unique>
+
+ <xsd:unique name="web-common-env-entry-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The env-entry-name element contains the name of a web
+ application's environment entry. The name is a JNDI
+ name relative to the java:comp/env context. The name
+ must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:selector xpath="javaee:env-entry"/>
+ <xsd:field xpath="javaee:env-entry-name"/>
+ </xsd:unique>
+
+ <xsd:key name="web-common-role-name-key">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ A role-name-key is specified to allow the references
+ from the security-role-refs.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:security-role"/>
+ <xsd:field xpath="javaee:role-name"/>
+ </xsd:key>
+
+ <xsd:keyref name="web-common-role-name-references"
+ refer="javaee:web-common-role-name-key">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The keyref indicates the references from
+ security-role-ref to a specified role-name.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:servlet/javaee:security-role-ref"/>
+ <xsd:field xpath="javaee:role-link"/>
+ </xsd:keyref>
+ </xsd:element>
+
+</xsd:schema>
+
15 years
JBossWeb SVN: r1006 - trunk/java/org/apache/catalina/core.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-14 08:34:32 -0400 (Tue, 14 Apr 2009)
New Revision: 1006
Modified:
trunk/java/org/apache/catalina/core/ContainerBase.java
Log:
- Switch to better collection types.
Modified: trunk/java/org/apache/catalina/core/ContainerBase.java
===================================================================
--- trunk/java/org/apache/catalina/core/ContainerBase.java 2009-04-10 21:08:42 UTC (rev 1005)
+++ trunk/java/org/apache/catalina/core/ContainerBase.java 2009-04-14 12:34:32 UTC (rev 1006)
@@ -24,10 +24,12 @@
import java.io.IOException;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
import javax.management.MBeanRegistration;
import javax.management.MBeanServer;
@@ -125,6 +127,18 @@
org.jboss.logging.Logger.getLogger( ContainerBase.class );
/**
+ * Container array type.
+ */
+ protected static final Container[] CONTAINER_ARRAY = new Container[0];
+
+
+ /**
+ * Listener array type.
+ */
+ protected static final ContainerListener[] LISTENER_ARRAY = new ContainerListener[0];
+
+
+ /**
* Perform addChild with the permissions of this class.
* addChild can be called with the XML parser on the stack,
* this allows the XML parser to have fewer privileges than
@@ -153,9 +167,9 @@
/**
* The child Containers belonging to this Container, keyed by name.
*/
- protected HashMap children = new HashMap();
+ protected Map<String, Container> children = new ConcurrentHashMap<String, Container>();
-
+
/**
* The processor delay for this component.
*/
@@ -171,7 +185,7 @@
/**
* The container event listeners for this Container.
*/
- protected ArrayList listeners = new ArrayList();
+ protected List<ContainerListener> listeners = new CopyOnWriteArrayList<ContainerListener>();
/**
@@ -779,38 +793,37 @@
}
}
- private void addChildInternal(Container child) {
+ private synchronized void addChildInternal(Container child) {
if( log.isDebugEnabled() )
log.debug("Add child " + child + " " + this);
- synchronized(children) {
- if (children.get(child.getName()) != null)
- throw new IllegalArgumentException("addChild: Child name '" +
- child.getName() +
- "' is not unique");
- child.setParent(this); // May throw IAE
- children.put(child.getName(), child);
- // Start child
- if (started && startChildren && (child instanceof Lifecycle)) {
- boolean success = false;
- try {
- ((Lifecycle) child).start();
- success = true;
- } catch (LifecycleException e) {
- log.error("ContainerBase.addChild: start: ", e);
- throw new IllegalStateException
- ("ContainerBase.addChild: start: " + e);
- } finally {
- if (!success) {
- children.remove(child.getName());
- }
+ if (children.get(child.getName()) != null)
+ throw new IllegalArgumentException("addChild: Child name '" +
+ child.getName() + "' is not unique");
+
+ child.setParent(this); // May throw IAE
+ children.put(child.getName(), child);
+
+ // Start child
+ if (started && startChildren && (child instanceof Lifecycle)) {
+ boolean success = false;
+ try {
+ ((Lifecycle) child).start();
+ success = true;
+ } catch (LifecycleException e) {
+ log.error("ContainerBase.addChild: start: ", e);
+ throw new IllegalStateException
+ ("ContainerBase.addChild: start: " + e);
+ } finally {
+ if (!success) {
+ children.remove(child.getName());
}
}
-
- fireContainerEvent(ADD_CHILD_EVENT, child);
}
+ fireContainerEvent(ADD_CHILD_EVENT, child);
+
}
@@ -821,9 +834,7 @@
*/
public void addContainerListener(ContainerListener listener) {
- synchronized (listeners) {
- listeners.add(listener);
- }
+ listeners.add(listener);
}
@@ -847,13 +858,9 @@
* @param name Name of the child Container to be retrieved
*/
public Container findChild(String name) {
-
if (name == null)
return (null);
- synchronized (children) { // Required by post-start changes
- return ((Container) children.get(name));
- }
-
+ return children.get(name);
}
@@ -862,12 +869,7 @@
* If this Container has no children, a zero-length array is returned.
*/
public Container[] findChildren() {
-
- synchronized (children) {
- Container results[] = new Container[children.size()];
- return ((Container[]) children.values().toArray(results));
- }
-
+ return children.values().toArray(CONTAINER_ARRAY);
}
@@ -877,13 +879,7 @@
* array is returned.
*/
public ContainerListener[] findContainerListeners() {
-
- synchronized (listeners) {
- ContainerListener[] results =
- new ContainerListener[listeners.size()];
- return ((ContainerListener[]) listeners.toArray(results));
- }
-
+ return listeners.toArray(LISTENER_ARRAY);
}
@@ -916,15 +912,13 @@
*
* @param child Existing child Container to be removed
*/
- public void removeChild(Container child) {
+ public synchronized void removeChild(Container child) {
- synchronized(children) {
- if (children.get(child.getName()) == null)
- return;
- if (children.get(child.getName()) != child)
- return;
- children.remove(child.getName());
- }
+ if (children.get(child.getName()) == null)
+ return;
+ if (children.get(child.getName()) != child)
+ return;
+ children.remove(child.getName());
if (started && (child instanceof Lifecycle)) {
try {
@@ -953,11 +947,7 @@
* @param listener The listener to remove
*/
public void removeContainerListener(ContainerListener listener) {
-
- synchronized (listeners) {
- listeners.remove(listener);
- }
-
+ listeners.remove(listener);
}
15 years
JBossWeb SVN: r1005 - trunk.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-10 17:08:42 -0400 (Fri, 10 Apr 2009)
New Revision: 1005
Modified:
trunk/ROADMAP.txt
Log:
- Status update.
Modified: trunk/ROADMAP.txt
===================================================================
--- trunk/ROADMAP.txt 2009-04-09 21:16:01 UTC (rev 1004)
+++ trunk/ROADMAP.txt 2009-04-10 21:08:42 UTC (rev 1005)
@@ -1,14 +1,15 @@
Roadmap for JBoss Web 3.0
Main development:
-- Setup standalone TCK environment for testing compliance with the new features
- Update digester XML parsing rules for web.xml updates
-- web.xml fragments scanning
-- Annotation scanning for JBoss Web standalone (likely disabled by default using conf/web.xml)
+- web.xml fragments scanning (merge with Catalina .tld scanning)
+- Resources overlay
+- Session tracking configuration
- Multipart support (and remove fileupload)
-- Other Servlet 3.0 changes (security, etc)
- JSP 2.2 changes
- EL 1.1 changes
+- Setup standalone TCK environment for testing compliance with the new features
+- Javassist annotation scanning impl for JBoss Web standalone
- Coordinate with AS 6 to implement new web.xml parsing (out of tree)
- JBoss Metadata parsing of .tld files (out of tree)
- Coordinate with AS 6 for annotation updates (out of tree)
15 years
JBossWeb SVN: r1004 - in trunk/java/org/apache/catalina: authenticator and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-09 17:16:01 -0400 (Thu, 09 Apr 2009)
New Revision: 1004
Modified:
trunk/java/org/apache/catalina/Authenticator.java
trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java
trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java
trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java
trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java
trunk/java/org/apache/catalina/authenticator/NonLoginAuthenticator.java
trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/connector/Response.java
Log:
- Use response type from the Servlet API for authenticate.
Modified: trunk/java/org/apache/catalina/Authenticator.java
===================================================================
--- trunk/java/org/apache/catalina/Authenticator.java 2009-04-09 19:25:39 UTC (rev 1003)
+++ trunk/java/org/apache/catalina/Authenticator.java 2009-04-09 21:16:01 UTC (rev 1004)
@@ -24,23 +24,17 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
/**
* An <b>Authenticator</b> is a component (usually a Valve or Container) that
- * provides some sort of authentication service. The interface itself has no
- * functional significance, but is used as a tagging mechanism so that other
- * components can detect the presence (via an "instanceof Authenticator" test)
- * of an already configured authentication service.
+ * provides some sort of authentication service.
*
* @author Craig R. McClanahan
* @version $Revision$ $Date$
*/
public interface Authenticator {
- public boolean login(Request request, Response response)
- throws IOException, ServletException;
public boolean login(Request request, HttpServletResponse response)
throws IOException, ServletException;
}
Modified: trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java
===================================================================
--- trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java 2009-04-09 19:25:39 UTC (rev 1003)
+++ trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java 2009-04-09 21:16:01 UTC (rev 1004)
@@ -370,7 +370,7 @@
/**
- * Login.
+ * API login.
*
* @param request Request we are processing
* @param response Response we are creating
@@ -379,30 +379,13 @@
*
* @exception IOException if an input/output error occurs
*/
- public boolean login(Request request, Response response)
+ public boolean login(Request request, HttpServletResponse response)
throws IOException, ServletException {
return authenticate(request, response, this.context.getLoginConfig());
}
/**
- * Login.
- *
- * @param request Request we are processing
- * @param response Response we are creating
- * @param config Login configuration describing how authentication
- * should be performed
- *
- * @exception IOException if an input/output error occurs
- */
- public boolean login(Request request, HttpServletResponse response)
- throws IOException, ServletException {
- // FIXME: use the wrapper
- return login(request, request.getResponse());
- }
-
-
- /**
* Enforce the security restrictions in the web application deployment
* descriptor of our associated Context.
*
@@ -595,7 +578,7 @@
* @exception IOException if an input/output error occurs
*/
protected abstract boolean authenticate(Request request,
- Response response,
+ HttpServletResponse response,
LoginConfig config)
throws IOException;
@@ -734,7 +717,7 @@
* @param username Username used to authenticate (if any)
* @param password Password used to authenticate (if any)
*/
- protected void register(Request request, Response response,
+ protected void register(Request request, HttpServletResponse response,
Principal principal, String authType,
String username, String password) {
Modified: trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java
===================================================================
--- trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java 2009-04-09 19:25:39 UTC (rev 1003)
+++ trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java 2009-04-09 21:16:01 UTC (rev 1004)
@@ -25,14 +25,12 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
import org.apache.catalina.deploy.LoginConfig;
import org.apache.catalina.util.Base64;
import org.apache.tomcat.util.buf.ByteChunk;
import org.apache.tomcat.util.buf.CharChunk;
import org.apache.tomcat.util.buf.MessageBytes;
import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
@@ -114,7 +112,7 @@
* @exception IOException if an input/output error occurs
*/
public boolean authenticate(Request request,
- Response response,
+ HttpServletResponse response,
LoginConfig config)
throws IOException {
@@ -189,7 +187,7 @@
// Send an "unauthorized" response and an appropriate challenge
MessageBytes authenticate =
- response.getCoyoteResponse().getMimeHeaders()
+ request.getResponse().getCoyoteResponse().getMimeHeaders()
.addValue(AUTHENTICATE_BYTES, 0, AUTHENTICATE_BYTES.length);
CharChunk authenticateCC = authenticate.getCharChunk();
authenticateCC.append("Basic realm=\"");
Modified: trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java
===================================================================
--- trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java 2009-04-09 19:25:39 UTC (rev 1003)
+++ trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java 2009-04-09 21:16:01 UTC (rev 1004)
@@ -27,14 +27,11 @@
import javax.servlet.http.HttpServletResponse;
-
import org.apache.catalina.Realm;
import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
import org.apache.catalina.deploy.LoginConfig;
import org.apache.catalina.util.MD5Encoder;
import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
@@ -127,7 +124,7 @@
* @exception IOException if an input/output error occurs
*/
public boolean authenticate(Request request,
- Response response,
+ HttpServletResponse response,
LoginConfig config)
throws IOException {
@@ -399,7 +396,7 @@
* @param nOnce nonce token
*/
protected void setAuthenticateHeader(Request request,
- Response response,
+ HttpServletResponse response,
LoginConfig config,
String nOnce) {
Modified: trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java
===================================================================
--- trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java 2009-04-09 19:25:39 UTC (rev 1003)
+++ trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java 2009-04-09 21:16:01 UTC (rev 1004)
@@ -33,7 +33,6 @@
import org.apache.catalina.Realm;
import org.apache.catalina.Session;
import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
import org.apache.catalina.deploy.LoginConfig;
import org.apache.coyote.ActionCode;
import org.apache.tomcat.util.buf.ByteChunk;
@@ -41,7 +40,6 @@
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.MimeHeaders;
import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
/**
@@ -121,7 +119,7 @@
* @exception IOException if an input/output error occurs
*/
public boolean authenticate(Request request,
- Response response,
+ HttpServletResponse response,
LoginConfig config)
throws IOException {
@@ -221,7 +219,6 @@
uriCC.setLimit(-1);
String contextPath = request.getContextPath();
String requestURI = request.getDecodedRequestURI();
- response.setContext(request.getContext());
// Is this the action request from the login page?
boolean loginAction =
@@ -308,13 +305,12 @@
* @param config Login configuration describing how authentication
* should be performed
*/
- protected void forwardToLoginPage(Request request, Response response, LoginConfig config) {
+ protected void forwardToLoginPage(Request request, HttpServletResponse response, LoginConfig config) {
RequestDispatcher disp =
context.getServletContext().getRequestDispatcher
(config.getLoginPage());
try {
- disp.forward(request.getRequest(), response.getResponse());
- response.finishResponse();
+ disp.forward(request.getRequest(), response);
} catch (Throwable t) {
log.warn("Unexpected error forwarding to login page", t);
}
@@ -329,12 +325,12 @@
* @param config Login configuration describing how authentication
* should be performed
*/
- protected void forwardToErrorPage(Request request, Response response, LoginConfig config) {
+ protected void forwardToErrorPage(Request request, HttpServletResponse response, LoginConfig config) {
RequestDispatcher disp =
context.getServletContext().getRequestDispatcher
(config.getErrorPage());
try {
- disp.forward(request.getRequest(), response.getResponse());
+ disp.forward(request.getRequest(), response);
} catch (Throwable t) {
log.warn("Unexpected error forwarding to error page", t);
}
Modified: trunk/java/org/apache/catalina/authenticator/NonLoginAuthenticator.java
===================================================================
--- trunk/java/org/apache/catalina/authenticator/NonLoginAuthenticator.java 2009-04-09 19:25:39 UTC (rev 1003)
+++ trunk/java/org/apache/catalina/authenticator/NonLoginAuthenticator.java 2009-04-09 21:16:01 UTC (rev 1004)
@@ -21,8 +21,9 @@
import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
import org.apache.catalina.deploy.LoginConfig;
@@ -79,7 +80,7 @@
* @exception IOException if an input/output error occurs
*/
public boolean authenticate(Request request,
- Response response,
+ HttpServletResponse response,
LoginConfig config)
throws IOException {
Modified: trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java
===================================================================
--- trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java 2009-04-09 19:25:39 UTC (rev 1003)
+++ trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java 2009-04-09 21:16:01 UTC (rev 1004)
@@ -25,12 +25,11 @@
import javax.servlet.http.HttpServletResponse;
-import org.apache.coyote.ActionCode;
import org.apache.catalina.Globals;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
import org.apache.catalina.deploy.LoginConfig;
+import org.apache.coyote.ActionCode;
@@ -82,7 +81,7 @@
* @exception IOException if an input/output error occurs
*/
public boolean authenticate(Request request,
- Response response,
+ HttpServletResponse response,
LoginConfig config)
throws IOException {
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-04-09 19:25:39 UTC (rev 1003)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-04-09 21:16:01 UTC (rev 1004)
@@ -2928,11 +2928,7 @@
public boolean login(HttpServletResponse response) throws IOException,
ServletException {
if (context.getAuthenticator() != null) {
- if (!WRAPPED_RESPONSE_IN_LOGIN || response instanceof ResponseFacade) {
- return context.getAuthenticator().login(this, this.response);
- } else {
- return context.getAuthenticator().login(this, response);
- }
+ return context.getAuthenticator().login(this, response);
} else {
throw new ServletException(sm.getString("coyoteRequest.noAuthenticator"));
}
Modified: trunk/java/org/apache/catalina/connector/Response.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Response.java 2009-04-09 19:25:39 UTC (rev 1003)
+++ trunk/java/org/apache/catalina/connector/Response.java 2009-04-09 21:16:01 UTC (rev 1004)
@@ -38,7 +38,6 @@
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
-import org.apache.catalina.Context;
import org.apache.catalina.Globals;
import org.apache.catalina.Session;
import org.apache.catalina.Wrapper;
@@ -159,26 +158,6 @@
/**
- * Return the Context within which this Request is being processed.
- */
- public Context getContext() {
- return (request.getContext());
- }
-
- /**
- * Set the Context within which this Request is being processed. This
- * must be called as soon as the appropriate Context is identified, because
- * it identifies the value to be returned by <code>getContextPath()</code>,
- * and thus enables parsing of the request URI.
- *
- * @param context The newly associated Context
- */
- public void setContext(Context context) {
- request.setContext(context);
- }
-
-
- /**
* The associated output buffer.
*/
protected OutputBuffer outputBuffer;
@@ -857,7 +836,7 @@
return;
}
- CharsetMapper cm = getContext().getCharsetMapper();
+ CharsetMapper cm = request.getContext().getCharsetMapper();
String charset = cm.getCharset( locale );
if ( charset != null ){
coyoteResponse.setCharacterEncoding(charset);
@@ -1503,7 +1482,7 @@
if (serverPort != urlPort)
return (false);
- String contextPath = getContext().getPath();
+ String contextPath = request.getContext().getPath();
if (contextPath != null) {
String file = url.getFile();
if ((file == null) || !file.startsWith(contextPath))
15 years
JBossWeb SVN: r1003 - in trunk: java/org/apache/catalina/loader and 7 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-09 15:25:39 -0400 (Thu, 09 Apr 2009)
New Revision: 1003
Modified:
trunk/java/org/apache/catalina/core/StandardHost.java
trunk/java/org/apache/catalina/loader/WebappClassLoader.java
trunk/java/org/apache/catalina/realm/JNDIRealm.java
trunk/java/org/apache/catalina/session/ManagerBase.java
trunk/java/org/apache/catalina/ssi/SSIServlet.java
trunk/java/org/apache/catalina/util/InstanceSupport.java
trunk/java/org/apache/catalina/util/LifecycleSupport.java
trunk/java/org/apache/jasper/compiler/Generator.java
trunk/java/org/apache/jasper/compiler/ScriptingVariabler.java
trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
trunk/webapps/docs/changelog.xml
Log:
- Port minor fixes.
- Add sync to JMX.
Modified: trunk/java/org/apache/catalina/core/StandardHost.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardHost.java 2009-04-09 17:02:09 UTC (rev 1002)
+++ trunk/java/org/apache/catalina/core/StandardHost.java 2009-04-09 19:25:39 UTC (rev 1003)
@@ -607,29 +607,25 @@
alias = alias.toLowerCase();
- synchronized (aliases) {
-
- // Make sure this alias is currently present
- int n = -1;
- for (int i = 0; i < aliases.length; i++) {
- if (aliases[i].equals(alias)) {
- n = i;
- break;
- }
+ // Make sure this alias is currently present
+ int n = -1;
+ for (int i = 0; i < aliases.length; i++) {
+ if (aliases[i].equals(alias)) {
+ n = i;
+ break;
}
- if (n < 0)
- return;
+ }
+ if (n < 0)
+ return;
- // Remove the specified alias
- int j = 0;
- String results[] = new String[aliases.length - 1];
- for (int i = 0; i < aliases.length; i++) {
- if (i != n)
- results[j++] = aliases[i];
- }
- aliases = results;
-
+ // Remove the specified alias
+ int j = 0;
+ String results[] = new String[aliases.length - 1];
+ for (int i = 0; i < aliases.length; i++) {
+ if (i != n)
+ results[j++] = aliases[i];
}
+ aliases = results;
// Inform interested listeners
fireContainerEvent(REMOVE_ALIAS_EVENT, alias);
@@ -747,7 +743,7 @@
private boolean initialized=false;
- public void init() {
+ public synchronized void init() {
if( initialized ) return;
initialized=true;
@@ -790,7 +786,7 @@
}
}
- public void destroy() throws Exception {
+ public synchronized void destroy() throws Exception {
// destroy our child containers, if any
Container children[] = findChildren();
super.destroy();
Modified: trunk/java/org/apache/catalina/loader/WebappClassLoader.java
===================================================================
--- trunk/java/org/apache/catalina/loader/WebappClassLoader.java 2009-04-09 17:02:09 UTC (rev 1002)
+++ trunk/java/org/apache/catalina/loader/WebappClassLoader.java 2009-04-09 19:25:39 UTC (rev 1003)
@@ -1276,7 +1276,7 @@
// the webapp from overriding J2SE classes
if (SYSTEM_CL_DELEGATION) {
try {
- clazz = system.loadClass(name);
+ clazz = Class.forName(name, false, system);
if (clazz != null) {
if (resolve)
resolveClass(clazz);
@@ -1312,7 +1312,7 @@
if (loader == null)
loader = system;
try {
- clazz = loader.loadClass(name);
+ clazz = Class.forName(name, false, loader);
if (clazz != null) {
if (log.isDebugEnabled())
log.debug(" Loading class from parent");
@@ -1349,7 +1349,7 @@
if (loader == null)
loader = system;
try {
- clazz = loader.loadClass(name);
+ clazz = Class.forName(name, false, loader);
if (clazz != null) {
if (log.isDebugEnabled())
log.debug(" Loading class from parent");
Modified: trunk/java/org/apache/catalina/realm/JNDIRealm.java
===================================================================
--- trunk/java/org/apache/catalina/realm/JNDIRealm.java 2009-04-09 17:02:09 UTC (rev 1002)
+++ trunk/java/org/apache/catalina/realm/JNDIRealm.java 2009-04-09 19:25:39 UTC (rev 1003)
@@ -18,6 +18,8 @@
package org.apache.catalina.realm;
import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.security.Principal;
import java.text.MessageFormat;
import java.util.ArrayList;
@@ -30,16 +32,16 @@
import java.util.Map;
import java.util.Set;
-import javax.naming.Context;
+import javax.naming.AuthenticationException;
import javax.naming.CommunicationException;
import javax.naming.CompositeName;
+import javax.naming.Context;
import javax.naming.InvalidNameException;
+import javax.naming.Name;
import javax.naming.NameNotFoundException;
+import javax.naming.NameParser;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.naming.NameParser;
-import javax.naming.Name;
-import javax.naming.AuthenticationException;
import javax.naming.PartialResultException;
import javax.naming.ServiceUnavailableException;
import javax.naming.directory.Attribute;
@@ -48,6 +50,7 @@
import javax.naming.directory.InitialDirContext;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
+
import org.apache.catalina.LifecycleException;
import org.apache.catalina.util.Base64;
import org.apache.tomcat.util.buf.ByteChunk;
@@ -2150,19 +2153,51 @@
* @param result The search result
* @return String containing the distinguished name
*/
- protected String getDistinguishedName(DirContext context, String base, SearchResult result)
- throws NamingException {
- // Get the entry's distinguished name
- NameParser parser = context.getNameParser("");
- Name contextName = parser.parse(context.getNameInNamespace());
- Name baseName = parser.parse(base);
-
- // Bugzilla 32269
- Name entryName = parser.parse(new CompositeName(result.getName()).get(0));
-
- Name name = contextName.addAll(baseName);
- name = name.addAll(entryName);
- return name.toString();
+ protected String getDistinguishedName(DirContext context, String base,
+ SearchResult result) throws NamingException {
+ // Get the entry's distinguished name. For relative results, this means
+ // we need to composite a name with the base name, the context name, and
+ // the result name. For non-relative names, use the returned name.
+ if (result.isRelative()) {
+ if (containerLog.isTraceEnabled()) {
+ containerLog.trace(" search returned relative name: " +
+ result.getName());
+ }
+ NameParser parser = context.getNameParser("");
+ Name contextName = parser.parse(context.getNameInNamespace());
+ Name baseName = parser.parse(base);
+
+ // Bugzilla 32269
+ Name entryName =
+ parser.parse(new CompositeName(result.getName()).get(0));
+
+ Name name = contextName.addAll(baseName);
+ name = name.addAll(entryName);
+ return name.toString();
+ } else {
+ String absoluteName = result.getName();
+ if (containerLog.isTraceEnabled())
+ containerLog.trace(" search returned absolute name: " +
+ result.getName());
+ try {
+ // Normalize the name by running it through the name parser.
+ NameParser parser = context.getNameParser("");
+ URI userNameUri = new URI(absoluteName);
+ String pathComponent = userNameUri.getPath();
+ // Should not ever have an empty path component, since that is /{DN}
+ if (pathComponent.length() < 1 ) {
+ throw new InvalidNameException(
+ "Search returned unparseable absolute name: " +
+ absoluteName );
+ }
+ Name name = parser.parse(pathComponent.substring(1));
+ return name.toString();
+ } catch ( URISyntaxException e ) {
+ throw new InvalidNameException(
+ "Search returned unparseable absolute name: " +
+ absoluteName );
+ }
+ }
}
Modified: trunk/java/org/apache/catalina/session/ManagerBase.java
===================================================================
--- trunk/java/org/apache/catalina/session/ManagerBase.java 2009-04-09 17:02:09 UTC (rev 1002)
+++ trunk/java/org/apache/catalina/session/ManagerBase.java 2009-04-09 19:25:39 UTC (rev 1003)
@@ -221,9 +221,13 @@
// ------------------------------------------------------------- Security classes
- private class PrivilegedSetRandomFile implements PrivilegedAction{
+ private class PrivilegedSetRandomFile implements PrivilegedAction<DataInputStream>{
- public Object run(){
+ public PrivilegedSetRandomFile(String s) {
+ devRandomSource = s;
+ }
+
+ public DataInputStream run(){
try {
File f=new File( devRandomSource );
if( ! f.exists() ) return null;
@@ -233,8 +237,18 @@
log.debug( "Opening " + devRandomSource );
return randomIS;
} catch (IOException ex){
+ log.warn("Error reading " + devRandomSource, ex);
+ if (randomIS != null) {
+ try {
+ randomIS.close();
+ } catch (Exception e) {
+ log.warn("Failed to close randomIS.");
+ }
+ }
+ devRandomSource = null;
+ randomIS=null;
return null;
- }
+ }
}
}
@@ -505,10 +519,10 @@
* - so use it if available.
*/
public void setRandomFile( String s ) {
- // as a hack, you can use a static file - and genarate the same
+ // as a hack, you can use a static file - and generate the same
// session ids ( good for strange debugging )
if (Globals.IS_SECURITY_ENABLED){
- randomIS = (DataInputStream)AccessController.doPrivileged(new PrivilegedSetRandomFile());
+ randomIS = AccessController.doPrivileged(new PrivilegedSetRandomFile(s));
} else {
try{
devRandomSource=s;
@@ -519,12 +533,15 @@
if( log.isDebugEnabled() )
log.debug( "Opening " + devRandomSource );
} catch( IOException ex ) {
- try {
- randomIS.close();
- } catch (Exception e) {
- log.warn("Failed to close randomIS.");
+ log.warn("Error reading " + devRandomSource, ex);
+ if (randomIS != null) {
+ try {
+ randomIS.close();
+ } catch (Exception e) {
+ log.warn("Failed to close randomIS.");
+ }
}
-
+ devRandomSource = null;
randomIS=null;
}
}
Modified: trunk/java/org/apache/catalina/ssi/SSIServlet.java
===================================================================
--- trunk/java/org/apache/catalina/ssi/SSIServlet.java 2009-04-09 17:02:09 UTC (rev 1002)
+++ trunk/java/org/apache/catalina/ssi/SSIServlet.java 2009-04-09 19:25:39 UTC (rev 1003)
@@ -210,5 +210,6 @@
String text = stringWriter.toString();
res.getWriter().write(text);
}
+ bufferedReader.close();
}
}
\ No newline at end of file
Modified: trunk/java/org/apache/catalina/util/InstanceSupport.java
===================================================================
--- trunk/java/org/apache/catalina/util/InstanceSupport.java 2009-04-09 17:02:09 UTC (rev 1002)
+++ trunk/java/org/apache/catalina/util/InstanceSupport.java 2009-04-09 19:25:39 UTC (rev 1003)
@@ -93,16 +93,14 @@
*
* @param listener The listener to add
*/
- public void addInstanceListener(InstanceListener listener) {
+ public synchronized void addInstanceListener(InstanceListener listener) {
- synchronized (listeners) {
- InstanceListener results[] =
+ InstanceListener results[] =
new InstanceListener[listeners.length + 1];
- for (int i = 0; i < listeners.length; i++)
- results[i] = listeners[i];
- results[listeners.length] = listener;
- listeners = results;
- }
+ for (int i = 0; i < listeners.length; i++)
+ results[i] = listeners[i];
+ results[listeners.length] = listener;
+ listeners = results;
}
@@ -310,27 +308,25 @@
*
* @param listener The listener to remove
*/
- public void removeInstanceListener(InstanceListener listener) {
+ public synchronized void removeInstanceListener(InstanceListener listener) {
- synchronized (listeners) {
- int n = -1;
- for (int i = 0; i < listeners.length; i++) {
- if (listeners[i] == listener) {
- n = i;
- break;
- }
+ int n = -1;
+ for (int i = 0; i < listeners.length; i++) {
+ if (listeners[i] == listener) {
+ n = i;
+ break;
}
- if (n < 0)
- return;
- InstanceListener results[] =
- new InstanceListener[listeners.length - 1];
- int j = 0;
- for (int i = 0; i < listeners.length; i++) {
- if (i != n)
- results[j++] = listeners[i];
- }
- listeners = results;
}
+ if (n < 0)
+ return;
+ InstanceListener results[] =
+ new InstanceListener[listeners.length - 1];
+ int j = 0;
+ for (int i = 0; i < listeners.length; i++) {
+ if (i != n)
+ results[j++] = listeners[i];
+ }
+ listeners = results;
}
Modified: trunk/java/org/apache/catalina/util/LifecycleSupport.java
===================================================================
--- trunk/java/org/apache/catalina/util/LifecycleSupport.java 2009-04-09 17:02:09 UTC (rev 1002)
+++ trunk/java/org/apache/catalina/util/LifecycleSupport.java 2009-04-09 19:25:39 UTC (rev 1003)
@@ -76,16 +76,14 @@
*
* @param listener The listener to add
*/
- public void addLifecycleListener(LifecycleListener listener) {
+ public synchronized void addLifecycleListener(LifecycleListener listener) {
- synchronized (listeners) {
- LifecycleListener results[] =
+ LifecycleListener results[] =
new LifecycleListener[listeners.length + 1];
- for (int i = 0; i < listeners.length; i++)
- results[i] = listeners[i];
- results[listeners.length] = listener;
- listeners = results;
- }
+ for (int i = 0; i < listeners.length; i++)
+ results[i] = listeners[i];
+ results[listeners.length] = listener;
+ listeners = results;
}
@@ -124,27 +122,25 @@
*
* @param listener The listener to remove
*/
- public void removeLifecycleListener(LifecycleListener listener) {
+ public synchronized void removeLifecycleListener(LifecycleListener listener) {
- synchronized (listeners) {
- int n = -1;
- for (int i = 0; i < listeners.length; i++) {
- if (listeners[i] == listener) {
- n = i;
- break;
- }
+ int n = -1;
+ for (int i = 0; i < listeners.length; i++) {
+ if (listeners[i] == listener) {
+ n = i;
+ break;
}
- if (n < 0)
- return;
- LifecycleListener results[] =
- new LifecycleListener[listeners.length - 1];
- int j = 0;
- for (int i = 0; i < listeners.length; i++) {
- if (i != n)
- results[j++] = listeners[i];
- }
- listeners = results;
}
+ if (n < 0)
+ return;
+ LifecycleListener results[] =
+ new LifecycleListener[listeners.length - 1];
+ int j = 0;
+ for (int i = 0; i < listeners.length; i++) {
+ if (i != n)
+ results[j++] = listeners[i];
+ }
+ listeners = results;
}
Modified: trunk/java/org/apache/jasper/compiler/Generator.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Generator.java 2009-04-09 17:02:09 UTC (rev 1002)
+++ trunk/java/org/apache/jasper/compiler/Generator.java 2009-04-09 19:25:39 UTC (rev 1003)
@@ -1591,8 +1591,7 @@
s0 = "<param name=\"type\""
+ makeAttr("value", "application/x-java-"
+ type
- + ";"
- + ((jreversion == null) ? "" : "version="
+ + ((jreversion == null) ? "" : ";version="
+ jreversion)) + '>';
out.printil("out.write(" + quote(s0) + ");");
out.printil("out.write(\"\\n\");");
@@ -1611,8 +1610,7 @@
s0 = "<EMBED"
+ makeAttr("type", "application/x-java-"
+ type
- + ";"
- + ((jreversion == null) ? "" : "version="
+ + ((jreversion == null) ? "" : ";version="
+ jreversion)) + makeAttr("name", name);
// s1 and s2 are the same as before.
Modified: trunk/java/org/apache/jasper/compiler/ScriptingVariabler.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/ScriptingVariabler.java 2009-04-09 17:02:09 UTC (rev 1002)
+++ trunk/java/org/apache/jasper/compiler/ScriptingVariabler.java 2009-04-09 19:25:39 UTC (rev 1003)
@@ -68,7 +68,7 @@
public void visit(Node.CustomTag n) throws JasperException {
setScriptingVars(n, VariableInfo.AT_BEGIN);
setScriptingVars(n, VariableInfo.NESTED);
- visitBody(n);
+ new ScriptingVariableVisitor(err).visitBody(n);
setScriptingVars(n, VariableInfo.AT_END);
}
Modified: trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
===================================================================
--- trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java 2009-04-09 17:02:09 UTC (rev 1002)
+++ trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java 2009-04-09 19:25:39 UTC (rev 1003)
@@ -186,7 +186,9 @@
if( declaring.isAssignableFrom(this.getClass()) ) {
result = m.invoke(this, NO_ARGS_PARAM );
} else {
- result = m.invoke(resource, NO_ARGS_PARAM );
+ synchronized (resource) {
+ result = m.invoke(resource, NO_ARGS_PARAM );
+ }
}
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
@@ -294,7 +296,9 @@
if( method.getDeclaringClass().isAssignableFrom( this.getClass()) ) {
result = method.invoke(this, params );
} else {
- result = method.invoke(resource, params);
+ synchronized (resource) {
+ result = method.invoke(resource, params);
+ }
}
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
@@ -411,7 +415,9 @@
if( m.getDeclaringClass().isAssignableFrom( this.getClass()) ) {
m.invoke(this, new Object[] { value });
} else {
- m.invoke(resource, new Object[] { value });
+ synchronized (resource) {
+ m.invoke(resource, new Object[] { value });
+ }
}
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-04-09 17:02:09 UTC (rev 1002)
+++ trunk/webapps/docs/changelog.xml 2009-04-09 19:25:39 UTC (rev 1003)
@@ -56,6 +56,18 @@
<fix>
<bug>46933</bug>: Simplify StringManager using Java 5 features. Based on a patch by Jens Kapitza. (markt)
</fix>
+ <fix>
+ <bug>46961</bug>: Prefer Class.forName for Java 6 compatibility with array fake types. (markt)
+ </fix>
+ <fix>
+ <bug>42579</bug>: Handle both relative and absolute search results in JNDI realm. Patch provided by Brandon DuRette. (markt)
+ </fix>
+ <fix>
+ <bug>46967</bug>: Secure random security manager fix. Based on a patch provided by Kirk Wolf. (markt)
+ </fix>
+ <fix>
+ <bug>46562</bug>: In SSI, close the reader when done. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
@@ -76,6 +88,13 @@
<fix>
<bug>46915</bug>: JSTL issues resolving resource bundle keys. (markt)
</fix>
+ <fix>
+ <bug>46909</bug>: The ';' should really only be used if there is a following parameter. (markt)
+ </fix>
+ <fix>
+ <bug>42390</bug>: Correct JSP compilation error with nested tagfile tags with variables with "AT_BEGIN" scope.
+ Patch provided by Konstantin Kolinko. (markt)
+ </fix>
</changelog>
</subsection>
</section>
15 years
JBossWeb SVN: r1002 - in trunk: java/org/apache/catalina/connector and 2 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-09 13:02:09 -0400 (Thu, 09 Apr 2009)
New Revision: 1002
Modified:
trunk/PATCHES.txt
trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
trunk/java/org/apache/catalina/core/ApplicationContext.java
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/catalina/servlets/InvokerServlet.java
Log:
- Spring cleaning in StandardContext. Remove internal sync, which is mostly useless.
Modified: trunk/PATCHES.txt
===================================================================
--- trunk/PATCHES.txt 2009-04-09 13:38:34 UTC (rev 1001)
+++ trunk/PATCHES.txt 2009-04-09 17:02:09 UTC (rev 1002)
@@ -58,3 +58,6 @@
757223
AJP hack to pass remote port (the protocol does not do it, well, too bad)
+
+763654
+Specific hack to address some error condition in HTTP method
Modified: trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
===================================================================
--- trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2009-04-09 13:38:34 UTC (rev 1001)
+++ trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2009-04-09 17:02:09 UTC (rev 1002)
@@ -20,6 +20,8 @@
import java.io.IOException;
+import javax.servlet.SessionTrackingMode;
+
import org.apache.catalina.Context;
import org.apache.catalina.Globals;
import org.apache.catalina.Wrapper;
@@ -543,6 +545,10 @@
return false;
}
+ // FIXME: Session Id processing according to
+ // FIXME: request.getServletContext().getEffectiveSessionTrackingModes().contains(SessionTrackingMode.URL);
+ // FIXME: request.getServletContext().getEffectiveSessionTrackingModes().contains(SessionTrackingMode.COOKIE);
+
// Parse session Id
parseSessionCookiesId(req, request);
@@ -559,7 +565,7 @@
int semicolon = uriBC.indexOf(match, 0, match.length(), 0);
if (semicolon > 0) {
-
+
// Parse session ID, and extract it from the decoded request URI
int start = uriBC.getStart();
int end = uriBC.getEnd();
Modified: trunk/java/org/apache/catalina/core/ApplicationContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-04-09 13:38:34 UTC (rev 1001)
+++ trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-04-09 17:02:09 UTC (rev 1002)
@@ -985,11 +985,12 @@
public boolean setInitParameter(String name, String value) {
- try {
- context.addParameter(name, value);
+ mergeParameters();
+ if (parameters.get(name) != null) {
+ return false;
+ } else {
+ parameters.put(name, value);
return true;
- } catch (IllegalStateException e) {
- return false;
}
}
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2009-04-09 13:38:34 UTC (rev 1001)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2009-04-09 17:02:09 UTC (rev 1002)
@@ -28,6 +28,7 @@
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.EnumSet;
+import java.util.EventListener;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
@@ -122,7 +123,7 @@
extends ContainerBase
implements Context, NotificationEmitter
{
- private static Logger log = Logger.getLogger(StandardContext.class);
+ protected static Logger log = Logger.getLogger(StandardContext.class);
// ----------------------------------------------------------- Constructors
@@ -146,7 +147,7 @@
/**
* The descriptive information string for this implementation.
*/
- private static final String info =
+ protected static final String info =
"org.apache.catalina.core.StandardContext/1.0";
@@ -176,58 +177,58 @@
/**
* The alternate deployment descriptor name.
*/
- private String altDDName = null;
+ protected String altDDName = null;
/**
* Lifecycle provider.
*/
- private InstanceManager instanceManager = null;
+ protected InstanceManager instanceManager = null;
/**
* Associated host name.
*/
- private String hostName;
+ protected String hostName;
/**
* The antiJARLocking flag for this Context.
*/
- private boolean antiJARLocking = false;
+ protected boolean antiJARLocking = false;
/**
* The antiResourceLocking flag for this Context.
*/
- private boolean antiResourceLocking = false;
+ protected boolean antiResourceLocking = false;
/**
* The set of application listener class names configured for this
* application, in the order they were encountered in the web.xml file.
*/
- private String applicationListeners[] = new String[0];
+ protected String applicationListeners[] = new String[0];
/**
* The set of instantiated application event listener objects</code>.
*/
- private Object applicationEventListenersObjects[] =
+ protected Object applicationEventListenersObjects[] =
new Object[0];
/**
* The set of instantiated application lifecycle listener objects</code>.
*/
- private Object applicationLifecycleListenersObjects[] =
+ protected Object applicationLifecycleListenersObjects[] =
new Object[0];
/**
* The set of application parameters defined for this application.
*/
- private ApplicationParameter applicationParameters[] =
+ protected ApplicationParameter applicationParameters[] =
new ApplicationParameter[0];
@@ -235,47 +236,47 @@
* The application authenticator for this Context. This is simply a reference
* and the authenticator should still be set as a valve.
*/
- private Authenticator authenticator = null;
+ protected Authenticator authenticator = null;
/**
* The application available flag for this Context.
*/
- private boolean available = false;
+ protected boolean available = false;
/**
* The broadcaster that sends j2ee notifications.
*/
- private NotificationBroadcasterSupport broadcaster = null;
+ protected NotificationBroadcasterSupport broadcaster = null;
/**
* The Locale to character set mapper for this application.
*/
- private CharsetMapper charsetMapper = null;
+ protected CharsetMapper charsetMapper = null;
/**
* The Java class name of the CharsetMapper class to be created.
*/
- private String charsetMapperClass =
+ protected String charsetMapperClass =
"org.apache.catalina.util.CharsetMapper";
/**
* The path to a file to save this Context information.
*/
- private String configFile = null;
+ protected String configFile = null;
/**
* The "correctly configured" flag for this Context.
*/
- private boolean configured = false;
+ protected boolean configured = false;
/**
* The security constraints for this web application.
*/
- private SecurityConstraint constraints[] = new SecurityConstraint[0];
+ protected SecurityConstraint constraints[] = new SecurityConstraint[0];
/**
@@ -287,98 +288,98 @@
/**
* Compiler classpath to use.
*/
- private String compilerClasspath = null;
+ protected String compilerClasspath = null;
/**
* The class name of the context configurator.
*/
- private String configClass = null;
+ protected String configClass = null;
/**
* Session tracking modes.
*/
// FIXME: see about SSL tracking mode
- private Set<SessionTrackingMode> defaultSessionTrackingModes =
+ protected Set<SessionTrackingMode> defaultSessionTrackingModes =
EnumSet.of(SessionTrackingMode.URL, SessionTrackingMode.COOKIE /*, SessionTrackingMode.SSL*/);
/**
* Session tracking modes.
*/
- private Set<SessionTrackingMode> sessionTrackingModes = defaultSessionTrackingModes;
+ protected Set<SessionTrackingMode> sessionTrackingModes = defaultSessionTrackingModes;
/**
* Should we allow the <code>ServletContext.getContext()</code> method
* to access the context of other web applications in this server?
*/
- private boolean crossContext = false;
+ protected boolean crossContext = false;
/**
* Encoded path.
*/
- private String encodedPath = null;
+ protected String encodedPath = null;
/**
* The "follow standard delegation model" flag that will be used to
* configure our ClassLoader.
*/
- private boolean delegate = false;
+ protected boolean delegate = false;
/**
* The display name of this web application.
*/
- private String displayName = null;
+ protected String displayName = null;
/**
* Override the default context xml location.
*/
- private String defaultContextXml;
+ protected String defaultContextXml;
/**
* Override the default web xml location.
*/
- private String defaultWebXml;
+ protected String defaultWebXml;
/**
* The distributable flag for this web application.
*/
- private boolean distributable = false;
+ protected boolean distributable = false;
/**
* The document root for this web application.
*/
- private String docBase = null;
+ protected String docBase = null;
/**
* The exception pages for this web application, keyed by fully qualified
* class name of the Java exception.
*/
- private HashMap exceptionPages = new HashMap();
+ protected HashMap<String, ErrorPage> exceptionPages = new HashMap<String, ErrorPage>();
/**
* The set of filter configurations (and associated filter instances) we
* have initialized, keyed by filter name.
*/
- private HashMap filterConfigs = new HashMap();
+ protected HashMap<String, ApplicationFilterConfig> filterConfigs = new HashMap<String, ApplicationFilterConfig>();
/**
* The set of filter definitions for this application, keyed by
* filter name.
*/
- private HashMap filterDefs = new HashMap();
+ protected HashMap<String, FilterDef> filterDefs = new HashMap<String, FilterDef>();
/**
@@ -387,7 +388,7 @@
* added via the {@link ServletContext} possibly both before and after those
* defined in the deployment descriptor.
*/
- private FilterMap filterMaps[] = new FilterMap[0];
+ protected FilterMap filterMaps[] = new FilterMap[0];
/**
@@ -399,76 +400,76 @@
* deployment descriptor mappings requires knowing where the last 'before'
* mapping was added.
*/
- private int filterMapInsertPoint = 0;
+ protected int filterMapInsertPoint = 0;
/**
* Ignore annotations.
*/
- private boolean ignoreAnnotations = false;
+ protected boolean ignoreAnnotations = false;
/**
* The set of classnames of InstanceListeners that will be added
* to each newly created Wrapper by <code>createWrapper()</code>.
*/
- private String instanceListeners[] = new String[0];
+ protected String instanceListeners[] = new String[0];
/**
* The login configuration descriptor for this web application.
*/
- private LoginConfig loginConfig = null;
+ protected LoginConfig loginConfig = null;
/**
* The mapper associated with this context.
*/
- private org.apache.tomcat.util.http.mapper.Mapper mapper =
+ protected org.apache.tomcat.util.http.mapper.Mapper mapper =
new org.apache.tomcat.util.http.mapper.Mapper();
/**
* The naming context listener for this web application.
*/
- private NamingContextListener namingContextListener = null;
+ protected NamingContextListener namingContextListener = null;
/**
* The naming resources for this web application.
*/
- private NamingResources namingResources = null;
+ protected NamingResources namingResources = null;
/**
* The message destinations for this web application.
*/
- private HashMap messageDestinations = new HashMap();
+ protected HashMap<String, MessageDestination> messageDestinations = new HashMap<String, MessageDestination>();
/**
* The MIME mappings for this web application, keyed by extension.
*/
- private HashMap mimeMappings = new HashMap();
+ protected HashMap<String, String> mimeMappings = new HashMap<String, String>();
/**
* Special case: error page for status 200.
*/
- private ErrorPage okErrorPage = null;
+ protected ErrorPage okErrorPage = null;
/**
* The context initialization parameters for this web application,
* keyed by name.
*/
- private HashMap parameters = new HashMap();
+ protected HashMap<String, String> parameters = new HashMap<String, String>();
/**
* The request processing pause flag (while reloading occurs)
*/
- private boolean paused = false;
+ protected boolean paused = false;
/**
@@ -476,37 +477,37 @@
* descriptor version we are currently parsing. This is used to support
* relaxed validation rules when processing version 2.2 web.xml files.
*/
- private String publicId = null;
+ protected String publicId = null;
/**
* The reloadable flag for this web application.
*/
- private boolean reloadable = false;
+ protected boolean reloadable = false;
/**
* Unpack WAR property.
*/
- private boolean unpackWAR = true;
+ protected boolean unpackWAR = true;
/**
* The DefaultContext override flag for this web application.
*/
- private boolean override = false;
+ protected boolean override = false;
/**
* The original document root for this web application.
*/
- private String originalDocBase = null;
+ protected String originalDocBase = null;
/**
* The privileged flag for this web application.
*/
- private boolean privileged = false;
+ protected boolean privileged = false;
/**
@@ -516,132 +517,132 @@
* choices <strong>replace</strong>, rather than append to, those defined
* in the global descriptor.
*/
- private boolean replaceWelcomeFiles = false;
+ protected boolean replaceWelcomeFiles = false;
/**
* The security role mappings for this application, keyed by role
* name (as used within the application).
*/
- private HashMap roleMappings = new HashMap();
+ protected HashMap<String, String> roleMappings = new HashMap<String, String>();
/**
* The security roles for this application, keyed by role name.
*/
- private String securityRoles[] = new String[0];
+ protected String securityRoles[] = new String[0];
/**
* The servlet mappings for this web application, keyed by
* matching pattern.
*/
- private HashMap servletMappings = new HashMap();
+ protected HashMap<String, String> servletMappings = new HashMap<String, String>();
/**
* The session timeout (in minutes) for this web application.
*/
- private int sessionTimeout = 30;
+ protected int sessionTimeout = 30;
/**
* The notification sequence number.
*/
- private long sequenceNumber = 0;
+ protected long sequenceNumber = 0;
/**
* The session cookie.
*/
- private SessionCookie sessionCookie = new SessionCookie();
+ protected SessionCookie sessionCookie = new SessionCookie();
/**
* The status code error pages for this web application, keyed by
* HTTP status code (as an Integer).
*/
- private HashMap statusPages = new HashMap();
+ protected HashMap<Integer, ErrorPage> statusPages = new HashMap<Integer, ErrorPage>();
/**
* Set flag to true to cause the system.out and system.err to be redirected
* to the logger when executing a servlet.
*/
- private boolean swallowOutput = false;
+ protected boolean swallowOutput = false;
/**
* The JSP tag libraries for this web application, keyed by URI
*/
- private HashMap taglibs = new HashMap();
+ protected HashMap<String, String> taglibs = new HashMap<String, String>();
/**
* Amount of ms that the container will wait for servlets to unload.
*/
- private long unloadDelay = 2000;
+ protected long unloadDelay = 2000;
/**
* The watched resources for this application.
*/
- private String watchedResources[] = new String[0];
+ protected String watchedResources[] = new String[0];
/**
* The welcome files for this application.
*/
- private String welcomeFiles[] = new String[0];
+ protected String welcomeFiles[] = new String[0];
/**
* The set of classnames of LifecycleListeners that will be added
* to each newly created Wrapper by <code>createWrapper()</code>.
*/
- private String wrapperLifecycles[] = new String[0];
+ protected String wrapperLifecycles[] = new String[0];
/**
* The set of classnames of ContainerListeners that will be added
* to each newly created Wrapper by <code>createWrapper()</code>.
*/
- private String wrapperListeners[] = new String[0];
+ protected String wrapperListeners[] = new String[0];
/**
* The pathname to the work directory for this context (relative to
* the server's home if not absolute).
*/
- private String workDir = null;
+ protected String workDir = null;
/**
* Java class name of the Wrapper class implementation we use.
*/
- private String wrapperClassName = StandardWrapper.class.getName();
- private Class wrapperClass = null;
+ protected String wrapperClassName = StandardWrapper.class.getName();
+ protected Class<?> wrapperClass = null;
/**
* JNDI use flag.
*/
- private boolean useNaming = true;
+ protected boolean useNaming = true;
/**
* Filesystem based flag.
*/
- private boolean filesystemBased = false;
+ protected boolean filesystemBased = false;
/**
* Name of the associated naming context.
*/
- private String namingContextName = null;
+ protected String namingContextName = null;
/**
* Caching allowed flag.
*/
- private boolean cachingAllowed = true;
+ protected boolean cachingAllowed = true;
/**
@@ -674,57 +675,57 @@
protected int cacheTTL = 5000;
- private boolean lazy=true;
+ protected boolean lazy=true;
/**
* Non proxied resources.
*/
- private DirContext webappResources = null;
+ protected DirContext webappResources = null;
- private long startupTime;
- private long startTime;
- private long tldScanTime;
+ protected long startupTime;
+ protected long startTime;
+ protected long tldScanTime;
/**
* Name of the engine. If null, the domain is used.
*/
- private String engineName = null;
- private String j2EEApplication="none";
- private String j2EEServer="none";
+ protected String engineName = null;
+ protected String j2EEApplication="none";
+ protected String j2EEServer="none";
/**
* Attribute value used to turn on/off XML validation
*/
- private boolean webXmlValidation = false;
+ protected boolean webXmlValidation = false;
/**
* Attribute value used to turn on/off XML namespace validation
*/
- private boolean webXmlNamespaceAware = false;
+ protected boolean webXmlNamespaceAware = false;
/**
* Attribute value used to turn on/off TLD processing
*/
- private boolean processTlds = true;
+ protected boolean processTlds = true;
/**
* Attribute value used to turn on/off XML validation
*/
- private boolean tldValidation = false;
+ protected boolean tldValidation = false;
/**
* Attribute value used to turn on/off TLD XML namespace validation
*/
- private boolean tldNamespaceAware = false;
+ protected boolean tldNamespaceAware = false;
/**
* Should we save the configuration.
*/
- private boolean saveConfig = true;
+ protected boolean saveConfig = true;
// ----------------------------------------------------- Context Properties
@@ -852,9 +853,7 @@
* our ClassLoader.
*/
public boolean getDelegate() {
-
return (this.delegate);
-
}
@@ -865,12 +864,9 @@
* @param delegate The new flag
*/
public void setDelegate(boolean delegate) {
-
boolean oldDelegate = this.delegate;
this.delegate = delegate;
- support.firePropertyChange("delegate", new Boolean(oldDelegate),
- new Boolean(this.delegate));
-
+ support.firePropertyChange("delegate", oldDelegate, this.delegate);
}
@@ -878,9 +874,7 @@
* Returns true if the internal naming support is used.
*/
public boolean isUseNaming() {
-
return (useNaming);
-
}
@@ -897,9 +891,7 @@
* filesystem based.
*/
public boolean isFilesystemBased() {
-
return (filesystemBased);
-
}
@@ -907,9 +899,7 @@
* Force setting if filesystem based.
*/
public void setFilesystemBased(boolean filesystemBased) {
-
this.filesystemBased = filesystemBased;
-
}
@@ -967,9 +957,7 @@
* Return the antiJARLocking flag for this Context.
*/
public boolean getAntiJARLocking() {
-
return (this.antiJARLocking);
-
}
@@ -977,9 +965,7 @@
* Return the antiResourceLocking flag for this Context.
*/
public boolean getAntiResourceLocking() {
-
return (this.antiResourceLocking);
-
}
@@ -989,13 +975,9 @@
* @param antiJARLocking The new flag value
*/
public void setAntiJARLocking(boolean antiJARLocking) {
-
boolean oldAntiJARLocking = this.antiJARLocking;
this.antiJARLocking = antiJARLocking;
- support.firePropertyChange("antiJARLocking",
- new Boolean(oldAntiJARLocking),
- new Boolean(this.antiJARLocking));
-
+ support.firePropertyChange("antiJARLocking", oldAntiJARLocking, this.antiJARLocking);
}
@@ -1005,13 +987,9 @@
* @param antiResourceLocking The new flag value
*/
public void setAntiResourceLocking(boolean antiResourceLocking) {
-
boolean oldAntiResourceLocking = this.antiResourceLocking;
this.antiResourceLocking = antiResourceLocking;
- support.firePropertyChange("antiResourceLocking",
- new Boolean(oldAntiResourceLocking),
- new Boolean(this.antiResourceLocking));
-
+ support.firePropertyChange("antiResourceLocking", oldAntiResourceLocking, this.antiResourceLocking);
}
@@ -1019,9 +997,7 @@
* Return the application authenticator for this Context.
*/
public Authenticator getAuthenticator() {
-
return (this.authenticator);
-
}
@@ -1031,12 +1007,10 @@
* @param authenticator The new application authenticator
*/
public void setAuthenticator(Authenticator authenticator) {
-
Authenticator oldAuthenticator = this.authenticator;
this.authenticator = authenticator;
support.firePropertyChange("authenticator", oldAuthenticator,
this.authenticator);
-
}
@@ -1044,9 +1018,7 @@
* Return the application available flag for this Context.
*/
public boolean getAvailable() {
-
return (this.available);
-
}
@@ -1056,13 +1028,9 @@
* @param available The new application available flag
*/
public void setAvailable(boolean available) {
-
boolean oldAvailable = this.available;
this.available = available;
- support.firePropertyChange("available",
- new Boolean(oldAvailable),
- new Boolean(this.available));
-
+ support.firePropertyChange("available", oldAvailable, this.available);
}
@@ -1074,9 +1042,8 @@
// Create a mapper the first time it is requested
if (this.charsetMapper == null) {
try {
- Class clazz = Class.forName(charsetMapperClass);
- this.charsetMapper =
- (CharsetMapper) clazz.newInstance();
+ Class<?> clazz = Class.forName(charsetMapperClass);
+ this.charsetMapper = (CharsetMapper) clazz.newInstance();
} catch (Throwable t) {
this.charsetMapper = new CharsetMapper();
}
@@ -1093,23 +1060,19 @@
* @param mapper The new mapper
*/
public void setCharsetMapper(CharsetMapper mapper) {
-
CharsetMapper oldCharsetMapper = this.charsetMapper;
this.charsetMapper = mapper;
if( mapper != null )
this.charsetMapperClass= mapper.getClass().getName();
support.firePropertyChange("charsetMapper", oldCharsetMapper,
this.charsetMapper);
-
}
/**
* Return the path to a file to save this Context information.
*/
public String getConfigFile() {
-
return (this.configFile);
-
}
@@ -1119,7 +1082,6 @@
* @param configFile The path to a file to save this Context information.
*/
public void setConfigFile(String configFile) {
-
this.configFile = configFile;
}
@@ -1128,9 +1090,7 @@
* Return the class name of the context configurator.
*/
public String getConfigClass() {
-
return (this.configClass);
-
}
@@ -1140,7 +1100,6 @@
* @param configClass The class name of the listener.
*/
public void setConfigClass(String configClass) {
-
this.configClass = configClass;
}
@@ -1149,9 +1108,7 @@
* Return the "correctly configured" flag for this Context.
*/
public boolean getConfigured() {
-
return (this.configured);
-
}
@@ -1163,13 +1120,9 @@
* @param configured The new correctly configured flag
*/
public void setConfigured(boolean configured) {
-
boolean oldConfigured = this.configured;
this.configured = configured;
- support.firePropertyChange("configured",
- new Boolean(oldConfigured),
- new Boolean(this.configured));
-
+ support.firePropertyChange("configured", oldConfigured, this.configured);
}
@@ -1177,9 +1130,7 @@
* Return the "use cookies for session ids" flag.
*/
public boolean getCookies() {
-
return (sessionTrackingModes.contains(SessionTrackingMode.COOKIE));
-
}
@@ -1189,7 +1140,6 @@
* @param cookies The new flag
*/
public void setCookies(boolean cookies) {
-
boolean oldCookies = sessionTrackingModes.contains(SessionTrackingMode.COOKIE);
if (oldCookies && !cookies) {
defaultSessionTrackingModes.remove(SessionTrackingMode.COOKIE);
@@ -1198,11 +1148,8 @@
defaultSessionTrackingModes.add(SessionTrackingMode.COOKIE);
}
if (oldCookies != cookies) {
- support.firePropertyChange("cookies",
- new Boolean(oldCookies),
- new Boolean(cookies));
+ support.firePropertyChange("cookies", oldCookies, cookies);
}
-
}
@@ -1210,9 +1157,7 @@
* Return the "allow crossing servlet contexts" flag.
*/
public boolean getCrossContext() {
-
return (this.crossContext);
-
}
@@ -1222,13 +1167,9 @@
* @param crossContext The new cross contexts flag
*/
public void setCrossContext(boolean crossContext) {
-
boolean oldCrossContext = this.crossContext;
this.crossContext = crossContext;
- support.firePropertyChange("crossContext",
- new Boolean(oldCrossContext),
- new Boolean(this.crossContext));
-
+ support.firePropertyChange("crossContext", oldCrossContext, this.crossContext);
}
public String getDefaultContextXml() {
@@ -1286,9 +1227,7 @@
* Return the display name of this web application.
*/
public String getDisplayName() {
-
return (this.displayName);
-
}
@@ -1333,11 +1272,9 @@
* @param displayName The new display name
*/
public void setDisplayName(String displayName) {
-
String oldDisplayName = this.displayName;
this.displayName = displayName;
- support.firePropertyChange("displayName", oldDisplayName,
- this.displayName);
+ support.firePropertyChange("displayName", oldDisplayName, this.displayName);
}
@@ -1345,9 +1282,7 @@
* Return the distributable flag for this web application.
*/
public boolean getDistributable() {
-
return (this.distributable);
-
}
/**
@@ -1358,16 +1293,9 @@
public void setDistributable(boolean distributable) {
boolean oldDistributable = this.distributable;
this.distributable = distributable;
- support.firePropertyChange("distributable",
- new Boolean(oldDistributable),
- new Boolean(this.distributable));
-
+ support.firePropertyChange("distributable", oldDistributable, this.distributable);
// Bugzilla 32866
- if(getManager() != null) {
- if(log.isDebugEnabled()) {
- log.debug("Propagating distributable=" + distributable
- + " to manager");
- }
+ if( getManager() != null) {
getManager().setDistributable(distributable);
}
}
@@ -1378,12 +1306,9 @@
* pathname, a relative pathname, or a URL.
*/
public String getDocBase() {
-
return (this.docBase);
-
}
-
/**
* Set the document root for this Context. This can be an absolute
* pathname, a relative pathname, or a URL.
@@ -1391,9 +1316,7 @@
* @param docBase The new document root
*/
public void setDocBase(String docBase) {
-
this.docBase = docBase;
-
}
// experimental
@@ -1448,10 +1371,8 @@
*
* @param loader The newly associated loader
*/
- public synchronized void setLoader(Loader loader) {
-
+ public void setLoader(Loader loader) {
super.setLoader(loader);
-
}
@@ -1472,8 +1393,7 @@
public void setIgnoreAnnotations(boolean ignoreAnnotations) {
boolean oldIgnoreAnnotations = this.ignoreAnnotations;
this.ignoreAnnotations = ignoreAnnotations;
- support.firePropertyChange("ignoreAnnotations", Boolean.valueOf(oldIgnoreAnnotations),
- Boolean.valueOf(this.ignoreAnnotations));
+ support.firePropertyChange("ignoreAnnotations", oldIgnoreAnnotations, this.ignoreAnnotations);
}
@@ -1501,9 +1421,7 @@
* Return the login configuration descriptor for this web application.
*/
public LoginConfig getLoginConfig() {
-
return (this.loginConfig);
-
}
@@ -1566,12 +1484,10 @@
* Return the naming resources associated with this web application.
*/
public NamingResources getNamingResources() {
-
if (namingResources == null) {
setNamingResources(new NamingResources());
}
return (namingResources);
-
}
@@ -1581,14 +1497,12 @@
* @param namingResources The new naming resources
*/
public void setNamingResources(NamingResources namingResources) {
-
// Process the property setting change
NamingResources oldNamingResources = this.namingResources;
this.namingResources = namingResources;
namingResources.setContainer(this);
support.firePropertyChange("namingResources",
oldNamingResources, this.namingResources);
-
}
@@ -1596,9 +1510,7 @@
* Return the context path for this Context.
*/
public String getPath() {
-
return (getName());
-
}
@@ -1611,9 +1523,7 @@
* @param path The new context path
*/
public void setPath(String path) {
- // XXX Use host in name
setName(path);
-
}
@@ -1622,9 +1532,7 @@
* currently being parsed.
*/
public String getPublicId() {
-
return (this.publicId);
-
}
@@ -1635,15 +1543,9 @@
* @param publicId The public identifier
*/
public void setPublicId(String publicId) {
-
- if (log.isDebugEnabled())
- log.debug("Setting deployment descriptor public ID to '" +
- publicId + "'");
-
String oldPublicId = this.publicId;
this.publicId = publicId;
support.firePropertyChange("publicId", oldPublicId, publicId);
-
}
@@ -1651,19 +1553,15 @@
* Return the reloadable flag for this web application.
*/
public boolean getReloadable() {
-
return (this.reloadable);
}
-
/**
* Return the DefaultContext override flag for this web application.
*/
public boolean getOverride() {
-
return (this.override);
-
}
@@ -1673,9 +1571,7 @@
* Is only set as deployment has change docRoot!
*/
public String getOriginalDocBase() {
-
return (this.originalDocBase);
-
}
/**
@@ -1685,7 +1581,6 @@
* @param docBase The orginal document root
*/
public void setOriginalDocBase(String docBase) {
-
this.originalDocBase = docBase;
}
@@ -1711,9 +1606,7 @@
* Return the privileged flag for this web application.
*/
public boolean getPrivileged() {
-
return (this.privileged);
-
}
@@ -1723,13 +1616,9 @@
* @param privileged The new privileged flag
*/
public void setPrivileged(boolean privileged) {
-
boolean oldPrivileged = this.privileged;
this.privileged = privileged;
- support.firePropertyChange("privileged",
- new Boolean(oldPrivileged),
- new Boolean(this.privileged));
-
+ support.firePropertyChange("privileged", oldPrivileged, this.privileged);
}
@@ -1739,13 +1628,9 @@
* @param reloadable The new reloadable flag
*/
public void setReloadable(boolean reloadable) {
-
boolean oldReloadable = this.reloadable;
this.reloadable = reloadable;
- support.firePropertyChange("reloadable",
- new Boolean(oldReloadable),
- new Boolean(this.reloadable));
-
+ support.firePropertyChange("reloadable", oldReloadable, this.reloadable);
}
@@ -1755,13 +1640,9 @@
* @param override The new override flag
*/
public void setOverride(boolean override) {
-
boolean oldOverride = this.override;
this.override = override;
- support.firePropertyChange("override",
- new Boolean(oldOverride),
- new Boolean(this.override));
-
+ support.firePropertyChange("override", oldOverride, this.override);
}
@@ -1785,9 +1666,7 @@
* Return the "replace welcome files" property.
*/
public boolean isReplaceWelcomeFiles() {
-
return (this.replaceWelcomeFiles);
-
}
@@ -1797,13 +1676,9 @@
* @param replaceWelcomeFiles The new property value
*/
public void setReplaceWelcomeFiles(boolean replaceWelcomeFiles) {
-
boolean oldReplaceWelcomeFiles = this.replaceWelcomeFiles;
this.replaceWelcomeFiles = replaceWelcomeFiles;
- support.firePropertyChange("replaceWelcomeFiles",
- new Boolean(oldReplaceWelcomeFiles),
- new Boolean(this.replaceWelcomeFiles));
-
+ support.firePropertyChange("replaceWelcomeFiles", oldReplaceWelcomeFiles, this.replaceWelcomeFiles);
}
@@ -1811,14 +1686,12 @@
* Return the servlet context for which this Context is a facade.
*/
public ServletContext getServletContext() {
-
if (context == null) {
context = new ApplicationContext(getBasePath(), this);
if (altDDName != null)
context.setAttribute(Globals.ALT_DD_ATTR,altDDName);
}
return (context.getFacade());
-
}
@@ -1827,9 +1700,7 @@
* web application.
*/
public int getSessionTimeout() {
-
return (this.sessionTimeout);
-
}
@@ -1840,7 +1711,6 @@
* @param timeout The new default session timeout
*/
public void setSessionTimeout(int timeout) {
-
int oldSessionTimeout = this.sessionTimeout;
/*
* SRV.13.4 ("Deployment Descriptor"):
@@ -1848,10 +1718,7 @@
* behaviour of sessions is never to time out.
*/
this.sessionTimeout = (timeout == 0) ? -1 : timeout;
- support.firePropertyChange("sessionTimeout",
- new Integer(oldSessionTimeout),
- new Integer(this.sessionTimeout));
-
+ support.firePropertyChange("sessionTimeout", oldSessionTimeout, this.sessionTimeout);
}
@@ -1859,9 +1726,7 @@
* Return the value of the swallowOutput flag.
*/
public boolean getSwallowOutput() {
-
return (this.swallowOutput);
-
}
@@ -1873,13 +1738,9 @@
* @param swallowOutput The new value
*/
public void setSwallowOutput(boolean swallowOutput) {
-
boolean oldSwallowOutput = this.swallowOutput;
this.swallowOutput = swallowOutput;
- support.firePropertyChange("swallowOutput",
- new Boolean(oldSwallowOutput),
- new Boolean(this.swallowOutput));
-
+ support.firePropertyChange("swallowOutput", oldSwallowOutput, this.swallowOutput);
}
@@ -1887,12 +1748,10 @@
* Return the value of the unloadDelay flag.
*/
public long getUnloadDelay() {
-
return (this.unloadDelay);
-
}
-
+
/**
* Set the value of the unloadDelay flag, which represents the amount
* of ms that the container will wait when unloading servlets.
@@ -1902,13 +1761,9 @@
* @param unloadDelay The new value
*/
public void setUnloadDelay(long unloadDelay) {
-
long oldUnloadDelay = this.unloadDelay;
this.unloadDelay = unloadDelay;
- support.firePropertyChange("unloadDelay",
- new Long(oldUnloadDelay),
- new Long(this.unloadDelay));
-
+ support.firePropertyChange("unloadDelay", oldUnloadDelay, this.unloadDelay);
}
@@ -1916,9 +1771,7 @@
* Unpack WAR flag accessor.
*/
public boolean getUnpackWAR() {
-
return (unpackWAR);
-
}
@@ -1926,9 +1779,7 @@
* Unpack WAR flag mutator.
*/
public void setUnpackWAR(boolean unpackWAR) {
-
this.unpackWAR = unpackWAR;
-
}
/**
@@ -1936,9 +1787,7 @@
* for servlets registered in this Context.
*/
public String getWrapperClass() {
-
return (this.wrapperClassName);
-
}
@@ -1952,9 +1801,7 @@
* cannot be found or is not a subclass of StandardWrapper
*/
public void setWrapperClass(String wrapperClassName) {
-
this.wrapperClassName = wrapperClassName;
-
try {
wrapperClass = Class.forName(wrapperClassName);
if (!StandardWrapper.class.isAssignableFrom(wrapperClass)) {
@@ -1974,7 +1821,7 @@
*
* @param resources The newly associated DirContext
*/
- public synchronized void setResources(DirContext resources) {
+ public void setResources(DirContext resources) {
if (started) {
throw new IllegalStateException
@@ -2014,9 +1861,7 @@
* Return the Locale to character set mapper class for this Context.
*/
public String getCharsetMapperClass() {
-
return (this.charsetMapperClass);
-
}
@@ -2026,13 +1871,11 @@
* @param mapper The new mapper class
*/
public void setCharsetMapperClass(String mapper) {
-
String oldCharsetMapperClass = this.charsetMapperClass;
this.charsetMapperClass = mapper;
support.firePropertyChange("charsetMapperClass",
oldCharsetMapperClass,
this.charsetMapperClass);
-
}
@@ -2064,9 +1907,7 @@
* Return the work directory for this Context.
*/
public String getWorkDir() {
-
return (this.workDir);
-
}
@@ -2076,9 +1917,7 @@
* @param workDir The new work directory
*/
public void setWorkDir(String workDir) {
-
this.workDir = workDir;
-
if (started) {
postWorkDirectory();
}
@@ -2111,23 +1950,18 @@
* @param listener Java class name of a listener class
*/
public void addApplicationListener(String listener) {
-
- synchronized (applicationListeners) {
- String results[] =new String[applicationListeners.length + 1];
- for (int i = 0; i < applicationListeners.length; i++) {
- if (listener.equals(applicationListeners[i])) {
- log.info(sm.getString("standardContext.duplicateListener", listener));
- return;
- }
- results[i] = applicationListeners[i];
+ String results[] =new String[applicationListeners.length + 1];
+ for (int i = 0; i < applicationListeners.length; i++) {
+ if (listener.equals(applicationListeners[i])) {
+ log.info(sm.getString("standardContext.duplicateListener", listener));
+ return;
}
- results[applicationListeners.length] = listener;
- applicationListeners = results;
+ results[i] = applicationListeners[i];
}
+ results[applicationListeners.length] = listener;
+ applicationListeners = results;
fireContainerEvent("addApplicationListener", listener);
-
// FIXME - add instance if already started?
-
}
@@ -2137,23 +1971,19 @@
* @param parameter The new application parameter
*/
public void addApplicationParameter(ApplicationParameter parameter) {
-
- synchronized (applicationParameters) {
- String newName = parameter.getName();
- for (int i = 0; i < applicationParameters.length; i++) {
- if (newName.equals(applicationParameters[i].getName()) &&
+ String newName = parameter.getName();
+ for (int i = 0; i < applicationParameters.length; i++) {
+ if (newName.equals(applicationParameters[i].getName()) &&
!applicationParameters[i].getOverride())
- return;
- }
- ApplicationParameter results[] =
- new ApplicationParameter[applicationParameters.length + 1];
- System.arraycopy(applicationParameters, 0, results, 0,
- applicationParameters.length);
- results[applicationParameters.length] = parameter;
- applicationParameters = results;
+ return;
}
+ ApplicationParameter results[] =
+ new ApplicationParameter[applicationParameters.length + 1];
+ System.arraycopy(applicationParameters, 0, results, 0,
+ applicationParameters.length);
+ results[applicationParameters.length] = parameter;
+ applicationParameters = results;
fireContainerEvent("addApplicationParameter", parameter);
-
}
@@ -2235,14 +2065,12 @@
}
// Add this constraint to the set for our web application
- synchronized (constraints) {
- SecurityConstraint results[] =
- new SecurityConstraint[constraints.length + 1];
- for (int i = 0; i < constraints.length; i++)
- results[i] = constraints[i];
- results[constraints.length] = constraint;
- constraints = results;
- }
+ SecurityConstraint results[] =
+ new SecurityConstraint[constraints.length + 1];
+ for (int i = 0; i < constraints.length; i++)
+ results[i] = constraints[i];
+ results[constraints.length] = constraint;
+ constraints = results;
}
@@ -2275,17 +2103,12 @@
// Add the specified error page to our internal collections
String exceptionType = errorPage.getExceptionType();
if (exceptionType != null) {
- synchronized (exceptionPages) {
- exceptionPages.put(exceptionType, errorPage);
- }
+ exceptionPages.put(exceptionType, errorPage);
} else {
- synchronized (statusPages) {
- if (errorPage.getErrorCode() == 200) {
- this.okErrorPage = errorPage;
- }
- statusPages.put(new Integer(errorPage.getErrorCode()),
- errorPage);
+ if (errorPage.getErrorCode() == 200) {
+ this.okErrorPage = errorPage;
}
+ statusPages.put(errorPage.getErrorCode(), errorPage);
}
fireContainerEvent("addErrorPage", errorPage);
@@ -2311,12 +2134,8 @@
* @param filterDef The filter definition to be added
*/
public void addFilterDef(FilterDef filterDef) {
-
- synchronized (filterDefs) {
- filterDefs.put(filterDef.getFilterName(), filterDef);
- }
+ filterDefs.put(filterDef.getFilterName(), filterDef);
fireContainerEvent("addFilterDef", filterDef);
-
}
@@ -2331,15 +2150,12 @@
* is malformed
*/
public void addFilterMap(FilterMap filterMap) {
-
validateFilterMap(filterMap);
// Add this filter mapping to our registered set
- synchronized (filterMaps) {
- FilterMap results[] =new FilterMap[filterMaps.length + 1];
- System.arraycopy(filterMaps, 0, results, 0, filterMaps.length);
- results[filterMaps.length] = filterMap;
- filterMaps = results;
- }
+ FilterMap results[] =new FilterMap[filterMaps.length + 1];
+ System.arraycopy(filterMaps, 0, results, 0, filterMaps.length);
+ results[filterMaps.length] = filterMap;
+ filterMaps = results;
fireContainerEvent("addFilterMap", filterMap);
}
@@ -2355,23 +2171,19 @@
* is malformed
*/
public void addFilterMapBefore(FilterMap filterMap) {
-
validateFilterMap(filterMap);
-
// Add this filter mapping to our registered set
- synchronized (filterMaps) {
- FilterMap results[] = new FilterMap[filterMaps.length + 1];
- System.arraycopy(filterMaps, 0, results, 0, filterMapInsertPoint);
- results[filterMapInsertPoint] = filterMap;
- System.arraycopy(filterMaps, filterMapInsertPoint, results,
- filterMaps.length - filterMapInsertPoint+1,
- filterMapInsertPoint);
-
- filterMapInsertPoint++;
-
- results[filterMaps.length] = filterMap;
- filterMaps = results;
- }
+ FilterMap results[] = new FilterMap[filterMaps.length + 1];
+ System.arraycopy(filterMaps, 0, results, 0, filterMapInsertPoint);
+ results[filterMapInsertPoint] = filterMap;
+ System.arraycopy(filterMaps, filterMapInsertPoint, results,
+ filterMaps.length - filterMapInsertPoint+1,
+ filterMapInsertPoint);
+
+ filterMapInsertPoint++;
+
+ results[filterMaps.length] = filterMap;
+ filterMaps = results;
fireContainerEvent("addFilterMap", filterMap);
}
@@ -2379,7 +2191,7 @@
/**
* Validate the supplied FilterMap.
*/
- private void validateFilterMap(FilterMap filterMap) {
+ protected void validateFilterMap(FilterMap filterMap) {
// Validate the proposed filter mapping
String filterName = filterMap.getFilterName();
String[] servletNames = filterMap.getServletNames();
@@ -2416,18 +2228,15 @@
* @param listener Java class name of an InstanceListener class
*/
public void addInstanceListener(String listener) {
-
- synchronized (instanceListeners) {
- String results[] =new String[instanceListeners.length + 1];
- for (int i = 0; i < instanceListeners.length; i++)
- results[i] = instanceListeners[i];
- results[instanceListeners.length] = listener;
- instanceListeners = results;
- }
+ String results[] =new String[instanceListeners.length + 1];
+ for (int i = 0; i < instanceListeners.length; i++)
+ results[i] = instanceListeners[i];
+ results[instanceListeners.length] = listener;
+ instanceListeners = results;
fireContainerEvent("addInstanceListener", listener);
-
}
+
/**
* Add the given URL pattern as a jsp-property-group. This maps
* resources that match the given pattern so they will be passed
@@ -2469,12 +2278,8 @@
* @param md New message destination
*/
public void addMessageDestination(MessageDestination md) {
-
- synchronized (messageDestinations) {
- messageDestinations.put(md.getName(), md);
- }
+ messageDestinations.put(md.getName(), md);
fireContainerEvent("addMessageDestination", md.getName());
-
}
@@ -2483,12 +2288,9 @@
*
* @param mdr New message destination reference
*/
- public void addMessageDestinationRef
- (MessageDestinationRef mdr) {
-
+ public void addMessageDestinationRef(MessageDestinationRef mdr) {
namingResources.addMessageDestinationRef(mdr);
fireContainerEvent("addMessageDestinationRef", mdr.getName());
-
}
@@ -2500,12 +2302,8 @@
* @param mimeType Corresponding MIME type
*/
public void addMimeMapping(String extension, String mimeType) {
-
- synchronized (mimeMappings) {
- mimeMappings.put(extension, mimeType);
- }
+ mimeMappings.put(extension, mimeType);
fireContainerEvent("addMimeMapping", extension);
-
}
@@ -2529,9 +2327,7 @@
(sm.getString("standardContext.parameter.duplicate", name));
// Add this parameter to our defined set
- synchronized (parameters) {
- parameters.put(name, value);
- }
+ parameters.put(name, value);
fireContainerEvent("addParameter", name);
}
@@ -2544,12 +2340,8 @@
* @param link Actual security role to check for
*/
public void addRoleMapping(String role, String link) {
-
- synchronized (roleMappings) {
- roleMappings.put(role, link);
- }
+ roleMappings.put(role, link);
fireContainerEvent("addRoleMapping", role);
-
}
@@ -2559,16 +2351,12 @@
* @param role New security role
*/
public void addSecurityRole(String role) {
-
- synchronized (securityRoles) {
- String results[] =new String[securityRoles.length + 1];
- for (int i = 0; i < securityRoles.length; i++)
- results[i] = securityRoles[i];
- results[securityRoles.length] = role;
- securityRoles = results;
- }
+ String results[] =new String[securityRoles.length + 1];
+ for (int i = 0; i < securityRoles.length; i++)
+ results[i] = securityRoles[i];
+ results[securityRoles.length] = role;
+ securityRoles = results;
fireContainerEvent("addSecurityRole", role);
-
}
@@ -2611,16 +2399,14 @@
(sm.getString("standardContext.servletMap.pattern", pattern));
// Add this mapping to our registered set
- synchronized (servletMappings) {
- String name2 = (String) servletMappings.get(pattern);
- if (name2 != null) {
- // Don't allow more than one servlet on the same pattern
- Wrapper wrapper = (Wrapper) findChild(name2);
- wrapper.removeMapping(pattern);
- mapper.removeWrapper(pattern);
- }
- servletMappings.put(pattern, name);
+ String name2 = (String) servletMappings.get(pattern);
+ if (name2 != null) {
+ // Don't allow more than one servlet on the same pattern
+ Wrapper wrapper = (Wrapper) findChild(name2);
+ wrapper.removeMapping(pattern);
+ mapper.removeWrapper(pattern);
}
+ servletMappings.put(pattern, name);
Wrapper wrapper = (Wrapper) findChild(name);
wrapper.addMapping(pattern);
@@ -2639,12 +2425,8 @@
* @param location Location of the tag library descriptor
*/
public void addTaglib(String uri, String location) {
-
- synchronized (taglibs) {
- taglibs.put(uri, location);
- }
+ taglibs.put(uri, location);
fireContainerEvent("addTaglib", uri);
-
}
@@ -2654,16 +2436,12 @@
* @param name New watched resource file name
*/
public void addWatchedResource(String name) {
-
- synchronized (watchedResources) {
- String results[] = new String[watchedResources.length + 1];
- for (int i = 0; i < watchedResources.length; i++)
- results[i] = watchedResources[i];
- results[watchedResources.length] = name;
- watchedResources = results;
- }
+ String results[] = new String[watchedResources.length + 1];
+ for (int i = 0; i < watchedResources.length; i++)
+ results[i] = watchedResources[i];
+ results[watchedResources.length] = name;
+ watchedResources = results;
fireContainerEvent("addWatchedResource", name);
-
}
@@ -2674,19 +2452,18 @@
*/
public void addWelcomeFile(String name) {
- synchronized (welcomeFiles) {
- // Welcome files from the application deployment descriptor
- // completely replace those from the default conf/web.xml file
- if (replaceWelcomeFiles) {
- welcomeFiles = new String[0];
- setReplaceWelcomeFiles(false);
- }
- String results[] =new String[welcomeFiles.length + 1];
- for (int i = 0; i < welcomeFiles.length; i++)
- results[i] = welcomeFiles[i];
- results[welcomeFiles.length] = name;
- welcomeFiles = results;
+ // Welcome files from the application deployment descriptor
+ // completely replace those from the default conf/web.xml file
+ if (replaceWelcomeFiles) {
+ welcomeFiles = new String[0];
+ setReplaceWelcomeFiles(false);
}
+ String results[] =new String[welcomeFiles.length + 1];
+ for (int i = 0; i < welcomeFiles.length; i++)
+ results[i] = welcomeFiles[i];
+ results[welcomeFiles.length] = name;
+ welcomeFiles = results;
+
postWelcomeFiles();
fireContainerEvent("addWelcomeFile", name);
@@ -2700,16 +2477,12 @@
* @param listener Java class name of a LifecycleListener class
*/
public void addWrapperLifecycle(String listener) {
-
- synchronized (wrapperLifecycles) {
- String results[] =new String[wrapperLifecycles.length + 1];
- for (int i = 0; i < wrapperLifecycles.length; i++)
- results[i] = wrapperLifecycles[i];
- results[wrapperLifecycles.length] = listener;
- wrapperLifecycles = results;
- }
+ String results[] =new String[wrapperLifecycles.length + 1];
+ for (int i = 0; i < wrapperLifecycles.length; i++)
+ results[i] = wrapperLifecycles[i];
+ results[wrapperLifecycles.length] = listener;
+ wrapperLifecycles = results;
fireContainerEvent("addWrapperLifecycle", listener);
-
}
@@ -2720,16 +2493,12 @@
* @param listener Java class name of a ContainerListener class
*/
public void addWrapperListener(String listener) {
-
- synchronized (wrapperListeners) {
- String results[] =new String[wrapperListeners.length + 1];
- for (int i = 0; i < wrapperListeners.length; i++)
- results[i] = wrapperListeners[i];
- results[wrapperListeners.length] = listener;
- wrapperListeners = results;
- }
+ String results[] =new String[wrapperListeners.length + 1];
+ for (int i = 0; i < wrapperListeners.length; i++)
+ results[i] = wrapperListeners[i];
+ results[wrapperListeners.length] = listener;
+ wrapperListeners = results;
fireContainerEvent("addWrapperListener", listener);
-
}
@@ -2753,46 +2522,40 @@
wrapper = new StandardWrapper();
}
- synchronized (instanceListeners) {
- for (int i = 0; i < instanceListeners.length; i++) {
- try {
- Class clazz = Class.forName(instanceListeners[i]);
- InstanceListener listener =
- (InstanceListener) clazz.newInstance();
- wrapper.addInstanceListener(listener);
- } catch (Throwable t) {
- log.error("createWrapper", t);
- return (null);
- }
+ for (int i = 0; i < instanceListeners.length; i++) {
+ try {
+ Class<?> clazz = Class.forName(instanceListeners[i]);
+ InstanceListener listener =
+ (InstanceListener) clazz.newInstance();
+ wrapper.addInstanceListener(listener);
+ } catch (Throwable t) {
+ log.error("createWrapper", t);
+ return (null);
}
}
- synchronized (wrapperLifecycles) {
- for (int i = 0; i < wrapperLifecycles.length; i++) {
- try {
- Class clazz = Class.forName(wrapperLifecycles[i]);
- LifecycleListener listener =
- (LifecycleListener) clazz.newInstance();
- if (wrapper instanceof Lifecycle)
- ((Lifecycle) wrapper).addLifecycleListener(listener);
- } catch (Throwable t) {
- log.error("createWrapper", t);
- return (null);
- }
+ for (int i = 0; i < wrapperLifecycles.length; i++) {
+ try {
+ Class<?> clazz = Class.forName(wrapperLifecycles[i]);
+ LifecycleListener listener =
+ (LifecycleListener) clazz.newInstance();
+ if (wrapper instanceof Lifecycle)
+ ((Lifecycle) wrapper).addLifecycleListener(listener);
+ } catch (Throwable t) {
+ log.error("createWrapper", t);
+ return (null);
}
}
- synchronized (wrapperListeners) {
- for (int i = 0; i < wrapperListeners.length; i++) {
- try {
- Class clazz = Class.forName(wrapperListeners[i]);
- ContainerListener listener =
- (ContainerListener) clazz.newInstance();
- wrapper.addContainerListener(listener);
- } catch (Throwable t) {
- log.error("createWrapper", t);
- return (null);
- }
+ for (int i = 0; i < wrapperListeners.length; i++) {
+ try {
+ Class<?> clazz = Class.forName(wrapperListeners[i]);
+ ContainerListener listener =
+ (ContainerListener) clazz.newInstance();
+ wrapper.addContainerListener(listener);
+ } catch (Throwable t) {
+ log.error("createWrapper", t);
+ return (null);
}
}
@@ -2805,9 +2568,7 @@
* Return the application filter for the given name.
*/
public ApplicationFilterConfig findApplicationFilterConfig(String name) {
-
return (ApplicationFilterConfig) filterConfigs.get(name);
-
}
@@ -2816,9 +2577,7 @@
* for this application.
*/
public String[] findApplicationListeners() {
-
return (applicationListeners);
-
}
@@ -2826,9 +2585,7 @@
* Return the set of application parameters for this application.
*/
public ApplicationParameter[] findApplicationParameters() {
-
return (applicationParameters);
-
}
@@ -2837,9 +2594,7 @@
* If there are none, a zero-length array is returned.
*/
public SecurityConstraint[] findConstraints() {
-
return (constraints);
-
}
@@ -2853,9 +2608,8 @@
if (errorCode == 200) {
return (okErrorPage);
} else {
- return ((ErrorPage) statusPages.get(new Integer(errorCode)));
+ return ((ErrorPage) statusPages.get(errorCode));
}
-
}
@@ -2866,11 +2620,7 @@
* @param exceptionType Exception type to look up
*/
public ErrorPage findErrorPage(String exceptionType) {
-
- synchronized (exceptionPages) {
- return ((ErrorPage) exceptionPages.get(exceptionType));
- }
-
+ return ((ErrorPage) exceptionPages.get(exceptionType));
}
@@ -2879,25 +2629,19 @@
* and exception types.
*/
public ErrorPage[] findErrorPages() {
-
- synchronized(exceptionPages) {
- synchronized(statusPages) {
- ErrorPage results1[] = new ErrorPage[exceptionPages.size()];
- results1 =
- (ErrorPage[]) exceptionPages.values().toArray(results1);
- ErrorPage results2[] = new ErrorPage[statusPages.size()];
- results2 =
- (ErrorPage[]) statusPages.values().toArray(results2);
- ErrorPage results[] =
- new ErrorPage[results1.length + results2.length];
- for (int i = 0; i < results1.length; i++)
- results[i] = results1[i];
- for (int i = results1.length; i < results.length; i++)
- results[i] = results2[i - results1.length];
- return (results);
- }
- }
-
+ ErrorPage results1[] = new ErrorPage[exceptionPages.size()];
+ results1 =
+ (ErrorPage[]) exceptionPages.values().toArray(results1);
+ ErrorPage results2[] = new ErrorPage[statusPages.size()];
+ results2 =
+ (ErrorPage[]) statusPages.values().toArray(results2);
+ ErrorPage results[] =
+ new ErrorPage[results1.length + results2.length];
+ for (int i = 0; i < results1.length; i++)
+ results[i] = results1[i];
+ for (int i = results1.length; i < results.length; i++)
+ results[i] = results2[i - results1.length];
+ return (results);
}
@@ -2908,11 +2652,7 @@
* @param filterName Filter name to look up
*/
public FilterDef findFilterDef(String filterName) {
-
- synchronized (filterDefs) {
- return ((FilterDef) filterDefs.get(filterName));
- }
-
+ return ((FilterDef) filterDefs.get(filterName));
}
@@ -2920,12 +2660,8 @@
* Return the set of defined filters for this Context.
*/
public FilterDef[] findFilterDefs() {
-
- synchronized (filterDefs) {
- FilterDef results[] = new FilterDef[filterDefs.size()];
- return ((FilterDef[]) filterDefs.values().toArray(results));
- }
-
+ FilterDef results[] = new FilterDef[filterDefs.size()];
+ return ((FilterDef[]) filterDefs.values().toArray(results));
}
@@ -2933,9 +2669,7 @@
* Return the set of filter mappings for this Context.
*/
public FilterMap[] findFilterMaps() {
-
return (filterMaps);
-
}
@@ -2944,9 +2678,7 @@
* newly created Wrappers automatically.
*/
public String[] findInstanceListeners() {
-
return (instanceListeners);
-
}
@@ -2965,11 +2697,7 @@
* @param name Name of the desired message destination
*/
public MessageDestination findMessageDestination(String name) {
-
- synchronized (messageDestinations) {
- return ((MessageDestination) messageDestinations.get(name));
- }
-
+ return ((MessageDestination) messageDestinations.get(name));
}
@@ -2979,14 +2707,10 @@
* is returned.
*/
public MessageDestination[] findMessageDestinations() {
-
- synchronized (messageDestinations) {
- MessageDestination results[] =
- new MessageDestination[messageDestinations.size()];
- return ((MessageDestination[])
- messageDestinations.values().toArray(results));
- }
-
+ MessageDestination results[] =
+ new MessageDestination[messageDestinations.size()];
+ return ((MessageDestination[])
+ messageDestinations.values().toArray(results));
}
@@ -2996,11 +2720,8 @@
*
* @param name Name of the desired message destination ref
*/
- public MessageDestinationRef
- findMessageDestinationRef(String name) {
-
+ public MessageDestinationRef findMessageDestinationRef(String name) {
return namingResources.findMessageDestinationRef(name);
-
}
@@ -3009,11 +2730,8 @@
* application. If none have been defined, a zero-length array
* is returned.
*/
- public MessageDestinationRef[]
- findMessageDestinationRefs() {
-
+ public MessageDestinationRef[] findMessageDestinationRefs() {
return namingResources.findMessageDestinationRefs();
-
}
@@ -3024,9 +2742,7 @@
* @param extension Extension to map to a MIME type
*/
public String findMimeMapping(String extension) {
-
return ((String) mimeMappings.get(extension));
-
}
@@ -3035,13 +2751,8 @@
* are none, a zero-length array is returned.
*/
public String[] findMimeMappings() {
-
- synchronized (mimeMappings) {
- String results[] = new String[mimeMappings.size()];
- return
- ((String[]) mimeMappings.keySet().toArray(results));
- }
-
+ String results[] = new String[mimeMappings.size()];
+ return ((String[]) mimeMappings.keySet().toArray(results));
}
@@ -3052,11 +2763,7 @@
* @param name Name of the parameter to return
*/
public String findParameter(String name) {
-
- synchronized (parameters) {
- return ((String) parameters.get(name));
- }
-
+ return ((String) parameters.get(name));
}
@@ -3066,12 +2773,8 @@
* array is returned.
*/
public String[] findParameters() {
-
- synchronized (parameters) {
- String results[] = new String[parameters.size()];
- return ((String[]) parameters.keySet().toArray(results));
- }
-
+ String results[] = new String[parameters.size()];
+ return ((String[]) parameters.keySet().toArray(results));
}
@@ -3083,16 +2786,11 @@
* @param role Security role to map
*/
public String findRoleMapping(String role) {
-
- String realRole = null;
- synchronized (roleMappings) {
- realRole = (String) roleMappings.get(role);
- }
+ String realRole = (String) roleMappings.get(role);
if (realRole != null)
return (realRole);
else
return (role);
-
}
@@ -3103,15 +2801,11 @@
* @param role Security role to verify
*/
public boolean findSecurityRole(String role) {
-
- synchronized (securityRoles) {
- for (int i = 0; i < securityRoles.length; i++) {
- if (role.equals(securityRoles[i]))
- return (true);
- }
+ for (int i = 0; i < securityRoles.length; i++) {
+ if (role.equals(securityRoles[i]))
+ return (true);
}
return (false);
-
}
@@ -3120,9 +2814,7 @@
* have been defined, a zero-length array is returned.
*/
public String[] findSecurityRoles() {
-
return (securityRoles);
-
}
@@ -3133,11 +2825,7 @@
* @param pattern Pattern for which a mapping is requested
*/
public String findServletMapping(String pattern) {
-
- synchronized (servletMappings) {
- return ((String) servletMappings.get(pattern));
- }
-
+ return ((String) servletMappings.get(pattern));
}
@@ -3146,13 +2834,8 @@
* Context. If no mappings are defined, a zero-length array is returned.
*/
public String[] findServletMappings() {
-
- synchronized (servletMappings) {
- String results[] = new String[servletMappings.size()];
- return
- ((String[]) servletMappings.keySet().toArray(results));
- }
-
+ String results[] = new String[servletMappings.size()];
+ return ((String[]) servletMappings.keySet().toArray(results));
}
@@ -3162,16 +2845,12 @@
* is returned.
*/
public int[] findStatusPages() {
-
- synchronized (statusPages) {
- int results[] = new int[statusPages.size()];
- Iterator elements = statusPages.keySet().iterator();
- int i = 0;
- while (elements.hasNext())
- results[i++] = ((Integer) elements.next()).intValue();
- return (results);
- }
-
+ int results[] = new int[statusPages.size()];
+ Iterator<Integer> elements = statusPages.keySet().iterator();
+ int i = 0;
+ while (elements.hasNext())
+ results[i++] = elements.next().intValue();
+ return (results);
}
@@ -3182,11 +2861,7 @@
* @param uri URI, relative to the web.xml file
*/
public String findTaglib(String uri) {
-
- synchronized (taglibs) {
- return ((String) taglibs.get(uri));
- }
-
+ return ((String) taglibs.get(uri));
}
@@ -3196,12 +2871,8 @@
* a zero-length array is returned.
*/
public String[] findTaglibs() {
-
- synchronized (taglibs) {
- String results[] = new String[taglibs.size()];
- return ((String[]) taglibs.keySet().toArray(results));
- }
-
+ String results[] = new String[taglibs.size()];
+ return ((String[]) taglibs.keySet().toArray(results));
}
@@ -3212,15 +2883,11 @@
* @param name Welcome file to verify
*/
public boolean findWelcomeFile(String name) {
-
- synchronized (welcomeFiles) {
- for (int i = 0; i < welcomeFiles.length; i++) {
- if (name.equals(welcomeFiles[i]))
- return (true);
- }
+ for (int i = 0; i < welcomeFiles.length; i++) {
+ if (name.equals(welcomeFiles[i]))
+ return (true);
}
return (false);
-
}
@@ -3238,9 +2905,7 @@
* defined, a zero-length array is returned.
*/
public String[] findWelcomeFiles() {
-
return (welcomeFiles);
-
}
@@ -3249,9 +2914,7 @@
* newly created Wrappers automatically.
*/
public String[] findWrapperLifecycles() {
-
return (wrapperLifecycles);
-
}
@@ -3260,9 +2923,7 @@
* newly created Wrappers automatically.
*/
public String[] findWrapperListeners() {
-
return (wrapperListeners);
-
}
@@ -3320,29 +2981,25 @@
*/
public void removeApplicationListener(String listener) {
- synchronized (applicationListeners) {
-
- // Make sure this welcome file is currently present
- int n = -1;
- for (int i = 0; i < applicationListeners.length; i++) {
- if (applicationListeners[i].equals(listener)) {
- n = i;
- break;
- }
+ // Make sure this welcome file is currently present
+ int n = -1;
+ for (int i = 0; i < applicationListeners.length; i++) {
+ if (applicationListeners[i].equals(listener)) {
+ n = i;
+ break;
}
- if (n < 0)
- return;
+ }
+ if (n < 0)
+ return;
- // Remove the specified constraint
- int j = 0;
- String results[] = new String[applicationListeners.length - 1];
- for (int i = 0; i < applicationListeners.length; i++) {
- if (i != n)
- results[j++] = applicationListeners[i];
- }
- applicationListeners = results;
-
+ // Remove the specified constraint
+ int j = 0;
+ String results[] = new String[applicationListeners.length - 1];
+ for (int i = 0; i < applicationListeners.length; i++) {
+ if (i != n)
+ results[j++] = applicationListeners[i];
}
+ applicationListeners = results;
// Inform interested listeners
fireContainerEvent("removeApplicationListener", listener);
@@ -3360,30 +3017,26 @@
*/
public void removeApplicationParameter(String name) {
- synchronized (applicationParameters) {
-
- // Make sure this parameter is currently present
- int n = -1;
- for (int i = 0; i < applicationParameters.length; i++) {
- if (name.equals(applicationParameters[i].getName())) {
- n = i;
- break;
- }
+ // Make sure this parameter is currently present
+ int n = -1;
+ for (int i = 0; i < applicationParameters.length; i++) {
+ if (name.equals(applicationParameters[i].getName())) {
+ n = i;
+ break;
}
- if (n < 0)
- return;
+ }
+ if (n < 0)
+ return;
- // Remove the specified parameter
- int j = 0;
- ApplicationParameter results[] =
- new ApplicationParameter[applicationParameters.length - 1];
- for (int i = 0; i < applicationParameters.length; i++) {
- if (i != n)
- results[j++] = applicationParameters[i];
- }
- applicationParameters = results;
-
+ // Remove the specified parameter
+ int j = 0;
+ ApplicationParameter results[] =
+ new ApplicationParameter[applicationParameters.length - 1];
+ for (int i = 0; i < applicationParameters.length; i++) {
+ if (i != n)
+ results[j++] = applicationParameters[i];
}
+ applicationParameters = results;
// Inform interested listeners
fireContainerEvent("removeApplicationParameter", name);
@@ -3419,30 +3072,26 @@
*/
public void removeConstraint(SecurityConstraint constraint) {
- synchronized (constraints) {
-
- // Make sure this constraint is currently present
- int n = -1;
- for (int i = 0; i < constraints.length; i++) {
- if (constraints[i].equals(constraint)) {
- n = i;
- break;
- }
+ // Make sure this constraint is currently present
+ int n = -1;
+ for (int i = 0; i < constraints.length; i++) {
+ if (constraints[i].equals(constraint)) {
+ n = i;
+ break;
}
- if (n < 0)
- return;
+ }
+ if (n < 0)
+ return;
- // Remove the specified constraint
- int j = 0;
- SecurityConstraint results[] =
- new SecurityConstraint[constraints.length - 1];
- for (int i = 0; i < constraints.length; i++) {
- if (i != n)
- results[j++] = constraints[i];
- }
- constraints = results;
-
+ // Remove the specified constraint
+ int j = 0;
+ SecurityConstraint results[] =
+ new SecurityConstraint[constraints.length - 1];
+ for (int i = 0; i < constraints.length; i++) {
+ if (i != n)
+ results[j++] = constraints[i];
}
+ constraints = results;
// Inform interested listeners
fireContainerEvent("removeConstraint", constraint);
@@ -3457,22 +3106,16 @@
* @param errorPage The error page definition to be removed
*/
public void removeErrorPage(ErrorPage errorPage) {
-
String exceptionType = errorPage.getExceptionType();
if (exceptionType != null) {
- synchronized (exceptionPages) {
- exceptionPages.remove(exceptionType);
- }
+ exceptionPages.remove(exceptionType);
} else {
- synchronized (statusPages) {
- if (errorPage.getErrorCode() == 200) {
- this.okErrorPage = null;
- }
- statusPages.remove(new Integer(errorPage.getErrorCode()));
+ if (errorPage.getErrorCode() == 200) {
+ this.okErrorPage = null;
}
+ statusPages.remove(errorPage.getErrorCode());
}
fireContainerEvent("removeErrorPage", errorPage);
-
}
@@ -3483,12 +3126,8 @@
* @param filterDef Filter definition to be removed
*/
public void removeFilterDef(FilterDef filterDef) {
-
- synchronized (filterDefs) {
- filterDefs.remove(filterDef.getFilterName());
- }
+ filterDefs.remove(filterDef.getFilterName());
fireContainerEvent("removeFilterDef", filterDef);
-
}
@@ -3499,30 +3138,26 @@
*/
public void removeFilterMap(FilterMap filterMap) {
- synchronized (filterMaps) {
-
- // Make sure this filter mapping is currently present
- int n = -1;
- for (int i = 0; i < filterMaps.length; i++) {
- if (filterMaps[i] == filterMap) {
- n = i;
- break;
- }
+ // Make sure this filter mapping is currently present
+ int n = -1;
+ for (int i = 0; i < filterMaps.length; i++) {
+ if (filterMaps[i] == filterMap) {
+ n = i;
+ break;
}
- if (n < 0)
- return;
+ }
+ if (n < 0)
+ return;
- // Remove the specified filter mapping
- FilterMap results[] = new FilterMap[filterMaps.length - 1];
- System.arraycopy(filterMaps, 0, results, 0, n);
- System.arraycopy(filterMaps, n + 1, results, n,
- (filterMaps.length - 1) - n);
- if (n < filterMapInsertPoint) {
- filterMapInsertPoint--;
- }
- filterMaps = results;
-
+ // Remove the specified filter mapping
+ FilterMap results[] = new FilterMap[filterMaps.length - 1];
+ System.arraycopy(filterMaps, 0, results, 0, n);
+ System.arraycopy(filterMaps, n + 1, results, n,
+ (filterMaps.length - 1) - n);
+ if (n < filterMapInsertPoint) {
+ filterMapInsertPoint--;
}
+ filterMaps = results;
// Inform interested listeners
fireContainerEvent("removeFilterMap", filterMap);
@@ -3538,29 +3173,25 @@
*/
public void removeInstanceListener(String listener) {
- synchronized (instanceListeners) {
-
- // Make sure this welcome file is currently present
- int n = -1;
- for (int i = 0; i < instanceListeners.length; i++) {
- if (instanceListeners[i].equals(listener)) {
- n = i;
- break;
- }
+ // Make sure this welcome file is currently present
+ int n = -1;
+ for (int i = 0; i < instanceListeners.length; i++) {
+ if (instanceListeners[i].equals(listener)) {
+ n = i;
+ break;
}
- if (n < 0)
- return;
+ }
+ if (n < 0)
+ return;
- // Remove the specified constraint
- int j = 0;
- String results[] = new String[instanceListeners.length - 1];
- for (int i = 0; i < instanceListeners.length; i++) {
- if (i != n)
- results[j++] = instanceListeners[i];
- }
- instanceListeners = results;
-
+ // Remove the specified constraint
+ int j = 0;
+ String results[] = new String[instanceListeners.length - 1];
+ for (int i = 0; i < instanceListeners.length; i++) {
+ if (i != n)
+ results[j++] = instanceListeners[i];
}
+ instanceListeners = results;
// Inform interested listeners
fireContainerEvent("removeInstanceListener", listener);
@@ -3574,12 +3205,8 @@
* @param name Name of the message destination to remove
*/
public void removeMessageDestination(String name) {
-
- synchronized (messageDestinations) {
- messageDestinations.remove(name);
- }
+ messageDestinations.remove(name);
fireContainerEvent("removeMessageDestination", name);
-
}
@@ -3589,10 +3216,8 @@
* @param name Name of the message destination ref to remove
*/
public void removeMessageDestinationRef(String name) {
-
namingResources.removeMessageDestinationRef(name);
fireContainerEvent("removeMessageDestinationRef", name);
-
}
@@ -3603,12 +3228,8 @@
* @param extension Extension to remove the mapping for
*/
public void removeMimeMapping(String extension) {
-
- synchronized (mimeMappings) {
- mimeMappings.remove(extension);
- }
+ mimeMappings.remove(extension);
fireContainerEvent("removeMimeMapping", extension);
-
}
@@ -3619,12 +3240,8 @@
* @param name Name of the parameter to remove
*/
public void removeParameter(String name) {
-
- synchronized (parameters) {
- parameters.remove(name);
- }
+ parameters.remove(name);
fireContainerEvent("removeParameter", name);
-
}
@@ -3634,12 +3251,8 @@
* @param role Security role (as used in the application) to remove
*/
public void removeRoleMapping(String role) {
-
- synchronized (roleMappings) {
- roleMappings.remove(role);
- }
+ roleMappings.remove(role);
fireContainerEvent("removeRoleMapping", role);
-
}
@@ -3650,29 +3263,25 @@
*/
public void removeSecurityRole(String role) {
- synchronized (securityRoles) {
-
- // Make sure this security role is currently present
- int n = -1;
- for (int i = 0; i < securityRoles.length; i++) {
- if (role.equals(securityRoles[i])) {
- n = i;
- break;
- }
+ // Make sure this security role is currently present
+ int n = -1;
+ for (int i = 0; i < securityRoles.length; i++) {
+ if (role.equals(securityRoles[i])) {
+ n = i;
+ break;
}
- if (n < 0)
- return;
+ }
+ if (n < 0)
+ return;
- // Remove the specified security role
- int j = 0;
- String results[] = new String[securityRoles.length - 1];
- for (int i = 0; i < securityRoles.length; i++) {
- if (i != n)
- results[j++] = securityRoles[i];
- }
- securityRoles = results;
-
+ // Remove the specified security role
+ int j = 0;
+ String results[] = new String[securityRoles.length - 1];
+ for (int i = 0; i < securityRoles.length; i++) {
+ if (i != n)
+ results[j++] = securityRoles[i];
}
+ securityRoles = results;
// Inform interested listeners
fireContainerEvent("removeSecurityRole", role);
@@ -3687,18 +3296,13 @@
* @param pattern URL pattern of the mapping to remove
*/
public void removeServletMapping(String pattern) {
-
- String name = null;
- synchronized (servletMappings) {
- name = (String) servletMappings.remove(pattern);
- }
+ String name = servletMappings.remove(pattern);
Wrapper wrapper = (Wrapper) findChild(name);
if( wrapper != null ) {
wrapper.removeMapping(pattern);
}
mapper.removeWrapper(pattern);
fireContainerEvent("removeServletMapping", pattern);
-
}
@@ -3708,10 +3312,7 @@
* @param uri URI, relative to the web.xml file
*/
public void removeTaglib(String uri) {
-
- synchronized (taglibs) {
- taglibs.remove(uri);
- }
+ taglibs.remove(uri);
fireContainerEvent("removeTaglib", uri);
}
@@ -3724,29 +3325,25 @@
*/
public void removeWatchedResource(String name) {
- synchronized (watchedResources) {
-
- // Make sure this watched resource is currently present
- int n = -1;
- for (int i = 0; i < watchedResources.length; i++) {
- if (watchedResources[i].equals(name)) {
- n = i;
- break;
- }
+ // Make sure this watched resource is currently present
+ int n = -1;
+ for (int i = 0; i < watchedResources.length; i++) {
+ if (watchedResources[i].equals(name)) {
+ n = i;
+ break;
}
- if (n < 0)
- return;
+ }
+ if (n < 0)
+ return;
- // Remove the specified watched resource
- int j = 0;
- String results[] = new String[watchedResources.length - 1];
- for (int i = 0; i < watchedResources.length; i++) {
- if (i != n)
- results[j++] = watchedResources[i];
- }
- watchedResources = results;
-
+ // Remove the specified watched resource
+ int j = 0;
+ String results[] = new String[watchedResources.length - 1];
+ for (int i = 0; i < watchedResources.length; i++) {
+ if (i != n)
+ results[j++] = watchedResources[i];
}
+ watchedResources = results;
fireContainerEvent("removeWatchedResource", name);
@@ -3761,29 +3358,25 @@
*/
public void removeWelcomeFile(String name) {
- synchronized (welcomeFiles) {
-
- // Make sure this welcome file is currently present
- int n = -1;
- for (int i = 0; i < welcomeFiles.length; i++) {
- if (welcomeFiles[i].equals(name)) {
- n = i;
- break;
- }
+ // Make sure this welcome file is currently present
+ int n = -1;
+ for (int i = 0; i < welcomeFiles.length; i++) {
+ if (welcomeFiles[i].equals(name)) {
+ n = i;
+ break;
}
- if (n < 0)
- return;
+ }
+ if (n < 0)
+ return;
- // Remove the specified constraint
- int j = 0;
- String results[] = new String[welcomeFiles.length - 1];
- for (int i = 0; i < welcomeFiles.length; i++) {
- if (i != n)
- results[j++] = welcomeFiles[i];
- }
- welcomeFiles = results;
-
+ // Remove the specified constraint
+ int j = 0;
+ String results[] = new String[welcomeFiles.length - 1];
+ for (int i = 0; i < welcomeFiles.length; i++) {
+ if (i != n)
+ results[j++] = welcomeFiles[i];
}
+ welcomeFiles = results;
// Inform interested listeners
postWelcomeFiles();
@@ -3801,29 +3394,25 @@
public void removeWrapperLifecycle(String listener) {
- synchronized (wrapperLifecycles) {
-
- // Make sure this welcome file is currently present
- int n = -1;
- for (int i = 0; i < wrapperLifecycles.length; i++) {
- if (wrapperLifecycles[i].equals(listener)) {
- n = i;
- break;
- }
+ // Make sure this welcome file is currently present
+ int n = -1;
+ for (int i = 0; i < wrapperLifecycles.length; i++) {
+ if (wrapperLifecycles[i].equals(listener)) {
+ n = i;
+ break;
}
- if (n < 0)
- return;
+ }
+ if (n < 0)
+ return;
- // Remove the specified constraint
- int j = 0;
- String results[] = new String[wrapperLifecycles.length - 1];
- for (int i = 0; i < wrapperLifecycles.length; i++) {
- if (i != n)
- results[j++] = wrapperLifecycles[i];
- }
- wrapperLifecycles = results;
-
+ // Remove the specified constraint
+ int j = 0;
+ String results[] = new String[wrapperLifecycles.length - 1];
+ for (int i = 0; i < wrapperLifecycles.length; i++) {
+ if (i != n)
+ results[j++] = wrapperLifecycles[i];
}
+ wrapperLifecycles = results;
// Inform interested listeners
fireContainerEvent("removeWrapperLifecycle", listener);
@@ -3840,29 +3429,25 @@
public void removeWrapperListener(String listener) {
- synchronized (wrapperListeners) {
-
- // Make sure this welcome file is currently present
- int n = -1;
- for (int i = 0; i < wrapperListeners.length; i++) {
- if (wrapperListeners[i].equals(listener)) {
- n = i;
- break;
- }
+ // Make sure this welcome file is currently present
+ int n = -1;
+ for (int i = 0; i < wrapperListeners.length; i++) {
+ if (wrapperListeners[i].equals(listener)) {
+ n = i;
+ break;
}
- if (n < 0)
- return;
+ }
+ if (n < 0)
+ return;
- // Remove the specified constraint
- int j = 0;
- String results[] = new String[wrapperListeners.length - 1];
- for (int i = 0; i < wrapperListeners.length; i++) {
- if (i != n)
- results[j++] = wrapperListeners[i];
- }
- wrapperListeners = results;
-
+ // Remove the specified constraint
+ int j = 0;
+ String results[] = new String[wrapperListeners.length - 1];
+ for (int i = 0; i < wrapperListeners.length; i++) {
+ if (i != n)
+ results[j++] = wrapperListeners[i];
}
+ wrapperListeners = results;
// Inform interested listeners
fireContainerEvent("removeWrapperListener", listener);
@@ -3900,41 +3485,39 @@
* Return <code>true</code> if all filter initialization completed
* successfully, or <code>false</code> otherwise.
*/
- public boolean filterStart() {
+ protected boolean filterStart() {
if (getLogger().isDebugEnabled())
getLogger().debug("Starting filters");
// Instantiate and record a FilterConfig for each defined filter
boolean ok = true;
- synchronized (filterConfigs) {
- Iterator filterConfigsIterator = filterConfigs.values().iterator();
- while (filterConfigsIterator.hasNext()) {
- ApplicationFilterConfig filterConfig =
- (ApplicationFilterConfig) filterConfigsIterator.next();
- try {
- filterConfig.getFilter();
- } catch (Throwable t) {
- getLogger().error
- (sm.getString("standardContext.filterStart", name), t);
- ok = false;
- }
+ Iterator<ApplicationFilterConfig> filterConfigsIterator =
+ filterConfigs.values().iterator();
+ while (filterConfigsIterator.hasNext()) {
+ ApplicationFilterConfig filterConfig = filterConfigsIterator.next();
+ try {
+ filterConfig.getFilter();
+ } catch (Throwable t) {
+ getLogger().error
+ (sm.getString("standardContext.filterStart", name), t);
+ ok = false;
}
- Iterator names = filterDefs.keySet().iterator();
- while (names.hasNext()) {
- String name = (String) names.next();
- if (getLogger().isDebugEnabled())
- getLogger().debug(" Starting filter '" + name + "'");
- ApplicationFilterConfig filterConfig = null;
- try {
- filterConfig = new ApplicationFilterConfig
- (this, (FilterDef) filterDefs.get(name));
- filterConfig.getFilter();
- filterConfigs.put(name, filterConfig);
- } catch (Throwable t) {
- getLogger().error
- (sm.getString("standardContext.filterStart", name), t);
- ok = false;
- }
+ }
+ Iterator<String> names = filterDefs.keySet().iterator();
+ while (names.hasNext()) {
+ String name = names.next();
+ if (getLogger().isDebugEnabled())
+ getLogger().debug(" Starting filter '" + name + "'");
+ ApplicationFilterConfig filterConfig = null;
+ try {
+ filterConfig = new ApplicationFilterConfig
+ (this, (FilterDef) filterDefs.get(name));
+ filterConfig.getFilter();
+ filterConfigs.put(name, filterConfig);
+ } catch (Throwable t) {
+ getLogger().error
+ (sm.getString("standardContext.filterStart", name), t);
+ ok = false;
}
}
@@ -3948,24 +3531,22 @@
* Return <code>true</code> if all filter finalization completed
* successfully, or <code>false</code> otherwise.
*/
- public boolean filterStop() {
+ protected boolean filterStop() {
if (getLogger().isDebugEnabled())
getLogger().debug("Stopping filters");
// Release all Filter and FilterConfig instances
- synchronized (filterConfigs) {
- Iterator names = filterConfigs.keySet().iterator();
- while (names.hasNext()) {
- String name = (String) names.next();
- if (getLogger().isDebugEnabled())
- getLogger().debug(" Stopping filter '" + name + "'");
- ApplicationFilterConfig filterConfig =
- (ApplicationFilterConfig) filterConfigs.get(name);
- filterConfig.release();
- }
- filterConfigs.clear();
+ Iterator<String> names = filterConfigs.keySet().iterator();
+ while (names.hasNext()) {
+ String name = names.next();
+ if (getLogger().isDebugEnabled())
+ getLogger().debug(" Stopping filter '" + name + "'");
+ ApplicationFilterConfig filterConfig =
+ (ApplicationFilterConfig) filterConfigs.get(name);
+ filterConfig.release();
}
+ filterConfigs.clear();
return (true);
}
@@ -3978,9 +3559,7 @@
* @param name Name of the desired filter
*/
public FilterConfig findFilterConfig(String name) {
-
return ((FilterConfig) filterConfigs.get(name));
-
}
@@ -3996,14 +3575,14 @@
// Instantiate the required listeners
String listeners[] = findApplicationListeners();
- Object results[] = new Object[listeners.length];
+ EventListener results[] = new EventListener[listeners.length];
boolean ok = true;
for (int i = 0; i < results.length; i++) {
if (getLogger().isDebugEnabled())
getLogger().debug(" Configuring event listener class '" +
listeners[i] + "'");
try {
- results[i] = instanceManager.newInstance(listeners[i]);
+ results[i] = (EventListener) instanceManager.newInstance(listeners[i]);
} catch (Throwable t) {
getLogger().error
(sm.getString("standardContext.applicationListener",
@@ -4017,8 +3596,8 @@
}
// Sort listeners in two arrays
- ArrayList eventListeners = new ArrayList();
- ArrayList lifecycleListeners = new ArrayList();
+ ArrayList<EventListener> eventListeners = new ArrayList<EventListener>();
+ ArrayList<EventListener> lifecycleListeners = new ArrayList<EventListener>();
for (int i = 0; i < results.length; i++) {
if ((results[i] instanceof ServletContextAttributeListener)
|| (results[i] instanceof ServletRequestAttributeListener)
@@ -4248,7 +3827,7 @@
int loadOnStartup = wrapper.getLoadOnStartup();
if (loadOnStartup < 0)
continue;
- Integer key = new Integer(loadOnStartup);
+ Integer key = Integer.valueOf(loadOnStartup);
ArrayList list = (ArrayList) map.get(key);
if (list == null) {
list = new ArrayList();
@@ -4614,7 +4193,7 @@
//cacheContext();
}
- private Map<String, Map<String, String>> buildInjectionMap(NamingResources namingResources) {
+ protected Map<String, Map<String, String>> buildInjectionMap(NamingResources namingResources) {
Map<String, Map<String, String>> injectionMap = new HashMap<String, Map<String, String>>();
for (Injectable resource: namingResources.findLocalEjbs()) {
addInjectionTarget(resource, injectionMap);
@@ -4640,7 +4219,7 @@
return injectionMap;
}
- private void addInjectionTarget(Injectable resource, Map<String, Map<String, String>> injectionMap) {
+ protected void addInjectionTarget(Injectable resource, Map<String, Map<String, String>> injectionMap) {
List<InjectionTarget> injectionTargets = resource.getInjectionTargets();
if (injectionTargets != null && injectionTargets.size() > 0) {
String jndiName = resource.getName();
@@ -4689,24 +4268,8 @@
+ ex.toString(), ex);
}
}
-
- private void cacheContext() {
- try {
- File workDir=new File( getWorkPath() );
-
- File ctxSer=new File( workDir, "_tomcat_context.ser");
- FileOutputStream fos=new FileOutputStream( ctxSer );
- ObjectOutputStream oos=new ObjectOutputStream( fos );
- oos.writeObject(this);
- oos.close();
- fos.close();
- } catch( Throwable t ) {
- if(log.isInfoEnabled())
- log.info("Error saving context.ser ", t);
- }
- }
-
+
/**
* Stop this Context component.
*
@@ -4836,11 +4399,8 @@
* read modified web.xml, etc. This can only be done by completely
* removing the context object and remapping a new one, or by cleaning
* up everything.
- *
- * XXX Should this be done in stop() ?
- *
*/
- public void destroy() throws Exception {
+ public synchronized void destroy() throws Exception {
if( oname != null ) {
// Send j2ee.object.deleted notification
Notification notification =
@@ -4857,7 +4417,7 @@
}
- private void resetContext() throws Exception, MBeanRegistrationException {
+ protected void resetContext() throws Exception, MBeanRegistrationException {
// Restore the original state ( pre reading web.xml in start )
// If you extend this - override this method and make sure to clean up
children=new HashMap();
@@ -4964,7 +4524,7 @@
}
- // -------------------------------------------------------- Private Methods
+ // -------------------------------------------------------- protected Methods
/**
@@ -4973,7 +4533,7 @@
*
* @return the previous context class loader
*/
- private ClassLoader bindThread() {
+ protected ClassLoader bindThread() {
ClassLoader oldContextClassLoader =
Thread.currentThread().getContextClassLoader();
@@ -5005,7 +4565,7 @@
/**
* Unbind thread.
*/
- private void unbindThread(ClassLoader oldContextClassLoader) {
+ protected void unbindThread(ClassLoader oldContextClassLoader) {
Thread.currentThread().setContextClassLoader(oldContextClassLoader);
@@ -5119,7 +4679,7 @@
/**
* Copy a file.
*/
- private boolean copy(File src, File dest) {
+ protected boolean copy(File src, File dest) {
FileInputStream is = null;
FileOutputStream os = null;
try {
@@ -5159,7 +4719,7 @@
/**
* Get naming context full name.
*/
- private String getNamingContextName() {
+ protected String getNamingContextName() {
if (namingContextName == null) {
Container parent = getParent();
if (parent == null) {
@@ -5212,7 +4772,7 @@
* Post a copy of our web application resources as a servlet context
* attribute.
*/
- private void postResources() {
+ protected void postResources() {
getServletContext().setAttribute
(Globals.RESOURCES_ATTR, getResources());
@@ -5224,7 +4784,7 @@
* Post a copy of our current list of welcome files as a servlet context
* attribute, so that the default servlet can find them.
*/
- private void postWelcomeFiles() {
+ protected void postWelcomeFiles() {
getServletContext().setAttribute("org.apache.catalina.WELCOME_FILES",
welcomeFiles);
@@ -5244,7 +4804,7 @@
/**
* Set the appropriate context attribute for our work directory.
*/
- private void postWorkDirectory() {
+ protected void postWorkDirectory() {
// Acquire (or calculate) the work directory path
String workDir = getWorkDir();
@@ -5304,7 +4864,7 @@
*
* @param paused The new request processing paused flag
*/
- private void setPaused(boolean paused) {
+ protected void setPaused(boolean paused) {
this.paused = paused;
@@ -5317,7 +4877,7 @@
*
* @param urlPattern URL pattern to be validated
*/
- private boolean validateURLPattern(String urlPattern) {
+ protected boolean validateURLPattern(String urlPattern) {
if (urlPattern == null)
return (false);
@@ -5347,7 +4907,7 @@
* Check for unusual but valid <code><url-pattern></code>s.
* See Bugzilla 34805, 43079 & 43080
*/
- private void checkUnusualURLPattern(String urlPattern) {
+ protected void checkUnusualURLPattern(String urlPattern) {
if (log.isInfoEnabled()) {
if(urlPattern.endsWith("*") && (urlPattern.length() < 2 ||
urlPattern.charAt(urlPattern.length()-2) != '/')) {
@@ -5443,7 +5003,7 @@
return oname;
}
- private void preRegisterJMX() {
+ protected void preRegisterJMX() {
try {
StandardHost host = (StandardHost) getParent();
if ((oname == null)
@@ -5458,7 +5018,7 @@
}
}
- private void registerJMX() {
+ protected void registerJMX() {
try {
if (log.isDebugEnabled()) {
log.debug("Checking for " + oname );
@@ -5521,7 +5081,7 @@
}
}
- public void init() throws Exception {
+ public synchronized void init() throws Exception {
if( this.getParent() == null ) {
ObjectName parentName=getParentName();
@@ -5646,7 +5206,7 @@
}
- private MBeanNotificationInfo[] notificationInfo;
+ protected MBeanNotificationInfo[] notificationInfo;
/* Get JMX Broadcaster Info
* @TODO use StringManager for international support!
@@ -5873,12 +5433,12 @@
/**
* The J2EE Server ObjectName this module is deployed on.
*/
- private String server = null;
+ protected String server = null;
/**
* The Java virtual machines on which this module is running.
*/
- private String[] javaVMs = null;
+ protected String[] javaVMs = null;
public String getServer() {
return server;
Modified: trunk/java/org/apache/catalina/servlets/InvokerServlet.java
===================================================================
--- trunk/java/org/apache/catalina/servlets/InvokerServlet.java 2009-04-09 13:38:34 UTC (rev 1001)
+++ trunk/java/org/apache/catalina/servlets/InvokerServlet.java 2009-04-09 17:02:09 UTC (rev 1002)
@@ -283,7 +283,7 @@
// Synchronize to avoid race conditions when multiple requests
// try to initialize the same servlet at the same time
- synchronized (this) {
+ synchronized (context) {
// Are we referencing an existing servlet class or name?
wrapper = (Wrapper) context.findChild(servletClass);
@@ -361,8 +361,10 @@
instance = wrapper.allocate();
} catch (ServletException e) {
log(sm.getString("invokerServlet.allocate", inRequestURI), e);
- context.removeServletMapping(pattern);
- context.removeChild(wrapper);
+ synchronized (context) {
+ context.removeServletMapping(pattern);
+ context.removeChild(wrapper);
+ }
Throwable rootCause = e.getRootCause();
if (rootCause == null)
rootCause = e;
15 years
JBossWeb SVN: r1001 - trunk/java/org/jboss/web/cluster.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-09 09:38:34 -0400 (Thu, 09 Apr 2009)
New Revision: 1001
Modified:
trunk/java/org/jboss/web/cluster/ClusterListener.java
Log:
- Cleanup.
Modified: trunk/java/org/jboss/web/cluster/ClusterListener.java
===================================================================
--- trunk/java/org/jboss/web/cluster/ClusterListener.java 2009-04-09 01:27:49 UTC (rev 1000)
+++ trunk/java/org/jboss/web/cluster/ClusterListener.java 2009-04-09 13:38:34 UTC (rev 1001)
@@ -822,11 +822,12 @@
localAddress = connection.getLocalAddress();
if (localAddress != null) {
IntrospectionUtils.setProperty(connector.getProtocolHandler(), "address", localAddress.getHostAddress());
+ log.info(sm.getString("clusterListener.address", localAddress.getHostAddress()));
} else {
// Should not happen
IntrospectionUtils.setProperty(connector.getProtocolHandler(), "address", "127.0.0.1");
+ log.info(sm.getString("clusterListener.address", "127.0.0.1"));
}
- log.info(sm.getString("clusterListener.address", localAddress.getHostAddress()));
}
if (engine.getJvmRoute() == null) {
String hostName = null;
@@ -1534,6 +1535,10 @@
}
}
+ public int hashCode() {
+ return (address + ":" + port + "-" + state).hashCode();
+ }
+
public boolean equals(Object o) {
if (o instanceof Proxy) {
Proxy compare = (Proxy) o;
15 years
JBossWeb SVN: r1000 - in trunk: java/javax/servlet and 5 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-08 21:27:49 -0400 (Wed, 08 Apr 2009)
New Revision: 1000
Added:
trunk/java/javax/servlet/Registration.java
trunk/java/org/apache/catalina/core/ApplicationFilterConfigFacade.java
Removed:
trunk/java/org/apache/catalina/core/StandardFilterFacade.java
Modified:
trunk/ROADMAP.txt
trunk/java/javax/servlet/FilterRegistration.java
trunk/java/javax/servlet/ServletContext.java
trunk/java/javax/servlet/ServletRegistration.java
trunk/java/javax/servlet/ServletRequest.java
trunk/java/javax/servlet/ServletRequestWrapper.java
trunk/java/javax/servlet/http/HttpSession.java
trunk/java/org/apache/catalina/Wrapper.java
trunk/java/org/apache/catalina/core/ApplicationContext.java
trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
trunk/java/org/apache/catalina/core/DefaultInstanceManager.java
trunk/java/org/apache/catalina/core/DummyRequest.java
trunk/java/org/apache/catalina/core/LocalStrings.properties
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/catalina/core/StandardWrapper.java
trunk/java/org/apache/catalina/core/StandardWrapperFacade.java
trunk/java/org/apache/jasper/servlet/JspCServletContext.java
trunk/java/org/apache/tomcat/InstanceManager.java
Log:
- Update Servlet 3.0 API.
- Redo filter registration impl.
- Add dynamic flag for the registration types.
Modified: trunk/ROADMAP.txt
===================================================================
--- trunk/ROADMAP.txt 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/ROADMAP.txt 2009-04-09 01:27:49 UTC (rev 1000)
@@ -2,7 +2,6 @@
Main development:
- Setup standalone TCK environment for testing compliance with the new features
-- Servlet 3.0 async API using event API
- Update digester XML parsing rules for web.xml updates
- web.xml fragments scanning
- Annotation scanning for JBoss Web standalone (likely disabled by default using conf/web.xml)
Modified: trunk/java/javax/servlet/FilterRegistration.java
===================================================================
--- trunk/java/javax/servlet/FilterRegistration.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/javax/servlet/FilterRegistration.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
@@ -37,105 +37,17 @@
package javax.servlet;
import java.util.EnumSet;
-import java.util.Map;
/**
- * Class through which a {@link Filter} (either annotated or declared
- * in the deployment descriptor or added via
- * {@link ServletContext#addFilter(String, String)}) may be further
- * configured.
+ * Interface through which a {@link Filter} may be further configured.
*
- * <p>While all aspects of a Filter added via
- * {@link ServletContext#addFilter(String, String)}) are configurable,
- * the only configurable aspects of an annotated or declared Filter are
- * its initialization parameters and mappings. Initialization parameters
- * may only be added, but not overridden.
- *
* @since 3.0
*/
-public interface FilterRegistration {
+public interface FilterRegistration extends Registration {
/**
- * Sets the description on the filter for which this
- * FilterRegistration was created.
- *
- * <p>A call to this method overrides any previous setting.
- *
- * @param description the description of the filter
- *
- * @return true if the update was successful, false otherwise
- *
- * @throws IllegalStateException if the ServletContext from which this
- * FilterRegistration was obtained has already been initialized
- */
- public boolean setDescription(String description);
-
-
- /**
- * Sets the initialization parameter with the given name and value
- * on the filter for which this FilterRegistration was created.
- *
- * @param name the initialization parameter name
- * @param value the initialization parameter value
- *
- * @return true if the update was successful, false otherwise
- *
- * @throws IllegalStateException if the ServletContext from which this
- * FilterRegistration was obtained has already been initialized
- * @throws IllegalArgumentException if the given name or value is
- * <tt>null</tt>
- */
- public boolean setInitParameter(String name, String value);
-
-
- /**
- * Sets the given initialization parameters on the filter for which
- * this FilterRegistration was created.
- *
- * <p>The given map of initialization parameters is processed
- * <i>by-value</i>, i.e., for each initialization parameter contained
- * in the map, this method calls {@link #setInitParameter(String,String)}.
- * If that method would return false for any of the
- * initialization parameters in the given map, no updates will be
- * performed, and false will be returned. Likewise, if the map contains
- * an initialization parameter with a <tt>null</tt> name or value, no
- * updates will be performed, and an IllegalArgumentException will be
- * thrown.
- *
- * @param initParameters the initialization parameters
- *
- * @return true if the update was successful, false otherwise
- *
- * @throws IllegalStateException if the ServletContext from which this
- * FilterRegistration was obtained has already been initialized
- * @throws IllegalArgumentException if the given map contains an
- * initialization parameter with a <tt>null</tt> name or value
- */
- public boolean setInitParameters(Map<String, String> initParameters);
-
-
- /**
- * Configures the filter for which this FilterRegistration was created
- * as supporting asynchronous operations or not.
- *
- * <p>By default, a filter does not support asynchronous operations.
- *
- * <p>A call to this method overrides any previous setting.
- *
- * @param isAsyncSupported true if the filter supports asynchronous
- * operations, false otherwise
- *
- * @return true if the update was successful, false otherwise
- *
- * @throws IllegalStateException if the ServletContext from which this
- * FilterRegistration was obtained has already been initialized
- */
- public boolean setAsyncSupported(boolean isAsyncSupported);
-
-
- /**
* Adds a filter mapping with the given servlet names and dispatcher
- * types for the filter for which this FilterRegistration was created.
+ * types for the Filter represented by this FilterRegistration.
*
* <p>Filter mappings are matched in the order in which they were
* added.
@@ -164,10 +76,9 @@
EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
String... servletNames);
-
/**
* Adds a filter mapping with the given url patterns and dispatcher
- * types for the filter for which this FilterRegistration was created.
+ * types for the Filter represented by this FilterRegistration.
*
* <p>Filter mappings are matched in the order in which they were
* added.
@@ -195,5 +106,13 @@
public boolean addMappingForUrlPatterns(
EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
String... urlPatterns);
+
+ /**
+ * Interface through which a {@link Filter} registered via one of the
+ * <tt>addFilter</tt> methods on {@link ServletContext} may be further
+ * configured.
+ */
+ interface Dynamic extends FilterRegistration, Registration.Dynamic {
+ }
}
Added: trunk/java/javax/servlet/Registration.java
===================================================================
--- trunk/java/javax/servlet/Registration.java (rev 0)
+++ trunk/java/javax/servlet/Registration.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -0,0 +1,132 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+
+package javax.servlet;
+
+import java.util.Map;
+
+/**
+ * Interface through which a {@link Servlet} or {@link Filter} may be
+ * further configured.
+ *
+ * @since 3.0
+ */
+public interface Registration {
+
+ /**
+ * Sets the initialization parameter with the given name and value
+ * on the Servlet or Filter that is represented by this Registration.
+ *
+ * @param name the initialization parameter name
+ * @param value the initialization parameter value
+ *
+ * @return true if the update was successful, i.e., an initialization
+ * parameter with the given name did not already exist for the Servlet
+ * or Filter represented by this Registration, and false otherwise
+ *
+ * @throws IllegalStateException if the ServletContext from which this
+ * Registration was obtained has already been initialized
+ * @throws IllegalArgumentException if the given name or value is
+ * <tt>null</tt>
+ */
+ public boolean setInitParameter(String name, String value);
+
+ /**
+ * Sets the given initialization parameters on the Servlet or Filter
+ * that is represented by this Registration.
+ *
+ * <p>The given map of initialization parameters is processed
+ * <i>by-value</i>, i.e., for each initialization parameter contained
+ * in the map, this method calls {@link #setInitParameter(String,String)}.
+ * If that method would return false for any of the
+ * initialization parameters in the given map, no updates will be
+ * performed, and false will be returned. Likewise, if the map contains
+ * an initialization parameter with a <tt>null</tt> name or value, no
+ * updates will be performed, and an IllegalArgumentException will be
+ * thrown.
+ *
+ * @param initParameters the initialization parameters
+ *
+ * @return true if the update was successful, false otherwise
+ *
+ * @throws IllegalStateException if the ServletContext from which this
+ * Registration was obtained has already been initialized
+ * @throws IllegalArgumentException if the given map contains an
+ * initialization parameter with a <tt>null</tt> name or value
+ */
+ public boolean setInitParameters(Map<String, String> initParameters);
+
+ /**
+ * Interface through which a {@link Servlet} or {@link Filter} registered
+ * via one of the <tt>addServlet</tt> or <tt>addFilter</tt> methods,
+ * respectively, on {@link ServletContext} may be further configured.
+ */
+ interface Dynamic extends Registration {
+
+ /**
+ * Sets the description on the Servlet or Filter represented by
+ * this dynamic Registration.
+ *
+ * <p>A call to this method overrides any previous setting.
+ *
+ * @param description the description of the servlet
+ *
+ * @throws IllegalStateException if the ServletContext from which
+ * this dynamic Registration was obtained has already been initialized
+ */
+ public void setDescription(String description);
+
+ /**
+ * Configures the Servlet or Filter represented by this dynamic
+ * Registration as supporting asynchronous operations or not.
+ *
+ * <p>By default, servlet and filters do not support asynchronous
+ * operations.
+ *
+ * <p>A call to this method overrides any previous setting.
+ *
+ * @param isAsyncSupported true if the Servlet or Filter represented
+ * by this dynamic Registration supports asynchronous operations,
+ * false otherwise
+ *
+ * @throws IllegalStateException if the ServletContext from which
+ * this dynamic Registration was obtained has already been
+ * initialized
+ */
+ public void setAsyncSupported(boolean isAsyncSupported);
+ }
+}
+
Modified: trunk/java/javax/servlet/ServletContext.java
===================================================================
--- trunk/java/javax/servlet/ServletContext.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/javax/servlet/ServletContext.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -663,8 +663,8 @@
*
* @since 3.0
*/
- public ServletRegistration addServlet(String servletName,
- String className);
+ public ServletRegistration.Dynamic addServlet(
+ String servletName, String className);
/*
@@ -690,8 +690,8 @@
*
* @since 3.0
*/
- public ServletRegistration addServlet(String servletName,
- Servlet servlet);
+ public ServletRegistration.Dynamic addServlet(
+ String servletName, Servlet servlet);
/*
@@ -713,7 +713,7 @@
*
* @since 3.0
*/
- public ServletRegistration addServlet(String servletName,
+ public ServletRegistration.Dynamic addServlet(String servletName,
Class <? extends Servlet> servletClass);
@@ -774,7 +774,8 @@
*
* @since 3.0
*/
- public FilterRegistration addFilter(String filterName, String className);
+ public FilterRegistration.Dynamic addFilter(
+ String filterName, String className);
/*
@@ -798,7 +799,8 @@
*
* @since 3.0
*/
- public FilterRegistration addFilter(String filterName, Filter filter);
+ public FilterRegistration.Dynamic addFilter(
+ String filterName, Filter filter);
/**
@@ -820,7 +822,7 @@
*
* @since 3.0
*/
- public FilterRegistration addFilter(String filterName,
+ public FilterRegistration.Dynamic addFilter(String filterName,
Class <? extends Filter> filterClass);
Modified: trunk/java/javax/servlet/ServletRegistration.java
===================================================================
--- trunk/java/javax/servlet/ServletRegistration.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/javax/servlet/ServletRegistration.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
@@ -36,144 +36,63 @@
package javax.servlet;
-import java.util.Map;
-
/**
- * Class through which a {@link Servlet} (either annotated or declared
- * in the deployment descriptor or added via
- * {@link ServletContext#addServlet(String, String)}) may be further
- * configured.
+ * Interface through which a {@link Servlet} may be further configured.
*
- * <p>While all aspects of a Servlet added via
- * {@link ServletContext#addServlet(String, String)}) are configurable,
- * the only configurable aspects of an annotated or declared Servlet are
- * its initialization parameters and mappings. Initialization parameters
- * may only be added, but not overridden.
- *
* @since 3.0
*/
-public interface ServletRegistration {
+public interface ServletRegistration extends Registration {
/**
- * Sets the description on the servlet for which this ServletRegistration
- * was created.
+ * Adds a servlet mapping with the given URL patterns for the Servlet
+ * represented by this ServletRegistration.
*
- * <p>A call to this method overrides any previous setting.
+ * @param urlPatterns the URL patterns of the servlet mapping
*
- * @param description the description of the servlet
- *
* @return true if the update was successful, false otherwise
*
+ * @throws IllegalArgumentException if <tt>urlPatterns</tt> is null
+ * or empty
* @throws IllegalStateException if the ServletContext from which this
* ServletRegistration was obtained has already been initialized
*/
- public boolean setDescription(String description);
+ public boolean addMapping(String... urlPatterns);
-
/**
- * Sets the initialization parameter with the given name and value
- * on the servlet for which this ServletRegistration was created.
- *
- * @param name the initialization parameter name
- * @param value the initialization parameter value
- *
- * @return true if the update was successful, false otherwise
- *
- * @throws IllegalStateException if the ServletContext from which this
- * ServletRegistration was obtained has already been initialized
- * @throws IllegalArgumentException if the given name or value is
- * <tt>null</tt>
- */
- public boolean setInitParameter(String name, String value);
-
-
- /**
- * Sets the given initialization parameters on the servlet for which
- * this ServletRegistration was created.
- *
- * <p>The given map of initialization parameters is processed
- * <i>by-value</i>, i.e., for each initialization parameter contained
- * in the map, this method calls {@link #setInitParameter(String,String)}.
- * If that method would return false for any of the
- * initialization parameters in the given map, no updates will be
- * performed, and false will be returned. Likewise, if the map contains
- * an initialization parameter with a <tt>null</tt> name or value, no
- * updates will be performed, and an IllegalArgumentException will be
- * thrown.
- *
- * @param initParameters the initialization parameters
- *
- * @return true if the update was successful, false otherwise
- *
- * @throws IllegalStateException if the ServletContext from which this
- * ServletRegistration was obtained has already been initialized
- * @throws IllegalArgumentException if the given map contains an
- * initialization parameter with a <tt>null</tt> name or value
- */
- public boolean setInitParameters(Map<String, String> initParameters);
-
-
- /**
- * Sets the <code>loadOnStartup</code> priority on the servlet for which
- * this ServletRegistration was created.
- *
- * <p>A <tt>loadOnStartup</tt> value of greater than or equal to zero
- * indicates to the container the initialization priority of the
- * servlet. In this case, the container must instantiate and initialize
- * the servlet during the initialization phase of this servlet context,
- * that is, after it has invoked all of the ServletContextListeners
- * configured for this servlet context at their
- * {@link ServletContextListener#contextInitialized} method.
- *
- * <p>If <tt>loadOnStartup</tt> is a negative integer, the container
- * is free to instantiate and initialize the servlet lazily.
- *
- * <p>The default value for <tt>loadOnStartup</tt> is <code>-1</code>.
- *
- * <p>A call to this method overrides any previous setting.
- *
- * @param loadOnStartup the initialization priority of the servlet
- *
- * @return true if the update was successful, false otherwise
- *
- * @throws IllegalStateException if the ServletContext from which this
- * ServletRegistration was obtained has already been initialized
+ * Interface through which a {@link Servlet} registered via one of the
+ * <tt>addServlet</tt> methods on {@link ServletContext} may be further
+ * configured.
*/
- public boolean setLoadOnStartup(int loadOnStartup);
+ interface Dynamic extends ServletRegistration, Registration.Dynamic {
+ /**
+ * Sets the <code>loadOnStartup</code> priority on the Servlet
+ * represented by this dynamic ServletRegistration.
+ *
+ * <p>A <tt>loadOnStartup</tt> value of greater than or equal to
+ * zero indicates to the container the initialization priority of
+ * the Servlet. In this case, the container must instantiate and
+ * initialize the Servlet during the initialization phase of the
+ * ServletContext, that is, after it has invoked all of the
+ * ServletContextListener objects configured for the ServletContext
+ * at their {@link ServletContextListener#contextInitialized}
+ * method.
+ *
+ * <p>If <tt>loadOnStartup</tt> is a negative integer, the container
+ * is free to instantiate and initialize the Servlet lazily.
+ *
+ * <p>The default value for <tt>loadOnStartup</tt> is <code>-1</code>.
+ *
+ * <p>A call to this method overrides any previous setting.
+ *
+ * @param loadOnStartup the initialization priority of the Servlet
+ *
+ * @throws IllegalStateException if the ServletContext from which
+ * this dynamic ServletRegistration was obtained has already been
+ * initialized
+ */
+ public void setLoadOnStartup(int loadOnStartup);
+ }
- /**
- * Configures the servlet for which this ServletRegistration was
- * created as supporting asynchronous operations or not.
- *
- * <p>By default, a servlet does not support asynchronous operations.
- *
- * <p>A call to this method overrides any previous setting.
- *
- * @param isAsyncSupported true if the servlet supports asynchronous
- * operations, false otherwise
- *
- * @return true if the update was successful, false otherwise
- *
- * @throws IllegalStateException if the ServletContext from which this
- * ServletRegistration was obtained has already been initialized
- */
- public boolean setAsyncSupported(boolean isAsyncSupported);
-
-
- /**
- * Adds a servlet mapping with the given URL patterns for the servlet
- * for which this ServletRegistration was created.
- *
- * @param urlPatterns the URL patterns of the servlet mapping
- *
- * @return true if the update was successful, false otherwise
- *
- * @throws IllegalArgumentException if <tt>urlPatterns</tt> is null
- * or empty
- * @throws IllegalStateException if the ServletContext from which this
- * ServletRegistration was obtained has already been initialized
- */
- public boolean addMapping(String... urlPatterns);
}
Modified: trunk/java/javax/servlet/ServletRequest.java
===================================================================
--- trunk/java/javax/servlet/ServletRequest.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/javax/servlet/ServletRequest.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -613,8 +613,8 @@
/**
* Puts this request into asynchronous mode, and initializes its
* {@link AsyncContext} with the original (unwrapped) ServletRequest
- * and ServletResponse objects and the timeout derived according
- * to the rules laid out in {@link #setAsyncTimeout}.
+ * and ServletResponse objects and the timeout as returned by
+ * {@link #getAsyncTimeout}.
*
* <p>This will delay committal of the associated response until
* {@link AsyncContext#complete} is called on the returned
@@ -659,8 +659,7 @@
/**
* Puts this request into asynchronous mode, and initializes its
* {@link AsyncContext} with the given request and response objects
- * and the timeout derived according to the rules laid out in
- * {@link #setAsyncTimeout}.
+ * and the timeout as returned by {@link #getAsyncTimeout}.
*
* <p>The ServletRequest and ServletResponse parameters must be either
* the same objects as were passed to the calling servlet's service
@@ -844,10 +843,11 @@
* started on this request by a call to {@link #startAsync} or
* {@link #startAsync(ServletRequest, ServletResponse)}.
*
- * <p>By default, the timeout specified via the
- * <code>async-timeout</code> deployment descriptor element or the
- * <code>asyncTimeout</code> annotation of the servlet or filter that
- * started the asynchronous operation will be used.
+ * <p>By default, the container's default timeout for asynchronous
+ * operations, which is available via a call to
+ * {@link #getAsyncTimeout}, will be used.
+ * A timeout value of 0 or less indicates that the asynchronous
+ * operations will never time out.
*
* <p>If neither {@link AsyncContext#complete} nor
* {@link AsyncContext#dispatch} is called within the
@@ -878,6 +878,26 @@
/**
+ * Gets the timeout (in milliseconds) for any asynchronous operations
+ * initiated on this request by a call to {@link #startAsync} or
+ * {@link #startAsync(ServletRequest, ServletResponse)}.
+ *
+ * <p>This method returns the container's default timeout for
+ * asynchronous operations, or the timeout value passed to the most
+ * recent invocation of {@link #setAsyncTimeout}.
+ *
+ * <p>A timeout value of 0 or less indicates that the asynchronous
+ * operation will never time out.
+ *
+ * @return the timeout in milliseconds for any asynchronous
+ * operations started on this request
+ *
+ * @since 3.0
+ */
+ public long getAsyncTimeout();
+
+
+ /**
* Gets the dispatcher type of this request.
*
* <p>The dispatcher type of a request is used by the container
Modified: trunk/java/javax/servlet/ServletRequestWrapper.java
===================================================================
--- trunk/java/javax/servlet/ServletRequestWrapper.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/javax/servlet/ServletRequestWrapper.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -544,11 +544,10 @@
/**
* Sets the timeout (in milliseconds) for any asynchronous operations
- * started on the wrapped request by a call to {@link #startAsync} or
- * {@link #startAsync(ServletRequest, ServletResponse)}.
+ * initiated on the wrapped request.
*
* @param timeout the timeout in milliseconds for any asynchronous
- * operations started on the wrapped request
+ * operations initiated on the wrapped request
*
* @throws IllegalStateException if called after {@link #startAsync},
* unless within the scope of a dispatch resulting from an
@@ -564,6 +563,22 @@
/**
+ * Gets the timeout (in milliseconds) for any asynchronous operations
+ * initiated on the wrapped request.
+ *
+ * @return the timeout in milliseconds for any asynchronous
+ * operations initiated on the wrapped request
+ *
+ * @see ServletRequest#getAsyncTimeout
+ *
+ * @since 3.0
+ */
+ public long getAsyncTimeout() {
+ return request.getAsyncTimeout();
+ }
+
+
+ /**
* Checks (recursively) if this ServletRequestWrapper wraps the given
* {@link ServletRequest} instance.
*
Modified: trunk/java/javax/servlet/http/HttpSession.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSession.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/javax/servlet/http/HttpSession.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -106,14 +106,10 @@
*
* @see HttpSessionBindingListener
* @see HttpSessionContext
- *
*/
public interface HttpSession {
-
-
-
/**
*
* Returns the time when this session was created, measured
@@ -126,16 +122,11 @@
*
* @exception IllegalStateException if this method is called on an
* invalidated session
- *
*/
-
public long getCreationTime();
-
-
-
+
/**
- *
* Returns a string containing the unique identifier assigned
* to this session. The identifier is assigned
* by the servlet container and is implementation dependent.
@@ -143,17 +134,15 @@
* @return a string specifying the identifier
* assigned to this session
*/
-
public String getId();
-
-
/**
*
* Returns the last time the client sent a request associated with
* this session, as the number of milliseconds since midnight
- * January 1, 1970 GMT, and marked by the time the container received the request.
+ * January 1, 1970 GMT, and marked by the time the container received the
+ * request.
*
* <p>Actions that your application takes, such as getting or setting
* a value associated with the session, do not affect the access
@@ -167,77 +156,63 @@
*
* @exception IllegalStateException if this method is called on an
* invalidated session
- *
*/
-
public long getLastAccessedTime();
/**
- * Returns the ServletContext to which this session belongs.
- *
- * @return The ServletContext object for the web application
- * @since 2.3
- */
-
+ * Returns the ServletContext to which this session belongs.
+ *
+ * @return The ServletContext object for the web application
+ * @since 2.3
+ */
public ServletContext getServletContext();
/**
- *
* Specifies the time, in seconds, between client requests before the
- * servlet container will invalidate this session. A negative time
- * indicates the session should never timeout.
+ * servlet container will invalidate this session.
*
+ * <p>An <tt>interval</tt> value of zero or less indicates that the
+ * session should never timeout.
+ *
* @param interval An integer specifying the number
* of seconds
- *
- */
-
+ */
public void setMaxInactiveInterval(int interval);
-
-
- /**
- * Returns the maximum time interval, in seconds, that
- * the servlet container will keep this session open between
- * client accesses. After this interval, the servlet container
- * will invalidate the session. The maximum time interval can be set
- * with the <code>setMaxInactiveInterval</code> method.
- * A negative time indicates the session should never timeout.
- *
- *
- * @return an integer specifying the number of
- * seconds this session remains open
- * between client requests
- *
- * @see #setMaxInactiveInterval
- *
- *
- */
-
+ /**
+ * Returns the maximum time interval, in seconds, that
+ * the servlet container will keep this session open between
+ * client accesses. After this interval, the servlet container
+ * will invalidate the session. The maximum time interval can be set
+ * with the <code>setMaxInactiveInterval</code> method.
+ *
+ * <p>A return value of zero or less indicates that the
+ * session will never timeout.
+ *
+ * @return an integer specifying the number of
+ * seconds this session remains open
+ * between client requests
+ *
+ * @see #setMaxInactiveInterval
+ */
public int getMaxInactiveInterval();
-
-
- /**
- *
- * @deprecated As of Version 2.1, this method is
- * deprecated and has no replacement.
- * It will be removed in a future
- * version of the Java Servlet API.
- *
- */
-
+ /**
+ *
+ * @deprecated As of Version 2.1, this method is
+ * deprecated and has no replacement.
+ * It will be removed in a future
+ * version of the Java Servlet API.
+ *
+ */
public HttpSessionContext getSessionContext();
-
-
-
+
/**
- *
* Returns the object bound with the specified name in this session, or
* <code>null</code> if no object is bound under the name.
*
@@ -247,16 +222,11 @@
*
* @exception IllegalStateException if this method is called on an
* invalidated session
- *
*/
-
public Object getAttribute(String name);
-
-
/**
- *
* @deprecated As of Version 2.2, this method is
* replaced by {@link #getAttribute}.
*
@@ -266,16 +236,11 @@
*
* @exception IllegalStateException if this method is called on an
* invalidated session
- *
*/
-
public Object getValue(String name);
-
-
-
+
/**
- *
* Returns an <code>Enumeration</code> of <code>String</code> objects
* containing the names of all the objects bound to this session.
*
@@ -286,16 +251,11 @@
*
* @exception IllegalStateException if this method is called on an
* invalidated session
- *
- */
-
+ */
public Enumeration<String> getAttributeNames();
-
-
/**
- *
* @deprecated As of Version 2.2, this method is
* replaced by {@link #getAttributeNames}
*
@@ -306,13 +266,9 @@
*
* @exception IllegalStateException if this method is called on an
* invalidated session
- *
*/
-
public String[] getValueNames();
-
-
/**
* Binds an object to this session, using the name specified.
@@ -341,17 +297,11 @@
*
* @exception IllegalStateException if this method is called on an
* invalidated session
- *
*/
-
public void setAttribute(String name, Object value);
-
-
-
/**
- *
* @deprecated As of Version 2.2, this method is
* replaced by {@link #setAttribute}
*
@@ -362,17 +312,11 @@
*
* @exception IllegalStateException if this method is called on an
* invalidated session
- *
*/
-
public void putValue(String name, Object value);
-
-
-
/**
- *
* Removes the object bound with the specified name from
* this session. If the session does not have an object
* bound with the specified name, this method does nothing.
@@ -383,8 +327,6 @@
* <code>HttpSessionBindingListener.valueUnbound</code>. The container
* then notifies any <code>HttpSessionAttributeListener</code>s in the web
* application.
- *
- *
*
* @param name the name of the object to
* remove from this session
@@ -392,15 +334,10 @@
* @exception IllegalStateException if this method is called on an
* invalidated session
*/
-
public void removeAttribute(String name);
-
-
-
/**
- *
* @deprecated As of Version 2.2, this method is
* replaced by {@link #removeAttribute}
*
@@ -410,29 +347,20 @@
* @exception IllegalStateException if this method is called on an
* invalidated session
*/
-
public void removeValue(String name);
-
-
/**
- *
* Invalidates this session then unbinds any objects bound
* to it.
*
* @exception IllegalStateException if this method is called on an
* already invalidated session
- *
*/
-
public void invalidate();
-
-
/**
- *
* Returns <code>true</code> if the client does not yet know about the
* session or if the client chooses not to join the session. For
* example, if the server used only cookie-based sessions, and
@@ -445,7 +373,6 @@
*
* @exception IllegalStateException if this method is called on an
* already invalidated session
- *
*/
public boolean isNew();
Modified: trunk/java/org/apache/catalina/Wrapper.java
===================================================================
--- trunk/java/org/apache/catalina/Wrapper.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/org/apache/catalina/Wrapper.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -104,6 +104,21 @@
/**
+ * Get the flag that indicates if the wrapper was added programmatically.
+ * The flag value defaults to false.
+ */
+ public boolean isDynamic();
+
+
+ /**
+ * Set a flag that indicates if the wrapper was added programmatically.
+ *
+ * @param value New async supported value
+ */
+ public void setDynamic(boolean dynamic);
+
+
+ /**
* Return the InstanceSupport object for this Wrapper instance.
*/
public InstanceSupport getInstanceSupport();
@@ -265,6 +280,13 @@
/**
+ * Set the associated servlet instance. This will only do something
+ * meaningful for non STM servlets.
+ */
+ public void setServlet(Servlet servlet);
+
+
+ /**
* Return the value for the specified initialization parameter name,
* if any; otherwise return <code>null</code>.
*
Modified: trunk/java/org/apache/catalina/core/ApplicationContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -1,18 +1,46 @@
/*
- * 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
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.
*
- * 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.
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 1999-2009 The Apache Software Foundation
+ *
+ * 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.
*/
@@ -808,37 +836,93 @@
}
- public FilterRegistration addFilter(String filterName, String className)
+ public FilterRegistration.Dynamic addFilter(String filterName, String className)
throws IllegalArgumentException, IllegalStateException {
if (context.isInitialized()) {
- throw new IllegalStateException(sm.getString("applicationContext.addFilter.ise",
+ throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
getContextPath()));
}
FilterDef filterDef = new FilterDef();
filterDef.setFilterName(filterName);
filterDef.setFilterClass(className);
- context.addFilterDef(filterDef);
- return new StandardFilterFacade(context, filterDef);
+ ApplicationFilterConfig filterConfig = new ApplicationFilterConfig(context, filterDef);
+ filterConfig.setDynamic(true);
+ context.addApplicationFilterConfig(filterConfig);
+ return (FilterRegistration.Dynamic) filterConfig.getFacade();
}
- public ServletRegistration addServlet(String servletName, String className)
+ public FilterRegistration.Dynamic addFilter(String filterName, Filter filter) {
+ if (context.isInitialized()) {
+ throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
+ getContextPath()));
+ }
+ FilterDef filterDef = new FilterDef();
+ filterDef.setFilterName(filterName);
+ filterDef.setFilterClass(filter.getClass().getName());
+ ApplicationFilterConfig filterConfig = new ApplicationFilterConfig(context, filterDef);
+ filterConfig.setDynamic(true);
+ filterConfig.setFilter(filter);
+ context.addApplicationFilterConfig(filterConfig);
+ return (FilterRegistration.Dynamic) filterConfig.getFacade();
+ }
+
+
+ public FilterRegistration.Dynamic addFilter(String filterName,
+ Class<? extends Filter> filterClass) {
+ return addFilter(filterName, filterClass.getName());
+ }
+
+
+ public ServletRegistration.Dynamic addServlet(String servletName, String className)
throws IllegalArgumentException, IllegalStateException {
+ if (context.isInitialized()) {
+ throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
+ getContextPath()));
+ }
Wrapper wrapper = context.createWrapper();
+ wrapper.setDynamic(true);
wrapper.setName(servletName);
wrapper.setServletClass(className);
context.addChild(wrapper);
- return wrapper.getFacade();
+ return (ServletRegistration.Dynamic) wrapper.getFacade();
}
+ public ServletRegistration.Dynamic addServlet(String servletName,
+ Class<? extends Servlet> clazz) throws IllegalArgumentException,
+ IllegalStateException {
+ return addServlet(servletName, clazz.getName());
+ }
+
+
+ public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet) {
+ if (context.isInitialized()) {
+ throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
+ getContextPath()));
+ }
+ Wrapper wrapper = context.createWrapper();
+ wrapper.setDynamic(true);
+ wrapper.setName(servletName);
+ wrapper.setServletClass(servlet.getClass().getName());
+ wrapper.setServlet(servlet);
+ context.addChild(wrapper);
+ return (ServletRegistration.Dynamic) wrapper.getFacade();
+ }
+
+
public FilterRegistration findFilterRegistration(String filterName) {
- FilterDef filterDef = context.findFilterDef(filterName);
- if (filterDef == null) {
- return null;
- } else {
- return new StandardFilterFacade(context, filterDef);
+ ApplicationFilterConfig filterConfig = context.findApplicationFilterConfig(filterName);
+ if (filterConfig == null) {
+ FilterDef filterDef = context.findFilterDef(filterName);
+ if (filterDef == null) {
+ return null;
+ } else {
+ filterConfig = new ApplicationFilterConfig(context, filterDef);
+ context.addApplicationFilterConfig(filterConfig);
+ }
}
+ return filterConfig.getFacade();
}
@@ -877,61 +961,36 @@
return context.getSessionCookie();
}
-/* FIXME gone ?
- public void setSessionCookieConfig(SessionCookieConfig sessionCookieConfig) {
- SessionCookie sessionCookie = new SessionCookie();
- sessionCookie.setComment(sessionCookieConfig.getComment());
- sessionCookie.setDomain(sessionCookieConfig.getDomain());
- sessionCookie.setHttpOnly(sessionCookieConfig.isHttpOnly());
- sessionCookie.setSecure(sessionCookieConfig.isSecure());
- context.setSessionCookie(sessionCookie);
- }*/
-
- public ServletRegistration addServlet(String servletName,
- Class<? extends Servlet> clazz) throws IllegalArgumentException,
- IllegalStateException {
- return addServlet(servletName, clazz.getName());
- }
-
-
- public FilterRegistration addFilter(String filterName, Filter filter) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public FilterRegistration addFilter(String filterName,
- Class<? extends Filter> filterClass) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public ServletRegistration addServlet(String servletName, Servlet servlet) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
public <T extends Filter> T createFilter(Class<T> c)
throws ServletException {
- // TODO Auto-generated method stub
- return null;
+ try {
+ return (T) context.getInstanceManager().newInstance(c);
+ } catch (Throwable e) {
+ throw new ServletException
+ (sm.getString("applicationContext.create"), e);
+ }
}
public <T extends Servlet> T createServlet(Class<T> c)
throws ServletException {
- // TODO Auto-generated method stub
- return null;
+ try {
+ return (T) context.getInstanceManager().newInstance(c);
+ } catch (Throwable e) {
+ throw new ServletException
+ (sm.getString("applicationContext.create"), e);
+ }
}
public boolean setInitParameter(String name, String value) {
- context.addParameter(name, value);
- // FIXME: return value ?
- return false;
+ try {
+ context.addParameter(name, value);
+ return true;
+ } catch (IllegalStateException e) {
+ return false;
+ }
}
Modified: trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContextFacade.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/org/apache/catalina/core/ApplicationContextFacade.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -1,18 +1,46 @@
/*
- * 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
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.
*
- * 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.
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 1999-2009 The Apache Software Foundation
+ *
+ * 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.
*/
@@ -373,10 +401,10 @@
}
- public FilterRegistration addFilter(String filterName, String className)
+ public FilterRegistration.Dynamic addFilter(String filterName, String className)
throws IllegalArgumentException, IllegalStateException {
if (SecurityUtil.isPackageProtectionEnabled()) {
- return (FilterRegistration) doPrivileged("addFilter",
+ return (FilterRegistration.Dynamic) doPrivileged("addFilter",
new Object[]{filterName, className});
} else {
return context.addFilter(filterName, className);
@@ -384,9 +412,9 @@
}
- public FilterRegistration addFilter(String filterName, Filter filter) {
+ public FilterRegistration.Dynamic addFilter(String filterName, Filter filter) {
if (SecurityUtil.isPackageProtectionEnabled()) {
- return (FilterRegistration) doPrivileged("addFilter",
+ return (FilterRegistration.Dynamic) doPrivileged("addFilter",
new Object[]{filterName, filter});
} else {
return context.addFilter(filterName, filter);
@@ -394,10 +422,10 @@
}
- public FilterRegistration addFilter(String filterName,
+ public FilterRegistration.Dynamic addFilter(String filterName,
Class<? extends Filter> filterClass) {
if (SecurityUtil.isPackageProtectionEnabled()) {
- return (FilterRegistration) doPrivileged("addFilter",
+ return (FilterRegistration.Dynamic) doPrivileged("addFilter",
new Object[]{filterName, filterClass});
} else {
return context.addFilter(filterName, filterClass);
@@ -405,10 +433,10 @@
}
- public ServletRegistration addServlet(String servletName, String className)
+ public ServletRegistration.Dynamic addServlet(String servletName, String className)
throws IllegalArgumentException, IllegalStateException {
if (SecurityUtil.isPackageProtectionEnabled()) {
- return (ServletRegistration) doPrivileged("addServlet",
+ return (ServletRegistration.Dynamic) doPrivileged("addServlet",
new Object[]{servletName, className});
} else {
return context.addServlet(servletName, className);
@@ -416,11 +444,11 @@
}
- public ServletRegistration addServlet(String servletName,
+ public ServletRegistration.Dynamic addServlet(String servletName,
Class<? extends Servlet> clazz) throws IllegalArgumentException,
IllegalStateException {
if (SecurityUtil.isPackageProtectionEnabled()) {
- return (ServletRegistration) doPrivileged("addServlet",
+ return (ServletRegistration.Dynamic) doPrivileged("addServlet",
new Object[]{servletName, clazz});
} else {
return context.addServlet(servletName, clazz);
@@ -428,9 +456,9 @@
}
- public ServletRegistration addServlet(String servletName, Servlet servlet) {
+ public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet) {
if (SecurityUtil.isPackageProtectionEnabled()) {
- return (ServletRegistration) doPrivileged("addServlet",
+ return (ServletRegistration.Dynamic) doPrivileged("addServlet",
new Object[]{servletName, servlet});
} else {
return context.addServlet(servletName, servlet);
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -1,18 +1,46 @@
/*
- * 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
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.
*
- * 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.
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 1999-2009 The Apache Software Foundation
+ *
+ * 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.
*/
@@ -22,19 +50,24 @@
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
+import java.util.EnumSet;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import javax.naming.NamingException;
+import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterConfig;
+import javax.servlet.FilterRegistration;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import org.apache.catalina.Context;
import org.apache.catalina.Globals;
import org.apache.catalina.deploy.FilterDef;
+import org.apache.catalina.deploy.FilterMap;
import org.apache.catalina.security.SecurityUtil;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.StringManager;
@@ -67,28 +100,10 @@
* @param context The context with which we are associated
* @param filterDef Filter definition for which a FilterConfig is to be
* constructed
- *
- * @exception ClassCastException if the specified class does not implement
- * the <code>javax.servlet.Filter</code> interface
- * @exception ClassNotFoundException if the filter class cannot be found
- * @exception IllegalAccessException if the filter class cannot be
- * publicly instantiated
- * @exception InstantiationException if an exception occurs while
- * instantiating the filter object
- * @exception ServletException if thrown by the filter's init() method
- * @throws NamingException
- * @throws InvocationTargetException
*/
- public ApplicationFilterConfig(Context context, FilterDef filterDef)
- throws ClassCastException, ClassNotFoundException,
- IllegalAccessException, InstantiationException,
- ServletException, InvocationTargetException, NamingException {
-
- super();
-
+ public ApplicationFilterConfig(Context context, FilterDef filterDef) {
this.context = context;
- setFilterDef(filterDef);
-
+ this.filterDef = filterDef;
}
@@ -96,18 +111,37 @@
/**
+ * The facade associated with this wrapper.
+ */
+ protected ApplicationFilterConfigFacade facade =
+ new ApplicationFilterConfigFacade(this);
+
+
+ /**
* The Context with which we are associated.
*/
private Context context = null;
/**
+ * Dynamic flag.
+ */
+ protected boolean dynamic = false;
+
+
+ /**
* The application Filter we are configured for.
*/
private transient Filter filter = null;
/**
+ * The application Filter we are configured for.
+ */
+ private transient Filter filterInstance = null;
+
+
+ /**
* The <code>FilterDef</code> that defines our associated Filter.
*/
private FilterDef filterDef = null;
@@ -175,6 +209,28 @@
/**
+ * Get the facade FilterRegistration.
+ */
+ public FilterRegistration getFacade() {
+ return facade;
+ }
+
+
+ public boolean isDynamic() {
+ return dynamic;
+ }
+
+
+ public void setDynamic(boolean dynamic) {
+ this.dynamic = dynamic;
+ if (dynamic) {
+ // Change the facade (normally, this happens when the Wrapper is created)
+ facade = new ApplicationFilterConfigFacade.Dynamic(this);
+ }
+ }
+
+
+ /**
* Return a String representation of this object.
*/
public String toString() {
@@ -190,6 +246,80 @@
}
+ public boolean addMappingForServletNames(EnumSet<DispatcherType> dispatcherTypes,
+ boolean isMatchAfter, String... servletNames) {
+ if (context.isInitialized()) {
+ throw new IllegalStateException(sm.getString("filterRegistration.addFilterMapping.ise", context.getPath()));
+ }
+ FilterMap filterMap = new FilterMap();
+ for (String servletName : servletNames) {
+ filterMap.addServletName(servletName);
+ }
+ filterMap.setFilterName(filterDef.getFilterName());
+ for (DispatcherType dispatcherType: dispatcherTypes) {
+ filterMap.setDispatcher(dispatcherType.name());
+ }
+ if (isMatchAfter) {
+ context.addFilterMap(filterMap);
+ } else {
+ context.addFilterMapBefore(filterMap);
+ }
+ return true;
+ }
+
+
+ public boolean addMappingForUrlPatterns(
+ EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
+ String... urlPatterns) {
+ if (context.isInitialized()) {
+ throw new IllegalStateException(sm.getString("filterRegistration.addFilterMapping.ise", context.getPath()));
+ }
+ FilterMap filterMap = new FilterMap();
+ for (String urlPattern : urlPatterns) {
+ filterMap.addURLPattern(urlPattern);
+ }
+ filterMap.setFilterName(filterDef.getFilterName());
+ for (DispatcherType dispatcherType: dispatcherTypes) {
+ filterMap.setDispatcher(dispatcherType.name());
+ }
+ if (isMatchAfter) {
+ context.addFilterMap(filterMap);
+ } else {
+ context.addFilterMapBefore(filterMap);
+ }
+ return true;
+ }
+
+
+ public void setAsyncSupported(boolean asyncSupported) {
+ filterDef.setAsyncSupported(asyncSupported);
+ context.addFilterDef(filterDef);
+ }
+
+
+ public void setDescription(String description) {
+ filterDef.setDescription(description);
+ context.addFilterDef(filterDef);
+ }
+
+
+ public boolean setInitParameter(String name, String value) {
+ filterDef.addInitParameter(name, value);
+ context.addFilterDef(filterDef);
+ return true;
+ }
+
+
+ public boolean setInitParameters(Map<String, String> initParameters) {
+ Iterator<String> parameterNames = initParameters.keySet().iterator();
+ while (parameterNames.hasNext()) {
+ String parameterName = parameterNames.next();
+ filterDef.addInitParameter(parameterName, initParameters.get(parameterName));
+ }
+ return true;
+ }
+
+
// -------------------------------------------------------- Package Methods
@@ -216,8 +346,13 @@
return (this.filter);
// Identify the class loader we will be using
- String filterClass = filterDef.getFilterClass();
- this.filter = (Filter) getInstanceManager().newInstance(filterClass);
+ if (filterInstance == null) {
+ String filterClass = filterDef.getFilterClass();
+ this.filter = (Filter) getInstanceManager().newInstance(filterClass);
+ } else {
+ this.filter = filterInstance;
+ filterInstance = null;
+ }
if (context instanceof StandardContext &&
context.getSwallowOutput()) {
@@ -238,6 +373,14 @@
}
+
+ /**
+ * Set the filter instance programmatically.
+ */
+ public void setFilter(Filter filter) {
+ filterInstance = filter;
+ }
+
/**
* Return the filter definition we are configured for.
@@ -279,65 +422,9 @@
}
- /**
- * Set the filter definition we are configured for. This has the side
- * effect of instantiating an instance of the corresponding filter class.
- *
- * @param filterDef The new filter definition
- *
- * @exception ClassCastException if the specified class does not implement
- * the <code>javax.servlet.Filter</code> interface
- * @exception ClassNotFoundException if the filter class cannot be found
- * @exception IllegalAccessException if the filter class cannot be
- * publicly instantiated
- * @exception InstantiationException if an exception occurs while
- * instantiating the filter object
- * @exception ServletException if thrown by the filter's init() method
- * @throws NamingException
- * @throws InvocationTargetException
- */
- void setFilterDef(FilterDef filterDef)
- throws ClassCastException, ClassNotFoundException,
- IllegalAccessException, InstantiationException,
- ServletException, InvocationTargetException, NamingException {
+ // -------------------------------------------------------- Private Methods
- this.filterDef = filterDef;
- if (filterDef == null) {
- // Release any previously allocated filter instance
- if (this.filter != null){
- if( Globals.IS_SECURITY_ENABLED) {
- try{
- SecurityUtil.doAsPrivilege("destroy", filter);
- } catch(java.lang.Exception ex){
- context.getLogger().error("ApplicationFilterConfig.doAsPrivilege", ex);
- }
- SecurityUtil.remove(filter);
- } else {
- filter.destroy();
- }
- if (!context.getIgnoreAnnotations()) {
- try {
- ((StandardContext) context).getInstanceManager().destroyInstance(this.filter);
- } catch (Exception e) {
- context.getLogger().error("ApplicationFilterConfig.preDestroy", e);
- }
- }
- }
- this.filter = null;
-
- } else {
-
- // Allocate a new filter instance
- Filter filter = getFilter();
-
- }
-
- }
-
-
- // -------------------------------------------------------- Private Methods
-
private InstanceManager getInstanceManager() {
if (instanceManager == null) {
if (context instanceof StandardContext) {
Added: trunk/java/org/apache/catalina/core/ApplicationFilterConfigFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterConfigFacade.java (rev 0)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterConfigFacade.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -0,0 +1,195 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.
+ *
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 1999-2009 The Apache Software Foundation
+ *
+ * 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.catalina.core;
+
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.naming.NamingException;
+import javax.servlet.DispatcherType;
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.FilterRegistration;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.apache.catalina.Context;
+import org.apache.catalina.Globals;
+import org.apache.catalina.deploy.FilterDef;
+import org.apache.catalina.security.SecurityUtil;
+import org.apache.catalina.util.Enumerator;
+import org.apache.catalina.util.StringManager;
+import org.apache.tomcat.InstanceManager;
+import org.apache.tomcat.util.log.SystemLogHandler;
+
+
+/**
+ * Facade for AppalicationFilterConfig.
+ *
+ * @author Remy Maucherat
+ * @version $Revision: 992 $ $Date: 2009-04-08 01:09:34 +0200 (Wed, 08 Apr 2009) $
+ */
+
+public class ApplicationFilterConfigFacade implements FilterConfig, FilterRegistration {
+
+
+ protected static StringManager sm =
+ StringManager.getManager(Constants.Package);
+
+ public static class Dynamic extends ApplicationFilterConfigFacade
+ implements FilterRegistration.Dynamic {
+
+ public Dynamic(ApplicationFilterConfig config) {
+ super(config);
+ }
+
+ }
+
+
+ // ----------------------------------------------------------- Constructors
+
+
+ public ApplicationFilterConfigFacade(ApplicationFilterConfig config) {
+ this.config = config;
+ }
+
+
+ // ----------------------------------------------------- Instance Variables
+
+
+ /**
+ * The Context with which we are associated.
+ */
+ private ApplicationFilterConfig config = null;
+
+
+ // --------------------------------------------------- FilterConfig Methods
+
+
+ /**
+ * Return the name of the filter we are configuring.
+ */
+ public String getFilterName() {
+
+ return config.getFilterName();
+
+ }
+
+
+ /**
+ * Return a <code>String</code> containing the value of the named
+ * initialization parameter, or <code>null</code> if the parameter
+ * does not exist.
+ *
+ * @param name Name of the requested initialization parameter
+ */
+ public String getInitParameter(String name) {
+
+ return config.getInitParameter(name);
+
+ }
+
+
+ /**
+ * Return an <code>Enumeration</code> of the names of the initialization
+ * parameters for this Filter.
+ */
+ public Enumeration getInitParameterNames() {
+
+ return config.getInitParameterNames();
+
+ }
+
+
+ /**
+ * Return the ServletContext of our associated web application.
+ */
+ public ServletContext getServletContext() {
+
+ return config.getServletContext();
+
+ }
+
+
+ public boolean addMappingForServletNames(
+ EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
+ String... servletNames) {
+ return config.addMappingForServletNames(dispatcherTypes, isMatchAfter, servletNames);
+ }
+
+
+ public boolean addMappingForUrlPatterns(
+ EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
+ String... urlPatterns) {
+ return config.addMappingForUrlPatterns(dispatcherTypes, isMatchAfter, urlPatterns);
+ }
+
+
+ public boolean setInitParameter(String name, String value) {
+ return config.setInitParameter(name, value);
+ }
+
+
+ public boolean setInitParameters(Map<String, String> initParameters) {
+ return config.setInitParameters(initParameters);
+ }
+
+
+ public void setAsyncSupported(boolean isAsyncSupported) {
+ config.setAsyncSupported(isAsyncSupported);
+ }
+
+ public void setDescription(String description) {
+ config.setDescription(description);
+ }
+
+}
Modified: trunk/java/org/apache/catalina/core/DefaultInstanceManager.java
===================================================================
--- trunk/java/org/apache/catalina/core/DefaultInstanceManager.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/org/apache/catalina/core/DefaultInstanceManager.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -123,6 +123,10 @@
return newInstance(clazz.newInstance(), clazz);
}
+ public Object newInstance(Class<?> c) throws IllegalAccessException, InvocationTargetException, NamingException, InstantiationException {
+ return newInstance(c.newInstance(), c);
+ }
+
public void newInstance(Object o)
throws IllegalAccessException, InvocationTargetException, NamingException {
newInstance(o, o.getClass());
Modified: trunk/java/org/apache/catalina/core/DummyRequest.java
===================================================================
--- trunk/java/org/apache/catalina/core/DummyRequest.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/org/apache/catalina/core/DummyRequest.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -288,6 +288,7 @@
ServletException { return false; }
public void login(String username, String password) throws ServletException {}
public void logout() throws ServletException {}
+ public long getAsyncTimeout() { return 0; }
}
Modified: trunk/java/org/apache/catalina/core/LocalStrings.properties
===================================================================
--- trunk/java/org/apache/catalina/core/LocalStrings.properties 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/org/apache/catalina/core/LocalStrings.properties 2009-04-09 01:27:49 UTC (rev 1000)
@@ -13,8 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-applicationContext.addFilter.ise=Filters can not be added to context {0} at this time. See SRV.4.4.
+applicationContext.alreadyInitialized=Context {0} is already initialized.
applicationContext.attributeEvent=Exception thrown by attributes event listener
+applicationContext.create=Error creating instance
applicationContext.mapping.error=Error during mapping
applicationContext.requestDispatcher.iae=Path {0} does not start with a "/" character
applicationContext.resourcePaths.iae=Path {0} does not start with a "/" character
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -2297,6 +2297,19 @@
*
* @param filterDef The filter definition to be added
*/
+ public void addApplicationFilterConfig(ApplicationFilterConfig filterConfig) {
+
+ filterConfigs.put(filterConfig.getFilterName(), filterConfig);
+ fireContainerEvent("addApplicationFilterConfig", filterConfig);
+
+ }
+
+
+ /**
+ * Add a filter definition to this Context.
+ *
+ * @param filterDef The filter definition to be added
+ */
public void addFilterDef(FilterDef filterDef) {
synchronized (filterDefs) {
@@ -2789,6 +2802,16 @@
/**
+ * Return the application filter for the given name.
+ */
+ public ApplicationFilterConfig findApplicationFilterConfig(String name) {
+
+ return (ApplicationFilterConfig) filterConfigs.get(name);
+
+ }
+
+
+ /**
* Return the set of application listener class names configured
* for this application.
*/
@@ -3884,7 +3907,18 @@
// Instantiate and record a FilterConfig for each defined filter
boolean ok = true;
synchronized (filterConfigs) {
- filterConfigs.clear();
+ Iterator filterConfigsIterator = filterConfigs.values().iterator();
+ while (filterConfigsIterator.hasNext()) {
+ ApplicationFilterConfig filterConfig =
+ (ApplicationFilterConfig) filterConfigsIterator.next();
+ try {
+ filterConfig.getFilter();
+ } catch (Throwable t) {
+ getLogger().error
+ (sm.getString("standardContext.filterStart", name), t);
+ ok = false;
+ }
+ }
Iterator names = filterDefs.keySet().iterator();
while (names.hasNext()) {
String name = (String) names.next();
@@ -3894,6 +3928,7 @@
try {
filterConfig = new ApplicationFilterConfig
(this, (FilterDef) filterDefs.get(name));
+ filterConfig.getFilter();
filterConfigs.put(name, filterConfig);
} catch (Throwable t) {
getLogger().error
Deleted: trunk/java/org/apache/catalina/core/StandardFilterFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardFilterFacade.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/org/apache/catalina/core/StandardFilterFacade.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -1,164 +0,0 @@
-/*
- * 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.catalina.core;
-
-
-import java.util.EnumSet;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.servlet.DispatcherType;
-import javax.servlet.FilterRegistration;
-
-import org.apache.catalina.Context;
-import org.apache.catalina.deploy.FilterDef;
-import org.apache.catalina.deploy.FilterMap;
-import org.apache.catalina.util.StringManager;
-
-
-/**
- * Facade for the <b>FilterDef</b> object, with a hook to the Context to
- * store them automatically. The name of the class is not accurate, since
- * there is no StandardFilter, but for consistency with StandardWrapper.
- *
- * @author Remy Maucharat
- * @version $Revision: 947 $ $Date: 2009-03-10 05:02:22 +0100 (Tue, 10 Mar 2009) $
- */
-
-public final class StandardFilterFacade
- implements FilterRegistration {
-
-
- /**
- * The string manager for this package.
- */
- private static final StringManager sm =
- StringManager.getManager(Constants.Package);
-
-
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Create a new facade around a FilterDef.
- */
- public StandardFilterFacade(Context context, FilterDef filterDef) {
-
- super();
- this.context = context;
- this.filterDef = filterDef;
-
- }
-
-
- // ----------------------------------------------------- Instance Variables
-
-
- /**
- * Associated context.
- */
- private Context context = null;
-
-
- /**
- * Wrapped filter def (facade).
- */
- private FilterDef filterDef = null;
-
-
- // --------------------------------------------- FilterRegistration Methods
-
-
- public boolean addMappingForServletNames(EnumSet<DispatcherType> dispatcherTypes,
- boolean isMatchAfter, String... servletNames) {
- if (context.isInitialized()) {
- throw new IllegalStateException(sm.getString("filterRegistration.addFilterMapping.ise", context.getPath()));
- }
- FilterMap filterMap = new FilterMap();
- for (String servletName : servletNames) {
- filterMap.addServletName(servletName);
- }
- filterMap.setFilterName(filterDef.getFilterName());
- for (DispatcherType dispatcherType: dispatcherTypes) {
- filterMap.setDispatcher(dispatcherType.name());
- }
- if (isMatchAfter) {
- context.addFilterMap(filterMap);
- } else {
- context.addFilterMapBefore(filterMap);
- }
- return true;
- }
-
-
- public boolean addMappingForUrlPatterns(
- EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
- String... urlPatterns) {
- if (context.isInitialized()) {
- throw new IllegalStateException(sm.getString("filterRegistration.addFilterMapping.ise", context.getPath()));
- }
- FilterMap filterMap = new FilterMap();
- for (String urlPattern : urlPatterns) {
- filterMap.addURLPattern(urlPattern);
- }
- filterMap.setFilterName(filterDef.getFilterName());
- for (DispatcherType dispatcherType: dispatcherTypes) {
- filterMap.setDispatcher(dispatcherType.name());
- }
- if (isMatchAfter) {
- context.addFilterMap(filterMap);
- } else {
- context.addFilterMapBefore(filterMap);
- }
- return true;
- }
-
-
- public boolean setAsyncSupported(boolean asyncSupported) {
- filterDef.setAsyncSupported(asyncSupported);
- context.addFilterDef(filterDef);
- return true;
- }
-
-
- public boolean setDescription(String description) {
- filterDef.setDescription(description);
- context.addFilterDef(filterDef);
- return true;
- }
-
-
- public boolean setInitParameter(String name, String value) {
- filterDef.addInitParameter(name, value);
- context.addFilterDef(filterDef);
- return true;
- }
-
-
- public boolean setInitParameters(Map<String, String> initParameters) {
- Iterator<String> parameterNames = initParameters.keySet().iterator();
- while (parameterNames.hasNext()) {
- String parameterName = parameterNames.next();
- filterDef.addInitParameter(parameterName, initParameters.get(parameterName));
- }
- return true;
- }
-
-
-}
Modified: trunk/java/org/apache/catalina/core/StandardWrapper.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -105,6 +105,12 @@
/**
+ * Dynamic flag.
+ */
+ protected boolean dynamic = false;
+
+
+ /**
* The date and time at which this servlet will become available (in
* milliseconds since the epoch), or zero if the servlet is available.
* If this value equals Long.MAX_VALUE, the unavailability of this
@@ -150,6 +156,12 @@
/**
+ * The (single) initialized instance of this servlet.
+ */
+ protected Servlet servletInstance = null;
+
+
+ /**
* The support object for our instance listeners.
*/
protected InstanceSupport instanceSupport = new InstanceSupport(this);
@@ -320,6 +332,20 @@
}
+ public boolean isDynamic() {
+ return dynamic;
+ }
+
+
+ public void setDynamic(boolean dynamic) {
+ this.dynamic = dynamic;
+ if (dynamic) {
+ // Change the facade (normally, this happens when the Wrapper is created)
+ facade = new StandardWrapperFacade.Dynamic(this);
+ }
+ }
+
+
/**
* Return the available date/time for this servlet, in milliseconds since
* the epoch. If this date/time is Long.MAX_VALUE, it is considered to mean
@@ -803,6 +829,14 @@
/**
+ * Set the associated servlet instance.
+ */
+ public void setServlet(Servlet servlet) {
+ servletInstance = servlet;
+ }
+
+
+ /**
* Allocate an initialized instance of this Servlet that is ready to have
* its <code>service()</code> method called. If the servlet class does
* not implement <code>SingleThreadModel</code>, the (only) initialized
@@ -1060,26 +1094,31 @@
(sm.getString("standardWrapper.notClass", getName()));
}
- InstanceManager instanceManager = ((StandardContext)getParent()).getInstanceManager();
- try {
- servlet = (Servlet) instanceManager.newInstance(actualClass);
- } catch (ClassCastException e) {
- unavailable(null);
- // Restore the context ClassLoader
- throw new ServletException
+ if (servletInstance == null) {
+ InstanceManager instanceManager = ((StandardContext)getParent()).getInstanceManager();
+ try {
+ servlet = (Servlet) instanceManager.newInstance(actualClass);
+ } catch (ClassCastException e) {
+ unavailable(null);
+ // Restore the context ClassLoader
+ throw new ServletException
(sm.getString("standardWrapper.notServlet", actualClass), e);
- } catch (Throwable e) {
- unavailable(null);
+ } catch (Throwable e) {
+ unavailable(null);
- // Added extra log statement for Bugzilla 36630:
- // http://issues.apache.org/bugzilla/show_bug.cgi?id=36630
- if(log.isDebugEnabled()) {
- log.debug(sm.getString("standardWrapper.instantiate", actualClass), e);
- }
+ // Added extra log statement for Bugzilla 36630:
+ // http://issues.apache.org/bugzilla/show_bug.cgi?id=36630
+ if(log.isDebugEnabled()) {
+ log.debug(sm.getString("standardWrapper.instantiate", actualClass), e);
+ }
- // Restore the context ClassLoader
- throw new ServletException
+ // Restore the context ClassLoader
+ throw new ServletException
(sm.getString("standardWrapper.instantiate", actualClass), e);
+ }
+ } else {
+ servlet = servletInstance;
+ servletInstance = null;
}
// Special handling for ContainerServlet instances
Modified: trunk/java/org/apache/catalina/core/StandardWrapperFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapperFacade.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/org/apache/catalina/core/StandardWrapperFacade.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -1,18 +1,46 @@
/*
- * 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
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.
*
- * 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.
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 1999-2009 The Apache Software Foundation
+ *
+ * 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.
*/
@@ -38,7 +66,7 @@
* @version $Revision$ $Date$
*/
-public final class StandardWrapperFacade
+public class StandardWrapperFacade
implements ServletRegistration, ServletConfig {
@@ -49,6 +77,16 @@
StringManager.getManager(Constants.Package);
+ public static class Dynamic extends StandardWrapperFacade
+ implements ServletRegistration.Dynamic {
+
+ public Dynamic(StandardWrapper wrapper) {
+ super(wrapper);
+ }
+
+ }
+
+
// ----------------------------------------------------------- Constructors
@@ -120,15 +158,13 @@
}
- public boolean setAsyncSupported(boolean asyncSupported) {
+ public void setAsyncSupported(boolean asyncSupported) {
wrapper.setAsyncSupported(asyncSupported);
- return true;
}
- public boolean setDescription(String description) {
+ public void setDescription(String description) {
wrapper.setDescription(description);
- return true;
}
@@ -148,9 +184,8 @@
}
- public boolean setLoadOnStartup(int loadOnStartup) {
+ public void setLoadOnStartup(int loadOnStartup) {
wrapper.setLoadOnStartup(loadOnStartup);
- return true;
}
Modified: trunk/java/org/apache/jasper/servlet/JspCServletContext.java
===================================================================
--- trunk/java/org/apache/jasper/servlet/JspCServletContext.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/org/apache/jasper/servlet/JspCServletContext.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -443,19 +443,19 @@
}
- public FilterRegistration addFilter(String filterName, String className)
+ public FilterRegistration.Dynamic addFilter(String filterName, String className)
throws IllegalArgumentException, IllegalStateException {
return null;
}
- public ServletRegistration addServlet(String servletName, String className)
+ public ServletRegistration.Dynamic addServlet(String servletName, String className)
throws IllegalArgumentException, IllegalStateException {
return null;
}
- public ServletRegistration addServlet(String servletName,
+ public ServletRegistration.Dynamic addServlet(String servletName,
Class<? extends Servlet> clazz) throws IllegalArgumentException,
IllegalStateException {
return null;
@@ -492,29 +492,18 @@
}
- public void setSessionCookieConfig(SessionCookieConfig sessionCookieConfig) {
- // Do nothing
- }
-
-
- public void setSessionTrackingModes(
- EnumSet<SessionTrackingMode> sessionTrackingModes) {
- // Do nothing
- }
-
-
- public FilterRegistration addFilter(String filterName, Filter filter) {
+ public FilterRegistration.Dynamic addFilter(String filterName, Filter filter) {
return null;
}
- public FilterRegistration addFilter(String filterName,
+ public FilterRegistration.Dynamic addFilter(String filterName,
Class<? extends Filter> filterClass) {
return null;
}
- public ServletRegistration addServlet(String servletName, Servlet servlet) {
+ public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet) {
return null;
}
Modified: trunk/java/org/apache/tomcat/InstanceManager.java
===================================================================
--- trunk/java/org/apache/tomcat/InstanceManager.java 2009-04-08 21:24:35 UTC (rev 999)
+++ trunk/java/org/apache/tomcat/InstanceManager.java 2009-04-09 01:27:49 UTC (rev 1000)
@@ -37,6 +37,10 @@
throws IllegalAccessException, InvocationTargetException, NamingException,
InstantiationException, ClassNotFoundException;
+ public Object newInstance(Class<?> c)
+ throws IllegalAccessException, InvocationTargetException, NamingException,
+ InstantiationException;
+
public void newInstance(Object o)
throws IllegalAccessException, InvocationTargetException, NamingException;
15 years