JBossWeb SVN: r1234 - in trunk: java/org/apache/coyote/http11 and 2 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-10-31 19:31:38 -0400 (Sat, 31 Oct 2009)
New Revision: 1234
Modified:
trunk/java/org/apache/catalina/core/AprLifecycleListener.java
trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
trunk/java/org/apache/tomcat/jni/SSLSocket.java
trunk/webapps/docs/changelog.xml
Log:
- Port SSL patch that had been forgotten.
Modified: trunk/java/org/apache/catalina/core/AprLifecycleListener.java
===================================================================
--- trunk/java/org/apache/catalina/core/AprLifecycleListener.java 2009-10-31 18:31:47 UTC (rev 1233)
+++ trunk/java/org/apache/catalina/core/AprLifecycleListener.java 2009-10-31 23:31:38 UTC (rev 1234)
@@ -27,7 +27,6 @@
import org.apache.catalina.util.StringManager;
import org.apache.tomcat.jni.Library;
import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
@@ -59,7 +58,7 @@
protected static final int TCN_REQUIRED_MAJOR = 1;
protected static final int TCN_REQUIRED_MINOR = 1;
protected static final int TCN_REQUIRED_PATCH = 8;
- protected static final int TCN_RECOMMENDED_PV = 12;
+ protected static final int TCN_RECOMMENDED_PV = 17;
// ---------------------------------------------- Properties
Modified: trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2009-10-31 18:31:47 UTC (rev 1233)
+++ trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2009-10-31 23:31:38 UTC (rev 1234)
@@ -1162,10 +1162,11 @@
request.setAttribute(AprEndpoint.CIPHER_SUITE_KEY, sslO);
}
// Get client certificate and the certificate chain if present
+ // certLength == -1 indicates an error
int certLength = SSLSocket.getInfoI(socket, SSL.SSL_INFO_CLIENT_CERT_CHAIN);
byte[] clientCert = SSLSocket.getInfoB(socket, SSL.SSL_INFO_CLIENT_CERT);
X509Certificate[] certs = null;
- if (clientCert != null) {
+ if (clientCert != null && certLength > -1) {
certs = new X509Certificate[certLength + 1];
CertificateFactory cf = CertificateFactory.getInstance("X.509");
certs[0] = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(clientCert));
@@ -1201,24 +1202,30 @@
inputBuffer.addActiveFilter(inputFilters[Constants.BUFFERED_FILTER]);
}
try {
+ // Configure connection to require a certificate
+ SSLSocket.setVerify(socket, SSL.SSL_CVERIFY_REQUIRE,
+ endpoint.getSSLVerifyDepth());
// Renegociate certificates
- SSLSocket.renegotiate(socket);
- // Get client certificate and the certificate chain if present
- int certLength = SSLSocket.getInfoI(socket, SSL.SSL_INFO_CLIENT_CERT_CHAIN);
- byte[] clientCert = SSLSocket.getInfoB(socket, SSL.SSL_INFO_CLIENT_CERT);
- X509Certificate[] certs = null;
- if (clientCert != null) {
- certs = new X509Certificate[certLength + 1];
- CertificateFactory cf = CertificateFactory.getInstance("X.509");
- certs[0] = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(clientCert));
- for (int i = 0; i < certLength; i++) {
- byte[] data = SSLSocket.getInfoB(socket, SSL.SSL_INFO_CLIENT_CERT_CHAIN + i);
- certs[i+1] = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(data));
+ if (SSLSocket.renegotiate(socket) == 0) {
+ // Don't look for certs unless we know renegotiation worked.
+ // Get client certificate and the certificate chain if present
+ // certLength == -1 indicates an error
+ int certLength = SSLSocket.getInfoI(socket, SSL.SSL_INFO_CLIENT_CERT_CHAIN);
+ byte[] clientCert = SSLSocket.getInfoB(socket, SSL.SSL_INFO_CLIENT_CERT);
+ X509Certificate[] certs = null;
+ if (clientCert != null && certLength > -1) {
+ certs = new X509Certificate[certLength + 1];
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ certs[0] = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(clientCert));
+ for (int i = 0; i < certLength; i++) {
+ byte[] data = SSLSocket.getInfoB(socket, SSL.SSL_INFO_CLIENT_CERT_CHAIN + i);
+ certs[i+1] = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(data));
+ }
}
- }
- if (certs != null) {
- request.setAttribute(AprEndpoint.CERTIFICATE_KEY, certs);
- }
+ if (certs != null) {
+ request.setAttribute(AprEndpoint.CERTIFICATE_KEY, certs);
+ }
+ }
} catch (Exception e) {
log.warn(sm.getString("http11processor.socket.ssl"), e);
}
Modified: trunk/java/org/apache/tomcat/jni/SSLSocket.java
===================================================================
--- trunk/java/org/apache/tomcat/jni/SSLSocket.java 2009-10-31 18:31:47 UTC (rev 1233)
+++ trunk/java/org/apache/tomcat/jni/SSLSocket.java 2009-10-31 23:31:38 UTC (rev 1234)
@@ -48,7 +48,7 @@
* response is sent. In more detail: the renegotiation happens after the
* request line and MIME headers were read, but _before_ the attached
* request body is read. The reason simply is that in the HTTP protocol
- * usually there is no acknowledgment step between the headers and the
+ * usually there is no acknowledgement step between the headers and the
* body (there is the 100-continue feature and the chunking facility
* only), so Apache has no API hook for this step.
*
@@ -57,7 +57,30 @@
public static native int renegotiate(long thesocket);
/**
- * Retrun SSL Info parameter as byte array.
+ * Set Type of Client Certificate verification and Maximum depth of CA
+ * Certificates in Client Certificate verification.
+ * <br />
+ * This is used to change the verification level for a connection prior to
+ * starting a re-negotiation.
+ * <br />
+ * The following levels are available for level:
+ * <PRE>
+ * SSL_CVERIFY_NONE - No client Certificate is required at all
+ * SSL_CVERIFY_OPTIONAL - The client may present a valid Certificate
+ * SSL_CVERIFY_REQUIRE - The client has to present a valid
+ * Certificate
+ * SSL_CVERIFY_OPTIONAL_NO_CA - The client may present a valid Certificate
+ * but it need not to be (successfully)
+ * verifiable
+ * </PRE>
+ * <br />
+ * @param sock The socket to change.
+ * @param level Type of Client Certificate verification.
+ */
+ public static native void setVerify(long sock, int level, int depth);
+
+ /**
+ * Return SSL Info parameter as byte array.
*
* @param sock The socket to read the data from.
* @param id Parameter id.
@@ -67,7 +90,7 @@
throws Exception;
/**
- * Retrun SSL Info parameter as String.
+ * Return SSL Info parameter as String.
*
* @param sock The socket to read the data from.
* @param id Parameter id.
@@ -77,7 +100,7 @@
throws Exception;
/**
- * Retrun SSL Info parameter as integer.
+ * Return SSL Info parameter as integer.
*
* @param sock The socket to read the data from.
* @param id Parameter id.
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-10-31 18:31:47 UTC (rev 1233)
+++ trunk/webapps/docs/changelog.xml 2009-10-31 23:31:38 UTC (rev 1234)
@@ -158,6 +158,9 @@
<fix>
Cookie separators and quoting compliance fixes. (markt, kkolinko)
</fix>
+ <fix>
+ <bug>46950</bug>: Fix SSL renegociation problems. (jfclere)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
15 years, 1 month
JBossWeb SVN: r1233 - in trunk: res/jboss/org/apache/catalina/startup and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-10-31 14:31:47 -0400 (Sat, 31 Oct 2009)
New Revision: 1233
Modified:
trunk/java/org/apache/tomcat/util/http/Cookies.java
trunk/java/org/apache/tomcat/util/http/ServerCookie.java
trunk/res/jboss/org/apache/catalina/startup/catalina.properties
Log:
- Cookie update, and restore the version switch for comments.
Modified: trunk/java/org/apache/tomcat/util/http/Cookies.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/Cookies.java 2009-10-30 16:18:49 UTC (rev 1232)
+++ trunk/java/org/apache/tomcat/util/http/Cookies.java 2009-10-31 18:31:47 UTC (rev 1233)
@@ -53,6 +53,12 @@
public static final boolean STRICT_SERVLET_COMPLIANCE;
/**
+ * If true, cookie values are allowed to contain an equals character without
+ * being quoted.
+ */
+ public static final boolean ALLOW_EQUALS_IN_VALUE;
+
+ /**
* If set to true, the <code>/</code> character will be treated as a
* separator. Default is usually false. If STRICT_SERVLET_COMPLIANCE==true
* then default is true. Explicitly setting always takes priority.
@@ -70,6 +76,10 @@
"org.apache.catalina.STRICT_SERVLET_COMPLIANCE",
"false")).booleanValue();
+ ALLOW_EQUALS_IN_VALUE = Boolean.valueOf(System.getProperty(
+ "org.apache.tomcat.util.http.ServerCookie.ALLOW_EQUALS_IN_VALUE",
+ "false")).booleanValue();
+
String fwdSlashIsSeparator = System.getProperty(
"org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR");
if (fwdSlashIsSeparator == null) {
@@ -588,7 +598,11 @@
*/
public static final int getTokenEndPosition(byte bytes[], int off, int end){
int pos = off;
- while (pos < end && !isSeparator(bytes[pos])) {pos++; }
+ while (pos < end &&
+ (!isSeparator(bytes[pos]) ||
+ bytes[pos]=='=' && ALLOW_EQUALS_IN_VALUE)) {
+ pos++;
+ }
if (pos > end)
return end;
Modified: trunk/java/org/apache/tomcat/util/http/ServerCookie.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/ServerCookie.java 2009-10-30 16:18:49 UTC (rev 1232)
+++ trunk/java/org/apache/tomcat/util/http/ServerCookie.java 2009-10-31 18:31:47 UTC (rev 1233)
@@ -75,6 +75,14 @@
public static final boolean STRICT_SERVLET_COMPLIANCE;
/**
+ * If set to false, we don't auto switch invalid v0 cookies to v1 and add
+ * quotes to make them valid.
+ * Default is usually true. If STRICT_SERVLET_COMPLIANCE==true then default
+ * is false. Explicitly setting always takes priority.
+ */
+ public static final boolean ALLOW_VERSION_SWITCH;
+
+ /**
* If set to false, we don't use the IE6/7 Max-Age/Expires work around.
* Default is usually true. If STRICT_SERVLET_COMPLIANCE==true then default
* is false. Explicitly setting always takes priority.
@@ -97,6 +105,15 @@
"false")).booleanValue();
+ String allowVersionSwitch = System.getProperty(
+ "org.apache.tomcat.util.http.ServerCookie.ALLOW_VERSION_SWITCH");
+ if (allowVersionSwitch == null) {
+ ALLOW_VERSION_SWITCH = STRICT_SERVLET_COMPLIANCE;
+ } else {
+ ALLOW_VERSION_SWITCH =
+ Boolean.valueOf(allowVersionSwitch).booleanValue();
+ }
+
String alwaysAddExpires = System.getProperty(
"org.apache.tomcat.util.http.ServerCookie.ALWAYS_ADD_EXPIRES");
if (alwaysAddExpires == null) {
@@ -301,6 +318,11 @@
buf.append("=");
// Servlet implementation does not check anything else
+ // Switch version if allowed and a comment has been configured
+ if (version == 0 && comment != null && ALLOW_VERSION_SWITCH) {
+ version = 1;
+ }
+
version = maybeQuote2(version, buf, value,true);
// Add version 1 specific information
@@ -400,7 +422,7 @@
buf.append('"');
buf.append(escapeDoubleQuotes(value,1,value.length()-1));
buf.append('"');
- } else if (allowVersionSwitch && (!STRICT_SERVLET_COMPLIANCE) && version==0 && !isToken2(value, literals)) {
+ } else if (allowVersionSwitch && ALLOW_VERSION_SWITCH && version==0 && !isToken2(value, literals)) {
buf.append('"');
buf.append(escapeDoubleQuotes(value,0,value.length()));
buf.append('"');
Modified: trunk/res/jboss/org/apache/catalina/startup/catalina.properties
===================================================================
--- trunk/res/jboss/org/apache/catalina/startup/catalina.properties 2009-10-30 16:18:49 UTC (rev 1232)
+++ trunk/res/jboss/org/apache/catalina/startup/catalina.properties 2009-10-31 18:31:47 UTC (rev 1233)
@@ -11,7 +11,6 @@
org.apache.catalina.core.StandardHost.deployOnStartup=false
org.apache.catalina.core.StandardHost.deployXML=false
org.apache.catalina.core.StandardHost.startChildren=false
-org.apache.tomcat.util.http.ServerCookie.VERSION_SWITCH=true
# String cache configuration.
org.apache.tomcat.util.buf.StringCache.byte.enabled=true
15 years, 1 month
JBossWeb SVN: r1232 - in trunk: java/org/apache/tomcat/util/http and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-10-30 12:18:49 -0400 (Fri, 30 Oct 2009)
New Revision: 1232
Modified:
trunk/java/javax/servlet/http/Cookie.java
trunk/java/org/apache/tomcat/util/http/Cookies.java
trunk/java/org/apache/tomcat/util/http/ServerCookie.java
trunk/webapps/docs/changelog.xml
Log:
- Port Tomcat cookie compliance fixes.
Modified: trunk/java/javax/servlet/http/Cookie.java
===================================================================
--- trunk/java/javax/servlet/http/Cookie.java 2009-10-29 23:57:43 UTC (rev 1231)
+++ trunk/java/javax/servlet/http/Cookie.java 2009-10-30 16:18:49 UTC (rev 1232)
@@ -1,59 +1,19 @@
/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2008 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.
- *
- *
- * This file incorporates work covered by the following copyright and
- * permission notice:
- *
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed 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.
- */
-
-
-
+* 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 javax.servlet.http;
import java.text.MessageFormat;
@@ -94,7 +54,9 @@
* created using Version 0 to ensure the best interoperability.
*
*
- * @author Various
+ * @author Various
+ * @version $Version$
+ *
*/
// XXX would implement java.io.Serializable too, but can't do that
@@ -104,28 +66,28 @@
public class Cookie implements Cloneable {
private static final String LSTRING_FILE =
- "javax.servlet.http.LocalStrings";
+ "javax.servlet.http.LocalStrings";
private static ResourceBundle lStrings =
- ResourceBundle.getBundle(LSTRING_FILE);
+ ResourceBundle.getBundle(LSTRING_FILE);
//
// The value of the cookie itself.
//
- private String name; // NAME= ... "$Name" style is reserved
- private String value; // value of NAME
+ private String name; // NAME= ... "$Name" style is reserved
+ private String value; // value of NAME
//
// Attributes encoded in the header's cookie fields.
//
- private String comment; // ;Comment=VALUE ... describes cookie's use
- // ;Discard ... implied by maxAge < 0
- private String domain; // ;Domain=VALUE ... domain that sees cookie
- private int maxAge = -1; // ;Max-Age=VALUE ... cookies auto-expire
- private String path; // ;Path=VALUE ... URLs that see the cookie
- private boolean secure; // ;Secure ... e.g. use SSL
- private int version = 0; // ;Version=1 ... means RFC 2109++ style
+ private String comment; // ;Comment=VALUE ... describes cookie's use
+ // ;Discard ... implied by maxAge < 0
+ private String domain; // ;Domain=VALUE ... domain that sees cookie
+ private int maxAge = -1; // ;Max-Age=VALUE ... cookies auto-expire
+ private String path; // ;Path=VALUE ... URLs that see the cookie
+ private boolean secure; // ;Secure ... e.g. use SSL
+ private int version = 0; // ;Version=1 ... means RFC 2109++ style
private boolean isHttpOnly = false;
@@ -148,40 +110,40 @@
* <code>setVersion</code> method.
*
*
- * @param name a <code>String</code> specifying the name of the cookie
+ * @param name a <code>String</code> specifying the name of the cookie
*
- * @param value a <code>String</code> specifying the value of the cookie
+ * @param value a <code>String</code> specifying the value of the cookie
*
- * @throws IllegalArgumentException if the cookie name contains illegal characters
- * (for example, a comma, space, or semicolon)
- * or it is one of the tokens reserved for use
- * by the cookie protocol
+ * @throws IllegalArgumentException if the cookie name contains illegal characters
+ * (for example, a comma, space, or semicolon)
+ * or it is one of the tokens reserved for use
+ * by the cookie protocol
* @see #setValue
* @see #setVersion
*
*/
public Cookie(String name, String value) {
- 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")
- || name.startsWith("$")
- ) {
- String errMsg = lStrings.getString("err.cookie_name_is_token");
- Object[] errArgs = new Object[1];
- errArgs[0] = name;
- errMsg = MessageFormat.format(errMsg, errArgs);
- throw new IllegalArgumentException(errMsg);
- }
+ 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")
+ || name.startsWith("$")
+ ) {
+ String errMsg = lStrings.getString("err.cookie_name_is_token");
+ Object[] errArgs = new Object[1];
+ errArgs[0] = name;
+ errMsg = MessageFormat.format(errMsg, errArgs);
+ throw new IllegalArgumentException(errMsg);
+ }
- this.name = name;
- this.value = value;
+ this.name = name;
+ this.value = value;
}
@@ -195,15 +157,15 @@
* to the user. Comments
* are not supported by Netscape Version 0 cookies.
*
- * @param purpose a <code>String</code> specifying the comment
- * to display to the user
+ * @param purpose a <code>String</code> specifying the comment
+ * to display to the user
*
* @see #getComment
*
*/
public void setComment(String purpose) {
- comment = purpose;
+ comment = purpose;
}
@@ -213,15 +175,15 @@
* Returns the comment describing the purpose of this cookie, or
* <code>null</code> if the cookie has no comment.
*
- * @return a <code>String</code> containing the comment,
- * or <code>null</code> if none
+ * @return a <code>String</code> containing the comment,
+ * or <code>null</code> if none
*
* @see #setComment
*
*/
public String getComment() {
- return comment;
+ return comment;
}
@@ -240,16 +202,16 @@
* to the server that sent them.
*
*
- * @param pattern a <code>String</code> containing the domain name
- * within which this cookie is visible;
- * form is according to RFC 2109
+ * @param pattern a <code>String</code> containing the domain name
+ * within which this cookie is visible;
+ * form is according to RFC 2109
*
* @see #getDomain
*
*/
public void setDomain(String pattern) {
- domain = pattern.toLowerCase(); // IE allegedly needs this
+ domain = pattern.toLowerCase(); // IE allegedly needs this
}
@@ -260,14 +222,14 @@
* Returns the domain name set for this cookie. The form of
* the domain name is set by RFC 2109.
*
- * @return a <code>String</code> containing the domain name
+ * @return a <code>String</code> containing the domain name
*
* @see #setDomain
*
*/
public String getDomain() {
- return domain;
+ return domain;
}
@@ -286,10 +248,10 @@
* when the Web browser exits. A zero value causes the cookie
* to be deleted.
*
- * @param expiry an integer specifying the maximum age of the
- * cookie in seconds; if negative, means
- * the cookie is not stored; if zero, deletes
- * the cookie
+ * @param expiry an integer specifying the maximum age of the
+ * cookie in seconds; if negative, means
+ * the cookie is not stored; if zero, deletes
+ * the cookie
*
*
* @see #getMaxAge
@@ -297,7 +259,7 @@
*/
public void setMaxAge(int expiry) {
- maxAge = expiry;
+ maxAge = expiry;
}
@@ -309,9 +271,9 @@
* until browser shutdown.
*
*
- * @return an integer specifying the maximum age of the
- * cookie in seconds; if negative, means
- * the cookie persists until browser shutdown
+ * @return an integer specifying the maximum age of the
+ * cookie in seconds; if negative, means
+ * the cookie persists until browser shutdown
*
*
* @see #setMaxAge
@@ -319,7 +281,7 @@
*/
public int getMaxAge() {
- return maxAge;
+ return maxAge;
}
@@ -339,7 +301,7 @@
* information on setting path names for cookies.
*
*
- * @param uri a <code>String</code> specifying a path
+ * @param uri a <code>String</code> specifying a path
*
*
* @see #getPath
@@ -347,7 +309,7 @@
*/
public void setPath(String uri) {
- path = uri;
+ path = uri;
}
@@ -359,15 +321,15 @@
* cookie is visible to all subpaths on the server.
*
*
- * @return a <code>String</code> specifying a path that contains
- * a servlet name, for example, <i>/catalog</i>
+ * @return a <code>String</code> specifying a path that contains
+ * a servlet name, for example, <i>/catalog</i>
*
* @see #setPath
*
*/
public String getPath() {
- return path;
+ return path;
}
@@ -380,16 +342,16 @@
*
* <p>The default value is <code>false</code>.
*
- * @param flag if <code>true</code>, sends the cookie from the browser
- * to the server only when using a secure protocol;
- * if <code>false</code>, sent on any protocol
+ * @param flag if <code>true</code>, sends the cookie from the browser
+ * to the server only when using a secure protocol;
+ * if <code>false</code>, sent on any protocol
*
* @see #getSecure
*
*/
public void setSecure(boolean flag) {
- secure = flag;
+ secure = flag;
}
@@ -400,15 +362,15 @@
* only over a secure protocol, or <code>false</code> if the
* browser can send cookies using any protocol.
*
- * @return <code>true</code> if the browser uses a secure protocol;
- * otherwise, <code>true</code>
+ * @return <code>true</code> if the browser uses a secure protocol;
+ * otherwise, <code>true</code>
*
* @see #setSecure
*
*/
public boolean getSecure() {
- return secure;
+ return secure;
}
@@ -419,12 +381,12 @@
* Returns the name of the cookie. The name cannot be changed after
* creation.
*
- * @return a <code>String</code> specifying the cookie's name
+ * @return a <code>String</code> specifying the cookie's name
*
*/
public String getName() {
- return name;
+ return name;
}
@@ -442,7 +404,7 @@
* and semicolons. Empty values may not behave the same way
* on all browsers.
*
- * @param newValue a <code>String</code> specifying the new value
+ * @param newValue a <code>String</code> specifying the new value
*
*
* @see #getValue
@@ -451,7 +413,7 @@
*/
public void setValue(String newValue) {
- value = newValue;
+ value = newValue;
}
@@ -460,8 +422,8 @@
/**
* Returns the value of the cookie.
*
- * @return a <code>String</code> containing the cookie's
- * present value
+ * @return a <code>String</code> containing the cookie's
+ * present value
*
* @see #setValue
* @see Cookie
@@ -469,7 +431,7 @@
*/
public String getValue() {
- return value;
+ return value;
}
@@ -483,16 +445,16 @@
* by a browser use and identify the browser's cookie version.
*
*
- * @return 0 if the cookie complies with the
- * original Netscape specification; 1
- * if the cookie complies with RFC 2109
+ * @return 0 if the cookie complies with the
+ * original Netscape specification; 1
+ * if the cookie complies with RFC 2109
*
* @see #setVersion
*
*/
public int getVersion() {
- return version;
+ return version;
}
@@ -507,16 +469,16 @@
* version 1 as experimental; do not use it yet on production sites.
*
*
- * @param v 0 if the cookie should comply with
- * the original Netscape specification;
- * 1 if the cookie should comply with RFC 2109
+ * @param v 0 if the cookie should comply with
+ * the original Netscape specification;
+ * 1 if the cookie should comply with RFC 2109
*
* @see #getVersion
*
*/
public void setVersion(int v) {
- version = v;
+ version = v;
}
// Note -- disabled for now to allow full Netscape compatibility
@@ -525,83 +487,124 @@
// private static final String tspecials = "()<>@,;:\\\"/[]?={} \t";
private static final String tspecials = ",; ";
+ private static final String tspecials2NoSlash = "()<>@,;:\\\"[]?={} \t";
+ private static final String tspecials2WithSlash = tspecials2NoSlash + "/";
+ private static final String tspecials2;
+ /**
+ * If set to true, we parse cookies strictly according to the servlet,
+ * cookie and HTTP specs by default.
+ */
+ private static final boolean STRICT_SERVLET_COMPLIANCE;
+
+ /**
+ * If set to true, the <code>/</code> character will be treated as a
+ * separator. Default is usually false. If STRICT_SERVLET_COMPLIANCE==true
+ * then default is true. Explicitly setting always takes priority.
+ */
+ private static final boolean FWD_SLASH_IS_SEPARATOR;
+
+ /**
+ * If set to true, enforce the cookie naming rules in the spec that require
+ * no separators in the cookie name. Default is usually false. If
+ * STRICT_SERVLET_COMPLIANCE==true then default is true. Explicitly setting
+ * always takes priority.
+ */
+ private static final boolean STRICT_NAMING;
+
+
+ static {
+ STRICT_SERVLET_COMPLIANCE = Boolean.valueOf(System.getProperty(
+ "org.apache.catalina.STRICT_SERVLET_COMPLIANCE",
+ "false")).booleanValue();
+
+ String fwdSlashIsSeparator = System.getProperty(
+ "org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR");
+ if (fwdSlashIsSeparator == null) {
+ FWD_SLASH_IS_SEPARATOR = STRICT_SERVLET_COMPLIANCE;
+ } else {
+ FWD_SLASH_IS_SEPARATOR =
+ Boolean.valueOf(fwdSlashIsSeparator).booleanValue();
+ }
+
+ if (FWD_SLASH_IS_SEPARATOR) {
+ tspecials2 = tspecials2WithSlash;
+ } else {
+ tspecials2 = tspecials2NoSlash;
+ }
+
+ String strictNaming = System.getProperty(
+ "org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING");
+ if (strictNaming == null) {
+ STRICT_NAMING = STRICT_SERVLET_COMPLIANCE;
+ } else {
+ STRICT_NAMING =
+ Boolean.valueOf(strictNaming).booleanValue();
+ }
+
+ }
+
+
-
/*
* 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
*/
-
private boolean isToken(String value) {
- int len = value.length();
+ 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 (c < 0x20 || c >= 0x7f || tspecials.indexOf(c) != -1 ||
+ (STRICT_NAMING && tspecials2.indexOf(c) != -1)) {
+ return false;
+ }
+ }
+ return true;
}
-
-
-
/**
*
* Overrides the standard <code>java.lang.Object.clone</code>
* method to return a copy of this cookie.
- *
+ *
*
*/
public Object clone() {
- try {
- return super.clone();
- } catch (CloneNotSupportedException e) {
- throw new RuntimeException(e.getMessage());
- }
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e.getMessage());
}
- /**
- * Marks or unmarks this cookie as <i>HttpOnly</i>.
- *
- * <p>If <tt>isHttpOnly</tt> is set to <tt>true</tt>, this cookie is
- * marked as <i>HttpOnly</i>, by adding the <tt>HttpOnly</tt> attribute
- * to it.
- *
- * <p><i>HttpOnly</i> cookies are not supposed to be exposed to
- * client-side scripting code, and may therefore help mitigate certain
- * kinds of cross-site scripting attacks.
- *
- * @param isHttpOnly true if this cookie is to be marked as
- * <i>HttpOnly</i>, false otherwise
- *
- * @since Servlet 3.0
- */
- public void setHttpOnly(boolean isHttpOnly) {
- this.isHttpOnly = isHttpOnly;
- }
-
- /**
- * Checks whether this cookie has been marked as <i>HttpOnly</i>.
- *
- * @return true if this cookie has been marked as <i>HttpOnly</i>,
- * false otherwise
- *
- * @since Servlet 3.0
- */
- public boolean isHttpOnly() {
- return isHttpOnly;
- }
+ }
+
+ /**
+ *
+ * @return
+ * @since Servlet 3.0
+ */
+ public boolean isHttpOnly() {
+ return isHttpOnly;
+ }
+
+ /**
+ *
+ * @param httpOnly
+ * @since Servlet 3.0
+ */
+ public void setHttpOnly(boolean httpOnly) {
+ this.isHttpOnly = httpOnly;
+ }
}
Modified: trunk/java/org/apache/tomcat/util/http/Cookies.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/Cookies.java 2009-10-29 23:57:43 UTC (rev 1231)
+++ trunk/java/org/apache/tomcat/util/http/Cookies.java 2009-10-30 16:18:49 UTC (rev 1232)
@@ -37,7 +37,7 @@
private static org.jboss.logging.Logger log=
org.jboss.logging.Logger.getLogger(Cookies.class );
-
+
// expected average number of cookies per request
public static final int INITIAL_SIZE=4;
ServerCookie scookies[]=new ServerCookie[INITIAL_SIZE];
@@ -46,19 +46,54 @@
MimeHeaders headers;
+ /**
+ * If set to true, we parse cookies strictly according to the servlet,
+ * cookie and HTTP specs by default.
+ */
+ public static final boolean STRICT_SERVLET_COMPLIANCE;
+
+ /**
+ * If set to true, the <code>/</code> character will be treated as a
+ * separator. Default is usually false. If STRICT_SERVLET_COMPLIANCE==true
+ * then default is true. Explicitly setting always takes priority.
+ */
+ public static final boolean FWD_SLASH_IS_SEPARATOR;
+
/*
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', ' ', '\"', '\'', '(', ')', ',',
- ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '{', '}' };
+ public static final char SEPARATORS[];
protected static final boolean separators[] = new boolean[128];
static {
+ STRICT_SERVLET_COMPLIANCE = Boolean.valueOf(System.getProperty(
+ "org.apache.catalina.STRICT_SERVLET_COMPLIANCE",
+ "false")).booleanValue();
+
+ String fwdSlashIsSeparator = System.getProperty(
+ "org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR");
+ if (fwdSlashIsSeparator == null) {
+ FWD_SLASH_IS_SEPARATOR = STRICT_SERVLET_COMPLIANCE;
+ } else {
+ FWD_SLASH_IS_SEPARATOR =
+ Boolean.valueOf(fwdSlashIsSeparator).booleanValue();
+ }
+
+ /*
+ Excluding the '/' char by default violates the RFC, but
+ it looks like a lot of people put '/'
+ in unquoted values: '/': ; //47
+ '\t':9 ' ':32 '\"':34 '(':40 ')':41 ',':44 ':':58 ';':59 '<':60
+ '=':61 '>':62 '?':63 '@':64 '[':91 '\\':92 ']':93 '{':123 '}':125
+ */
+ if (FWD_SLASH_IS_SEPARATOR) {
+ SEPARATORS = new char[] { '\t', ' ', '\"', '(', ')', ',', '/',
+ ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '{', '}' };
+ } else {
+ SEPARATORS = new char[] { '\t', ' ', '\"', '(', ')', ',',
+ ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '{', '}' };
+ }
+
for (int i = 0; i < 128; i++) {
separators[i] = false;
}
@@ -190,13 +225,15 @@
// Uncomment to test the new parsing code
if( cookieValue.getType() == MessageBytes.T_BYTES ) {
- if( dbg>0 ) log( "Parsing b[]: " + cookieValue.toString());
+ if(log.isDebugEnabled())
+ log.debug("Cookies: Parsing b[]: " + cookieValue.toString());
ByteChunk bc=cookieValue.getByteChunk();
processCookieHeader( bc.getBytes(),
bc.getOffset(),
bc.getLength());
} else {
- if( dbg>0 ) log( "Parsing S: " + cookieValue.toString());
+ if(log.isDebugEnabled())
+ log.debug("Cookies: Parsing S: " + cookieValue.toString());
processCookieHeader( cookieValue.toString() );
}
pos++;// search from the next position
@@ -224,7 +261,8 @@
private void processCookieHeader( String cookieString )
{
- if( dbg>0 ) log( "Parsing cookie header " + cookieString );
+ if(log.isDebugEnabled())
+ log.debug("Cookies: Parsing cookie header " + cookieString);
// normal cookie, with a string value.
// This is the original code, un-optimized - it shouldn't
// happen in normal case
@@ -248,7 +286,8 @@
cookie.getName().setString(name);
cookie.getValue().setString(value);
- if( dbg > 0 ) log( "Add cookie " + name + "=" + value);
+ if(log.isDebugEnabled())
+ log.debug("Cookies: Add cookie " + name + "=" + value);
} else {
// we have a bad cookie.... just let it go
}
@@ -278,15 +317,6 @@
return value;
}
-
- // log
- static final int dbg=0;
- public void log(String s ) {
- if (log.isDebugEnabled())
- log.debug("Cookies: " + s);
- }
-
-
/**
* Returns true if the byte is a separator character as
* defined in RFC2619. Since this is called often, this
@@ -370,7 +400,7 @@
pos = nameEnd = getTokenEndPosition(bytes,pos,end);
// Skip whitespace
- while (pos < end && isWhiteSpace(bytes[pos])) {pos++; };
+ while (pos < end && isWhiteSpace(bytes[pos])) {pos++; }
// Check for an '=' -- This could also be a name-only
@@ -390,7 +420,7 @@
// Determine what type of value this is, quoted value,
// token, name-only with an '=', or other (bad)
switch (bytes[pos]) {
- case '"':; // Quoted Value
+ case '"': // Quoted Value
isQuoted = true;
valueStart=pos + 1; // strip "
// getQuotedValue returns the position before
@@ -413,7 +443,7 @@
valueStart = valueEnd = -1;
// The position is OK (On a delimiter)
break;
- default:;
+ default:
if (!isSeparator(bytes[pos])) {
// Token
valueStart=pos;
@@ -426,10 +456,11 @@
// 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");
+ log.info("Cookies: Invalid cookie." +
+ "Value not a token or quoted value");
while (pos < end && bytes[pos] != ';' &&
bytes[pos] != ',')
- {pos++; };
+ {pos++; }
pos++;
// Make sure no special avpairs can be attributed to
// the previous cookie by setting the current cookie
@@ -450,7 +481,7 @@
// in a good state.
// Skip whitespace
- while (pos < end && isWhiteSpace(bytes[pos])) {pos++; };
+ while (pos < end && isWhiteSpace(bytes[pos])) {pos++; }
// Make sure that after the cookie we have a separator. This
@@ -525,7 +556,7 @@
}
// Unknown cookie, complain
- log("Unknown Special Cookie");
+ log.info("Cookies: Unknown Special Cookie");
} else { // Normal Cookie
sc = addCookie();
@@ -557,7 +588,7 @@
*/
public static final int getTokenEndPosition(byte bytes[], int off, int end){
int pos = off;
- while (pos < end && !isSeparator(bytes[pos])) {pos++; };
+ while (pos < end && !isSeparator(bytes[pos])) {pos++; }
if (pos > end)
return end;
Modified: trunk/java/org/apache/tomcat/util/http/ServerCookie.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/ServerCookie.java 2009-10-29 23:57:43 UTC (rev 1231)
+++ trunk/java/org/apache/tomcat/util/http/ServerCookie.java 2009-10-30 16:18:49 UTC (rev 1232)
@@ -68,24 +68,54 @@
};
private static final String ancientDate;
+ /**
+ * If set to true, we parse cookies strictly according to the servlet,
+ * cookie and HTTP specs by default.
+ */
+ public static final boolean STRICT_SERVLET_COMPLIANCE;
- static {
- ancientDate = OLD_COOKIE_FORMAT.get().format(new Date(10000));
- }
-
/**
- * If set to true, we parse cookies according to the servlet spec,
+ * If set to false, we don't use the IE6/7 Max-Age/Expires work around.
+ * Default is usually true. If STRICT_SERVLET_COMPLIANCE==true then default
+ * is false. Explicitly setting always takes priority.
*/
- public static final boolean VERSION_SWITCH =
- Boolean.valueOf(System.getProperty("org.apache.tomcat.util.http.ServerCookie.VERSION_SWITCH", "true")).booleanValue();
+ public static final boolean ALWAYS_ADD_EXPIRES;
/**
- * If set to false, we don't use the IE6/7 Max-Age/Expires work around
+ * If set to true, the <code>/</code> character will be treated as a
+ * separator. Default is usually false. If STRICT_SERVLET_COMPLIANCE==true
+ * then default is true. Explicitly setting always takes priority.
*/
- public static final boolean ALWAYS_ADD_EXPIRES =
- Boolean.valueOf(System.getProperty("org.apache.tomcat.util.http.ServerCookie.ALWAYS_ADD_EXPIRES", "false")).booleanValue();
+ public static final boolean FWD_SLASH_IS_SEPARATOR;
+ static {
+ ancientDate = OLD_COOKIE_FORMAT.get().format(new Date(10000));
+
+ STRICT_SERVLET_COMPLIANCE = Boolean.valueOf(System.getProperty(
+ "org.apache.catalina.STRICT_SERVLET_COMPLIANCE",
+ "false")).booleanValue();
+
+
+ String alwaysAddExpires = System.getProperty(
+ "org.apache.tomcat.util.http.ServerCookie.ALWAYS_ADD_EXPIRES");
+ if (alwaysAddExpires == null) {
+ ALWAYS_ADD_EXPIRES = !STRICT_SERVLET_COMPLIANCE;
+ } else {
+ ALWAYS_ADD_EXPIRES =
+ Boolean.valueOf(alwaysAddExpires).booleanValue();
+ }
+
+ String fwdSlashIsSeparator = System.getProperty(
+ "org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR");
+ if (fwdSlashIsSeparator == null) {
+ FWD_SLASH_IS_SEPARATOR = STRICT_SERVLET_COMPLIANCE;
+ } else {
+ FWD_SLASH_IS_SEPARATOR =
+ Boolean.valueOf(fwdSlashIsSeparator).booleanValue();
+ }
+ }
+
// Note: Servlet Spec =< 2.5 only refers to Netscape and RFC2109,
// not RFC2965
@@ -223,26 +253,6 @@
return true;
}
- /**
- * @deprecated - Not used
- */
- public static boolean checkName( String name ) {
- 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
@@ -290,12 +300,7 @@
buf.append( name );
buf.append("=");
// Servlet implementation does not check anything else
-
- // Switch version if allowed and a comment has been configured
- if (version == 0 && comment != null && VERSION_SWITCH) {
- version = 1;
- }
-
+
version = maybeQuote2(version, buf, value,true);
// Add version 1 specific information
@@ -319,6 +324,10 @@
// Max-Age=secs ... or use old "Expires" format
// TODO RFC2965 Discard
if (maxAge >= 0) {
+ if (version > 0) {
+ buf.append ("; Max-Age=");
+ buf.append (maxAge);
+ }
// IE6, IE7 and possibly other browsers don't understand Max-Age.
// They do understand Expires, even with V1 cookies!
if (version == 0 || ALWAYS_ADD_EXPIRES) {
@@ -332,9 +341,6 @@
new Date(System.currentTimeMillis() +
maxAge*1000L),
buf, new FieldPosition(0));
- } else {
- buf.append ("; Max-Age=");
- buf.append (maxAge);
}
}
@@ -344,7 +350,13 @@
if (version==0) {
maybeQuote2(version, buf, path);
} else {
- maybeQuote2(version, buf, path, ServerCookie.tspecials2NoSlash, false);
+ if (FWD_SLASH_IS_SEPARATOR) {
+ maybeQuote2(version, buf, path, ServerCookie.tspecials,
+ false);
+ } else {
+ maybeQuote2(version, buf, path,
+ ServerCookie.tspecials2NoSlash, false);
+ }
}
}
@@ -360,21 +372,6 @@
headerBuf.append(buf);
}
- /**
- * @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,0,value.length()));
- buf.append('"');
- }
- }
-
public static boolean alreadyQuoted (String value) {
if (value==null || value.length()==0) return false;
return (value.charAt(0)=='\"' && value.charAt(value.length()-1)=='\"');
@@ -403,7 +400,7 @@
buf.append('"');
buf.append(escapeDoubleQuotes(value,1,value.length()-1));
buf.append('"');
- } else if (allowVersionSwitch && VERSION_SWITCH && version==0 && !isToken2(value, literals)) {
+ } else if (allowVersionSwitch && (!STRICT_SERVLET_COMPLIANCE) && version==0 && !isToken2(value, literals)) {
buf.append('"');
buf.append(escapeDoubleQuotes(value,0,value.length()));
buf.append('"');
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-10-29 23:57:43 UTC (rev 1231)
+++ trunk/webapps/docs/changelog.xml 2009-10-30 16:18:49 UTC (rev 1232)
@@ -155,6 +155,9 @@
<fix>
<bug>47225</bug>: Fix bad length when redirecting in the mapper. (markt)
</fix>
+ <fix>
+ Cookie separators and quoting compliance fixes. (markt, kkolinko)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
15 years, 1 month
JBossWeb SVN: r1231 - tags.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-10-29 19:57:43 -0400 (Thu, 29 Oct 2009)
New Revision: 1231
Added:
tags/JBOSSWEB_2_1_5_GA/
Log:
- JBoss Web 2.1.5.
- Character encoding fix.
Copied: tags/JBOSSWEB_2_1_5_GA (from rev 1230, branches/2.1.x)
15 years, 1 month
JBossWeb SVN: r1230 - trunk/java/org/jboss/web/rewrite.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-10-29 11:28:15 -0400 (Thu, 29 Oct 2009)
New Revision: 1230
Modified:
trunk/java/org/jboss/web/rewrite/RewriteRule.java
trunk/java/org/jboss/web/rewrite/RewriteValve.java
trunk/java/org/jboss/web/rewrite/TomcatResolver.java
Log:
- No proxy, so raise an error if the flag is used.
Modified: trunk/java/org/jboss/web/rewrite/RewriteRule.java
===================================================================
--- trunk/java/org/jboss/web/rewrite/RewriteRule.java 2009-10-29 15:27:50 UTC (rev 1229)
+++ trunk/java/org/jboss/web/rewrite/RewriteRule.java 2009-10-29 15:28:15 UTC (rev 1230)
@@ -278,11 +278,11 @@
* module. Use this flag to achieve a more powerful implementation of the
* ProxyPass directive, to map some remote stuff into the namespace of
* the local server.
- * FIXME: No proxy
+ * Note: No proxy
*/
/**
- * FIXME: No passthrough ?
+ * Note: No passthrough
*/
/**
Modified: trunk/java/org/jboss/web/rewrite/RewriteValve.java
===================================================================
--- trunk/java/org/jboss/web/rewrite/RewriteValve.java 2009-10-29 15:27:50 UTC (rev 1229)
+++ trunk/java/org/jboss/web/rewrite/RewriteValve.java 2009-10-29 15:28:15 UTC (rev 1230)
@@ -674,9 +674,9 @@
rule.setNocase(true);
} else if (flag.startsWith("noescape") || flag.startsWith("NE")) {
rule.setNoescape(true);
+ /* Proxy not supported, would require strong proxy capabilities
} else if (flag.startsWith("proxy") || flag.startsWith("P")) {
- // FIXME: Proxy not supported at the moment, would require proxy capabilities
- //rule.setProxy(true);
+ rule.setProxy(true);*/
} else if (flag.startsWith("qsappend") || flag.startsWith("QSA")) {
rule.setQsappend(true);
} else if (flag.startsWith("redirect") || flag.startsWith("R")) {
Modified: trunk/java/org/jboss/web/rewrite/TomcatResolver.java
===================================================================
--- trunk/java/org/jboss/web/rewrite/TomcatResolver.java 2009-10-29 15:27:50 UTC (rev 1229)
+++ trunk/java/org/jboss/web/rewrite/TomcatResolver.java 2009-10-29 15:28:15 UTC (rev 1230)
@@ -77,7 +77,7 @@
} else if (key.equals("REQUEST_METHOD")) {
return request.getMethod();
} else if (key.equals("SCRIPT_FILENAME")) {
- return request.getRealPath(request.getServletPath()); //FIXME ?
+ return request.getRealPath(request.getServletPath());
} else if (key.equals("REQUEST_PATH")) {
return request.getRequestPathMB().toString();
} else if (key.equals("CONTEXT_PATH")) {
15 years, 1 month
JBossWeb SVN: r1229 - trunk/java/org/apache/tomcat/util/net.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-10-29 11:27:50 -0400 (Thu, 29 Oct 2009)
New Revision: 1229
Modified:
trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
Log:
- Remove the very risky dead code to destroy when things go really wrong. After fixing the real bugs, this scenario
never occurs.
Modified: trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2009-10-29 00:54:53 UTC (rev 1228)
+++ trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2009-10-29 15:27:50 UTC (rev 1229)
@@ -1764,16 +1764,6 @@
// Close socket and clear pool
Socket.destroy(desc[n*2+1]);
}
- // FIXME: decide vs destroy
- /*
- if ((desc[n*2] & Poll.APR_POLLHUP) == Poll.APR_POLLHUP) {
- // Destroy and reallocate the poller
- reset = true;
- if (skip == null) {
- skip = new ArrayList<Long>();
- }
- skip.add(desc[n*2+1]);
- }*/
} else if ((desc[n*2] & Poll.APR_POLLIN) == Poll.APR_POLLIN) {
if (!processSocket(desc[n*2+1], SocketStatus.OPEN_READ)) {
// Close socket and clear pool
@@ -1789,16 +1779,6 @@
|| ((desc[n*2] & Poll.APR_POLLERR) == Poll.APR_POLLERR)) {
// Close socket and clear pool
Socket.destroy(desc[n*2+1]);
- // FIXME: decide vs destroy
- /*
- if ((desc[n*2] & Poll.APR_POLLHUP) == Poll.APR_POLLHUP) {
- // Destroy and reallocate the poller
- reset = true;
- if (skip == null) {
- skip = new ArrayList<Long>();
- }
- skip.add(desc[n*2+1]);
- }*/
} else if (!processSocket(desc[n*2+1])) {
// Close socket and clear pool
Socket.destroy(desc[n*2+1]);
@@ -1821,21 +1801,9 @@
// Reallocate the current poller
int count = Poll.pollset(pollers[i], desc);
long newPoller = allocatePoller(actualPollerSize, pool, -1);
- // FIXME: don't restore connections for now, since I have not tested it
+ // Don't restore connections for now, since I have not tested it
pollerSpace[i] = actualPollerSize;
connectionCount -= count;
- /*
- for (int j = 0; j < count; j++) {
- int events = (int) desc[2*j];
- long socket = desc[2*j+1];
- Poll.remove(pollers[i], socket);
- if (skip != null && skip.contains(socket)) {
- continue;
- }
- if (Poll.add(newPoller, socket, events) != Status.APR_SUCCESS) {
- // Skip
- }
- }*/
Poll.destroy(pollers[i]);
pollers[i] = newPoller;
}
15 years, 1 month
JBossWeb SVN: r1228 - in trunk: java/javax/annotation and 2 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-10-28 20:54:53 -0400 (Wed, 28 Oct 2009)
New Revision: 1228
Added:
trunk/java/javax/annotation/ManagedBean.java
trunk/java/javax/annotation/Named.java
trunk/java/javax/annotation/NonBinding.java
trunk/java/javax/annotation/Stereotype.java
trunk/java/javax/annotation/package.html
trunk/java/javax/annotation/security/package.html
trunk/java/javax/annotation/sql/
trunk/java/javax/annotation/sql/DataSourceDefinition.java
trunk/java/javax/annotation/sql/DataSourceDefinitions.java
Modified:
trunk/build.xml
trunk/java/javax/annotation/Generated.java
trunk/java/javax/annotation/PostConstruct.java
trunk/java/javax/annotation/PreDestroy.java
trunk/java/javax/annotation/Resource.java
trunk/java/javax/annotation/Resources.java
trunk/java/javax/annotation/security/DeclareRoles.java
trunk/java/javax/annotation/security/DenyAll.java
trunk/java/javax/annotation/security/PermitAll.java
trunk/java/javax/annotation/security/RolesAllowed.java
trunk/java/javax/annotation/security/RunAs.java
Log:
- Update common annotations (from the RI for now, as with the rest of the API).
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2009-10-28 15:08:23 UTC (rev 1227)
+++ trunk/build.xml 2009-10-29 00:54:53 UTC (rev 1228)
@@ -127,11 +127,10 @@
<target name="package" >
- <!-- Common Annotations 1.0 JAR File -->
+ <!-- Common Annotations 1.1 JAR File -->
<jar jarfile="${annotations-api.jar}">
<fileset dir="${tomcat.classes}">
- <include name="javax/annotation/*" />
- <include name="javax/annotation/security/*" />
+ <include name="javax/annotation/**" />
<include name="javax/ejb/*" />
<include name="javax/persistence/*" />
<include name="javax/xml/ws/*" />
@@ -141,7 +140,7 @@
</fileset>
</jar>
- <!-- Servlet 2.5 Implementation JAR File -->
+ <!-- Servlet 3.0 Implementation JAR File -->
<jar jarfile="${servlet-api.jar}">
<fileset dir="${tomcat.classes}">
<include name="javax/servlet/*" />
@@ -155,7 +154,7 @@
</fileset>
</jar>
- <!-- JSP 2.1 Implementation JAR File -->
+ <!-- JSP 2.2 Implementation JAR File -->
<jar jarfile="${jsp-api.jar}">
<fileset dir="${tomcat.classes}">
<include name="javax/servlet/jsp/**" />
@@ -165,7 +164,7 @@
</fileset>
</jar>
- <!-- JSP 2.1 EL Implementation JAR File -->
+ <!-- JSP 2.2 EL Implementation JAR File -->
<jar jarfile="${el-api.jar}">
<fileset dir="${tomcat.classes}">
<include name="javax/el/*" />
Modified: trunk/java/javax/annotation/Generated.java
===================================================================
--- trunk/java/javax/annotation/Generated.java 2009-10-28 15:08:23 UTC (rev 1227)
+++ trunk/java/javax/annotation/Generated.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -1,35 +1,73 @@
/*
- * 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
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
*
- * 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.
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
*/
+/*
+ *
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
package javax.annotation;
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+/**
+ * The Generated annoation is used to mark source code that has been generated.
+ * It can also be used to differentiate user written code from generated code
+ * in a single file. When used, the value element must have the name of the
+ * code generator. The recommended convention is to use the fully qualified
+ * name of the code generator in the value field .
+ * For example: com.company.package.classname.
+ * The date element is used to indicate the date the source was generated.
+ * The date element must follow the ISO 8601 standard. For example the date
+ * element would have the following value 2001-07-04T12:08:56.235-0700
+ * which represents 2001-07-04 12:08:56 local time in the U.S. Pacific
+ * Time time zone.
+ * The comment element is a place holder for any comments that the code
+ * generator may want to include in the generated code.
+ *
+ * @since Common Annotations 1.0
+ */
-(a)Target({ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR,
- ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD,
- ElementType.PACKAGE, ElementType.PARAMETER, ElementType.TYPE})
-(a)Retention(RetentionPolicy.SOURCE)
+@Documented
+@Retention(SOURCE)
+@Target({PACKAGE, TYPE, ANNOTATION_TYPE, METHOD, CONSTRUCTOR, FIELD,
+ LOCAL_VARIABLE, PARAMETER})
+public @interface Generated {
+ /**
+ * This is used by the code generator to mark the generated classes
+ * and methods.
+ */
+ String[] value();
-public @interface Generated {
- public String[] value();
- public String date() default "";
- public String comment() default "";
+ /**
+ * Date when the source was generated.
+ */
+ String date() default "";
+
+ /**
+ * A place holder for any comments that the code generator may want to
+ * include in the generated code.
+ */
+ String comments() default "";
}
+
Added: trunk/java/javax/annotation/ManagedBean.java
===================================================================
--- trunk/java/javax/annotation/ManagedBean.java (rev 0)
+++ trunk/java/javax/annotation/ManagedBean.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -0,0 +1,56 @@
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
+ */
+
+/*
+ *
+ * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
+package javax.annotation;
+
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * The ManagedBean annotation marks a POJO (Plain Old Java Object) as a
+ * ManagedBean.A ManagedBean supports a small set of basic services such as
+ * resource injection, lifecycle callbacks and interceptors.
+ *
+ * @since Common Annotations 1.1
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+public @interface ManagedBean {
+ /**
+ * The name of the Managed Bean. Managed Bean names must be unique within a
+ * Java EE module. For each named Managed Bean, Java EE containers must make
+ * available the following entries in JNDI, using the same naming scheme used
+ * for EJB components.
+ * <p>
+ * In the application namespace: <p>
+ * java:app/<module-name>/<bean-name> <p>
+ * In the module namespace of the module containing the Managed Bean:
+ * <p> java:module/<bean-name>
+ *
+ */
+ public String value() default "";
+}
Added: trunk/java/javax/annotation/Named.java
===================================================================
--- trunk/java/javax/annotation/Named.java (rev 0)
+++ trunk/java/javax/annotation/Named.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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 javax.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Specifies the name of a bean.
+ *
+ * @author Gavin King
+ * @author Pete Muir
+ */
+
+@Target( { TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface Named
+{
+
+ /**
+ * If no name is explicitly specified, the default name is used.
+ *
+ * For simple beans and session beans the default name is the unqualified
+ * class name of the bean class, after converting the first character to
+ * lower case.
+ *
+ * For producer methods the default name is the method name, unless the
+ * method follows the JavaBeans property getter naming convention, in which
+ * case the default name is the JavaBeans property name.
+ *
+ * @return the bean name
+ */
+ public String value() default "";
+
+}
Added: trunk/java/javax/annotation/NonBinding.java
===================================================================
--- trunk/java/javax/annotation/NonBinding.java (rev 0)
+++ trunk/java/javax/annotation/NonBinding.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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 javax.annotation;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Specifies that a member of a binding type or interceptor binding type is to
+ * be ignored for the purposes of resolution.
+ *
+ * @author Gavin King
+ *
+ */
+@Retention(RUNTIME)
+@Target(METHOD)
+public @interface NonBinding
+{
+}
Modified: trunk/java/javax/annotation/PostConstruct.java
===================================================================
--- trunk/java/javax/annotation/PostConstruct.java 2009-10-28 15:08:23 UTC (rev 1227)
+++ trunk/java/javax/annotation/PostConstruct.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -1,30 +1,64 @@
/*
- * 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
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
*
- * 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.
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
*/
+/*
+ *
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
package javax.annotation;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
-(a)Target({ElementType.METHOD})
-(a)Retention(RetentionPolicy.RUNTIME)
-
+/**
+ * The PostConstruct annotation is used on a method that needs to be executed
+ * after dependency injection is done to perform any initialization. This
+ * method MUST be invoked before the class is put into service. This
+ * annotation MUST be supported on all classes that support dependency
+ * injection. The method annotated with PostConstruct MUST be invoked even
+ * if the class does not request any resources to be injected. Only one
+ * method can be annotated with this annotation. The method on which the
+ * PostConstruct annotation is applied MUST fulfill all of the following
+ * criteria -
+- The method MUST NOT have any parameters except in the case of EJB
+ * interceptors in which case it takes an InvocationC ontext object as
+ * defined by the EJB specification.
+ * - The return type of the method MUST be void.
+ * - The method MUST NOT throw a checked exception.
+ * - The method on which PostConstruct is applied MAY be public, protected,
+ * package private or private.
+ * - The method MUST NOT be static except for the application client.
+ * - The method MAY be final.
+ * - If the method throws an unchecked exception the class MUST NOT be put into
+ * service except in the case of EJBs where the EJB can handle exceptions and
+ * even recover from them.
+ * @since Common Annotations 1.0
+ * @see javax.annotation.PreDestroy
+ * @see javax.annotation.Resource
+ */
+@Documented
+@Retention (RUNTIME)
+@Target(METHOD)
public @interface PostConstruct {
}
Modified: trunk/java/javax/annotation/PreDestroy.java
===================================================================
--- trunk/java/javax/annotation/PreDestroy.java 2009-10-28 15:08:23 UTC (rev 1227)
+++ trunk/java/javax/annotation/PreDestroy.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -1,30 +1,64 @@
/*
- * 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
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
*
- * 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.
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
*/
+/*
+ *
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
package javax.annotation;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
-(a)Target({ElementType.METHOD})
-(a)Retention(RetentionPolicy.RUNTIME)
+/**
+ * The PreDestroy annotation is used on methods as a callback notification to
+ * signal that the instance is in the process of being removed by the
+ * container. The method annotated with PreDestroy is typically used to
+ * release resources that it has been holding. This annotation MUST be
+ * supported by all container managed objects that support PostConstruct
+ * except the application client container in Java EE 5. The method on which
+ * the PreDestroy annotation is applied MUST fulfill all of the following
+ * criteria -
+ * - The method MUST NOT have any parameters except in the case of EJB
+ * interceptors in which case it takes an InvocationContext object as defined
+ * by the EJB specification.
+ * - The return type of the method MUST be void.
+ * - The method MUST NOT throw a checked exception.
+ * - The method on which PreDestroy is applied MAY be public, protected,
+ * package private or private.
+ * - The method MUST NOT be static.
+ * - The method MAY be final.
+ * - If the method throws an unchecked exception it is ignored except in the
+ * case of EJBs where the EJB can handle exceptions.
+ *
+ * @see javax.annotation.PostConstruct
+ * @see javax.annotation.Resource
+ * @since Common Annotations 1.0
+ */
+@Documented
+@Retention (RUNTIME)
+@Target(METHOD)
public @interface PreDestroy {
}
Modified: trunk/java/javax/annotation/Resource.java
===================================================================
--- trunk/java/javax/annotation/Resource.java 2009-10-28 15:08:23 UTC (rev 1227)
+++ trunk/java/javax/annotation/Resource.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -1,40 +1,132 @@
/*
- * 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
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
*
- * 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.
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
*/
+/*
+ *
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
package javax.annotation;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
-(a)Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
-(a)Retention(RetentionPolicy.RUNTIME)
+/**
+ * The Resource annotation marks a resource that is needed
+ * by the application. This annotation may be applied to an
+ * application component class, or to fields or methods of the
+ * component class. When the annotation is applied to a
+ * field or method, the container will inject an instance
+ * of the requested resource into the application component
+ * when the component is initialized. If the annotation is
+ * applied to the component class, the annotation declares a
+ * resource that the application will look up at runtime. <p>
+ *
+ * Even though this annotation is not marked Inherited, deployment
+ * tools are required to examine all superclasses of any component
+ * class to discover all uses of this annotation in all superclasses.
+ * All such annotation instances specify resources that are needed
+ * by the application component. Note that this annotation may
+ * appear on private fields and methods of superclasses; the container
+ * is required to perform injection in these cases as well.
+ *
+ * @since Common Annotations 1.0
+ */
+@Target({TYPE, FIELD, METHOD})
+@Retention(RUNTIME)
+public @interface Resource {
+ /**
+ * The JNDI name of the resource. For field annotations,
+ * the default is the field name. For method annotations,
+ * the default is the JavaBeans property name corresponding
+ * to the method. For class annotations, there is no default
+ * and this must be specified.
+ */
+ String name() default "";
-public @interface Resource {
- public enum AuthenticationType {
- CONTAINER,
- APPLICATION
+ /**
+ * The name of the resource that the reference points to. It can
+ * link to any compatible resource using the global JNDI names.
+ */
+
+ String lookup() default "";
+
+ /**
+ * The Java type of the resource. For field annotations,
+ * the default is the type of the field. For method annotations,
+ * the default is the type of the JavaBeans property.
+ * For class annotations, there is no default and this must be
+ * specified.
+ */
+ Class type() default java.lang.Object.class;
+
+ /**
+ * The two possible authentication types for a resource.
+ */
+ enum AuthenticationType {
+ CONTAINER,
+ APPLICATION
}
- public String name() default "";
- public Class type() default Object.class;
- public AuthenticationType authenticationType() default AuthenticationType.CONTAINER;
- public boolean shareable() default true;
- public String description() default "";
- public String mappedName() default "";
+
+ /**
+ * The authentication type to use for this resource.
+ * This may be specified for resources representing a
+ * connection factory of any supported type, and must
+ * not be specified for resources of other types.
+ */
+ AuthenticationType authenticationType() default AuthenticationType.CONTAINER;
+
+ /**
+ * Indicates whether this resource can be shared between
+ * this component and other components.
+ * This may be specified for resources representing a
+ * connection factory of any supported type, and must
+ * not be specified for resources of other types.
+ */
+ boolean shareable() default true;
+
+ /**
+ * A product specific name that this resource should be mapped to.
+ * The name of this resource, as defined by the <code>name</code>
+ * element or defaulted, is a name that is local to the application
+ * component using the resource. (It's a name in the JNDI
+ * <code>java:comp/env</code> namespace.) Many application servers
+ * provide a way to map these local names to names of resources
+ * known to the application server. This mapped name is often a
+ * <i>global</i> JNDI name, but may be a name of any form. <p>
+ *
+ * Application servers are not required to support any particular
+ * form or type of mapped name, nor the ability to use mapped names.
+ * The mapped name is product-dependent and often installation-dependent.
+ * No use of a mapped name is portable.
+ */
+ String mappedName() default "";
+
+ /**
+ * Description of this resource. The description is expected
+ * to be in the default language of the system on which the
+ * application is deployed. The description can be presented
+ * to the Deployer to help in choosing the correct resource.
+ */
+ String description() default "";
}
Modified: trunk/java/javax/annotation/Resources.java
===================================================================
--- trunk/java/javax/annotation/Resources.java 2009-10-28 15:08:23 UTC (rev 1227)
+++ trunk/java/javax/annotation/Resources.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -1,31 +1,48 @@
/*
- * 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
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
*
- * 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.
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
*/
+/*
+ *
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
package javax.annotation;
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+/**
+ * This class is used to allow multiple resources declarations.
+ *
+ * @see javax.annotation.Resource
+ * @since Common Annotations 1.0
+ */
-(a)Target({ElementType.TYPE})
-(a)Retention(RetentionPolicy.RUNTIME)
-
+@Documented
+@Retention(RUNTIME)
+@Target(TYPE)
public @interface Resources {
- public Resource[] value();
+ /**
+ * Array used for multiple resource declarations.
+ */
+ Resource[] value();
}
Added: trunk/java/javax/annotation/Stereotype.java
===================================================================
--- trunk/java/javax/annotation/Stereotype.java (rev 0)
+++ trunk/java/javax/annotation/Stereotype.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -0,0 +1,55 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed 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 javax.annotation;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Specifies that an annotation type is a stereotype.
+ *
+ * @author Pete Muir
+ * @author Gavin King
+ */
+
+@Retention(RUNTIME)
+@Target(ANNOTATION_TYPE)
+@Documented
+public @interface Stereotype
+{
+
+ /**
+ * Restrict the scope of the stereotyped bean
+ *
+ * @return the allowed scopes
+ */
+ public Class<? extends Annotation>[] supportedScopes() default {};
+
+ /**
+ * Require that stereotype beans have certain API types
+ *
+ * @return the required types
+ */
+ public Class<?>[] requiredTypes() default {};
+
+}
Added: trunk/java/javax/annotation/package.html
===================================================================
--- trunk/java/javax/annotation/package.html (rev 0)
+++ trunk/java/javax/annotation/package.html 2009-10-29 00:54:53 UTC (rev 1228)
@@ -0,0 +1,29 @@
+<!--
+
+ The contents of this file are subject to the terms
+ of the Common Development and Distribution License
+ (the "License"). You may not use this file except
+ in compliance with the License.
+
+ You can obtain a copy of the license at
+ glassfish/bootstrap/legal/CDDLv1.0.txt or
+ https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ See the License for the specific language governing
+ permissions and limitations under the License.
+
+ When distributing Covered Code, include this CDDL
+ HEADER in each file and include the License file at
+ glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your
+ own identifying information: Portions Copyright [yyyy]
+ [name of copyright owner]
+
+ Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+-->
+
+<html>
+<body>
+ This package defines the common annotations.
+</body>
+</html>
Modified: trunk/java/javax/annotation/security/DeclareRoles.java
===================================================================
--- trunk/java/javax/annotation/security/DeclareRoles.java 2009-10-28 15:08:23 UTC (rev 1227)
+++ trunk/java/javax/annotation/security/DeclareRoles.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -1,31 +1,44 @@
/*
- * 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
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
*
- * 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.
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
*/
+/*
+ *
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
package javax.annotation.security;
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-(a)Target({ElementType.TYPE})
-(a)Retention(RetentionPolicy.RUNTIME)
-
+/**
+ * Used by application to declare roles. It can be
+ * specified on a class.
+ *
+ * @since Common Annotations 1.0
+ */
+@Documented
+@Retention (RUNTIME)
+@Target(TYPE)
public @interface DeclareRoles {
- public String[] value();
+ String[] value();
}
Modified: trunk/java/javax/annotation/security/DenyAll.java
===================================================================
--- trunk/java/javax/annotation/security/DenyAll.java 2009-10-28 15:08:23 UTC (rev 1227)
+++ trunk/java/javax/annotation/security/DenyAll.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -1,30 +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
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
*
- * 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.
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
*/
+/*
+ *
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
package javax.annotation.security;
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-(a)Target({ElementType.METHOD})
-(a)Retention(RetentionPolicy.RUNTIME)
-
+/**
+ * Specifies that no security roles are allowed to invoke the specified
+ * method(s) - i.e that the methods are to be excluded from execution in
+ * the J2EE container.
+ *
+ * @see javax.annotation.security.RolesAllowed
+ * @see javax.annotation.security.PermitAll
+ * @since Common Annotations 1.0
+ */
+@Documented
+@Retention (RUNTIME)
+@Target({TYPE, METHOD})
public @interface DenyAll {
}
Modified: trunk/java/javax/annotation/security/PermitAll.java
===================================================================
--- trunk/java/javax/annotation/security/PermitAll.java 2009-10-28 15:08:23 UTC (rev 1227)
+++ trunk/java/javax/annotation/security/PermitAll.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -1,30 +1,51 @@
/*
- * 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
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
*
- * 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.
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
*/
+/*
+ *
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
package javax.annotation.security;
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-(a)Target({ElementType.TYPE, ElementType.METHOD})
-(a)Retention(RetentionPolicy.RUNTIME)
-
+/**
+ * Specifies that all security roles are allowed to invoke the specified
+ * method(s) i.e that the specified method(s) are "unchecked". It can be
+ * specified on a class or on methods. Specifying it on the class means that
+ * it applies to all methods of the class. If specified at the method level,
+ * it only affects that method. If the RolesAllowed is specified at the class
+ * level and this annotation is applied at the method level, the PermitAll
+ * annotation overrides the RolesAllowed for the specified method.
+ *
+ * @see javax.annotation.security.RolesAllowed
+ * @see javax.annotation.security.DenyAll
+ *
+ * @since Common Annotations 1.0
+ */
+@Documented
+@Retention (RUNTIME)
+@Target({TYPE, METHOD})
public @interface PermitAll {
}
Modified: trunk/java/javax/annotation/security/RolesAllowed.java
===================================================================
--- trunk/java/javax/annotation/security/RolesAllowed.java 2009-10-28 15:08:23 UTC (rev 1227)
+++ trunk/java/javax/annotation/security/RolesAllowed.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -1,31 +1,49 @@
/*
- * 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
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
*
- * 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.
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
*/
+/*
+ *
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
package javax.annotation.security;
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-(a)Target({ElementType.TYPE, ElementType.METHOD})
-(a)Retention(RetentionPolicy.RUNTIME)
-
+/**
+ * Specifies the list of roles permitted to access method(s) in an application.
+ * The value of the RolesAllowed annotation is a list of security role names.
+ * This annotation can be specified on a class or on method(s). Specifying it
+ * at a class level means that it applies to all the methods in the class.
+ * Specifying it on a method means that it is applicable to that method only.
+ * If applied at both the class and methods level , the method value overrides
+ * the class value if the two conflict.
+ *
+ * @since Common Annotations 1.0
+ */
+@Documented
+@Retention (RUNTIME)
+@Target({TYPE, METHOD})
public @interface RolesAllowed {
- public String[] value();
+ String[] value();
}
Modified: trunk/java/javax/annotation/security/RunAs.java
===================================================================
--- trunk/java/javax/annotation/security/RunAs.java 2009-10-28 15:08:23 UTC (rev 1227)
+++ trunk/java/javax/annotation/security/RunAs.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -1,31 +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
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
*
- * 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.
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
*/
+/*
+ *
+ * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
package javax.annotation.security;
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-(a)Target({ElementType.TYPE})
-(a)Retention(RetentionPolicy.RUNTIME)
-
+/**
+ * Defines the identity of the application during execution in a J2EE
+ * container. This allows developers to execute under a particular role.
+ * The role must map to the user / group information in the containers
+ * security realm. It's value is the name of a security role.
+ *
+ * @since Common Annotations 1.0
+ */
+@Documented
+@Retention (RUNTIME)
+@Target(TYPE)
public @interface RunAs {
- public String value();
+ String value();
}
Added: trunk/java/javax/annotation/security/package.html
===================================================================
--- trunk/java/javax/annotation/security/package.html (rev 0)
+++ trunk/java/javax/annotation/security/package.html 2009-10-29 00:54:53 UTC (rev 1228)
@@ -0,0 +1,28 @@
+<!--
+
+ The contents of this file are subject to the terms
+ of the Common Development and Distribution License
+ (the "License"). You may not use this file except
+ in compliance with the License.
+
+ You can obtain a copy of the license at
+ glassfish/bootstrap/legal/CDDLv1.0.txt or
+ https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ See the License for the specific language governing
+ permissions and limitations under the License.
+
+ When distributing Covered Code, include this CDDL
+ HEADER in each file and include the License file at
+ glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your
+ own identifying information: Portions Copyright [yyyy]
+ [name of copyright owner]
+
+ Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+-->
+<html>
+<body>
+ This package contains the security common annotations.
+</body>
+</html>
Added: trunk/java/javax/annotation/sql/DataSourceDefinition.java
===================================================================
--- trunk/java/javax/annotation/sql/DataSourceDefinition.java (rev 0)
+++ trunk/java/javax/annotation/sql/DataSourceDefinition.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -0,0 +1,278 @@
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
+ */
+
+/*
+ *
+ * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
+
+package javax.annotation.sql;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Annotation used to define a container <code>DataSource</code> and
+ * be registered with JNDI. The <code>DataSource</code> may be configured by
+ * setting the annotation elements for commonly used <code>DataSource</code>
+ * properties. Additional standard and vendor-specific properties may be
+ * specified using the <code>properties</code> element.
+ * <p>
+ *
+ * The data source will be registered under the name specified in the
+ * <code>name</code> element. It may be defined to be in any valid
+ * <code>Java EE</code> namespace, and will determine the accessibility of
+ * the data source from other components.
+ * <p>
+ * A JDBC driver implementation class of the appropriate type, either
+ * <code>DataSource</code>, <code>ConnectionPoolDataSource</code>, or
+ * <code>XADataSource</code>, must be indicated by the <code>className</code>
+ * element. The availability of the driver class will be assumed at runtime.
+ *<p>
+ * The <code>url</code> property should not be specified in conjunction with
+ * other standard properties for defining the connectivity to the database.
+ * If the <code>url</code> property is specified along with other standard
+ * <code>DataSource</code> properties
+ * such as <code>serverName</code> and <code>portNumber</code>, the more
+ * specific properties will take precedence and <code>url</code> will be
+ * ignored.
+ * <p>
+ * Vendors are not required to support properties that do not normally
+ * apply to a specific data source type. For example, specifying the
+ * <code>transactional</code> property to be <code>true</code> but supplying
+ * a value for <code>className</code> that implements a data source class
+ * other than <code>XADataSource</code> may not be supported.
+ * <p>
+ * Vendor-specific properties may be combined with or used to
+ * override standard data source properties defined using this annotation.
+ * <p>
+ * <code>DataSource</code> properties that are specified and are not supported
+ * in a given configuration or cannot be mapped to a vendor specific
+ * configuration property may be ignored.
+ * <p>
+ * Examples:
+ * <br>
+ * <pre>
+ * @DataSourceDefinition(name="java:global/MyApp/MyDataSource",
+ * className="com.foobar.MyDataSource",
+ * portNumber=6689,
+ * serverName="myserver.com",
+ * user="lance",
+ * password="secret"
+ * )
+ *
+ * </pre>
+ * <p>
+ * Using a <code>URL</code>:
+ * <br>
+ * <pre>
+ * @DataSourceDefinition(name="java:global/MyApp/MyDataSource",
+ * className="org.apache.derby.jdbc.ClientDataSource",
+ * url="jdbc:derby://localhost:1527/myDB",
+ * user="lance",
+ * password="secret"
+ * )
+ * </pre>
+ * <p>
+ * An example lookup of the {@link DataSource} from an EJB:
+ * <pre>
+ * @Stateless
+ * public class MyStatelessEJB {
+ * @Resource(lookup="java:global/MyApp/myDataSource")
+ * DataSource myDB;
+ * ...
+ * }
+ * </pre>
+ * <p>
+ * @see javax.sql.DataSource
+ * @see javax.sql.XADataSource
+ * @see javax.sql.ConnectionPoolDataSource
+ * @since Common Annotations 1.1
+ */
+(a)Target({ElementType.TYPE})
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface DataSourceDefinition {
+
+ /**
+ * JNDI name by which the data source will be registered.
+ * @since 1.1
+ */
+ String name();
+
+ /**
+ * DataSource implementation class name which implements:
+ * <code>javax.sql.DataSource</code> or <code>javax.sql.XADataSource</code>
+ * or <code>javax.sql.ConnectionPoolDataSource</code>.
+ * @since 1.1
+ */
+ String className();
+
+ /**
+ * Description of this data source
+ * @since 1.1
+ */
+ String description() default "";
+
+ /**
+ * A JDBC URL. If the <code>url</code> property is specified along with
+ * other standard <code>DataSource</code> properties
+ * such as <code>serverName</code> and <code>portNumber</code>, the more
+ * specific properties will take precedence and <code>url</code> will be
+ * ignored.
+ * @since 1.1
+ */
+ String url() default "";
+
+ /**
+ * User name to use for connection authentication.
+ * @since 1.1
+ */
+ String user() default "";
+
+ /**
+ * Password to use for connection authentication.
+ * @since 1.1
+ */
+ String password() default "";
+
+ /**
+ * Name of a database on a server.
+ * @since 1.1
+ */
+ String databaseName() default "";
+
+ /**
+ * Port number where a server is listening for requests.
+ * @since 1.1
+ */
+ int portNumber() default -1;
+
+ /**
+ * Database server name.
+ * @since 1.1
+ */
+ String serverName() default "localhost";
+
+ /**
+ * Isolation level for connections. The Isolation level
+ * must be one of the following:
+ * <p>
+ * <ul>
+ * <li>Connection.TRANSACTION_NONE,
+ * <li>Connection.TRANSACTION_READ_ UNCOMMITTED,
+ * <li>Connection.TRANSACTION_READ_COMMITTED,
+ * <li>Connection.TRANSACTION_REPEATABLE_READ,
+ * <li>Connection.TRANSACTION_SERIALIZABLE
+ *</ul>
+ * <p>
+ * Default is vendor-specific.
+ * @since 1.1
+ */
+ int isolationLevel() default -1;
+
+ /**
+ * Set to <code>false</code> if connections should not participate
+ * in transactions.
+ * <p>
+ * Default is to enlist in a transaction when one is active or becomes
+ * active.
+ * @since 1.1
+ */
+ boolean transactional() default true;
+
+ /**
+ * Number of connections that should be created when a connection pool
+ * is initialized.
+ * <p>
+ * Default is vendor-specific
+ * @since 1.1
+ */
+ int initialPoolSize() default -1;
+
+ /**
+ * Maximum number of connections that should be concurrently allocated for a
+ * connection pool.
+ * <p>
+ * Default is vendor-specific.
+ * @since 1.1
+ */
+ int maxPoolSize() default -1;
+
+ /**
+ * Minimum number of connections that should be allocated for a
+ * connection pool.
+ * <p>
+ * Default is vendor-specific.
+ * @since 1.1
+ */
+ int minPoolSize() default -1;
+
+ /**
+ * The number of seconds that a physical connection
+ * should remain unused in the pool before the
+ * connection is closed for a connection pool.
+ * <p>
+ * Default is vendor-specific
+ * @since 1.1
+ */
+ int maxIdleTime() default -1;
+
+ /**
+ * The total number of statements that a connection pool should keep open.
+ * A value of 0 indicates that the caching of statements is disabled for
+ * a connection pool.
+ * <p>
+ * Default is vendor-specific
+ * @since 1.1
+ */
+ int maxStatements() default -1;
+ /**
+ * Used to specify Vendor specific properties and less commonly
+ * used <code>DataSource</code> properties such as:
+ * <p>
+ * <ul>
+ * <li>dataSourceName
+ * <li>networkProtocol
+ * <li>propertyCycle
+ * <li>roleName
+ * </ul>
+ * <p>
+ * Properties are specified using the format:
+ * <i>propertyName=propertyValue</i> with one property per array element.
+ * @since 1.1
+ */
+ String[] properties() default {};
+
+
+ /**
+ * Sets the maximum time in seconds that this data source will wait while
+ * attempting to connect to a database. A value of zero specifies that
+ * the timeout is the default system timeout if there is one; otherwise,
+ * it specifies that there is no timeout.
+ * <p>
+ * Default is vendor-specific.
+ * @since 1.1
+ */
+ int loginTimeout() default 0;
+}
Added: trunk/java/javax/annotation/sql/DataSourceDefinitions.java
===================================================================
--- trunk/java/javax/annotation/sql/DataSourceDefinitions.java (rev 0)
+++ trunk/java/javax/annotation/sql/DataSourceDefinitions.java 2009-10-29 00:54:53 UTC (rev 1228)
@@ -0,0 +1,46 @@
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the "License"). You may not use this file except
+ * in compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt or
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * HEADER in each file and include the License file at
+ * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
+ * add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your
+ * own identifying information: Portions Copyright [yyyy]
+ * [name of copyright owner]
+ */
+
+/*
+ *
+ * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
+
+package javax.annotation.sql;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Declares one or more <code>DataSourceDefinition</code> annotations.
+ *
+ * @see javax.annotation.sql.DataSourceDefinition
+ * @since Common Annotations 1.1
+ */
+(a)Target({ElementType.TYPE})
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface DataSourceDefinitions {
+ DataSourceDefinition[] value ();
+
+}
15 years, 1 month
JBossWeb SVN: r1227 - in trunk/java/org/apache/catalina: core and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-10-28 11:08:23 -0400 (Wed, 28 Oct 2009)
New Revision: 1227
Modified:
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/core/StandardWrapper.java
Log:
- Add back two request mutators.
- Remove useless logging.
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-10-27 16:03:40 UTC (rev 1226)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-10-28 15:08:23 UTC (rev 1227)
@@ -56,7 +56,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
-import java.util.EventListener;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -969,7 +968,7 @@
* @param remoteAddr The remote IP address
*/
public void setRemoteAddr(String remoteAddr) {
- // Not used
+ this.remoteAddr = remoteAddr;
}
@@ -980,7 +979,7 @@
* @param remoteHost The remote host name
*/
public void setRemoteHost(String remoteHost) {
- // Not used
+ this.remoteHost = remoteHost;
}
Modified: trunk/java/org/apache/catalina/core/StandardWrapper.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-10-27 16:03:40 UTC (rev 1226)
+++ trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-10-28 15:08:23 UTC (rev 1227)
@@ -989,9 +989,6 @@
synchronized (this) {
if (instance == null) {
try {
- if (log.isDebugEnabled())
- log.debug("Allocating non-STM instance");
-
instance = loadServlet();
} catch (ServletException e) {
throw e;
@@ -1004,8 +1001,6 @@
}
if (!singleThreadModel) {
- if (log.isTraceEnabled())
- log.trace(" Returning non-STM instance");
return (instance);
}
@@ -1033,8 +1028,6 @@
}
}
}
- if (log.isTraceEnabled())
- log.trace(" Returning allocated STM instance");
countAllocated++;
return (Servlet) instancePool.pop();
15 years, 1 month
JBossWeb SVN: r1226 - tags.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-10-27 12:03:40 -0400 (Tue, 27 Oct 2009)
New Revision: 1226
Added:
tags/JBOSSWEB_2_0_0_GA_CP12/
Log:
CP12 release.
Copied: tags/JBOSSWEB_2_0_0_GA_CP12 (from rev 1225, branches/JBOSSWEB_2_0_0_GA_CP)
15 years, 1 month
JBossWeb SVN: r1225 - branches/2.1.x/java/org/apache/jasper.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-10-27 11:23:55 -0400 (Tue, 27 Oct 2009)
New Revision: 1225
Modified:
branches/2.1.x/java/org/apache/jasper/Constants.java
Log:
Fix for JBWEB-142.
Modified: branches/2.1.x/java/org/apache/jasper/Constants.java
===================================================================
--- branches/2.1.x/java/org/apache/jasper/Constants.java 2009-10-27 15:20:39 UTC (rev 1224)
+++ branches/2.1.x/java/org/apache/jasper/Constants.java 2009-10-27 15:23:55 UTC (rev 1225)
@@ -83,7 +83,7 @@
/**
* Default size for the tag buffers.
*/
- public static final int DEFAULT_TAG_BUFFER_SIZE = 512;
+ public static final int DEFAULT_TAG_BUFFER_SIZE = Integer.parseInt(System.getProperty("org.apache.jasper.Constants.DEFAULT_TAG_BUFFER_SIZE", "512"));
/**
* Default tag handler pool size.
15 years, 1 month