JBossWeb SVN: r989 - 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-04-06 21:50:57 -0400 (Mon, 06 Apr 2009)
New Revision: 989
Modified:
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
Log:
- Add a listener structure.
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-04-07 01:29:59 UTC (rev 988)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-04-07 01:50:57 UTC (rev 989)
@@ -57,6 +57,7 @@
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
@@ -64,9 +65,9 @@
import javax.security.auth.Subject;
import javax.servlet.AsyncContext;
+import javax.servlet.AsyncEvent;
import javax.servlet.AsyncListener;
import javax.servlet.DispatcherType;
-import javax.servlet.FilterChain;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@@ -249,6 +250,13 @@
/**
+ * Async listeners.
+ */
+ protected LinkedHashMap<AsyncEvent, AsyncListener> asyncListeners =
+ new LinkedHashMap<AsyncEvent, AsyncListener>();
+
+
+ /**
* Associated event.
*/
protected HttpEventImpl event = null;
@@ -445,6 +453,7 @@
asyncContext = null;
asyncTimeout = 300000;
+ asyncListeners.clear();
authType = null;
inputBuffer.recycle();
usingInputStream = false;
@@ -2825,7 +2834,8 @@
public void addAsyncListener(AsyncListener listener,
ServletRequest servletRequest, ServletResponse servletResponse) {
- // FIXME: Maybe add to the asyncContext ?
+ AsyncEvent event = new AsyncEvent(servletRequest, servletResponse);
+ asyncListeners.put(event, listener);
}
public void addAsyncListener(AsyncListener listener) {
@@ -2856,7 +2866,7 @@
public AsyncContext startAsync(ServletRequest servletRequest,
ServletResponse servletResponse) throws IllegalStateException {
- // FIXME: check is supported
+ // FIXME: check isAsyncSupported
// FIXME: get async timeout according to what was configured in the filter chains
setTimeout((asyncTimeout > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) asyncTimeout);
asyncContext = new AsyncContextImpl(servletRequest, servletResponse);
@@ -2982,6 +2992,10 @@
public Runnable getRunnable() {
return runnable;
}
+
+ public Map<AsyncEvent, AsyncListener> getAsyncListeners() {
+ return asyncListeners;
+ }
}
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterChain.java 2009-04-07 01:29:59 UTC (rev 988)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterChain.java 2009-04-07 01:50:57 UTC (rev 989)
@@ -1,18 +1,46 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*
- * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 1999-2009 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 2009-04-07 01:29:59 UTC (rev 988)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 2009-04-07 01:50:57 UTC (rev 989)
@@ -1,18 +1,46 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*
- * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 1999-2009 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
15 years, 1 month
JBossWeb SVN: r988 - in trunk/java/org/apache/catalina: authenticator and 2 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-06 21:29:59 -0400 (Mon, 06 Apr 2009)
New Revision: 988
Modified:
trunk/java/org/apache/catalina/Authenticator.java
trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/connector/RequestFacade.java
trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
Log:
- Add code to build the execution stack in the request.
- Map the login method.
Modified: trunk/java/org/apache/catalina/Authenticator.java
===================================================================
--- trunk/java/org/apache/catalina/Authenticator.java 2009-04-06 17:11:45 UTC (rev 987)
+++ trunk/java/org/apache/catalina/Authenticator.java 2009-04-07 01:29:59 UTC (rev 988)
@@ -18,7 +18,15 @@
package org.apache.catalina;
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+
+
/**
* An <b>Authenticator</b> is a component (usually a Valve or Container) that
* provides some sort of authentication service. The interface itself has no
@@ -31,6 +39,8 @@
*/
public interface Authenticator {
-
-
+ public boolean login(Request request, Response response)
+ throws IOException, ServletException;
+ public boolean login(Request request, HttpServletResponse response)
+ throws IOException, ServletException;
}
Modified: trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java
===================================================================
--- trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java 2009-04-06 17:11:45 UTC (rev 987)
+++ trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java 2009-04-07 01:29:59 UTC (rev 988)
@@ -30,6 +30,7 @@
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.Authenticator;
import org.apache.catalina.Container;
@@ -50,7 +51,6 @@
import org.apache.catalina.util.StringManager;
import org.apache.catalina.valves.ValveBase;
import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
/**
@@ -370,6 +370,39 @@
/**
+ * Login.
+ *
+ * @param request Request we are processing
+ * @param response Response we are creating
+ * @param config Login configuration describing how authentication
+ * should be performed
+ *
+ * @exception IOException if an input/output error occurs
+ */
+ public boolean login(Request request, Response response)
+ throws IOException, ServletException {
+ return authenticate(request, response, this.context.getLoginConfig());
+ }
+
+
+ /**
+ * Login.
+ *
+ * @param request Request we are processing
+ * @param response Response we are creating
+ * @param config Login configuration describing how authentication
+ * should be performed
+ *
+ * @exception IOException if an input/output error occurs
+ */
+ public boolean login(Request request, HttpServletResponse response)
+ throws IOException, ServletException {
+ // FIXME
+ return false;
+ }
+
+
+ /**
* Enforce the security restrictions in the web application deployment
* descriptor of our associated Context.
*
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-04-06 17:11:45 UTC (rev 987)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-04-07 01:29:59 UTC (rev 988)
@@ -88,6 +88,7 @@
import org.apache.catalina.Realm;
import org.apache.catalina.Session;
import org.apache.catalina.Wrapper;
+import org.apache.catalina.core.ApplicationFilterChain;
import org.apache.catalina.core.ApplicationFilterFactory;
import org.apache.catalina.realm.GenericPrincipal;
import org.apache.catalina.util.Enumerator;
@@ -242,6 +243,12 @@
/**
+ * Async timeout.
+ */
+ protected long asyncTimeout = 300000L;
+
+
+ /**
* Associated event.
*/
protected HttpEventImpl event = null;
@@ -437,6 +444,7 @@
}
asyncContext = null;
+ asyncTimeout = 300000;
authType = null;
inputBuffer.recycle();
usingInputStream = false;
@@ -455,6 +463,7 @@
localPort = -1;
localAddr = null;
localName = null;
+ currentFilterChain = 0;
attributes.clear();
notes.clear();
@@ -581,28 +590,55 @@
/**
- * Filter chain associated with the request.
+ * Filter chains associated with the request.
*/
- protected FilterChain filterChain = null;
-
+ protected ArrayList<ApplicationFilterChain> filterChains = new ArrayList<ApplicationFilterChain>();
+
+
/**
+ * Number of filter chains used.
+ */
+ protected int currentFilterChain = 0;
+
+
+ /**
* Get filter chain associated with the request.
*/
- public FilterChain getFilterChain() {
- return (this.filterChain);
+ public ApplicationFilterChain getFilterChain() {
+ if (currentFilterChain < filterChains.size()) {
+ return filterChains.get(currentFilterChain++);
+ } else {
+ return null;
+ }
}
+
/**
* Set filter chain associated with the request.
*
* @param filterChain new filter chain
*/
- public void setFilterChain(FilterChain filterChain) {
- this.filterChain = filterChain;
+ public void setFilterChain(ApplicationFilterChain filterChain) {
+ if (currentFilterChain < filterChains.size()) {
+ filterChains.set(currentFilterChain++, filterChain);
+ } else {
+ filterChains.add(filterChain);
+ currentFilterChain++;
+ }
}
/**
+ * Set filter chain associated with the request.
+ *
+ * @param filterChain new filter chain
+ */
+ public void releaseFilterChain() {
+ currentFilterChain--;
+ }
+
+
+ /**
* Return the Host within which this Request is being processed.
*/
public Host getHost() {
@@ -2811,7 +2847,7 @@
}
public void setAsyncTimeout(long timeout) {
- setTimeout((timeout > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) timeout);
+ this.asyncTimeout = timeout;
}
public AsyncContext startAsync() throws IllegalStateException {
@@ -2820,6 +2856,9 @@
public AsyncContext startAsync(ServletRequest servletRequest,
ServletResponse servletResponse) throws IllegalStateException {
+ // FIXME: check is supported
+ // FIXME: get async timeout according to what was configured in the filter chains
+ setTimeout((asyncTimeout > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) asyncTimeout);
asyncContext = new AsyncContextImpl(servletRequest, servletResponse);
eventMode = true;
return asyncContext;
@@ -2827,13 +2866,22 @@
public boolean login(HttpServletResponse response) throws IOException,
ServletException {
- // TODO Auto-generated method stub
+ // FIXME: wrapped response is super evil :(
+ if (response instanceof ResponseFacade) {
+
+ }
return false;
}
public void login(String username, String password) throws ServletException {
- // TODO Auto-generated method stub
-
+ Realm realm = context.getRealm();
+ userPrincipal = realm.authenticate(username, password);
+ // FIXME: not sure how the login should be completed: set in the session, SSO, etc etc ?
+ // (apparently, no according to the javadoc)
+ if (userPrincipal == null) {
+ throw new ServletException();
+ }
+ authType = "?";
}
public void logout() throws ServletException {
Modified: trunk/java/org/apache/catalina/connector/RequestFacade.java
===================================================================
--- trunk/java/org/apache/catalina/connector/RequestFacade.java 2009-04-06 17:11:45 UTC (rev 987)
+++ trunk/java/org/apache/catalina/connector/RequestFacade.java 2009-04-07 01:29:59 UTC (rev 988)
@@ -41,6 +41,7 @@
import javax.servlet.http.HttpSession;
import org.apache.catalina.Globals;
+import org.apache.catalina.core.ApplicationFilterChain;
import org.apache.catalina.security.SecurityUtil;
import org.apache.catalina.util.StringManager;
@@ -1041,6 +1042,44 @@
}
+ /**
+ * Get filter chain associated with the request.
+ */
+ public ApplicationFilterChain getFilterChain() {
+ if (request == null) {
+ throw new IllegalStateException(
+ sm.getString("requestFacade.nullRequest"));
+ }
+ return request.getFilterChain();
+ }
+
+
+ /**
+ * Set filter chain associated with the request.
+ *
+ * @param filterChain new filter chain
+ */
+ public void setFilterChain(ApplicationFilterChain filterChain) {
+ if (request == null) {
+ throw new IllegalStateException(
+ sm.getString("requestFacade.nullRequest"));
+ }
+ request.setFilterChain(filterChain);
+ }
+
+
+ /**
+ * Release the current filter chain.
+ */
+ public void releaseFilterChain() {
+ if (request == null) {
+ throw new IllegalStateException(
+ sm.getString("requestFacade.nullRequest"));
+ }
+ request.releaseFilterChain();
+ }
+
+
public ServletResponse getServletResponse() {
if (request == null) {
throw new IllegalStateException(
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterChain.java 2009-04-06 17:11:45 UTC (rev 987)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterChain.java 2009-04-07 01:29:59 UTC (rev 988)
@@ -53,7 +53,7 @@
* @version $Revision$ $Date$
*/
-final class ApplicationFilterChain implements FilterChain, HttpEventFilterChain {
+public final class ApplicationFilterChain implements FilterChain, HttpEventFilterChain {
// Used to enforce requirements of SRV.8.2 / SRV.14.2.5.1
private final static ThreadLocal lastServicedRequest;
@@ -69,6 +69,7 @@
}
}
+
// -------------------------------------------------------------- Constants
@@ -90,7 +91,11 @@
// ----------------------------------------------------- Instance Variables
-
+ // FIXME: Add a requestFacade field to be able to call release when done
+ // FIXME: Add accessors for the internal structures
+ // FIXME: Keep the wrapper, to be able to access the servlet registration
+ // FIXME: Add an exec pointer field to know which element of the chain we are running
+
/**
* Filters.
*/
@@ -572,5 +577,13 @@
}
+
+ // -------------------------------------------- AsyncProterties Inner Class
+
+
+ protected class AsyncProperties {
+ public boolean asyncSupported = true;
+ public long timeout = -1;
+ }
}
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 2009-04-06 17:11:45 UTC (rev 987)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 2009-04-07 01:29:59 UTC (rev 988)
@@ -21,11 +21,13 @@
import javax.servlet.Servlet;
import javax.servlet.ServletRequest;
+import javax.servlet.ServletRequestWrapper;
import javax.servlet.http.HttpServletRequest;
import org.apache.catalina.Globals;
import org.apache.catalina.Wrapper;
import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.RequestFacade;
import org.apache.catalina.deploy.FilterMap;
import org.jboss.servlet.http.HttpEventFilter;
@@ -119,31 +121,48 @@
if (servlet == null)
return (null);
- boolean comet = false;
+ boolean event = false;
+ // Get the request facade object
+ RequestFacade requestFacade = null;
+ if (request instanceof Request) {
+ Request coreRequest = (Request) request;
+ event = coreRequest.isEventMode();
+ requestFacade = (RequestFacade) coreRequest.getRequest();
+ } else {
+ ServletRequest current = request;
+ while (current != null) {
+ // If we run into the container request we are done
+ if (current instanceof RequestFacade) {
+ requestFacade = (RequestFacade) current;
+ break;
+ }
+ // Advance to the next request in the chain
+ current = ((ServletRequestWrapper) current).getRequest();
+ }
+ }
+
// Create and initialize a filter chain object
ApplicationFilterChain filterChain = null;
- if (request instanceof Request) {
- Request req = (Request) request;
- comet = req.isEventMode();
+ if (requestFacade == null) {
+ // Not normal: some async functions and tracing will be disabled
+ filterChain = new ApplicationFilterChain();
+ } else {
+ // Add this filter chain to the request facade
if (Globals.IS_SECURITY_ENABLED) {
- // Security: Do not recycle
filterChain = new ApplicationFilterChain();
- if (comet) {
- req.setFilterChain(filterChain);
- }
+ requestFacade.setFilterChain(filterChain);
} else {
- filterChain = (ApplicationFilterChain) req.getFilterChain();
+ filterChain = requestFacade.getFilterChain();
if (filterChain == null) {
filterChain = new ApplicationFilterChain();
- req.setFilterChain(filterChain);
+ requestFacade.setFilterChain(filterChain);
}
}
- } else {
- // Request dispatcher in use
- filterChain = new ApplicationFilterChain();
+ // FIXME: Set the request field in the chain so that the chain removes itself when it recycles
}
-
+
+
filterChain.setServlet(servlet);
filterChain.setSupport
@@ -173,16 +192,16 @@
; // FIXME - log configuration problem
continue;
}
- boolean isCometFilter = false;
- if (comet) {
+ boolean isEventFilter = false;
+ if (event) {
try {
- isCometFilter = filterConfig.getFilter() instanceof HttpEventFilter;
+ isEventFilter = filterConfig.getFilter() instanceof HttpEventFilter;
} catch (Exception e) {
// Note: The try catch is there because getFilter has a lot of
// declared exceptions. However, the filter is allocated much
// earlier
}
- if (isCometFilter) {
+ if (isEventFilter) {
filterChain.addFilter(filterConfig);
}
} else {
@@ -203,16 +222,16 @@
; // FIXME - log configuration problem
continue;
}
- boolean isCometFilter = false;
- if (comet) {
+ boolean isEventFilter = false;
+ if (event) {
try {
- isCometFilter = filterConfig.getFilter() instanceof HttpEventFilter;
+ isEventFilter = filterConfig.getFilter() instanceof HttpEventFilter;
} catch (Exception e) {
// Note: The try catch is there because getFilter has a lot of
// declared exceptions. However, the filter is allocated much
// earlier
}
- if (isCometFilter) {
+ if (isEventFilter) {
filterChain.addFilter(filterConfig);
}
} else {
15 years, 1 month
JBossWeb SVN: r987 - trunk.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-06 13:11:45 -0400 (Mon, 06 Apr 2009)
New Revision: 987
Modified:
trunk/build.xml
Log:
- Fix encoding.
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2009-04-06 12:12:17 UTC (rev 986)
+++ trunk/build.xml 2009-04-06 17:11:45 UTC (rev 987)
@@ -110,7 +110,7 @@
<filter token="VERSION" value="${version}"/>
<filter token="VERSION_NUMBER" value="${version.number}"/>
<filter token="VERSION_BUILT" value="${TODAY} ${TSTAMP}"/>
- <copy todir="${tomcat.classes}" filtering="true">
+ <copy todir="${tomcat.classes}" filtering="true" encoding="ISO-8859-1">
<fileset dir="java">
<include name="**/*.properties"/>
<include name="**/*.dtd"/>
15 years, 1 month
JBossWeb SVN: r986 - in trunk/java/org/apache/jasper: runtime and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-06 08:12:17 -0400 (Mon, 06 Apr 2009)
New Revision: 986
Modified:
trunk/java/org/apache/jasper/compiler/Generator.java
trunk/java/org/apache/jasper/runtime/InstanceManagerFactory.java
Log:
- POrt patch to fix oooops.
Modified: trunk/java/org/apache/jasper/compiler/Generator.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Generator.java 2009-04-03 17:27:27 UTC (rev 985)
+++ trunk/java/org/apache/jasper/compiler/Generator.java 2009-04-06 12:12:17 UTC (rev 986)
@@ -531,7 +531,7 @@
out.printin("private javax.el.ExpressionFactory ");
out.print(VAR_EXPRESSIONFACTORY);
out.println(";");
- out.printin("private org.apache.InstanceManager ");
+ out.printin("private org.apache.tomcat.InstanceManager ");
out.print(VAR_INSTANCEMANAGER);
out.println(";");
out.println();
Modified: trunk/java/org/apache/jasper/runtime/InstanceManagerFactory.java
===================================================================
--- trunk/java/org/apache/jasper/runtime/InstanceManagerFactory.java 2009-04-03 17:27:27 UTC (rev 985)
+++ trunk/java/org/apache/jasper/runtime/InstanceManagerFactory.java 2009-04-06 12:12:17 UTC (rev 986)
@@ -36,7 +36,7 @@
InstanceManager instanceManager =
(InstanceManager) config.getServletContext().getAttribute(InstanceManager.class.getName());
if (instanceManager == null) {
- throw new IllegalStateException("No org.apache.InstanceManager set in ServletContext");
+ throw new IllegalStateException("No org.apache.tomcat.InstanceManager set in ServletContext");
}
return instanceManager;
}
15 years, 1 month
JBossWeb SVN: r985 - in trunk/java/org/apache/catalina: session and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-03 13:27:27 -0400 (Fri, 03 Apr 2009)
New Revision: 985
Modified:
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/session/StandardSession.java
Log:
- Logout.
- Remove the useless property change.
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-04-02 23:32:47 UTC (rev 984)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-04-03 17:27:27 UTC (rev 985)
@@ -2837,8 +2837,13 @@
}
public void logout() throws ServletException {
- // TODO Auto-generated method stub
-
+ userPrincipal = null;
+ authType = null;
+ Session session = getSessionInternal(false);
+ if (session != null) {
+ session.setPrincipal(null);
+ session.setAuthType(null);
+ }
}
public DispatcherType getDispatcherType() {
Modified: trunk/java/org/apache/catalina/session/StandardSession.java
===================================================================
--- trunk/java/org/apache/catalina/session/StandardSession.java 2009-04-02 23:32:47 UTC (rev 984)
+++ trunk/java/org/apache/catalina/session/StandardSession.java 2009-04-03 17:27:27 UTC (rev 985)
@@ -19,7 +19,6 @@
package org.apache.catalina.session;
-import java.beans.PropertyChangeSupport;
import java.io.IOException;
import java.io.NotSerializableException;
import java.io.ObjectInputStream;
@@ -54,11 +53,10 @@
import org.apache.catalina.Session;
import org.apache.catalina.SessionEvent;
import org.apache.catalina.SessionListener;
+import org.apache.catalina.security.SecurityUtil;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.StringManager;
-import org.apache.catalina.security.SecurityUtil;
-
/**
* Standard implementation of the <b>Session</b> interface. This object is
* serializable, so that it can be stored in persistent storage or transferred
@@ -269,14 +267,6 @@
/**
- * The property change support for this component. NOTE: This value
- * is not included in the serialized version of this object.
- */
- protected transient PropertyChangeSupport support =
- new PropertyChangeSupport(this);
-
-
- /**
* The current accessed time for this session.
*/
protected int thisAccessedTime = 0;
@@ -310,9 +300,7 @@
*/
public void setAuthType(String authType) {
- String oldAuthType = this.authType;
this.authType = authType;
- support.firePropertyChange("authType", oldAuthType, this.authType);
}
@@ -538,9 +526,7 @@
*/
public void setPrincipal(Principal principal) {
- Principal oldPrincipal = this.principal;
this.principal = principal;
- support.firePropertyChange("principal", oldPrincipal, this.principal);
}
15 years, 1 month
JBossWeb SVN: r984 - trunk/java/javax/servlet/http.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-02 19:32:47 -0400 (Thu, 02 Apr 2009)
New Revision: 984
Removed:
trunk/java/javax/servlet/http/annotation/
Log:
- Update to the current version (and switch to Sun's sources for now).
15 years, 1 month
JBossWeb SVN: r983 - trunk/java/javax/servlet/http/annotation.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-02 19:30:48 -0400 (Thu, 02 Apr 2009)
New Revision: 983
Removed:
trunk/java/javax/servlet/http/annotation/FilterMapping.java
trunk/java/javax/servlet/http/annotation/InitParam.java
trunk/java/javax/servlet/http/annotation/Servlet.java
trunk/java/javax/servlet/http/annotation/ServletContextListener.java
trunk/java/javax/servlet/http/annotation/ServletFilter.java
Log:
- Update to the current version (and switch to Sun's sources for now).
Deleted: trunk/java/javax/servlet/http/annotation/FilterMapping.java
===================================================================
--- trunk/java/javax/servlet/http/annotation/FilterMapping.java 2009-04-02 23:28:07 UTC (rev 982)
+++ trunk/java/javax/servlet/http/annotation/FilterMapping.java 2009-04-02 23:30:48 UTC (rev 983)
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package javax.servlet.http.annotation;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import javax.servlet.DispatcherType;
-
-/**
- * @version $Rev: 675701 $ $Date: 2008-07-10 21:49:52 +0200 (Thu, 10 Jul 2008) $
- * @since 3.0
- */
-
-(a)Target(value=ElementType.TYPE)
-@Retention(value= RetentionPolicy.RUNTIME)
-public @interface FilterMapping {
-
- String[] urlPattern();
-
- String[] servletNames() default {};
-
- DispatcherType[] dispatcherTypes() default {DispatcherType.REQUEST};
-
-}
Deleted: trunk/java/javax/servlet/http/annotation/InitParam.java
===================================================================
--- trunk/java/javax/servlet/http/annotation/InitParam.java 2009-04-02 23:28:07 UTC (rev 982)
+++ trunk/java/javax/servlet/http/annotation/InitParam.java 2009-04-02 23:30:48 UTC (rev 983)
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package javax.servlet.http.annotation;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * @version $Rev: 675701 $ $Date: 2008-07-10 21:49:52 +0200 (Thu, 10 Jul 2008) $
- */
-
-@Target(value= ElementType.TYPE)
-@Retention(value= RetentionPolicy.RUNTIME)
-public @interface InitParam {
-
- String description() default "";
-
- String name() default "";
-
- String value() default "";
-
-}
Deleted: trunk/java/javax/servlet/http/annotation/Servlet.java
===================================================================
--- trunk/java/javax/servlet/http/annotation/Servlet.java 2009-04-02 23:28:07 UTC (rev 982)
+++ trunk/java/javax/servlet/http/annotation/Servlet.java 2009-04-02 23:30:48 UTC (rev 983)
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package javax.servlet.http.annotation;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * @version $Rev: 675701 $ $Date: 2008-07-10 21:49:52 +0200 (Thu, 10 Jul 2008) $
- * @since 3.0
- */
-
-@Target(value= ElementType.TYPE)
-@Retention(value= RetentionPolicy.RUNTIME)
-public @interface Servlet {
- String[] urlMappings();
-
- String icon() default "";
-
- InitParam[] initParams() default {};
-
- int loadOnStartup() default -1;
-
- String name() default "";
-
-}
Deleted: trunk/java/javax/servlet/http/annotation/ServletContextListener.java
===================================================================
--- trunk/java/javax/servlet/http/annotation/ServletContextListener.java 2009-04-02 23:28:07 UTC (rev 982)
+++ trunk/java/javax/servlet/http/annotation/ServletContextListener.java 2009-04-02 23:30:48 UTC (rev 983)
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package javax.servlet.http.annotation;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * @version $Rev: 675701 $ $Date: 2008-07-10 21:49:52 +0200 (Thu, 10 Jul 2008) $
- * @since 3.0
- */
-
-@Target(value= ElementType.TYPE)
-@Retention(value= RetentionPolicy.RUNTIME)
-public @interface ServletContextListener {
-
- String description() default "";
-}
Deleted: trunk/java/javax/servlet/http/annotation/ServletFilter.java
===================================================================
--- trunk/java/javax/servlet/http/annotation/ServletFilter.java 2009-04-02 23:28:07 UTC (rev 982)
+++ trunk/java/javax/servlet/http/annotation/ServletFilter.java 2009-04-02 23:30:48 UTC (rev 983)
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package javax.servlet.http.annotation;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * @version $Rev: 675701 $ $Date: 2008-07-10 21:49:52 +0200 (Thu, 10 Jul 2008) $
- * @since 3.0
- */
-
-@Target(value= ElementType.TYPE)
-@Retention(value= RetentionPolicy.RUNTIME)
-public @interface ServletFilter {
-
- String description() default "";
-
- String displayName() default "";
-
- String filterName() default "";
-
- String icon() default "";
-
- InitParam[] initParams() default {};
-}
15 years, 1 month
JBossWeb SVN: r982 - in trunk: java/javax/servlet/annotation and 8 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-02 19:28:07 -0400 (Thu, 02 Apr 2009)
New Revision: 982
Added:
trunk/java/javax/servlet/ServletContainerInitializer.java
trunk/java/javax/servlet/annotation/
trunk/java/javax/servlet/annotation/HandlesTypes.java
trunk/java/javax/servlet/annotation/WebFilter.java
trunk/java/javax/servlet/annotation/WebInitParam.java
trunk/java/javax/servlet/annotation/WebListener.java
trunk/java/javax/servlet/annotation/WebServlet.java
trunk/java/javax/servlet/annotation/package.html
trunk/java/javax/servlet/http/package.html
trunk/java/javax/servlet/package.html
Modified:
trunk/java/javax/servlet/AsyncContext.java
trunk/java/javax/servlet/AsyncEvent.java
trunk/java/javax/servlet/AsyncListener.java
trunk/java/javax/servlet/DispatcherType.java
trunk/java/javax/servlet/Filter.java
trunk/java/javax/servlet/FilterChain.java
trunk/java/javax/servlet/FilterConfig.java
trunk/java/javax/servlet/FilterRegistration.java
trunk/java/javax/servlet/GenericServlet.java
trunk/java/javax/servlet/LocalStrings.properties
trunk/java/javax/servlet/LocalStrings_fr.properties
trunk/java/javax/servlet/LocalStrings_ja.properties
trunk/java/javax/servlet/RequestDispatcher.java
trunk/java/javax/servlet/Servlet.java
trunk/java/javax/servlet/ServletConfig.java
trunk/java/javax/servlet/ServletContext.java
trunk/java/javax/servlet/ServletContextAttributeEvent.java
trunk/java/javax/servlet/ServletContextAttributeListener.java
trunk/java/javax/servlet/ServletContextEvent.java
trunk/java/javax/servlet/ServletContextListener.java
trunk/java/javax/servlet/ServletException.java
trunk/java/javax/servlet/ServletInputStream.java
trunk/java/javax/servlet/ServletOutputStream.java
trunk/java/javax/servlet/ServletRegistration.java
trunk/java/javax/servlet/ServletRequest.java
trunk/java/javax/servlet/ServletRequestAttributeEvent.java
trunk/java/javax/servlet/ServletRequestAttributeListener.java
trunk/java/javax/servlet/ServletRequestEvent.java
trunk/java/javax/servlet/ServletRequestListener.java
trunk/java/javax/servlet/ServletRequestWrapper.java
trunk/java/javax/servlet/ServletResponse.java
trunk/java/javax/servlet/ServletResponseWrapper.java
trunk/java/javax/servlet/SessionCookieConfig.java
trunk/java/javax/servlet/SessionTrackingMode.java
trunk/java/javax/servlet/SingleThreadModel.java
trunk/java/javax/servlet/UnavailableException.java
trunk/java/javax/servlet/http/Cookie.java
trunk/java/javax/servlet/http/HttpServlet.java
trunk/java/javax/servlet/http/HttpServletRequest.java
trunk/java/javax/servlet/http/HttpServletRequestWrapper.java
trunk/java/javax/servlet/http/HttpServletResponse.java
trunk/java/javax/servlet/http/HttpServletResponseWrapper.java
trunk/java/javax/servlet/http/HttpSession.java
trunk/java/javax/servlet/http/HttpSessionActivationListener.java
trunk/java/javax/servlet/http/HttpSessionAttributeListener.java
trunk/java/javax/servlet/http/HttpSessionBindingEvent.java
trunk/java/javax/servlet/http/HttpSessionBindingListener.java
trunk/java/javax/servlet/http/HttpSessionContext.java
trunk/java/javax/servlet/http/HttpSessionEvent.java
trunk/java/javax/servlet/http/HttpSessionListener.java
trunk/java/javax/servlet/http/HttpUtils.java
trunk/java/javax/servlet/http/LocalStrings.properties
trunk/java/javax/servlet/http/LocalStrings_es.properties
trunk/java/javax/servlet/http/LocalStrings_fr.properties
trunk/java/javax/servlet/http/LocalStrings_ja.properties
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/connector/RequestFacade.java
trunk/java/org/apache/catalina/connector/Response.java
trunk/java/org/apache/catalina/connector/ResponseFacade.java
trunk/java/org/apache/catalina/core/ApplicationContext.java
trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
trunk/java/org/apache/catalina/core/ClassLoadingAnnotationScanner.java
trunk/java/org/apache/catalina/core/DummyRequest.java
trunk/java/org/apache/catalina/core/DummyResponse.java
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/catalina/core/StandardFilterFacade.java
trunk/java/org/apache/catalina/core/StandardWrapperFacade.java
trunk/java/org/apache/catalina/core/StandardWrapperValve.java
trunk/java/org/apache/catalina/deploy/SessionCookie.java
trunk/java/org/apache/catalina/startup/ContextConfig.java
trunk/java/org/apache/catalina/valves/RequestDumperValve.java
trunk/java/org/apache/jasper/servlet/JspCServletContext.java
trunk/webapps/docs/changelog.xml
Log:
Modified: trunk/java/javax/servlet/AsyncContext.java
===================================================================
--- trunk/java/javax/servlet/AsyncContext.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/AsyncContext.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,48 +1,276 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
*/
-
package javax.servlet;
/**
- * @version $Rev: 743426 $ $Date: 2009-02-11 18:52:39 +0100 (Wed, 11 Feb 2009) $
+ * Class representing the execution context for an asynchronous operation
+ * that was started on a ServletRequest.
+ *
+ * <p>An AsyncContext is created and initialized by a call to
+ * {@link ServletRequest#startAsync()} or
+ * {@link ServletRequest#startAsync(ServletRequest, ServletResponse)}.
+ * Repeated invocations of these methods will return the same AsyncContext
+ * instance, reinitialized as appropriate.
+ *
* @since 3.0
*/
public interface AsyncContext {
- String ASYNC_CONTEXT_PATH = "javax.servlet.async.context_path";
- String ASYNC_PATH_INFO = "javax.servlet.async.path_info";
- String ASYNC_QUERY_STRING = "javax.servlet.async.query_string";
- String ASYNC_REQUEST_URI = "javax.servlet.async.request_uri";
- String ASYNC_SERVLET_PATH = "javax.servlet.async.servlet_path";
+ /**
+ * The name of the request attribute under which the original
+ * request URI is made available to the target of a
+ * {@link #dispatch(String)} or {@link #dispatch(ServletContext,String)}
+ */
+ static final String ASYNC_REQUEST_URI = "javax.servlet.async.request_uri";
- void complete();
+ /**
+ * The name of the request attribute under which the original
+ * context path is made available to the target of a
+ * {@link #dispatch(String)} or {@link #dispatch(ServletContext,String)}
+ */
+ static final String ASYNC_CONTEXT_PATH = "javax.servlet.async.context_path";
- void dispatch();
+ /**
+ * The name of the request attribute under which the original
+ * path info is made available to the target of a
+ * {@link #dispatch(String)} or {@link #dispatch(ServletContext,String)}
+ */
+ static final String ASYNC_PATH_INFO = "javax.servlet.async.path_info";
- void dispatch(ServletContext servletContext, String path);
+ /**
+ * The name of the request attribute under which the original
+ * servlet path is made available to the target of a
+ * {@link #dispatch(String)} or {@link #dispatch(ServletContext,String)}
+ */
+ static final String ASYNC_SERVLET_PATH = "javax.servlet.async.servlet_path";
- ServletRequest getRequest();
+ /**
+ * The name of the request attribute under which the original
+ * query string is made available to the target of a
+ * {@link #dispatch(String)} or {@link #dispatch(ServletContext,String)}
+ */
+ static final String ASYNC_QUERY_STRING = "javax.servlet.async.query_string";
- ServletResponse getResponse();
- boolean hasOriginalRequestAndResonse();
+ /**
+ * Gets the request that was used to initialize this AsyncContext
+ * by calling {@link ServletRequest#startAsync()} or
+ * {@link ServletRequest#startAsync(ServletRequest, ServletResponse)}.
+ *
+ * @return the request that was used to initialize this AsyncContext
+ */
+ public ServletRequest getRequest();
- void start(Runnable run);
+
+ /**
+ * Gets the response that was used to initialize this AsyncContext
+ * by calling {@link ServletRequest#startAsync()} or
+ * {@link ServletRequest#startAsync(ServletRequest, ServletResponse)}.
+ *
+ * @return the response that was used to initialize this AsyncContext
+ */
+ public ServletResponse getResponse();
+
+
+ /**
+ * Checks if this AsyncContext was initialized with the original
+ * request and response objects by calling
+ * {@link ServletRequest#startAsync()}, or if it was initialized
+ * with wrapped request and/or response objects using
+ * {@link ServletRequest#startAsync(ServletRequest, ServletResponse)}.
+ *
+ * <p>This information may be used by filters invoked in the
+ * <i>outbound</i> direction, after a request was put into
+ * asynchronous mode, to determine whether any request and/or response
+ * wrappers that they added during their <i>inbound</i> invocation need
+ * to be preserved for the duration of the asynchronous operation, or may
+ * be released.
+ *
+ * @return true if this AsyncContext was initialized with the original
+ * request and response objects by calling
+ * {@link ServletRequest#startAsync()}, and false if it was initialized
+ * with wrapped request and/or response objects using
+ * {@link ServletRequest#startAsync(ServletRequest, ServletResponse)}.
+ */
+ public boolean hasOriginalRequestAndResponse();
+
+
+ /**
+ * Dispatches the request and response objects of this AsyncContext
+ * to the servlet container.
+ *
+ * <p>If the asynchronous cycle was started with
+ * {@link ServletRequest#startAsync(ServletRequest, ServletResponse)}
+ * then the dispatch is to the URI of the request passed to startAsync.
+ * If the asynchronous cycle was started with
+ * {@link ServletRequest#startAsync()}, then the dispatch is to the
+ * URI of the request when it was last dispatched by the container.
+ *
+ * <p>The following sequence illustrates how this will work:
+ * <code><pre>
+ * // REQUEST dispatch to /url/A
+ * AsyncContext ac = request.startAsync();
+ * ...
+ * ac.dispatch(); // ASYNC dispatch to /url/A
+ *
+ * // FORWARD dispatch to /url/B
+ * getRequestDispatcher("/url/B").forward(request,response);
+ * // Start async operation from within the target of the FORWARD
+ * // dispatch
+ * ac = request.startAsync();
+ * ...
+ * ac.dispatch(); // ASYNC dispatch to /url/A
+ *
+ * // FORWARD dispatch to /url/B
+ * getRequestDispatcher("/url/B").forward(request,response);
+ * // Start async operation from within the target of the FORWARD
+ * // dispatch
+ * ac = request.startAsync(request,response);
+ * ...
+ * ac.dispatch(); // ASYNC dispatch to /url/B
+ * </pre></code>
+ *
+ * <p>This method returns immediately after passing the request
+ * and response objects to a container managed thread, on which the
+ * dispatch operation will be performed.
+ *
+ * <p>The dispatcher type of the request is set to
+ * <tt>DispatcherType.ASYNC</tt>. Unlike
+ * {@link RequestDispatcher#forward(ServletRequest, ServletResponse)
+ * forward dispatches}, the response buffer and
+ * headers will not be reset, and it is legal to dispatch even if the
+ * response has already been committed.
+ *
+ * <p>Control over the request and response is delegated
+ * to the dispatch target, and the response will be closed when the
+ * dispatch target has completed execution, unless
+ * {@link ServletRequest#startAsync()} or
+ * {@link ServletRequest#startAsync(ServletRequest, ServletResponse)}
+ * are called.
+ *
+ * @exception IllegalStateException if {@link #complete} has already
+ * been called
+ *
+ * @see ServletRequest#getDispatcherType
+ */
+ public void dispatch();
+
+
+ /**
+ * Dispatches the request and response objects of this AsyncContext
+ * to the given <tt>path</tt>.
+ *
+ * <p>The <tt>path</tt> parameter is interpreted in the same way
+ * as in {@link ServletRequest#getRequestDispatcher(String)}, within
+ * the scope of the {@link ServletContext} from which this
+ * AsyncContext was initialized.
+ *
+ * <p>All path related query methods of the request must reflect the
+ * dispatch target, while the original request URI, context path,
+ * path info, servlet path, and query string may be recovered from
+ * the {@link #ASYNC_REQUEST_URI}, {@link #ASYNC_CONTEXT_PATH},
+ * {@link #ASYNC_PATH_INFO}, {@link #ASYNC_SERVLET_PATH}, and
+ * {@link #ASYNC_QUERY_STRING} attributes of the request. These
+ * attributes will always reflect the original path elements, even under
+ * repeated dispatches.
+ *
+ * <p>See {@link #dispatch()} for additional details.
+ *
+ * @param path the path of the dispatch target, scoped to the
+ * ServletContext from which this AsyncContext was initialized
+ *
+ * @exception IllegalStateException if {@link #complete} has already
+ * been called
+ *
+ * @see ServletRequest#getDispatcherType
+ */
+ public void dispatch(String path);
+
+
+ /**
+ * Dispatches the request and response objects of this AsyncContext
+ * to the given <tt>path</tt> scoped to the given <tt>context</tt>.
+ *
+ * <p>The <tt>path</tt> parameter is interpreted in the same way
+ * as in {@link ServletRequest#getRequestDispatcher(String)}, except that
+ * it is scoped to the given <tt>context</tt>.
+ *
+ * <p>All path related query methods of the request must reflect the
+ * dispatch target, while the original request URI, context path,
+ * path info, servlet path, and query string may be recovered from
+ * the {@link #ASYNC_REQUEST_URI}, {@link #ASYNC_CONTEXT_PATH},
+ * {@link #ASYNC_PATH_INFO}, {@link #ASYNC_SERVLET_PATH}, and
+ * {@link #ASYNC_QUERY_STRING} attributes of the request. These
+ * attributes will always reflect the original path elements, even under
+ * repeated dispatches.
+ *
+ * <p>See {@link #dispatch()} for additional details.
+ *
+ * @param context the ServletContext of the dispatch target
+ * @param path the path of the dispatch target, scoped to the given
+ * ServletContext
+ *
+ * @exception IllegalStateException if {@link #complete} has already
+ * been called
+ *
+ * @see ServletRequest#getDispatcherType
+ */
+ public void dispatch(ServletContext context, String path);
+
+
+ /**
+ * Completes the asynchronous operation that was started on the request
+ * that was used to initialze this AsyncContext, closing the response
+ * that was used to initialize this AsyncContext.
+ *
+ * <p>Any listeners of type {@link AsyncListener} that were added to the
+ * request that was used to initialize this AsyncContext will have their
+ * {@link AsyncListener#onComplete(AsyncEvent)} method invoked.
+ */
+ public void complete();
+
+
+ /**
+ * Dispatches a container thread to run the specified Runnable in the
+ * {@link ServletContext} that initialized this AsyncContext.
+ *
+ * @param run the asynchronous handler
+ */
+ public void start(Runnable run);
}
+
+
Modified: trunk/java/javax/servlet/AsyncEvent.java
===================================================================
--- trunk/java/javax/servlet/AsyncEvent.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/AsyncEvent.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,44 +1,84 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ *
*/
-
package javax.servlet;
/**
- * @version $Rev: 743426 $ $Date: 2009-02-11 18:52:39 +0100 (Wed, 11 Feb 2009) $
+ * Event that gets fired when a ServletRequest on which asynchronous
+ * processing was started has finished processing through a call to
+ * {@link AsyncContext#complete} or has timed out.
+ *
* @since 3.0
*/
-public class AsyncEvent {
+public class AsyncEvent {
- private final ServletRequest request;
- private final ServletResponse response;
+ private ServletRequest request;
+ private ServletResponse response;
+ /**
+ * Constructs an AsyncEvent from the given request and response objects.
+ *
+ * @param request the ServletRequest
+ * @param response the ServletResponse
+ */
public AsyncEvent(ServletRequest request, ServletResponse response) {
this.request = request;
this.response = response;
}
+
+ /**
+ * Gets the ServletRequest from this event
+ *
+ * @return the ServletRequest
+ */
public ServletRequest getRequest() {
return request;
}
+
+ /**
+ * Gets the ServletResponse from this event
+ *
+ * @return the ServletResponse
+ */
public ServletResponse getResponse() {
return response;
}
+
}
+
Modified: trunk/java/javax/servlet/AsyncListener.java
===================================================================
--- trunk/java/javax/servlet/AsyncListener.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/AsyncListener.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,34 +1,86 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ *
*/
-
package javax.servlet;
+import java.io.IOException;
import java.util.EventListener;
/**
- * @version $Rev: 743426 $ $Date: 2009-02-11 18:52:39 +0100 (Wed, 11 Feb 2009) $
+ * Listener that will be notified when an asynchronous operation that was
+ * started on a ServletRequest by a call to {@link ServletRequest#startAsync}
+ * or {@link ServletRequest#startAsync(ServletRequest, ServletResponse)}
+ * completes or times out.
+ *
* @since 3.0
*/
public interface AsyncListener extends EventListener {
+
+ /**
+ * Notifies this AsyncListener that an asynchronous operation
+ * started on the ServletRequest with which this AsyncListener was
+ * registered has been completed.
+ *
+ * @param event the AsyncEvent containing the request and response
+ * objects that were used when this AsyncListener was registered via a
+ * call to {@link ServletRequest#addAsyncListener(AsyncListener)}
+ * or {@link ServletRequest#addAsyncListener(AsyncListener,
+ * ServletRequest, ServletResponse)}
+ *
+ * @throws IOException if an I/O exception occurred during the processing
+ * of the given AsyncEvent
+ */
+ public void onComplete(AsyncEvent event) throws IOException;
- void onComplete(AsyncEvent event);
- void onTimeout(AsyncEvent event);
+ /**
+ * Notifies this AsyncListener that an asynchronous operation
+ * started on the ServletRequest with which this AsyncListener was
+ * registered has timed out.
+ *
+ * @param event the AsyncEvent containing the request and response
+ * objects that were used when this AsyncListener was registered via a
+ * call to {@link ServletRequest#addAsyncListener(AsyncListener)}
+ * or {@link ServletRequest#addAsyncListener(AsyncListener,
+ * ServletRequest, ServletResponse)}
+ *
+ * @throws IOException if an I/O exception occurred during the processing
+ * of the given AsyncEvent
+ */
+ public void onTimeout(AsyncEvent event) throws IOException;
+
}
Modified: trunk/java/javax/servlet/DispatcherType.java
===================================================================
--- trunk/java/javax/servlet/DispatcherType.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/DispatcherType.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,34 +1,38 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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]"
+ *
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ *
*/
-
package javax.servlet;
/**
- * @version $Rev: 743426 $ $Date: 2009-02-11 18:52:39 +0100 (Wed, 11 Feb 2009) $
- * @since 3.0
+ * Enumeration of filter dispatcher types.
*/
public enum DispatcherType {
-
- ERROR,
FORWARD,
INCLUDE,
REQUEST,
- ASYNC
+ ASYNC,
+ ERROR
}
Modified: trunk/java/javax/servlet/Filter.java
===================================================================
--- trunk/java/javax/servlet/Filter.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/Filter.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,95 +1,158 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
package javax.servlet;
import java.io.IOException;
- /**
- * A filter is an object that performs filtering tasks on either the request to a resource (a servlet or static content), or on the response from a resource, or both.
- * <br><br>
- * Filters perform filtering in the <code>doFilter</code> method. Every Filter has access to
- ** a FilterConfig object from which it can obtain its initialization parameters, a
- ** reference to the ServletContext which it can use, for example, to load resources
- ** needed for filtering tasks.
- ** <p>
- ** Filters are configured in the deployment descriptor of a web application
- ** <p>
- ** Examples that have been identified for this design are<br>
- ** 1) Authentication Filters <br>
- ** 2) Logging and Auditing Filters <br>
- ** 3) Image conversion Filters <br>
- ** 4) Data compression Filters <br>
- ** 5) Encryption Filters <br>
- ** 6) Tokenizing Filters <br>
- ** 7) Filters that trigger resource access events <br>
- ** 8) XSL/T filters <br>
- ** 9) Mime-type chain Filter <br>
- * @since Servlet 2.3
- */
+/**
+ * A filter is an object that performs filtering tasks on either the
+ * request to a resource (a servlet or static content), or on the response
+ * from a resource, or both.
+ *
+ * <p>Filters perform filtering in the <code>doFilter</code> method.
+ * Every Filter has access to a FilterConfig object from which it can obtain
+ * its initialization parameters, and a reference to the ServletContext which
+ * it can use, for example, to load resources needed for filtering tasks.
+ *
+ * <p>Filters are configured in the deployment descriptor of a web
+ * application.
+ *
+ * <p>Examples that have been identified for this design are:
+ * <ol>
+ * <li>Authentication Filters
+ * <li>Logging and Auditing Filters
+ * <li>Image conversion Filters
+ * <li>Data compression Filters
+ * <li>Encryption Filters
+ * <li>Tokenizing Filters
+ * <li>Filters that trigger resource access events
+ * <li>XSL/T filters
+ * <li>Mime-type chain Filter
+ * </ol>
+ *
+ * @since Servlet 2.3
+ */
public interface Filter {
- /**
- * Called by the web container to indicate to a filter that it is being placed into
- * service. The servlet container calls the init method exactly once after instantiating the
- * filter. The init method must complete successfully before the filter is asked to do any
- * filtering work. <br><br>
-
- * The web container cannot place the filter into service if the init method either<br>
- * 1.Throws a ServletException <br>
- * 2.Does not return within a time period defined by the web container
- */
- public void init(FilterConfig filterConfig) throws ServletException;
+ /**
+ * Called by the web container to indicate to a filter that it is
+ * being placed into service.
+ *
+ * <p>The servlet container calls the init
+ * method exactly once after instantiating the filter. The init
+ * method must complete successfully before the filter is asked to do any
+ * filtering work.
+ *
+ * <p>The web container cannot place the filter into service if the init
+ * method either
+ * <ol>
+ * <li>Throws a ServletException
+ * <li>Does not return within a time period defined by the web container
+ * </ol>
+ */
+ public void init(FilterConfig filterConfig) throws ServletException;
- /**
- * The <code>doFilter</code> method of the Filter is called by the container
- * each time a request/response pair is passed through the chain due
- * to a client request for a resource at the end of the chain. The FilterChain passed in to this
- * method allows the Filter to pass on the request and response to the next entity in the
- * chain.<p>
- * A typical implementation of this method would follow the following pattern:- <br>
- * 1. Examine the request<br>
- * 2. Optionally wrap the request object with a custom implementation to
- * filter content or headers for input filtering <br>
- * 3. Optionally wrap the response object with a custom implementation to
- * filter content or headers for output filtering <br>
- * 4. a) <strong>Either</strong> invoke the next entity in the chain using the FilterChain object (<code>chain.doFilter()</code>), <br>
- ** 4. b) <strong>or</strong> not pass on the request/response pair to the next entity in the filter chain to block the request processing<br>
- ** 5. Directly set headers on the response after invocation of the next entity in the filter chain.
- **/
- public void doFilter ( ServletRequest request, ServletResponse response, FilterChain chain ) throws IOException, ServletException;
+ /**
+ * The <code>doFilter</code> method of the Filter is called by the
+ * container each time a request/response pair is passed through the
+ * chain due to a client request for a resource at the end of the chain.
+ * The FilterChain passed in to this method allows the Filter to pass
+ * on the request and response to the next entity in the chain.
+ *
+ * <p>A typical implementation of this method would follow the following
+ * pattern:
+ * <ol>
+ * <li>Examine the request
+ * <li>Optionally wrap the request object with a custom implementation to
+ * filter content or headers for input filtering
+ * <li>Optionally wrap the response object with a custom implementation to
+ * filter content or headers for output filtering
+ * <li>
+ * <ul>
+ * <li><strong>Either</strong> invoke the next entity in the chain
+ * using the FilterChain object
+ * (<code>chain.doFilter()</code>),
+ * <li><strong>or</strong> not pass on the request/response pair to
+ * the next entity in the filter chain to
+ * block the request processing
+ * </ul>
+ * <li>Directly set headers on the response after invocation of the
+ * next entity in the filter chain.
+ * </ol>
+ */
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain)
+ throws IOException, ServletException;
- /**
- * Called by the web container to indicate to a filter that it is being taken out of service. This
- * method is only called once all threads within the filter's doFilter method have exited or after
- * a timeout period has passed. After the web container calls this method, it will not call the
- * doFilter method again on this instance of the filter. <br><br>
- *
- * This method gives the filter an opportunity to clean up any resources that are being held (for
- * example, memory, file handles, threads) and make sure that any persistent state is synchronized
- * with the filter's current state in memory.
- */
- public void destroy();
-
-
+ /**
+ * Called by the web container to indicate to a filter that it is being
+ * taken out of service.
+ *
+ * <p>This method is only called once all threads within the filter's
+ * doFilter method have exited or after a timeout period has passed.
+ * After the web container calls this method, it will not call the
+ * doFilter method again on this instance of the filter.
+ *
+ * <p>This method gives the filter an opportunity to clean up any
+ * resources that are being held (for example, memory, file handles,
+ * threads) and make sure that any persistent state is synchronized
+ * with the filter's current state in memory.
+ */
+ public void destroy();
}
Modified: trunk/java/javax/servlet/FilterChain.java
===================================================================
--- trunk/java/javax/servlet/FilterChain.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/FilterChain.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
import java.io.IOException;
Modified: trunk/java/javax/servlet/FilterConfig.java
===================================================================
--- trunk/java/javax/servlet/FilterConfig.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/FilterConfig.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,73 +1,101 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
package javax.servlet;
import java.util.Enumeration;
- /**
- *
- * A filter configuration object used by a servlet container
- * to pass information to a filter during initialization.
- * @see Filter
- * @since Servlet 2.3
- *
- */
-
-
+/**
+ * A filter configuration object used by a servlet container
+ * to pass information to a filter during initialization.
+ *
+ * @see Filter
+ * @since Servlet 2.3
+ */
public interface FilterConfig {
- /**
- * Returns the filter-name of this filter as defined in the deployment descriptor.
- */
-
- public String getFilterName();
+ /**
+ * Returns the filter-name of this filter as defined in the deployment
+ * descriptor.
+ */
+ public String getFilterName();
- /**
+ /**
* Returns a reference to the {@link ServletContext} in which the caller
* is executing.
*
- *
- * @return a {@link ServletContext} object, used
- * by the caller to interact with its servlet
- * container
+ * @return a {@link ServletContext} object, used by the caller to
+ * interact with its servlet container
*
- * @see ServletContext
- *
+ * @see ServletContext
*/
-
public ServletContext getServletContext();
+
/**
* Returns a <code>String</code> containing the value of the
* named initialization parameter, or <code>null</code> if
- * the parameter does not exist.
+ * the initialization parameter does not exist.
*
- * @param name a <code>String</code> specifying the name
- * of the initialization parameter
+ * @param name a <code>String</code> specifying the name of the
+ * initialization parameter
*
- * @return a <code>String</code> containing the value
- * of the initialization parameter
- *
+ * @return a <code>String</code> containing the value of the
+ * initialization parameter, or <code>null</code> if
+ * the initialization parameter does not exist
*/
-
public String getInitParameter(String name);
@@ -77,17 +105,9 @@
* or an empty <code>Enumeration</code> if the filter has
* no initialization parameters.
*
- * @return an <code>Enumeration</code> of <code>String</code>
- * objects containing the names of the filter's
- * initialization parameters
- *
- *
- *
+ * @return an <code>Enumeration</code> of <code>String</code> objects
+ * containing the names of the filter's initialization parameters
*/
+ public Enumeration<String> getInitParameterNames();
- public Enumeration getInitParameterNames();
-
-
-
-
}
Modified: trunk/java/javax/servlet/FilterRegistration.java
===================================================================
--- trunk/java/javax/servlet/FilterRegistration.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/FilterRegistration.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,43 +1,199 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
*/
-
package javax.servlet;
import java.util.EnumSet;
import java.util.Map;
/**
- * @version $Rev: 751589 $ $Date: 2009-03-09 06:35:08 +0100 (Mon, 09 Mar 2009) $
+ * Class through which a {@link Filter} (either annotated or declared
+ * in the deployment descriptor or added via
+ * {@link ServletContext#addFilter(String, String)}) may be further
+ * configured.
+ *
+ * <p>While all aspects of a Filter added via
+ * {@link ServletContext#addFilter(String, String)}) are configurable,
+ * the only configurable aspects of an annotated or declared Filter are
+ * its initialization parameters and mappings. Initialization parameters
+ * may only be added, but not overridden.
+ *
* @since 3.0
*/
public interface FilterRegistration {
- boolean setDescription(String description);
- void setAsyncSupported(boolean asyncSupported);
+ /**
+ * Sets the description on the filter for which this
+ * FilterRegistration was created.
+ *
+ * <p>A call to this method overrides any previous setting.
+ *
+ * @param description the description of the filter
+ *
+ * @return true if the update was successful, false otherwise
+ *
+ * @throws IllegalStateException if the ServletContext from which this
+ * FilterRegistration was obtained has already been initialized
+ */
+ public boolean setDescription(String description);
- void addMappingForServletNames(EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter, String ... servletNames);
- void addMappingForUrlPatterns(EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter, String ... urlPatterns);
+ /**
+ * Sets the initialization parameter with the given name and value
+ * on the filter for which this FilterRegistration was created.
+ *
+ * @param name the initialization parameter name
+ * @param value the initialization parameter value
+ *
+ * @return true if the update was successful, false otherwise
+ *
+ * @throws IllegalStateException if the ServletContext from which this
+ * FilterRegistration was obtained has already been initialized
+ * @throws IllegalArgumentException if the given name or value is
+ * <tt>null</tt>
+ */
+ public boolean setInitParameter(String name, String value);
- boolean setInitParameter(String name, String value);
- void setInitParameters(Map<String, String> initParameters);
+ /**
+ * Sets the given initialization parameters on the filter for which
+ * this FilterRegistration was created.
+ *
+ * <p>The given map of initialization parameters is processed
+ * <i>by-value</i>, i.e., for each initialization parameter contained
+ * in the map, this method calls {@link #setInitParameter(String,String)}.
+ * If that method would return false for any of the
+ * initialization parameters in the given map, no updates will be
+ * performed, and false will be returned. Likewise, if the map contains
+ * an initialization parameter with a <tt>null</tt> name or value, no
+ * updates will be performed, and an IllegalArgumentException will be
+ * thrown.
+ *
+ * @param initParameters the initialization parameters
+ *
+ * @return true if the update was successful, false otherwise
+ *
+ * @throws IllegalStateException if the ServletContext from which this
+ * FilterRegistration was obtained has already been initialized
+ * @throws IllegalArgumentException if the given map contains an
+ * initialization parameter with a <tt>null</tt> name or value
+ */
+ public boolean setInitParameters(Map<String, String> initParameters);
+
+ /**
+ * Configures the filter for which this FilterRegistration was created
+ * as supporting asynchronous operations or not.
+ *
+ * <p>By default, a filter does not support asynchronous operations.
+ *
+ * <p>A call to this method overrides any previous setting.
+ *
+ * @param isAsyncSupported true if the filter supports asynchronous
+ * operations, false otherwise
+ *
+ * @return true if the update was successful, false otherwise
+ *
+ * @throws IllegalStateException if the ServletContext from which this
+ * FilterRegistration was obtained has already been initialized
+ */
+ public boolean setAsyncSupported(boolean isAsyncSupported);
+
+
+ /**
+ * Adds a filter mapping with the given servlet names and dispatcher
+ * types for the filter for which this FilterRegistration was created.
+ *
+ * <p>Filter mappings are matched in the order in which they were
+ * added.
+ *
+ * <p>Depending on the value of the <tt>isMatchAfter</tt> parameter, the
+ * given filter mapping will be considered after or before any
+ * <i>declared</i> filter mappings of the ServletContext from which this
+ * FilterRegistration was obtained.
+ *
+ * @param dispatcherTypes the dispatcher types of the filter mapping,
+ * or null if the default <tt>DispatcherType.REQUEST</tt> is to be used
+ * @param isMatchAfter true if the given filter mapping should be matched
+ * after any declared filter mappings, and false if it is supposed to
+ * be matched before any declared filter mappings of the ServletContext
+ * from which this FilterRegistration was obtained
+ * @param servletNames the servlet names of the filter mapping
+ *
+ * @return true if the update was successful, false otherwise
+ *
+ * @throws IllegalArgumentException if <tt>servletNames</tt> is null or
+ * empty
+ * @throws IllegalStateException if the ServletContext from which this
+ * FilterRegistration was obtained has already been initialized
+ */
+ public boolean addMappingForServletNames(
+ EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
+ String... servletNames);
+
+
+ /**
+ * Adds a filter mapping with the given url patterns and dispatcher
+ * types for the filter for which this FilterRegistration was created.
+ *
+ * <p>Filter mappings are matched in the order in which they were
+ * added.
+ *
+ * <p>Depending on the value of the <tt>isMatchAfter</tt> parameter, the
+ * given filter mapping will be considered after or before any
+ * <i>declared</i> filter mappings of the ServletContext from which
+ * this FilterRegistration was obtained.
+ *
+ * @param dispatcherTypes the dispatcher types of the filter mapping,
+ * or null if the default <tt>DispatcherType.REQUEST</tt> is to be used
+ * @param isMatchAfter true if the given filter mapping should be matched
+ * after any declared filter mappings, and false if it is supposed to
+ * be matched before any declared filter mappings of the ServletContext
+ * from which this FilterRegistration was obtained
+ * @param urlPatterns the url patterns of the filter mapping
+ *
+ * @return true if the update was successful, false otherwise
+ *
+ * @throws IllegalArgumentException if <tt>urlPatterns</tt> is null or
+ * empty
+ * @throws IllegalStateException if the ServletContext from which this
+ * FilterRegistration was obtained has already been initialized
+ */
+ public boolean addMappingForUrlPatterns(
+ EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
+ String... urlPatterns);
}
+
Modified: trunk/java/javax/servlet/GenericServlet.java
===================================================================
--- trunk/java/javax/servlet/GenericServlet.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/GenericServlet.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,26 +1,65 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
import java.io.IOException;
import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.ResourceBundle;
/**
*
@@ -45,16 +84,15 @@
*
*
* @author Various
- * @version $Version$
- *
- *
- *
*/
public abstract class GenericServlet
implements Servlet, ServletConfig, java.io.Serializable
{
+ private static final String LSTRING_FILE = "javax.servlet.LocalStrings";
+ private static ResourceBundle lStrings =
+ ResourceBundle.getBundle(LSTRING_FILE);
private transient ServletConfig config;
@@ -65,23 +103,19 @@
* is done by one of the <code>init</code> methods.
*
*/
-
public GenericServlet() { }
-
- /**
+ /**
* Called by the servlet container to indicate to a servlet that the
* servlet is being taken out of service. See {@link Servlet#destroy}.
*
*
*/
-
public void destroy() {
}
-
/**
* Returns a <code>String</code> containing the value of the named
* initialization parameter, or <code>null</code> if the parameter does
@@ -98,13 +132,17 @@
* of the initialization parameter
*
*/
+ public String getInitParameter(String name) {
+ ServletConfig sc = getServletConfig();
+ if (sc == null) {
+ throw new IllegalStateException(
+ lStrings.getString("err.servlet_config_not_initialized"));
+ }
- public String getInitParameter(String name) {
- return getServletConfig().getInitParameter(name);
+ return sc.getInitParameter(name);
}
-
/**
* Returns the names of the servlet's initialization parameters
* as an <code>Enumeration</code> of <code>String</code> objects,
@@ -119,30 +157,27 @@
* @return Enumeration an enumeration of <code>String</code>
* objects containing the names of
* the servlet's initialization parameters
- *
*/
+ public Enumeration<String> getInitParameterNames() {
+ ServletConfig sc = getServletConfig();
+ if (sc == null) {
+ throw new IllegalStateException(
+ lStrings.getString("err.servlet_config_not_initialized"));
+ }
- public Enumeration getInitParameterNames() {
- return getServletConfig().getInitParameterNames();
+ return sc.getInitParameterNames();
}
-
-
-
/**
* Returns this servlet's {@link ServletConfig} object.
*
* @return ServletConfig the <code>ServletConfig</code> object
* that initialized this servlet
- *
- */
-
+ */
public ServletConfig getServletConfig() {
return config;
}
-
-
/**
@@ -156,17 +191,18 @@
* @return ServletContext the <code>ServletContext</code> object
* passed to this servlet by the <code>init</code>
* method
- *
*/
+ public ServletContext getServletContext() {
+ ServletConfig sc = getServletConfig();
+ if (sc == null) {
+ throw new IllegalStateException(
+ lStrings.getString("err.servlet_config_not_initialized"));
+ }
- public ServletContext getServletContext() {
- return getServletConfig().getServletContext();
+ return sc.getServletContext();
}
-
-
-
/**
* Returns information about the servlet, such as
* author, version, and copyright.
@@ -177,18 +213,13 @@
*
* @return String information about this servlet, by default an
* empty string
- *
- */
-
+ */
public String getServletInfo() {
return "";
}
-
-
/**
- *
* Called by the servlet container to indicate to a servlet that the
* servlet is being placed into service. See {@link Servlet#init}.
*
@@ -204,23 +235,16 @@
* @exception ServletException if an exception occurs that
* interrupts the servlet's normal
* operation
- *
*
* @see UnavailableException
- *
*/
-
public void init(ServletConfig config) throws ServletException {
this.config = config;
this.init();
}
-
-
-
/**
- *
* A convenience method which can be overridden so that there's no need
* to call <code>super.init(config)</code>.
*
@@ -233,33 +257,24 @@
* @exception ServletException if an exception occurs that
* interrupts the servlet's
* normal operation
- *
*/
-
public void init() throws ServletException {
}
-
-
/**
- *
* Writes the specified message to a servlet log file, prepended by the
* servlet's name. See {@link ServletContext#log(String)}.
*
* @param msg a <code>String</code> specifying
* the message to be written to the log file
- *
- */
-
+ */
public void log(String msg) {
getServletContext().log(getServletName() + ": "+ msg);
}
-
-
/**
* Writes an explanatory message and a stack trace
* for a given <code>Throwable</code> exception
@@ -272,16 +287,12 @@
*
* @param t the <code>java.lang.Throwable</code> error
* or exception
- *
- *
- */
-
+ */
public void log(String message, Throwable t) {
getServletContext().log(getServletName() + ": " + message, t);
}
-
/**
* Called by the servlet container to allow the servlet to respond to
* a request. See {@link Servlet#service}.
@@ -289,8 +300,6 @@
* <p>This method is declared abstract so subclasses, such as
* <code>HttpServlet</code>, must override it.
*
- *
- *
* @param req the <code>ServletRequest</code> object
* that contains the client's request
*
@@ -303,25 +312,25 @@
*
* @exception IOException if an input or output
* exception occurs
- *
*/
public abstract void service(ServletRequest req, ServletResponse res)
throws ServletException, IOException;
-
/**
* Returns the name of this servlet instance.
* See {@link ServletConfig#getServletName}.
*
* @return the name of this servlet instance
- *
- *
- *
*/
+ public String getServletName() {
+ ServletConfig sc = getServletConfig();
+ if (sc == null) {
+ throw new IllegalStateException(
+ lStrings.getString("err.servlet_config_not_initialized"));
+ }
- public String getServletName() {
- return config.getServletName();
+ return sc.getServletName();
}
}
Modified: trunk/java/javax/servlet/LocalStrings.properties
===================================================================
--- trunk/java/javax/servlet/LocalStrings.properties 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/LocalStrings.properties 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,29 +1,61 @@
-##
-## 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.
-##
+#
+# 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.
+#
-##
-## $Rev: 600957 $ $Date: 2007-12-04 15:01:31 +0100 (Tue, 04 Dec 2007) $
-##
-
# Default localized string information
# Localized for Locale en_US
err.not_iso8859_1=Not an ISO 8859-1 character: {0}
+err.servlet_config_not_initialized=ServletConfig has not been initialized
value.true=true
value.false=false
Modified: trunk/java/javax/servlet/LocalStrings_fr.properties
===================================================================
--- trunk/java/javax/servlet/LocalStrings_fr.properties 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/LocalStrings_fr.properties 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,26 +1,57 @@
-##
-## 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.
-##
+#
+# 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.
+#
-##
-## $Rev: 600957 $ $Date: 2007-12-04 15:01:31 +0100 (Tue, 04 Dec 2007) $
-##
-
# Default localized string information
# Localized for Locale fr_FR
Modified: trunk/java/javax/servlet/LocalStrings_ja.properties
===================================================================
--- trunk/java/javax/servlet/LocalStrings_ja.properties 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/LocalStrings_ja.properties 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,26 +1,57 @@
-##
-## 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.
-##
+#
+# 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.
+#
-##
-## $Rev: 600957 $ $Date: 2007-12-04 15:01:31 +0100 (Tue, 04 Dec 2007) $
-##
-
# Default localized string information
# Localized for Locale ja_JP
Modified: trunk/java/javax/servlet/RequestDispatcher.java
===================================================================
--- trunk/java/javax/servlet/RequestDispatcher.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/RequestDispatcher.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,27 +1,60 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
-
package javax.servlet;
import java.io.IOException;
-
/**
* Defines an object that receives requests from the client
* and sends them to any resource (such as a servlet,
@@ -34,71 +67,171 @@
* but a servlet container can create <code>RequestDispatcher</code>
* objects to wrap any type of resource.
*
- * @author Various
- * @version $Version$
+ * @author Various
*
- * @see ServletContext#getRequestDispatcher(java.lang.String)
- * @see ServletContext#getNamedDispatcher(java.lang.String)
- * @see ServletRequest#getRequestDispatcher(java.lang.String)
- *
+ * @see ServletContext#getRequestDispatcher(java.lang.String)
+ * @see ServletContext#getNamedDispatcher(java.lang.String)
+ * @see ServletRequest#getRequestDispatcher(java.lang.String)
*/
public interface RequestDispatcher {
+ /**
+ * The name of the request attribute under which the original
+ * request URI is made available to the target of a
+ * {@link #forward(ServletRequest,ServletResponse) forward}
+ */
+ static final String FORWARD_REQUEST_URI = "javax.servlet.forward.request_uri";
+ /**
+ * The name of the request attribute under which the original
+ * context path is made available to the target of a
+ * {@link #forward(ServletRequest,ServletResponse) forward}
+ */
+ static final String FORWARD_CONTEXT_PATH = "javax.servlet.forward.context_path";
+ /**
+ * The name of the request attribute under which the original
+ * path info is made available to the target of a
+ * {@link #forward(ServletRequest,ServletResponse) forward}
+ */
+ static final String FORWARD_PATH_INFO = "javax.servlet.forward.path_info";
+ /**
+ * The name of the request attribute under which the original
+ * servlet path is made available to the target of a
+ * {@link #forward(ServletRequest,ServletResponse) forward}
+ */
+ static final String FORWARD_SERVLET_PATH = "javax.servlet.forward.servlet_path";
-/**
- * Forwards a request from
- * a servlet to another resource (servlet, JSP file, or
- * HTML file) on the server. This method allows
- * one servlet to do preliminary processing of
- * a request and another resource to generate
- * the response.
- *
- * <p>For a <code>RequestDispatcher</code> obtained via
- * <code>getRequestDispatcher()</code>, the <code>ServletRequest</code>
- * object has its path elements and parameters adjusted to match
- * the path of the target resource.
- *
- * <p><code>forward</code> should be called before the response has been
- * committed to the client (before response body output has been flushed).
- * If the response already has been committed, this method throws
- * an <code>IllegalStateException</code>.
- * Uncommitted output in the response buffer is automatically cleared
- * before the forward.
- *
- * <p>The request and response parameters must be either the same
- * objects as were passed to the calling servlet's service method or be
- * subclasses of the {@link ServletRequestWrapper} or {@link ServletResponseWrapper} classes
- * that wrap them.
- *
- *
- * @param request a {@link ServletRequest} object
- * that represents the request the client
- * makes of the servlet
- *
- * @param response a {@link ServletResponse} object
- * that represents the response the servlet
- * returns to the client
- *
- * @exception ServletException if the target resource throws this exception
- *
- * @exception IOException if the target resource throws this exception
- *
- * @exception IllegalStateException if the response was already committed
- *
- */
+ /**
+ * The name of the request attribute under which the original
+ * query string is made available to the target of a
+ * {@link #forward(ServletRequest,ServletResponse) forward}
+ */
+ static final String FORWARD_QUERY_STRING = "javax.servlet.forward.query_string";
- public void forward(ServletRequest request, ServletResponse response)
- throws ServletException, IOException;
+ /**
+ * The name of the request attribute under which the request URI
+ * of the target of an {@link #include(ServletRequest,ServletResponse)
+ * include} is stored
+ */
+ static final String INCLUDE_REQUEST_URI = "javax.servlet.include.request_uri";
+ /**
+ * The name of the request attribute under which the context path
+ * of the target of an {@link #include(ServletRequest,ServletResponse)
+ * include} is stored
+ */
+ static final String INCLUDE_CONTEXT_PATH = "javax.servlet.include.context_path";
+ /**
+ * The name of the request attribute under which the path info
+ * of the target of an {@link #include(ServletRequest,ServletResponse)
+ * include} is stored
+ */
+ static final String INCLUDE_PATH_INFO = "javax.servlet.include.path_info";
+ /**
+ * The name of the request attribute under which the servlet path
+ * of the target of an {@link #include(ServletRequest,ServletResponse)
+ * include} is stored
+ */
+ static final String INCLUDE_SERVLET_PATH = "javax.servlet.include.servlet_path";
/**
+ * The name of the request attribute under which the query string
+ * of the target of an {@link #include(ServletRequest,ServletResponse)
+ * include} is stored
+ */
+ static final String INCLUDE_QUERY_STRING = "javax.servlet.include.query_string";
+
+ /**
+ * The name of the request attribute under which the exception object
+ * is propagated during an error dispatch
+ */
+ public static final String ERROR_EXCEPTION = "javax.servlet.error.exception";
+
+ /**
+ * The name of the request attribute under which the type of the
+ * exception object is propagated during an error dispatch
+ */
+ public static final String ERROR_EXCEPTION_TYPE = "javax.servlet.error.exception_type";
+
+ /**
+ * The name of the request attribute under which the exception message
+ * is propagated during an error dispatch
+ */
+ public static final String ERROR_MESSAGE = "javax.servlet.error.message";
+
+ /**
+ * The name of the request attribute under which the request URI
+ * whose processing caused the error is propagated during an error
+ * dispatch
+ */
+ public static final String ERROR_REQUEST_URI = "javax.servlet.error.request_uri";
+
+ /**
+ * The name of the request attribute under which the name of the servlet
+ * in which the error occurred is propagated during an error dispatch
+ */
+ public static final String ERROR_SERVLET_NAME = "javax.servlet.error.servlet_name";
+
+ /**
+ * The name of the request attribute under which the response status
+ * is propagated during an error dispatch
+ */
+ public static final String ERROR_STATUS_CODE = "javax.servlet.error.status_code";
+
+
+ /**
+ * Forwards a request from
+ * a servlet to another resource (servlet, JSP file, or
+ * HTML file) on the server. This method allows
+ * one servlet to do preliminary processing of
+ * a request and another resource to generate
+ * the response.
*
+ * <p>For a <code>RequestDispatcher</code> obtained via
+ * <code>getRequestDispatcher()</code>, the <code>ServletRequest</code>
+ * object has its path elements and parameters adjusted to match
+ * the path of the target resource.
+ *
+ * <p><code>forward</code> should be called before the response has been
+ * committed to the client (before response body output has been flushed).
+ * If the response already has been committed, this method throws
+ * an <code>IllegalStateException</code>.
+ * Uncommitted output in the response buffer is automatically cleared
+ * before the forward.
+ *
+ * <p>The request and response parameters must be either the same
+ * objects as were passed to the calling servlet's service method or be
+ * subclasses of the {@link ServletRequestWrapper} or
+ * {@link ServletResponseWrapper} classes
+ * that wrap them.
+ *
+ * <p>This method sets the dispatcher type of the given request to
+ * <code>DispatcherType.FORWARD</code>.
+ *
+ * @param request a {@link ServletRequest} object that represents the
+ * request the client makes of the servlet
+ *
+ * @param response a {@link ServletResponse} object that represents
+ * the response the servlet returns to the client
+ *
+ * @throws ServletException if the target resource throws this exception
+ *
+ * @throws IOException if the target resource throws this exception
+ *
+ * @throws IllegalStateException if the response was already committed
+ *
+ * @see ServletRequest#getDispatcherType
+ */
+ public void forward(ServletRequest request, ServletResponse response)
+ throws ServletException, IOException;
+
+ /**
+ *
* Includes the content of a resource (servlet, JSP page,
* HTML file) in the response. In essence, this method enables
* programmatic server-side includes.
@@ -110,26 +243,27 @@
*
* <p>The request and response parameters must be either the same
* objects as were passed to the calling servlet's service method or be
- * subclasses of the {@link ServletRequestWrapper} or {@link ServletResponseWrapper} classes
- * that wrap them.
- *
+ * subclasses of the {@link ServletRequestWrapper} or
+ * {@link ServletResponseWrapper} classes that wrap them.
*
+ * <p>This method sets the dispatcher type of the given request to
+ * <code>DispatcherType.INCLUDE</code>.
*
- * @param request a {@link ServletRequest} object
- * that contains the client's request
+ * @param request a {@link ServletRequest} object that contains the
+ * client's request
*
- * @param response a {@link ServletResponse} object
- * that contains the servlet's response
+ * @param response a {@link ServletResponse} object that contains the
+ * servlet's response
*
- * @exception ServletException if the included resource throws this exception
+ * @throws ServletException if the included resource throws this
+ * exception
*
- * @exception IOException if the included resource throws this exception
+ * @throws IOException if the included resource throws this exception
*
- *
+ * @see ServletRequest#getDispatcherType
*/
-
public void include(ServletRequest request, ServletResponse response)
- throws ServletException, IOException;
+ throws ServletException, IOException;
}
Modified: trunk/java/javax/servlet/Servlet.java
===================================================================
--- trunk/java/javax/servlet/Servlet.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/Servlet.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
import java.io.IOException;
@@ -52,7 +89,6 @@
* such as author, version, and copyright.
*
* @author Various
- * @version $Version$
*
* @see GenericServlet
* @see javax.servlet.http.HttpServlet
Modified: trunk/java/javax/servlet/ServletConfig.java
===================================================================
--- trunk/java/javax/servlet/ServletConfig.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletConfig.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,80 +1,101 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
package javax.servlet;
import java.util.Enumeration;
+import java.util.Iterator;
-
-
/**
- *
* A servlet configuration object used by a servlet container
* to pass information to a servlet during initialization.
- *
*/
-
-public interface ServletConfig {
+ public interface ServletConfig {
-
/**
* Returns the name of this servlet instance.
* The name may be provided via server administration, assigned in the
* web application deployment descriptor, or for an unregistered (and thus
* unnamed) servlet instance it will be the servlet's class name.
*
- * @return the name of the servlet instance
- *
- *
- *
+ * @return the name of the servlet instance
*/
-
public String getServletName();
+
/**
* Returns a reference to the {@link ServletContext} in which the caller
* is executing.
*
- *
- * @return a {@link ServletContext} object, used
- * by the caller to interact with its servlet
- * container
+ * @return a {@link ServletContext} object, used
+ * by the caller to interact with its servlet container
*
- * @see ServletContext
- *
+ * @see ServletContext
*/
+ public ServletContext getServletContext();
- public ServletContext getServletContext();
/**
- * Returns a <code>String</code> containing the value of the
- * named initialization parameter, or <code>null</code> if
- * the parameter does not exist.
+ * Gets the value of the initialization parameter with the given name.
*
- * @param name a <code>String</code> specifying the name
- * of the initialization parameter
+ * @param name the name of the initialization parameter whose value to
+ * get
*
- * @return a <code>String</code> containing the value
- * of the initialization parameter
- *
+ * @return a <code>String</code> containing the value
+ * of the initialization parameter, or <code>null</code> if
+ * the initialization parameter does not exist
*/
-
public String getInitParameter(String name);
@@ -84,15 +105,10 @@
* or an empty <code>Enumeration</code> if the servlet has
* no initialization parameters.
*
- * @return an <code>Enumeration</code> of <code>String</code>
- * objects containing the names of the servlet's
- * initialization parameters
- *
- *
- *
+ * @return an <code>Enumeration</code> of <code>String</code>
+ * objects containing the names of the servlet's
+ * initialization parameters
*/
+ public Enumeration<String> getInitParameterNames();
- public Enumeration getInitParameterNames();
-
-
}
Added: trunk/java/javax/servlet/ServletContainerInitializer.java
===================================================================
--- trunk/java/javax/servlet/ServletContainerInitializer.java (rev 0)
+++ trunk/java/javax/servlet/ServletContainerInitializer.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ *
+ */
+
+
+package javax.servlet;
+
+
+import java.util.Set;
+
+/**
+ * An implementation of this interface can be provided by a library /
+ * runtime to get notified by the container for the classes / interfaces
+ * that it expresses interest via the <tt>@HandlesTypes</tt> annotation. If
+ * there is no <tt>@HandlesTypes</tt> annotation on an implementation of this
+ * interface, the container MUST invoke the <tt>onStartup</tt> method once for
+ * every webapp passing it a <tt>null</tt> set of classes.
+ *
+ * @see javax.servlet.annotation.HandlesTypes
+ *
+ * @since 3.0
+ */
+public interface ServletContainerInitializer {
+ /**
+ *
+ * @param c The set of classes that an implementation of ServletContainerInitializer expressed interest on
+ * via the <tt>HandlesTypes</tt> annotation. If there is no <tt>HandlesTypes</tt> annotation on the implementation
+ * of the ServletContainerInitializer, a <tt>null</tt> set of classes will be passed
+ *
+ * @param ctx The <tt>ServletContext</tt> instance in which the types defined via the <tt>HandlesTypes</tt>
+ * are found.
+ *
+ * @since 3.0
+ */
+ public void onStartup(Set<Class<?>> c, ServletContext ctx);
+}
Modified: trunk/java/javax/servlet/ServletContext.java
===================================================================
--- trunk/java/javax/servlet/ServletContext.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletContext.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,20 +1,55 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
package javax.servlet;
@@ -23,13 +58,11 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;
+import java.util.EnumSet;
+import java.util.Map;
import java.util.Set;
-import java.util.Map;
-import java.util.EnumSet;
-
/**
- *
* Defines a set of methods that a servlet uses to communicate with its
* servlet container, for example, to get the MIME type of a file, dispatch
* requests, or write to a log file.
@@ -51,17 +84,48 @@
* servlet when the servlet is initialized.
*
* @author Various
- * @version $Version$
*
* @see Servlet#getServletConfig
* @see ServletConfig#getServletContext
- *
*/
public interface ServletContext {
+ /**
+ * The name of the <tt>ServletContext</tt> attribute which stores
+ * the private temporary directory (of type <tt>java.io.File</tt>)
+ * provided by the servlet container for the <tt>ServletContext</tt>
+ */
+ public static final String TEMPDIR = "javax.servlet.context.tempdir";
/**
+ * Returns the context path of the web application.
+ *
+ * <p>The context path is the portion of the request URI that is used
+ * to select the context of the request. The context path always comes
+ * first in a request URI. The path starts with a "/" character but does
+ * not end with a "/" character. For servlets in the default (root)
+ * context, this method returns "".
+ *
+ * <p>It is possible that a servlet container may match a context by
+ * more than one context path. In such cases the
+ * {@link javax.servlet.http.HttpServletRequest#getContextPath()}
+ * will return the actual context path used by the request and it may
+ * differ from the path returned by this method.
+ * The context path returned by this method should be considered as the
+ * prime or preferred context path of the application.
+ *
+ * @return The context path of the web application, or "" for the
+ * default (root) context
+ *
+ * @see javax.servlet.http.HttpServletRequest#getContextPath()
+ *
+ * @since 2.5
+ */
+ public String getContextPath();
+
+
+ /**
* Returns a <code>ServletContext</code> object that
* corresponds to a specified URL on the server.
*
@@ -69,8 +133,8 @@
* access to the context for various parts of the server, and as
* needed obtain {@link RequestDispatcher} objects from the context.
* The given path must be begin with "/", is interpreted relative
- * to the server's document root and is matched against the context roots of
- * other web applications hosted on this container.
+ * to the server's document root and is matched against the context
+ * roots of other web applications hosted on this container.
*
* <p>In a security conscious environment, the servlet container may
* return <code>null</code> for a given URL.
@@ -83,43 +147,30 @@
* this access.
*
* @see RequestDispatcher
- *
*/
-
public ServletContext getContext(String uripath);
- public String getContextPath();
-
-
/**
* Returns the major version of the Java Servlet API that this
* servlet container supports. All implementations that comply
- * with Version 2.4 must have this method
- * return the integer 2.
+ * with Version 3.0 must have this method return the integer 3.
*
- * @return 2
- *
+ * @return 3
*/
-
public int getMajorVersion();
-
/**
* Returns the minor version of the Servlet API that this
* servlet container supports. All implementations that comply
- * with Version 2.4 must have this method
- * return the integer 4.
+ * with Version 3.0 must have this method return the integer 0.
*
- * @return 4
- *
+ * @return 0
*/
-
public int getMinorVersion();
-
-
+
/**
* Returns the MIME type of the specified file, or <code>null</code> if
* the MIME type is not known. The MIME type is determined
@@ -128,46 +179,49 @@
* types are <code>"text/html"</code> and <code>"image/gif"</code>.
*
*
- * @param file a <code>String</code> specifying the name
- * of a file
+ * @param file a <code>String</code> specifying the name of a file
*
- * @return a <code>String</code> specifying the file's MIME type
- *
+ * @return a <code>String</code> specifying the file's MIME type
*/
-
public String getMimeType(String file);
+
/**
- * Returns a directory-like listing of all the paths to resources within the web application whose longest sub-path
- * matches the supplied path argument. Paths indicating subdirectory paths end with a '/'. The returned paths are all
- * relative to the root of the web application and have a leading '/'. For example, for a web application
- * containing<br><br>
-
- * /welcome.html<br>
- * /catalog/index.html<br>
- * /catalog/products.html<br>
- * /catalog/offers/books.html<br>
- * /catalog/offers/music.html<br>
- * /customer/login.jsp<br>
- * /WEB-INF/web.xml<br>
- * /WEB-INF/classes/com.acme.OrderServlet.class,<br><br>
- *
- * getResourcePaths("/") returns {"/welcome.html", "/catalog/", "/customer/", "/WEB-INF/"}<br>
- * getResourcePaths("/catalog/") returns {"/catalog/index.html", "/catalog/products.html", "/catalog/offers/"}.<br>
-
-
-
- *@param path the partial path used to match the resources,
- * which must start with a /
- *@return a Set containing the directory listing, or null if there are no resources in the web application whose path
- * begins with the supplied path.
-
- * @since Servlet 2.3
- */
+ * Returns a directory-like listing of all the paths to resources
+ * within the web application whose longest sub-path matches the
+ * supplied path argument.
+ *
+ * Paths indicating subdirectory paths end with a '/'.
+ *
+ * The returned paths are all relative to the root of the web application
+ * and have a leading '/'.
+ *
+ * For example, for a web application containing<br><br>
+ *
+ * /welcome.html<br>
+ * /catalog/index.html<br>
+ * /catalog/products.html<br>
+ * /catalog/offers/books.html<br>
+ * /catalog/offers/music.html<br>
+ * /customer/login.jsp<br>
+ * /WEB-INF/web.xml<br>
+ * /WEB-INF/classes/com.acme.OrderServlet.class,<br><br>
+ *
+ * getResourcePaths("/") returns {"/welcome.html", "/catalog/",
+ * "/customer/", "/WEB-INF/"}<br>
+ * getResourcePaths("/catalog/") returns {"/catalog/index.html",
+ * "/catalog/products.html", "/catalog/offers/"}.<br>
+ *
+ * @param path the partial path used to match the resources,
+ * which must start with a /
+ * @return a Set containing the directory listing, or null if there
+ * are no resources in the web application whose path
+ * begins with the supplied path.
+ *
+ * @since 2.3
+ */
+ public Set<String> getResourcePaths(String path);
- public Set getResourcePaths(String path);
-
-
/**
* Returns a URL to the resource that is mapped to a specified
@@ -199,21 +253,17 @@
* which looks up resources based on a class loader. This
* method does not use class loaders.
*
- * @param path a <code>String</code> specifying
- * the path to the resource
+ * @param path a <code>String</code> specifying
+ * the path to the resource
*
- * @return the resource located at the named path,
- * or <code>null</code> if there is no resource
- * at that path
+ * @return the resource located at the named path,
+ * or <code>null</code> if there is no resource at that path
*
- * @exception MalformedURLException if the pathname is not given in
- * the correct form
- *
- */
-
+ * @exception MalformedURLException if the pathname is not given in
+ * the correct form
+ */
public URL getResource(String path) throws MalformedURLException;
-
/**
* Returns the resource located at the named path as
@@ -246,15 +296,10 @@
* @return the <code>InputStream</code> returned to the
* servlet, or <code>null</code> if no resource
* exists at the specified path
- *
- *
*/
-
public InputStream getResourceAsStream(String path);
-
-
/**
*
* Returns a {@link RequestDispatcher} object that acts
@@ -280,13 +325,10 @@
*
* @see RequestDispatcher
* @see ServletContext#getContext
- *
*/
-
public RequestDispatcher getRequestDispatcher(String path);
-
/**
* Returns a {@link RequestDispatcher} object that acts
* as a wrapper for the named servlet.
@@ -311,16 +353,11 @@
* @see RequestDispatcher
* @see ServletContext#getContext
* @see ServletConfig#getServletName
- *
*/
-
public RequestDispatcher getNamedDispatcher(String name);
-
-
/**
- *
* @deprecated As of Java Servlet API 2.1, with no direct replacement.
*
* <p>This method was originally defined to retrieve a servlet
@@ -332,35 +369,23 @@
* <p>In lieu of this method, servlets can share information using the
* <code>ServletContext</code> class and can perform shared business logic
* by invoking methods on common non-servlet classes.
- *
*/
-
public Servlet getServlet(String name) throws ServletException;
-
-
-
-
/**
- *
* @deprecated As of Java Servlet API 2.0, with no replacement.
*
- * <p>This method was originally defined to return an <code>Enumeration</code>
- * of all the servlets known to this servlet context. In this
- * version, this method always returns an empty enumeration and
+ * <p>This method was originally defined to return an
+ * <code>Enumeration</code> of all the servlets known to this servlet
+ * context.
+ * In this version, this method always returns an empty enumeration and
* remains only to preserve binary compatibility. This method
* will be permanently removed in a future version of the Java
* Servlet API.
- *
*/
+ public Enumeration<Servlet> getServlets();
- public Enumeration getServlets();
-
-
-
-
-
/**
* @deprecated As of Java Servlet API 2.1, with no replacement.
@@ -371,32 +396,21 @@
* this method always returns an empty <code>Enumeration</code> and
* remains only to preserve binary compatibility. This method will
* be permanently removed in a future version of the Java Servlet API.
- *
*/
-
- public Enumeration getServletNames();
+ public Enumeration<String> getServletNames();
-
-
-
-
+
/**
*
* Writes the specified message to a servlet log file, usually
* an event log. The name and type of the servlet log file is
* specific to the servlet container.
*
- *
* @param msg a <code>String</code> specifying the
* message to be written to the log file
- *
*/
-
public void log(String msg);
-
-
-
/**
* @deprecated As of Java Servlet API 2.1, use
@@ -406,14 +420,9 @@
* <p>This method was originally defined to write an
* exception's stack trace and an explanatory error message
* to the servlet log file.
- *
*/
-
public void log(Exception exception, String msg);
-
-
-
/**
* Writes an explanatory message and a stack trace
@@ -421,21 +430,15 @@
* to the servlet log file. The name and type of the servlet log
* file is specific to the servlet container, usually an event log.
*
- *
* @param message a <code>String</code> that
* describes the error or exception
*
* @param throwable the <code>Throwable</code> error
* or exception
- *
*/
-
public void log(String message, Throwable throwable);
-
-
-
/**
* Returns a <code>String</code> containing the real path
* for a given virtual path. For example, the path "/index.html"
@@ -457,15 +460,10 @@
*
* @return a <code>String</code> specifying the real path,
* or null if the translation cannot be performed
- *
- *
*/
-
public String getRealPath(String path);
-
-
/**
* Returns the name and version of the servlet container on which
* the servlet is running.
@@ -482,14 +480,10 @@
*
* @return a <code>String</code> containing at least the
* servlet container name and version number
- *
*/
-
public String getServerInfo();
-
-
/**
* Returns a <code>String</code> containing the value of the named
* context-wide initialization parameter, or <code>null</code> if the
@@ -508,10 +502,7 @@
*
* @see ServletConfig#getInitParameter
*/
-
public String getInitParameter(String name);
-
-
/**
@@ -526,12 +517,29 @@
*
* @see ServletConfig#getInitParameter
*/
-
- public Enumeration getInitParameterNames();
+ public Enumeration<String> getInitParameterNames();
-
/**
+ * Sets the context initialization parameter with the given name and
+ * value on this ServletContext.
+ *
+ * @param name the name of the context initialization parameter to set
+ * @param value the value of the context initialization parameter to set
+ *
+ * @return true if the context initialization parameter with the given
+ * name and value was set successfully on this ServletContext, and false
+ * if it was not set because this ServletContext already contains a
+ * context initialization parameter with a matching name
+ * @throws IllegalStateException if this ServletContext has already
+ * been initialized
+ *
+ * @since 3.0
+ */
+ public boolean setInitParameter(String name, String value);
+
+
+ /**
* Returns the servlet container attribute with the given name,
* or <code>null</code> if there is no attribute by that name.
* An attribute allows a servlet container to give the
@@ -558,36 +566,27 @@
* name
*
* @see ServletContext#getAttributeNames
- *
*/
-
public Object getAttribute(String name);
-
-
/**
* Returns an <code>Enumeration</code> containing the
- * attribute names available
- * within this servlet context. Use the
- * {@link #getAttribute} method with an attribute name
+ * attribute names available within this ServletContext.
+ *
+ * <p>Use the {@link #getAttribute} method with an attribute name
* to get the value of an attribute.
*
* @return an <code>Enumeration</code> of attribute
* names
*
* @see #getAttribute
- *
*/
-
- public Enumeration getAttributeNames();
+ public Enumeration<String> getAttributeNames();
-
-
/**
- *
- * Binds an object to a given attribute name in this servlet context. If
+ * Binds an object to a given attribute name in this ServletContext. If
* the name specified is already used for an attribute, this
* method will replace the attribute with the new to the new attribute.
* <p>If listeners are configured on the <code>ServletContext</code> the
@@ -607,151 +606,330 @@
*
* @param object an <code>Object</code> representing the
* attribute to be bound
- *
- *
- *
*/
-
public void setAttribute(String name, Object object);
-
-
-
/**
* Removes the attribute with the given name from
- * the servlet context. After removal, subsequent calls to
+ * this ServletContext. After removal, subsequent calls to
* {@link #getAttribute} to retrieve the attribute's value
* will return <code>null</code>.
-
+ *
* <p>If listeners are configured on the <code>ServletContext</code> the
* container notifies them accordingly.
-
*
*
+ *
* @param name a <code>String</code> specifying the name
* of the attribute to be removed
- *
*/
+ public void removeAttribute(String name);
- public void removeAttribute(String name);
/**
- * Returns the name of this web application corresponding to this ServletContext as specified in the deployment
- * descriptor for this web application by the display-name element.
+ * Returns the name of this web application corresponding to this
+ * ServletContext as specified in the deployment descriptor for this
+ * web application by the display-name element.
*
*
- * @return The name of the web application or null if no name has been declared in the deployment descriptor.
- * @since Servlet 2.3
+ * @return The name of the web application or null if no name has been
+ * declared in the deployment descriptor.
+ *
+ * @since 2.3
*/
-
public String getServletContextName();
- /**
- * Add the specified servlet to the context
- * @param servletName servlet's name
- * @param className class name of servlet
- * @throws IllegalArgumentException duplicate servletName
- * @throws IllegalStateException this method called after #initialize
- * @return ServletRegistration allowing configuration of the servlet
+
+ /*
+ * Adds the servlet with the given name and class name to this servlet
+ * context.
*
+ * <p>The registered servlet may be further configured via the returned
+ * {@link ServletRegistration} object.
+ *
+ * <p>The specified <tt>className</tt> will be loaded using the
+ * classloader associated with the application represented by this
+ * ServletContext.
+ *
+ * @param servletName the name of the servlet
+ * @param className the fully qualified class name of the servlet
+ *
+ * @return a ServletRegistration object that may be used to further
+ * configure the registered servlet, or <tt>null</tt> if this
+ * ServletContext already contains a servlet with a matching name
+ * @throws IllegalStateException if this ServletContext has already
+ * been initialized
+ *
* @since 3.0
*/
- ServletRegistration addServlet(String servletName,
- String className) throws IllegalArgumentException, IllegalStateException;
+ public ServletRegistration addServlet(String servletName,
+ String className);
+
+ /*
+ * Registers the given servlet instance with this ServletContext
+ * under the given <tt>servletName</tt>.
+ *
+ * <p>The registered servlet may be further configured via the returned
+ * {@link ServletRegistration} object.
+ *
+ * @param servletName the name of the servlet
+ * @param servlet the servlet instance to register
+ *
+ * @return a ServletRegistration object that may be used to further
+ * configure the given servlet, or <tt>null</tt> if this
+ * ServletContext already contains a servlet with a matching name,
+ * or if the same servlet instance has already been registered with
+ * this or another ServletContext that is part of the same servlet
+ * container
+ * @throws IllegalStateException if this ServletContext has already
+ * been initialized
+ * @throws IllegalArgumentException if the given servlet instance
+ * implements {@link SingleThreadModel}
+ *
+ * @since 3.0
+ */
+ public ServletRegistration addServlet(String servletName,
+ Servlet servlet);
+
+
+ /*
+ * Adds the servlet with the given name and class type to this servlet
+ * context.
+ *
+ * <p>The registered servlet may be further configured via the returned
+ * {@link ServletRegistration} object.
+ *
+ * @param servletName the name of the servlet
+ * @param servletClass the class object from which the servlet will be
+ * instantiated
+ *
+ * @return a ServletRegistration object that may be used to further
+ * configure the registered servlet, or <tt>null</tt> if this
+ * ServletContext already contains a servlet with a matching name
+ * @throws IllegalStateException if this ServletContext has already
+ * been initialized
+ *
+ * @since 3.0
+ */
+ public ServletRegistration addServlet(String servletName,
+ Class <? extends Servlet> servletClass);
+
+
/**
- * Add the specified servlet to the context
- * @param servletName servlet's name
- * @param clazz class of the servlet
- * @throws IllegalArgumentException duplicate servletName
- * @throws IllegalStateException this method called after #initialize
- * @return ServletRegistration allowing configuration of the servlet
+ * Instantiates the given Servlet class and performs any required
+ * resource injection into the new Servlet instance before returning
+ * it.
*
+ * <p>The returned Servlet instance may be further customized before it
+ * is registered with this ServletContext via a call to
+ * {@link #addServlet(String,Servlet)}.
+ *
+ * @param c the Servlet class to instantiate
+ *
+ * @return the new Servlet instance
+ *
+ * @throws ServletException if an error occurs during the instantiation
+ * of, or resource injection into the new Servlet
+ *
* @since 3.0
*/
- ServletRegistration addServlet(String servletName,
- Class<? extends Servlet> clazz) throws IllegalArgumentException, IllegalStateException;
+ public <T extends Servlet> T createServlet(Class<T> c)
+ throws ServletException;
+
/**
- * Fish out the servlet registration for a named servlet
- * @param servletName name of the servlet you want to configure
- * @return ServletRegistration for servlet you want
+ * Gets the ServletRegistration corresponding to the servlet with the
+ * given <tt>servletName</tt>.
*
+ * @return the ServletRegistration corresponding to the servlet with the
+ * given <tt>servletName</tt>, or null if no ServletRegistration exists
+ * under that name in this ServletContext
+ *
* @since 3.0
*/
- ServletRegistration findServletRegistration(String servletName);
+ public ServletRegistration findServletRegistration(String servletName);
+
/**
- * Add a filter to this context
- * @param filterName name of filter
- * @param className class name of filter
- * @throws IllegalArgumentException duplicate filter name
- * @throws IllegalStateException if called after #initialise
- * @return FilterRegistration allowing configuration of filter
+ * Adds the filter with the given name and class name to this servlet
+ * context.
*
+ * <p>The registered filter may be further configured via the returned
+ * {@link FilterRegistration} object.
+ *
+ * <p>The specified <tt>className</tt> will be loaded using the
+ * classloader associated with the application represented by this
+ * ServletContext.
+ *
+ * @param filterName the name of the filter
+ * @param className the fully qualified class name of the filter
+ *
+ * @return a FilterRegistration object that may be used to further
+ * configure the registered filter, or <tt>null</tt> if this
+ * ServletContext already contains a filter with a matching name
+ * @throws IllegalStateException if this ServletContext has already
+ * been initialized
+ *
* @since 3.0
*/
- FilterRegistration addFilter(String filterName,
- String className) throws IllegalArgumentException, IllegalStateException;
+ public FilterRegistration addFilter(String filterName, String className);
+
+ /*
+ * Registers the given filter instance with this ServletContext
+ * under the given <tt>filterName</tt>.
+ *
+ * <p>The registered filter may be further configured via the returned
+ * {@link FilterRegistration} object.
+ *
+ * @param filterName the name of the filter
+ * @param filter the filter instance to register
+ *
+ * @return a FilterRegistration object that may be used to further
+ * configure the given filter, or <tt>null</tt> if this
+ * ServletContext already contains a filter with a matching name,
+ * or if the same filter instance has already been registered with
+ * this or another ServletContext that is part of the same servlet
+ * container
+ * @throws IllegalStateException if this ServletContext has already
+ * been initialized
+ *
+ * @since 3.0
+ */
+ public FilterRegistration addFilter(String filterName, Filter filter);
+
+
/**
+ * Adds the filter with the given name and class type to this servlet
+ * context.
*
- * @param filterName Name of filter you want to configure
- * @return FilterRegistration allowing configuration of filter
+ * <p>The registered filter may be further configured via the returned
+ * {@link FilterRegistration} object.
*
+ * @param filterName the name of the filter
+ * @param filterClass the class object from which the filter will be
+ * instantiated
+ *
+ * @return a FilterRegistration object that may be used to further
+ * configure the registered filter, or <tt>null</tt> if this
+ * ServletContext already contains a filter with a matching name
+ * @throws IllegalStateException if this ServletContext has already
+ * been initialized
+ *
* @since 3.0
*/
- FilterRegistration findFilterRegistration(String filterName);
+ public FilterRegistration addFilter(String filterName,
+ Class <? extends Filter> filterClass);
+
/**
+ * Instantiates the given Filter class and performs any required
+ * resource injection into the new Filter instance before returning
+ * it.
*
- * @param sessionCookieConfig configuration of session cookie
+ * <p>The returned Filter instance may be further customized before it
+ * is registered with this ServletContext via a call to
+ * {@link #addFilter(String,Filter)}.
*
+ * @param c the Filter class to instantiate
+ *
+ * @return the new Filter instance
+ *
+ * @throws ServletException if an error occurs during the instantiation
+ * of, or resource injection into the new Filter
+ *
* @since 3.0
*/
- void setSessionCookieConfig(SessionCookieConfig sessionCookieConfig);
+ public <T extends Filter> T createFilter(Class<T> c)
+ throws ServletException;
+
/**
+ * Gets the FilterRegistration corresponding to the filter with the
+ * given <tt>filterName</tt>.
*
- * @return configuration of session cookie
+ * @return the FilterRegistration corresponding to the filter with the
+ * given <tt>filterName</tt>, or null if no FilterRegistration exists
+ * under that name in this ServletContext
*
* @since 3.0
*/
- SessionCookieConfig getSessionCookieConfig();
+ public FilterRegistration findFilterRegistration(String filterName);
+
/**
+ * Gets the {@link SessionCookieConfig} object through which various
+ * properties of the session tracking cookies created on behalf of this
+ * <tt>ServletContext</tt> may be configured.
*
- * @param sessionTrackingModes set of SessionTrackingModes for this web app
+ * <p>Repeated invocations of this method will return the same
+ * <tt>SessionCookieConfig</tt> instance.
*
+ * @return the <tt>SessionCookieConfig</tt> object through which
+ * various properties of the session tracking cookies created on
+ * behalf of this <tt>ServletContext</tt> may be configured
+ *
* @since 3.0
*/
- void setSessionTrackingModes(EnumSet<SessionTrackingMode> sessionTrackingModes);
+ public SessionCookieConfig getSessionCookieConfig();
+
+
/**
+ * Sets the session tracking modes that are to become effective for this
+ * <tt>ServletContext</tt>.
*
- * @return the default session tracking modes
+ * <p>The given <tt>sessionTrackingModes</tt> replaces any
+ * session tracking modes set by a previous invocation of this
+ * method on this <tt>ServletContext</tt>.
*
+ * @param sessionTrackingModes the set of session tracking modes to
+ * become effective for this <tt>ServletContext</tt>
+ *
+ * @throws IllegalStateException if this <tt>ServletContext</tt> has
+ * already been initialized
+ * @throws IllegalArgumentException if <tt>sessionTrackingModes</tt>
+ * specifies a combination of <tt>SessionTrackingMode.SSL</tt> with a
+ * session tracking mode other than <tt>SessionTrackingMode.SSL</tt>,
+ * or if <tt>sessionTrackingModes</tt> specifies a session tracking mode
+ * that is not supported by the servlet container
+ *
* @since 3.0
*/
- EnumSet<SessionTrackingMode> getDefaultSessionTrackingModes();
+ public void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes);
+
/**
+ * Gets the session tracking modes that are supported by default for this
+ * <tt>ServletContext</tt>.
*
- * @return the actual session tracking modes. These will be the default ones unless they've been explicitly set.
+ * @return set of the session tracking modes supported by default for
+ * this <tt>ServletContext</tt>
*
* @since 3.0
*/
- EnumSet<SessionTrackingMode> getEffectiveSessionTrackingModes();
+ public Set<SessionTrackingMode> getDefaultSessionTrackingModes();
+
/**
+ * Gets the session tracking modes that are in effect for this
+ * <tt>ServletContext</tt>.
*
- * @param name of the init parameter to set
- * @param value new value
- * @return whether it was set??
+ * <p>The session tracking modes in effect are those provided to
+ * {@link #setSessionTrackingModes setSessionTrackingModes}.
+ *
+ * <p>By default, the session tracking modes returned by
+ * {@link #getDefaultSessionTrackingModes getDefaultSessionTrackingModes}
+ * are in effect.
+ *
+ * @return set of the session tracking modes in effect for this
+ * <tt>ServletContext</tt>
+ *
* @since 3.0
*/
- boolean setInitParameter(String name, String value);
+ public Set<SessionTrackingMode> getEffectiveSessionTrackingModes();
}
Modified: trunk/java/javax/servlet/ServletContextAttributeEvent.java
===================================================================
--- trunk/java/javax/servlet/ServletContextAttributeEvent.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletContextAttributeEvent.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
Modified: trunk/java/javax/servlet/ServletContextAttributeListener.java
===================================================================
--- trunk/java/javax/servlet/ServletContextAttributeListener.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletContextAttributeListener.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,20 +1,55 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
package javax.servlet;
Modified: trunk/java/javax/servlet/ServletContextEvent.java
===================================================================
--- trunk/java/javax/servlet/ServletContextEvent.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletContextEvent.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
Modified: trunk/java/javax/servlet/ServletContextListener.java
===================================================================
--- trunk/java/javax/servlet/ServletContextListener.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletContextListener.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
import java.util.EventListener;
Modified: trunk/java/javax/servlet/ServletException.java
===================================================================
--- trunk/java/javax/servlet/ServletException.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletException.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
@@ -25,17 +62,30 @@
* encounters difficulty.
*
* @author Various
- * @version $Version$
*/
+
+
public class ServletException extends Exception {
+ private Throwable rootCause;
+
+
+
+
+
/**
* Constructs a new servlet exception.
+ *
*/
+
public ServletException() {
- super();
+ super();
}
+
+
+
+
/**
* Constructs a new servlet exception with the
* specified message. The message can be written
@@ -44,10 +94,16 @@
* @param message a <code>String</code>
* specifying the text of
* the exception message
+ *
*/
+
public ServletException(String message) {
- super(message);
+ super(message);
}
+
+
+
+
/**
* Constructs a new servlet exception when the servlet
@@ -55,6 +111,7 @@
* about the "root cause" exception that interfered with its
* normal operation, including a description message.
*
+ *
* @param message a <code>String</code> containing
* the text of the exception message
*
@@ -62,11 +119,18 @@
* that interfered with the servlet's
* normal operation, making this servlet
* exception necessary
+ *
*/
+
public ServletException(String message, Throwable rootCause) {
- super(message, rootCause);
+ super(message, rootCause);
+ this.rootCause = rootCause;
}
+
+
+
+
/**
* Constructs a new servlet exception when the servlet
* needs to throw an exception and include a message
@@ -84,18 +148,33 @@
* that interfered with the servlet's
* normal operation, making the servlet exception
* necessary
+ *
*/
+
public ServletException(Throwable rootCause) {
- super(rootCause);
+ super(rootCause);
+ this.rootCause = rootCause;
}
-
+
+
+
+
+
/**
* Returns the exception that caused this servlet exception.
*
+ *
* @return the <code>Throwable</code>
* that caused this servlet exception
+ *
*/
+
public Throwable getRootCause() {
- return getCause();
+ return rootCause;
}
}
+
+
+
+
+
Modified: trunk/java/javax/servlet/ServletInputStream.java
===================================================================
--- trunk/java/javax/servlet/ServletInputStream.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletInputStream.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
import java.io.InputStream;
@@ -40,7 +77,6 @@
*
*
* @author Various
- * @version $Version$
*
* @see ServletRequest
*
Modified: trunk/java/javax/servlet/ServletOutputStream.java
===================================================================
--- trunk/java/javax/servlet/ServletOutputStream.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletOutputStream.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
import java.io.OutputStream;
@@ -37,7 +74,6 @@
*
*
* @author Various
- * @version $Version$
*
* @see ServletResponse
*
Modified: trunk/java/javax/servlet/ServletRegistration.java
===================================================================
--- trunk/java/javax/servlet/ServletRegistration.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletRegistration.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,43 +1,179 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
*/
-
package javax.servlet;
import java.util.Map;
/**
- * @version $Rev: 751589 $ $Date: 2009-03-09 06:35:08 +0100 (Mon, 09 Mar 2009) $
+ * Class through which a {@link Servlet} (either annotated or declared
+ * in the deployment descriptor or added via
+ * {@link ServletContext#addServlet(String, String)}) may be further
+ * configured.
+ *
+ * <p>While all aspects of a Servlet added via
+ * {@link ServletContext#addServlet(String, String)}) are configurable,
+ * the only configurable aspects of an annotated or declared Servlet are
+ * its initialization parameters and mappings. Initialization parameters
+ * may only be added, but not overridden.
+ *
* @since 3.0
*/
public interface ServletRegistration {
- void setDescription(String description);
+ /**
+ * Sets the description on the servlet for which this ServletRegistration
+ * was created.
+ *
+ * <p>A call to this method overrides any previous setting.
+ *
+ * @param description the description of the servlet
+ *
+ * @return true if the update was successful, false otherwise
+ *
+ * @throws IllegalStateException if the ServletContext from which this
+ * ServletRegistration was obtained has already been initialized
+ */
+ public boolean setDescription(String description);
- void setAsyncSupported(boolean asyncSupported);
- void setLoadOnStartup(int loadOnStartup);
+ /**
+ * Sets the initialization parameter with the given name and value
+ * on the servlet for which this ServletRegistration was created.
+ *
+ * @param name the initialization parameter name
+ * @param value the initialization parameter value
+ *
+ * @return true if the update was successful, false otherwise
+ *
+ * @throws IllegalStateException if the ServletContext from which this
+ * ServletRegistration was obtained has already been initialized
+ * @throws IllegalArgumentException if the given name or value is
+ * <tt>null</tt>
+ */
+ public boolean setInitParameter(String name, String value);
- void addMapping(String... urlPatterns);
- boolean setInitParameter(String name, String value);
+ /**
+ * Sets the given initialization parameters on the servlet for which
+ * this ServletRegistration was created.
+ *
+ * <p>The given map of initialization parameters is processed
+ * <i>by-value</i>, i.e., for each initialization parameter contained
+ * in the map, this method calls {@link #setInitParameter(String,String)}.
+ * If that method would return false for any of the
+ * initialization parameters in the given map, no updates will be
+ * performed, and false will be returned. Likewise, if the map contains
+ * an initialization parameter with a <tt>null</tt> name or value, no
+ * updates will be performed, and an IllegalArgumentException will be
+ * thrown.
+ *
+ * @param initParameters the initialization parameters
+ *
+ * @return true if the update was successful, false otherwise
+ *
+ * @throws IllegalStateException if the ServletContext from which this
+ * ServletRegistration was obtained has already been initialized
+ * @throws IllegalArgumentException if the given map contains an
+ * initialization parameter with a <tt>null</tt> name or value
+ */
+ public boolean setInitParameters(Map<String, String> initParameters);
- void setInitParameters(Map<String, String> initParameters);
+ /**
+ * Sets the <code>loadOnStartup</code> priority on the servlet for which
+ * this ServletRegistration was created.
+ *
+ * <p>A <tt>loadOnStartup</tt> value of greater than or equal to zero
+ * indicates to the container the initialization priority of the
+ * servlet. In this case, the container must instantiate and initialize
+ * the servlet during the initialization phase of this servlet context,
+ * that is, after it has invoked all of the ServletContextListeners
+ * configured for this servlet context at their
+ * {@link ServletContextListener#contextInitialized} method.
+ *
+ * <p>If <tt>loadOnStartup</tt> is a negative integer, the container
+ * is free to instantiate and initialize the servlet lazily.
+ *
+ * <p>The default value for <tt>loadOnStartup</tt> is <code>-1</code>.
+ *
+ * <p>A call to this method overrides any previous setting.
+ *
+ * @param loadOnStartup the initialization priority of the servlet
+ *
+ * @return true if the update was successful, false otherwise
+ *
+ * @throws IllegalStateException if the ServletContext from which this
+ * ServletRegistration was obtained has already been initialized
+ */
+ public boolean setLoadOnStartup(int loadOnStartup);
+
+
+ /**
+ * Configures the servlet for which this ServletRegistration was
+ * created as supporting asynchronous operations or not.
+ *
+ * <p>By default, a servlet does not support asynchronous operations.
+ *
+ * <p>A call to this method overrides any previous setting.
+ *
+ * @param isAsyncSupported true if the servlet supports asynchronous
+ * operations, false otherwise
+ *
+ * @return true if the update was successful, false otherwise
+ *
+ * @throws IllegalStateException if the ServletContext from which this
+ * ServletRegistration was obtained has already been initialized
+ */
+ public boolean setAsyncSupported(boolean isAsyncSupported);
+
+
+ /**
+ * Adds a servlet mapping with the given URL patterns for the servlet
+ * for which this ServletRegistration was created.
+ *
+ * @param urlPatterns the URL patterns of the servlet mapping
+ *
+ * @return true if the update was successful, false otherwise
+ *
+ * @throws IllegalArgumentException if <tt>urlPatterns</tt> is null
+ * or empty
+ * @throws IllegalStateException if the ServletContext from which this
+ * ServletRegistration was obtained has already been initialized
+ */
+ public boolean addMapping(String... urlPatterns);
}
+
Modified: trunk/java/javax/servlet/ServletRequest.java
===================================================================
--- trunk/java/javax/servlet/ServletRequest.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletRequest.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
import java.io.BufferedReader;
@@ -39,7 +76,6 @@
* provided by {@link javax.servlet.http.HttpServletRequest}.
*
* @author Various
- * @version $Version$
*
* @see javax.servlet.http.HttpServletRequest
*
@@ -47,6 +83,9 @@
public interface ServletRequest {
+
+
+
/**
*
* Returns the value of the named attribute as an <code>Object</code>,
@@ -91,7 +130,7 @@
*
*/
- public Enumeration getAttributeNames();
+ public Enumeration<String> getAttributeNames();
@@ -110,17 +149,19 @@
public String getCharacterEncoding();
- /**
+
+ /**
* Overrides the name of the character encoding used in the body of this
* request. This method must be called prior to reading request parameters
- * or reading input using getReader().
+ * or reading input using getReader(). Otherwise, it has no effect.
*
- *
- * @param env a <code>String</code> containing the name of
- * the character encoding.
- * @throws java.io.UnsupportedEncodingException if this is not a valid encoding
+ * @param env <code>String</code> containing the name of
+ * the character encoding.
+ * @throws java.io.UnsupportedEncodingException if this
+ * ServletRequest is still in a state where a
+ * character encoding may be set, but the specified
+ * encoding is invalid
*/
-
public void setCharacterEncoding(String env) throws java.io.UnsupportedEncodingException;
@@ -157,8 +198,6 @@
public String getContentType();
-
-
/**
* Retrieves the body of the request as binary data using
* a {@link ServletInputStream}. Either this method or
@@ -167,17 +206,13 @@
* @return a {@link ServletInputStream} object containing
* the body of the request
*
- * @exception IllegalStateException if the {@link #getReader} method
- * has already been called for this request
+ * @exception IllegalStateException if the {@link #getReader} method
+ * has already been called for this request
*
- * @exception IOException if an input or output exception occurred
- *
+ * @exception IOException if an input or output exception occurred
*/
-
public ServletInputStream getInputStream() throws IOException;
-
-
/**
* Returns the value of a request parameter as a <code>String</code>,
@@ -205,14 +240,10 @@
* single value of the parameter
*
* @see #getParameterValues
- *
*/
-
public String getParameter(String name);
-
-
/**
*
* Returns an <code>Enumeration</code> of <code>String</code>
@@ -226,13 +257,9 @@
* the name of a request parameter; or an
* empty <code>Enumeration</code> if the
* request has no parameters
- *
*/
-
- public Enumeration getParameterNames();
-
-
-
+ public Enumeration<String> getParameterNames();
+
/**
* Returns an array of <code>String</code> objects containing
@@ -249,26 +276,24 @@
* containing the parameter's values
*
* @see #getParameter
- *
*/
-
public String[] getParameterValues(String name);
- /** Returns a java.util.Map of the parameters of this request.
- * Request parameters
- * are extra information sent with the request. For HTTP servlets,
- * parameters are contained in the query string or posted form data.
+
+ /**
+ * Returns a java.util.Map of the parameters of this request.
+ *
+ * <p>Request parameters are extra information sent with the request.
+ * For HTTP servlets, parameters are contained in the query string or
+ * posted form data.
*
* @return an immutable java.util.Map containing parameter names as
* keys and parameter values as map values. The keys in the parameter
* map are of type String. The values in the parameter map are of type
* String array.
- *
*/
-
- public Map getParameterMap();
+ public Map<String, String[]> getParameterMap();
-
/**
* Returns the name and version of the protocol the request uses
@@ -279,13 +304,9 @@
*
* @return a <code>String</code> containing the protocol
* name and version number
- *
- */
-
+ */
public String getProtocol();
-
-
/**
* Returns the name of the scheme used to make this request,
@@ -296,18 +317,15 @@
*
* @return a <code>String</code> containing the name
* of the scheme used to make this request
- *
*/
-
public String getScheme();
-
-
/**
* Returns the host name of the server to which the request was sent.
* It is the value of the part before ":" in the <code>Host</code>
- * header value, if any, or the resolved server name, or the server IP address.
+ * header value, if any, or the resolved server name, or the server IP
+ * address.
*
* @return a <code>String</code> containing the name
* of the server
@@ -343,7 +361,7 @@
* @return a <code>BufferedReader</code>
* containing the body of the request
*
- * @exception java.io.UnsupportedEncodingException if the character set encoding
+ * @exception UnsupportedEncodingException if the character set encoding
* used is not supported and the
* text cannot be decoded
*
@@ -448,7 +466,6 @@
/**
- *
* Returns the preferred <code>Locale</code> that the client will
* accept content in, based on the Accept-Language header.
* If the client request doesn't provide an Accept-Language header,
@@ -456,16 +473,11 @@
*
*
* @return the preferred <code>Locale</code> for the client
- *
*/
-
public Locale getLocale();
-
-
/**
- *
* Returns an <code>Enumeration</code> of <code>Locale</code> objects
* indicating, in decreasing order starting with the preferred locale, the
* locales that are acceptable to the client based on the Accept-Language
@@ -474,13 +486,10 @@
* this method returns an <code>Enumeration</code> containing one
* <code>Locale</code>, the default locale for the server.
*
- *
* @return an <code>Enumeration</code> of preferred
* <code>Locale</code> objects for the client
- *
*/
-
- public Enumeration getLocales();
+ public Enumeration<Locale> getLocales();
@@ -531,21 +540,14 @@
*
* @see RequestDispatcher
* @see ServletContext#getRequestDispatcher
- *
*/
-
public RequestDispatcher getRequestDispatcher(String path);
-
-
/**
- *
* @deprecated As of Version 2.1 of the Java Servlet API,
* use {@link ServletContext#getRealPath} instead.
- *
*/
-
public String getRealPath(String path);
@@ -571,6 +573,7 @@
*/
public String getLocalName();
+
/**
* Returns the Internet Protocol (IP) address of the interface on
* which the request was received.
@@ -594,99 +597,317 @@
*/
public int getLocalPort();
+
/**
- * Get the servlet context the request-response pair was last dispatched through.
- * @return the latest ServletContext on the dispatch chain.
+ * Gets the servlet context to which this servlet request was last
+ * dispatched.
+ *
+ * @return the servlet context to which this servlet request was last
+ * dispatched
+ *
* @since 3.0
*/
- ServletContext getServletContext();
+ public ServletContext getServletContext();
+
/**
- * Gets the associated servlet response.
- * @return the ServletResponse associated with this request.
+ * Puts this request into asynchronous mode, and initializes its
+ * {@link AsyncContext} with the original (unwrapped) ServletRequest
+ * and ServletResponse objects and the timeout derived according
+ * to the rules laid out in {@link #setAsyncTimeout}.
+ *
+ * <p>This will delay committal of the associated response until
+ * {@link AsyncContext#complete} is called on the returned
+ * {@link AsyncContext}, or the AsyncContext times out.
+ *
+ * <p>The timer for async timeouts will not start until this request
+ * and its associated response have returned from the container.
+ *
+ * <p>If a timeout occurs and none of the
+ * {@link AsyncListener#onTimeout(AsyncEvent)} handlers call
+ * {@link AsyncContext#complete} or one of the
+ * {@link AsyncContext#dispatch} methods, the container must call
+ * {@link AsyncContext#complete}.
+ *
+ * <p>Calling {@link AsyncContext#hasOriginalRequestAndResponse()} on
+ * the returned AsyncContext will return <code>true</code>. Any filters
+ * invoked in the <i>outbound</i> direction after this request was put
+ * into asynchronous mode may use this as an indication that any request
+ * and/or response wrappers that they added during their <i>inbound</i>
+ * invocation need not stay around for the duration of the asynchronous
+ * operation, and therefore any of their associated resources may be
+ * released.
+ *
+ * <p>Subsequent invocations of this method, or its overloaded
+ * variant, will return the same AsyncContext instance, reinitialized
+ * as appropriate.
+ *
+ * @return the (re)initialized AsyncContext
+ *
+ * @throws IllegalStateException if this request is within the scope of
+ * a filter or servlet that does not support asynchronous operation,
+ * that is, if {@link #isAsyncSupported} returns false, or if this method
+ * is called again outside the scope of a dispatch resulting from an
+ * {@link AsyncContext#dispatch}, or if the response has already been
+ * closed
+ *
* @since 3.0
*/
- ServletResponse getServletResponse();
-
- void addAsyncListener(AsyncListener listener);
+ public AsyncContext startAsync() throws IllegalStateException;
- void addAsyncListener(AsyncListener listener, ServletRequest request, ServletResponse response);
- AsyncContext getAsyncContext();
+ /**
+ * Puts this request into asynchronous mode, and initializes its
+ * {@link AsyncContext} with the given request and response objects
+ * and the timeout derived according to the rules laid out in
+ * {@link #setAsyncTimeout}.
+ *
+ * <p>The ServletRequest and ServletResponse parameters must be either
+ * the same objects as were passed to the calling servlet's service
+ * (or calling filter's doFilter) method, or be subclasses of the
+ * {@link ServletRequestWrapper} or {@link ServletResponseWrapper}
+ * classes that wrap them.
+ *
+ * <p>This will delay committal of the response until
+ * {@link AsyncContext#complete} is called on the returned
+ * {@link AsyncContext}, or the AsyncContext times out.
+ *
+ * <p>The timer for async timeouts will not start until this request
+ * and its associated response have returned from the container.
+ *
+ * <p>If a timeout occurs and none of the
+ * {@link AsyncListener#onTimeout(AsyncEvent)} handlers call
+ * {@link AsyncContext#complete} or one of the
+ * {@link AsyncContext#dispatch} methods, the container must call
+ * {@link AsyncContext#complete}.
+ *
+ * <p>Calling {@link AsyncContext#hasOriginalRequestAndResponse()} on
+ * the returned AsyncContext will return <code>false</code>
+ * (unless the passed in ServletRequest and ServletResponse arguments
+ * are the original ones).
+ * Any filters invoked in the <i>outbound</i> direction after this
+ * request was put into asynchronous mode may use this as an indication
+ * that some of the request and/or response wrappers that they added
+ * during their <i>inbound</i> invocation may need to stay in place for
+ * the duration of the asynchronous operation, and their associated
+ * resources may not be released.
+ * A ServletRequestWrapper applied during the <i>inbound</i>
+ * invocation of a filter may be released by the <i>outbound</i>
+ * invocation of the filter only if the given <code>servletRequest</code>,
+ * which is used to initialize the AsyncContext and will be returned by
+ * a call to {@link AsyncContext#getRequest()}, does not contain said
+ * ServletRequestWrapper. The same holds true for ServletResponseWrapper
+ * instances.
+ *
+ * <p>Subsequent invocations of this method, or its zero-argument
+ * variant, will return the same AsyncContext instance, reinitialized
+ * as appropriate. If a call to this method is followed by a call to its
+ * zero-argument variant, the specified (and possibly wrapped) request
+ * and response objects will remain <i>locked in</i> on the returned
+ * AsyncContext.
+ *
+ * @param servletRequest the ServletRequest used to initialize the
+ * AsyncContext
+ * @param servletResponse the ServletResponse used to initialize the
+ * AsyncContext
+ *
+ * @return the (re)initialized AsyncContext
+ *
+ * @throws IllegalStateException if this request is within the scope of
+ * a filter or servlet that does not support asynchronous operation,
+ * that is, if {@link #isAsyncSupported} returns false, or if this method
+ * is called again outside the scope of a dispatch resulting from an
+ * {@link AsyncContext#dispatch}, or if the response has already been
+ * closed
+ *
+ * @since 3.0
+ */
+ public AsyncContext startAsync(ServletRequest servletRequest,
+ ServletResponse servletResponse)
+ throws IllegalStateException;
- boolean isAsyncStarted();
- boolean isAsyncSupported();
+ /**
+ * Checks if this request has been put into asynchronous mode.
+ *
+ * <p>A ServletRequest is put into asynchronous mode by calling
+ * {@link #startAsync} or
+ * {@link #startAsync(ServletRequest,ServletResponse)} on it.
+ *
+ * <p>If this request has been dispatched using one of the
+ * {@link AsyncContext#dispatch} methods since it was put into
+ * asynchronous mode, this method returns <tt>false</tt>.
+ *
+ * @return true if this request has been put into asynchronous mode,
+ * false otherwise
+ *
+ * @since 3.0
+ */
+ public boolean isAsyncStarted();
- void setAsyncTimeout(long timeout);
- AsyncContext startAsync();
+ /**
+ * Checks if this request supports asynchronous operation.
+ *
+ * <p>Asynchronous operation is disabled for this request if this request
+ * is within the scope of a filter or servlet that has not been annotated
+ * or flagged in the deployment descriptor as being able to support
+ * asynchronous handling.
+ *
+ * @return true if this request supports asynchronous operation, false
+ * otherwise
+ *
+ * @since 3.0
+ */
+ public boolean isAsyncSupported();
- AsyncContext startAsync(ServletRequest request, ServletResponse response);
- DispatcherType getDispatcherType();
+ /**
+ * Gets the AsyncContext that was created or reinitialized by the
+ * most recent invocation of {@link #startAsync} or
+ * {@link #startAsync(ServletRequest,ServletResponse)} on this request.
+ *
+ * @return the AsyncContext that was created or reinitialized by the
+ * most recent invocation of {@link #startAsync} or
+ * {@link #startAsync(ServletRequest,ServletResponse)} on
+ * this request
+ *
+ * @throws IllegalStateException if this request has not been put
+ * into asynchronous mode, i.e., if neither {@link #startAsync} nor
+ * {@link #startAsync(ServletRequest,ServletResponse)} has been called
+ *
+ * @since 3.0
+ */
+ public AsyncContext getAsyncContext();
-// /**
-// * complete a suspended request.
-// * @throws IllegalStateException
-// * @since 3.0
-// */
-// void complete() throws IllegalStateException;
-//
-// /**
-// * Suspend request processing. Must be called by a thread that is processing this request.
-// * @param timeoutMilliseconds new timeout period, in milliseconds
-// * @throws IllegalStateException if called by a thread not processing this request or after error dispatch
-// * @since 3.0
-// * @see #complete
-// * @see #resume
-// */
-// void suspend(long timeoutMilliseconds) throws IllegalStateException;
-//
-// /**
-// * Similar to suspend(timeoutMilliseconds) but with a container supplied timeout period.
-// * @throws IllegalStateException
-// * @since 3.0
-// * @see #complete
-// * @see #resume
-// */
-// void suspend() throws IllegalStateException;
-//
-// /**
-// * Resume a suspended request
-// * @throws IllegalStateException if the request is not suspended
-// * @since 3.0
-// * @see #suspend
-// */
-// void resume() throws IllegalStateException;
-//
-// /**
-// *
-// * @return if the request is suspended
-// * @since 3.0
-// */
-// boolean isSuspended();
-//
-// /**
-// *
-// * @return if the request is resumed
-// * @since 3.0
-// */
-// boolean isResumed();
-//
-// /**
-// *
-// * @return if the request is timed out
-// * @since 3.0
-// */
-// boolean isTimeout();
-//
-// /**
-// *
-// * @return if the request has never been suspended (or resumed)
-// * @since 3.0
-// */
-// boolean isInitial();
+ /**
+ * Registers the given {@link AsyncListener} with this request for
+ * asynchronous complete and timeout events.
+ *
+ * <p>If {@link #startAsync} or
+ * {@link #startAsync(ServletRequest,ServletResponse)} is called on this
+ * request, an {@link AsyncEvent} will be sent to this AsyncListener as
+ * soon as the asynchronous operation has completed or timed out.
+ * The AsyncEvent will contain the ServletRequest and ServletResponse
+ * objects that were used to initialize the {@link AsyncContext}
+ * returned by the call to startAsync.
+ *
+ * <p>AsyncListener instances will be notified in the order
+ * in which they were added to this request.
+ *
+ * @param listener the AsyncListener to be registered
+ *
+ * @since 3.0
+ */
+ public void addAsyncListener(AsyncListener listener);
+
+
+ /**
+ * Registers the given {@link AsyncListener} with this request for
+ * asynchronous complete and timeout events.
+ *
+ * <p>If {@link #startAsync} or
+ * {@link #startAsync(ServletRequest,ServletResponse)} is called on this
+ * request, an {@link AsyncEvent} will be sent to this AsyncListener as
+ * soon as the asynchronous operation has completed or timed out.
+ * The AsyncEvent will contain the given ServletRequest and
+ * ServletResponse objects.
+ *
+ * <p>AsyncListener instances will be notified in the order
+ * in which they were added to this request.
+ *
+ * <p>The specified request and response objects, which will be included
+ * in the AsyncEvent that will be delivered to the given AsyncListener,
+ * should not be read from or written to, respectively, at the time
+ * when the AsyncEvent is delivered, because additional wrapping may have
+ * occurred after this method was called. One of the main reasons for
+ * allowing request and response objects to be passed to this method is
+ * to allow the AsyncListener to release any resources associated with
+ * them when the AsyncEvent is delivered.
+ *
+ * @param listener the AsyncListener to be registered
+ * @param servletRequest the ServletRequest that will be included
+ * in the AsyncEvent
+ * @param servletResponse the ServletResponse that will be included
+ * in the AsyncEvent
+ *
+ * @since 3.0
+ */
+ public void addAsyncListener(AsyncListener listener,
+ ServletRequest servletRequest,
+ ServletResponse servletResponse);
+
+
+ /**
+ * Sets the timeout (in milliseconds) for any asynchronous operations
+ * started on this request by a call to {@link #startAsync} or
+ * {@link #startAsync(ServletRequest, ServletResponse)}.
+ *
+ * <p>By default, the timeout specified via the
+ * <code>async-timeout</code> deployment descriptor element or the
+ * <code>asyncTimeout</code> annotation of the servlet or filter that
+ * started the asynchronous operation will be used.
+ *
+ * <p>If neither {@link AsyncContext#complete} nor
+ * {@link AsyncContext#dispatch} is called within the
+ * specified timeout, any listeners of type {@link AsyncListener} that
+ * were added to this request via a call to
+ * {@link #addAsyncListener(AsyncListener)}
+ * or {@link #addAsyncListener(AsyncListener, ServletRequest,
+ * ServletResponse)} will have their
+ * {@link AsyncListener#onTimeout(AsyncEvent)} method invoked.
+ *
+ * <p>This method raises an <code>IllegalStateException</code> if
+ * called after {@link #startAsync}, unless it is called within the
+ * scope of an {@link AsyncContext#dispatch}, in which case the specified
+ * timeout will be used to initialize the AsyncContext created by a new
+ * call to {@link #startAsync}, or will be ignored if {@link #startAsync}
+ * is not called again.
+ *
+ * @param timeout the timeout in milliseconds for any asynchronous
+ * operations started on this request
+ *
+ * @throws IllegalStateException if called after {@link #startAsync},
+ * unless within the scope of a dispatch resulting from an
+ * {@link AsyncContext#dispatch}
+ *
+ * @since 3.0
+ */
+ public void setAsyncTimeout(long timeout);
+
+
+ /**
+ * Gets the dispatcher type of this request.
+ *
+ * <p>The dispatcher type of a request is used by the container
+ * to select the filters that need to be applied to the request:
+ * Only filters with matching dispatcher type and url patterns will
+ * be applied.
+ *
+ * <p>Allowing a filter that has been configured for multiple
+ * dispatcher types to query a request for its dispatcher type
+ * allows the filter to process the request differently depending on
+ * its dispatcher type.
+ *
+ * <p>The initial dispatcher type of a request is defined as
+ * <code>DispatcherType.REQUEST</code>. The dispatcher type of a request
+ * dispatched via {@link RequestDispatcher#forward(ServletRequest,
+ * ServletResponse)} or {@link RequestDispatcher#include(ServletRequest,
+ * ServletResponse)} is given as <code>DispatcherType.FORWARD</code> or
+ * <code>DispatcherType.INCLUDE</code>, respectively, while the
+ * dispatcher type of an asynchronous request dispatched via
+ * one of the {@link AsyncContext#dispatch} methods is given as
+ * <code>DispatcherType.ASYNC</code>. Finally, the dispatcher type of a
+ * request dispatched to an error page by the container's error handling
+ * mechanism is given as <code>DispatcherType.ERROR</code>.
+ *
+ * @return the dispatcher type of this request
+ *
+ * @see DispatcherType
+ *
+ * @since 3.0
+ */
+ public DispatcherType getDispatcherType();
}
Modified: trunk/java/javax/servlet/ServletRequestAttributeEvent.java
===================================================================
--- trunk/java/javax/servlet/ServletRequestAttributeEvent.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletRequestAttributeEvent.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
Modified: trunk/java/javax/servlet/ServletRequestAttributeListener.java
===================================================================
--- trunk/java/javax/servlet/ServletRequestAttributeListener.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletRequestAttributeListener.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
import java.util.EventListener;
Modified: trunk/java/javax/servlet/ServletRequestEvent.java
===================================================================
--- trunk/java/javax/servlet/ServletRequestEvent.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletRequestEvent.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
Modified: trunk/java/javax/servlet/ServletRequestListener.java
===================================================================
--- trunk/java/javax/servlet/ServletRequestListener.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletRequestListener.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,72 +1,80 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
import java.util.EventListener;
-/**
- * A ServletRequestListener can be implemented by the developer
- * interested in being notified of requests coming in and out of
- * scope in a web component. A request is defined as coming into
- * scope when it is about to enter the first servlet or filter
- * in each web application, as going out of scope when it exits
- * the last servlet or the first filter in the chain.
- *
- * @since Servlet 2.4
- */
-
-
-public interface ServletRequestListener extends EventListener {
-
/**
- * The request is about to go out of scope of the web application.
+ * A ServletRequestListener can be implemented by the developer
+ * interested in being notified of requests coming in and out of
+ * scope in a web component. A request is defined as coming into
+ * scope when it is about to enter the first servlet or filter
+ * in each web application, as going out of scope when it exits
+ * the last servlet or the first filter in the chain.
*
- * @param sre event containing request
+ * @since Servlet 2.4
*/
- public void requestDestroyed(ServletRequestEvent sre);
- /**
- * The request is about to come into scope of the web application.
- *
- * @param sre event containing request
- */
- public void requestInitialized(ServletRequestEvent sre);
- /**
- * Called after suspend
- * @param sre event containing request
- * @since 3.0
- */
- void requestSuspended(ServletRequestEvent sre);
+public interface ServletRequestListener extends EventListener {
- /**
- * called before resume
- * @param sre event containing request
- * @since 3.0
- */
- void requestResumed(ServletRequestEvent sre);
+ /** The request is about to go out of scope of the web application. */
+ public void requestDestroyed ( ServletRequestEvent sre );
- /**
- * called after completion
- * @param sre event containing request
- * @since 3.0
- */
- void requestCompleted(ServletRequestEvent sre);
+ /** The request is about to come into scope of the web application. */
+ public void requestInitialized ( ServletRequestEvent sre );
}
Modified: trunk/java/javax/servlet/ServletRequestWrapper.java
===================================================================
--- trunk/java/javax/servlet/ServletRequestWrapper.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletRequestWrapper.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,362 +1,341 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
package javax.servlet;
import java.io.BufferedReader;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
-
-
/**
- *
* Provides a convenient implementation of the ServletRequest interface that
* can be subclassed by developers wishing to adapt the request to a Servlet.
* This class implements the Wrapper or Decorator pattern. Methods default to
* calling through to the wrapped request object.
- * @since v 2.3
- *
- *
*
- * @see javax.servlet.ServletRequest
+ * @see javax.servlet.ServletRequest
*
+ * @since 2.3
*/
public class ServletRequestWrapper implements ServletRequest {
+
private ServletRequest request;
- /**
- * Creates a ServletRequest adaptor wrapping the given request object.
- * @throws java.lang.IllegalArgumentException if the request is null
- */
-
+ /**
+ * Creates a ServletRequest adaptor wrapping the given request object.
+ * @throws java.lang.IllegalArgumentException if the request is null
+ */
public ServletRequestWrapper(ServletRequest request) {
- if (request == null) {
- throw new IllegalArgumentException("Request cannot be null");
- }
- this.request = request;
+ if (request == null) {
+ throw new IllegalArgumentException("Request cannot be null");
+ }
+ this.request = request;
}
- /**
- * Return the wrapped request object.
- */
- public ServletRequest getRequest() {
- return this.request;
- }
-
- /**
- * Sets the request object being wrapped.
- * @throws java.lang.IllegalArgumentException if the request is null.
- */
-
- public void setRequest(ServletRequest request) {
- if (request == null) {
- throw new IllegalArgumentException("Request cannot be null");
- }
- this.request = request;
- }
/**
- *
+ * Return the wrapped request object.
+ */
+ public ServletRequest getRequest() {
+ return this.request;
+ }
+
+
+ /**
+ * Sets the request object being wrapped.
+ * @throws java.lang.IllegalArgumentException if the request is null.
+ */
+ public void setRequest(ServletRequest request) {
+ if (request == null) {
+ throw new IllegalArgumentException("Request cannot be null");
+ }
+ this.request = request;
+ }
+
+
+ /**
* The default behavior of this method is to call getAttribute(String name)
* on the wrapped request object.
*/
-
public Object getAttribute(String name) {
- return this.request.getAttribute(name);
- }
-
-
+ return this.request.getAttribute(name);
+ }
+
/**
* The default behavior of this method is to return getAttributeNames()
* on the wrapped request object.
*/
+ public Enumeration<String> getAttributeNames() {
+ return this.request.getAttributeNames();
+ }
- public Enumeration getAttributeNames() {
- return this.request.getAttributeNames();
- }
-
-
-
+
/**
- * The default behavior of this method is to return getCharacterEncoding()
+ * The default behavior of this method is to return getCharacterEncoding()
* on the wrapped request object.
*/
+ public String getCharacterEncoding() {
+ return this.request.getCharacterEncoding();
+ }
- public String getCharacterEncoding() {
- return this.request.getCharacterEncoding();
- }
-
+
/**
- * The default behavior of this method is to set the character encoding
+ * The default behavior of this method is to set the character encoding
* on the wrapped request object.
*/
+ public void setCharacterEncoding(String enc)
+ throws UnsupportedEncodingException {
+ this.request.setCharacterEncoding(enc);
+ }
- public void setCharacterEncoding(String enc) throws java.io.UnsupportedEncodingException {
- this.request.setCharacterEncoding(enc);
- }
-
-
+
/**
- * The default behavior of this method is to return getContentLength()
+ * The default behavior of this method is to return getContentLength()
* on the wrapped request object.
*/
-
public int getContentLength() {
- return this.request.getContentLength();
+ return this.request.getContentLength();
}
-
-
-
- /**
- * The default behavior of this method is to return getContentType()
+
+ /**
+ * The default behavior of this method is to return getContentType()
* on the wrapped request object.
*/
public String getContentType() {
- return this.request.getContentType();
+ return this.request.getContentType();
}
-
-
-
- /**
- * The default behavior of this method is to return getInputStream()
+
+ /**
+ * The default behavior of this method is to return getInputStream()
* on the wrapped request object.
*/
-
public ServletInputStream getInputStream() throws IOException {
- return this.request.getInputStream();
- }
-
-
-
+ return this.request.getInputStream();
+ }
+
/**
- * The default behavior of this method is to return getParameter(String name)
- * on the wrapped request object.
+ * The default behavior of this method is to return
+ * getParameter(String name) on the wrapped request object.
*/
-
public String getParameter(String name) {
- return this.request.getParameter(name);
+ return this.request.getParameter(name);
}
-
+
+
/**
- * The default behavior of this method is to return getParameterMap()
+ * The default behavior of this method is to return getParameterMap()
* on the wrapped request object.
*/
- public Map getParameterMap() {
- return this.request.getParameterMap();
+ public Map<String, String[]> getParameterMap() {
+ return this.request.getParameterMap();
}
-
-
-
+
/**
- * The default behavior of this method is to return getParameterNames()
+ * The default behavior of this method is to return getParameterNames()
* on the wrapped request object.
*/
-
- public Enumeration getParameterNames() {
- return this.request.getParameterNames();
+ public Enumeration<String> getParameterNames() {
+ return this.request.getParameterNames();
}
-
-
-
- /**
- * The default behavior of this method is to return getParameterValues(String name)
- * on the wrapped request object.
+
+ /**
+ * The default behavior of this method is to return
+ * getParameterValues(String name) on the wrapped request object.
*/
public String[] getParameterValues(String name) {
- return this.request.getParameterValues(name);
- }
-
-
-
+ return this.request.getParameterValues(name);
+ }
- /**
- * The default behavior of this method is to return getProtocol()
+
+ /**
+ * The default behavior of this method is to return getProtocol()
* on the wrapped request object.
*/
-
public String getProtocol() {
- return this.request.getProtocol();
- }
-
-
-
+ return this.request.getProtocol();
+ }
+
/**
- * The default behavior of this method is to return getScheme()
+ * The default behavior of this method is to return getScheme()
* on the wrapped request object.
*/
-
-
public String getScheme() {
- return this.request.getScheme();
- }
-
-
-
+ return this.request.getScheme();
+ }
+
/**
- * The default behavior of this method is to return getServerName()
+ * The default behavior of this method is to return getServerName()
* on the wrapped request object.
*/
public String getServerName() {
- return this.request.getServerName();
- }
-
-
-
+ return this.request.getServerName();
+ }
- /**
- * The default behavior of this method is to return getServerPort()
+
+ /**
+ * The default behavior of this method is to return getServerPort()
* on the wrapped request object.
*/
+ public int getServerPort() {
+ return this.request.getServerPort();
+ }
- public int getServerPort() {
- return this.request.getServerPort();
- }
-
-
-
- /**
- * The default behavior of this method is to return getReader()
+
+ /**
+ * The default behavior of this method is to return getReader()
* on the wrapped request object.
*/
-
public BufferedReader getReader() throws IOException {
- return this.request.getReader();
- }
-
-
-
+ return this.request.getReader();
+ }
+
/**
- * The default behavior of this method is to return getRemoteAddr()
+ * The default behavior of this method is to return getRemoteAddr()
* on the wrapped request object.
*/
-
public String getRemoteAddr() {
- return this.request.getRemoteAddr();
+ return this.request.getRemoteAddr();
}
-
-
-
- /**
- * The default behavior of this method is to return getRemoteHost()
+
+ /**
+ * The default behavior of this method is to return getRemoteHost()
* on the wrapped request object.
*/
-
public String getRemoteHost() {
- return this.request.getRemoteHost();
+ return this.request.getRemoteHost();
}
-
-
-
+
/**
- * The default behavior of this method is to return setAttribute(String name, Object o)
- * on the wrapped request object.
+ * The default behavior of this method is to return
+ * setAttribute(String name, Object o) on the wrapped request object.
*/
-
public void setAttribute(String name, Object o) {
- this.request.setAttribute(name, o);
+ this.request.setAttribute(name, o);
}
-
-
-
+
/**
- * The default behavior of this method is to call removeAttribute(String name)
- * on the wrapped request object.
+ * The default behavior of this method is to call
+ * removeAttribute(String name) on the wrapped request object.
*/
public void removeAttribute(String name) {
- this.request.removeAttribute(name);
+ this.request.removeAttribute(name);
}
-
-
-
- /**
- * The default behavior of this method is to return getLocale()
+
+ /**
+ * The default behavior of this method is to return getLocale()
* on the wrapped request object.
*/
-
public Locale getLocale() {
- return this.request.getLocale();
+ return this.request.getLocale();
}
-
-
-
- /**
- * The default behavior of this method is to return getLocales()
+
+ /**
+ * The default behavior of this method is to return getLocales()
* on the wrapped request object.
*/
-
- public Enumeration getLocales() {
- return this.request.getLocales();
+ public Enumeration<Locale> getLocales() {
+ return this.request.getLocales();
}
-
-
-
+
/**
- * The default behavior of this method is to return isSecure()
+ * The default behavior of this method is to return isSecure()
* on the wrapped request object.
*/
-
public boolean isSecure() {
- return this.request.isSecure();
+ return this.request.isSecure();
}
-
-
-
+
/**
- * The default behavior of this method is to return getRequestDispatcher(String path)
- * on the wrapped request object.
+ * The default behavior of this method is to return
+ * getRequestDispatcher(String path) on the wrapped request object.
*/
-
public RequestDispatcher getRequestDispatcher(String path) {
- return this.request.getRequestDispatcher(path);
+ return this.request.getRequestDispatcher(path);
}
-
-
-
+
/**
- * The default behavior of this method is to return getRealPath(String path)
- * on the wrapped request object.
+ * The default behavior of this method is to return
+ * getRealPath(String path) on the wrapped request object.
+ *
+ * @deprecated As of Version 2.1 of the Java Servlet API,
+ * use {@link ServletContext#getRealPath} instead
*/
-
public String getRealPath(String path) {
- return this.request.getRealPath(path);
+ return this.request.getRealPath(path);
}
+
/**
* The default behavior of this method is to return
@@ -379,6 +358,7 @@
return this.request.getLocalName();
}
+
/**
* The default behavior of this method is to return
* getLocalAddr() on the wrapped request object.
@@ -400,139 +380,254 @@
return this.request.getLocalPort();
}
+
/**
- * Get the servlet context the request-response pair was last dispatched through.
+ * Gets the servlet context to which the wrapped servlet request was last
+ * dispatched.
*
- * @return the latest ServletContext on the dispatch chain.
+ * @return the servlet context to which the wrapped servlet request was
+ * last dispatched
+ *
* @since 3.0
*/
public ServletContext getServletContext() {
return request.getServletContext();
}
+
/**
- * Gets the associated servlet response.
+ * Puts the wrapped request into asynchronous mode, and initializes its
+ * {@link AsyncContext} with the original ServletRequest and
+ * ServletResponse objects and the timeout derived according to
+ * the rules laid out in {@link #setAsyncTimeout}.
*
- * @return the ServletResponse associated with this request.
+ * @return the (re)initialized AsyncContext
+ *
+ * @throws IllegalStateException if this request is within the scope of
+ * a filter or servlet that does not support asynchronous operation,
+ * that is, if {@link #isAsyncSupported} returns false, or if this method
+ * is called again outside the scope of a dispatch resulting from an
+ * {@link AsyncContext#dispatch}, or if the response has already been
+ * closed
+ *
+ * @see ServletRequest#startAsync
+ *
* @since 3.0
*/
- public ServletResponse getServletResponse() {
- return request.getServletResponse();
+ public AsyncContext startAsync() throws IllegalStateException {
+ return request.startAsync();
}
+
- public void addAsyncListener(AsyncListener listener) {
- request.addAsyncListener(listener);
+ /**
+ * Puts the wrapped request into asynchronous mode, and initializes its
+ * {@link AsyncContext} with the given request and response objects
+ * and the timeout derived according to the rules laid out in
+ * {@link #setAsyncTimeout}.
+ *
+ * @param servletRequest the ServletRequest used to initialize the
+ * AsyncContext
+ * @param servletResponse the ServletResponse used to initialize the
+ * AsyncContext
+ *
+ * @return the (re)initialized AsyncContext
+ *
+ * @throws IllegalStateException if this request is within the scope of
+ * a filter or servlet that does not support asynchronous operation,
+ * that is, if {@link #isAsyncSupported} returns false, or if this method
+ * is called again outside the scope of a dispatch resulting from an
+ * {@link AsyncContext#dispatch}, or if the response has already been
+ * closed
+ *
+ * @see ServletRequest#startAsync(ServletRequest, ServletResponse)
+ *
+ * @since 3.0
+ */
+ public AsyncContext startAsync(ServletRequest servletRequest,
+ ServletResponse servletResponse)
+ throws IllegalStateException {
+ return request.startAsync(servletRequest, servletResponse);
}
- public void addAsyncListener(AsyncListener listener, ServletRequest request, ServletResponse response) {
- request.addAsyncListener(listener, request, response);
+
+ /**
+ * Checks if the wrapped request has been put into asynchronous mode.
+ *
+ * @return true if this request has been put into asynchronous mode,
+ * false otherwise
+ *
+ * @see ServletRequest#isAsyncStarted
+ *
+ * @since 3.0
+ */
+ public boolean isAsyncStarted() {
+ return request.isAsyncStarted();
}
+
+ /**
+ * Checks if the wrapped request supports asynchronous operation.
+ *
+ * @return true if this request supports asynchronous operation, false
+ * otherwise
+ *
+ * @see ServletRequest#isAsyncSupported
+ *
+ * @since 3.0
+ */
+ public boolean isAsyncSupported() {
+ return request.isAsyncSupported();
+ }
+
+
+ /**
+ * Gets the AsyncContext that was created or reinitialized by the
+ * most recent invocation of {@link #startAsync} or
+ * {@link #startAsync(ServletRequest,ServletResponse)} on the wrapped
+ * request.
+ *
+ * @return the AsyncContext that was created or reinitialized by the
+ * most recent invocation of {@link #startAsync} or
+ * {@link #startAsync(ServletRequest,ServletResponse)} on
+ * the wrapped request
+ *
+ * @throws IllegalStateException if this request has not been put
+ * into asynchronous mode, i.e., if neither {@link #startAsync} nor
+ * {@link #startAsync(ServletRequest,ServletResponse)} has been called
+ *
+ * @see ServletRequest#getAsyncContext
+ *
+ * @since 3.0
+ */
public AsyncContext getAsyncContext() {
return request.getAsyncContext();
}
- public boolean isAsyncStarted() {
- return request.isAsyncStarted();
+
+ /**
+ * Registers the given {@link AsyncListener} with the wrapped request
+ * for asynchronous complete and timeout events.
+ *
+ * @param listener the AsyncListener to be registered
+ *
+ * @see ServletRequest#addAsyncListener(AsyncListener)
+ *
+ * @since 3.0
+ */
+ public void addAsyncListener(AsyncListener listener) {
+ request.addAsyncListener(listener);
}
- public boolean isAsyncSupported() {
- return request.isAsyncSupported();
+
+ /**
+ * Registers the given {@link AsyncListener}, {@link ServletRequest},
+ * and {@link ServletResponse} with the wrapped request for asynchronous
+ * complete and timeout events.
+ *
+ * @param listener the AsyncListener to be registered
+ * @param servletRequest the ServletRequest that will be included
+ * in the AsyncEvent
+ * @param servletResponse the ServletResponse that will be included
+ * in the AsyncEvent
+ *
+ * @see ServletRequest#addAsyncListener(AsyncListener, ServletRequest,
+ * ServletResponse)
+ *
+ * @since 3.0
+ */
+ public void addAsyncListener(AsyncListener listener,
+ ServletRequest servletRequest,
+ ServletResponse servletResponse) {
+ request.addAsyncListener(listener, servletRequest, servletResponse);
}
+
+ /**
+ * Sets the timeout (in milliseconds) for any asynchronous operations
+ * started on the wrapped request by a call to {@link #startAsync} or
+ * {@link #startAsync(ServletRequest, ServletResponse)}.
+ *
+ * @param timeout the timeout in milliseconds for any asynchronous
+ * operations started on the wrapped request
+ *
+ * @throws IllegalStateException if called after {@link #startAsync},
+ * unless within the scope of a dispatch resulting from an
+ * {@link AsyncContext#dispatch}
+ *
+ * @see ServletRequest#setAsyncTimeout
+ *
+ * @since 3.0
+ */
public void setAsyncTimeout(long timeout) {
request.setAsyncTimeout(timeout);
}
- public AsyncContext startAsync() {
- return request.startAsync();
+
+ /**
+ * Checks (recursively) if this ServletRequestWrapper wraps the given
+ * {@link ServletRequest} instance.
+ *
+ * @param wrapped the ServletRequest instance to search for
+ *
+ * @return true if this ServletRequestWrapper wraps the
+ * given ServletRequest instance, false otherwise
+ *
+ * @since 3.0
+ */
+ public boolean isWrapperFor(ServletRequest wrapped) {
+ if (request == wrapped) {
+ return true;
+ } else if (request instanceof ServletRequestWrapper) {
+ return ((ServletRequestWrapper) request).isWrapperFor(wrapped);
+ } else {
+ return false;
+ }
}
- public AsyncContext startAsync(ServletRequest request, ServletResponse response) {
- return request.startAsync(request, response);
+
+ /**
+ * Checks (recursively) if this ServletRequestWrapper wraps a
+ * {@link ServletRequest} of the given class type.
+ *
+ * @param wrappedType the ServletRequest class type to
+ * search for
+ *
+ * @return true if this ServletRequestWrapper wraps a
+ * ServletRequest of the given class type, false otherwise
+ *
+ * @throws IllegalArgumentException if the given class does not
+ * implement {@link ServletRequest}
+ *
+ * @since 3.0
+ */
+ public boolean isWrapperFor(Class wrappedType) {
+ if (!ServletRequest.class.isAssignableFrom(wrappedType)) {
+ throw new IllegalArgumentException("Given class " +
+ wrappedType.getName() + " not a subinterface of " +
+ ServletRequest.class.getName());
+ }
+ if (wrappedType.isAssignableFrom(request.getClass())) {
+ return true;
+ } else if (request instanceof ServletRequestWrapper) {
+ return ((ServletRequestWrapper) request).isWrapperFor(wrappedType);
+ } else {
+ return false;
+ }
}
+
+ /**
+ * Gets the dispatcher type of the wrapped request.
+ *
+ * @return the dispatcher type of the wrapped request
+ *
+ * @see ServletRequest#getDispatcherType
+ *
+ * @since 3.0
+ */
public DispatcherType getDispatcherType() {
return request.getDispatcherType();
}
-// /**
-// * complete a suspended request.
-// *
-// * @throws IllegalStateException
-// * @since 3.0
-// */
-// public void complete() throws IllegalStateException {
-// request.complete();
-// }
-//
-// /**
-// * Suspend request processing. Must be called by a thread that is processing this request.
-// *
-// * @param timeoutMilliseconds new timeout period, in milliseconds
-// * @throws IllegalStateException if called by a thread not processing this request or after error dispatch
-// * @see #complete
-// * @see #resume
-// * @since 3.0
-// */
-// public void suspend(long timeoutMilliseconds) throws IllegalStateException {
-// request.suspend(timeoutMilliseconds);
-// }
-//
-// /**
-// * Similar to suspend(timeoutMilliseconds) but with a container supplied timeout period.
-// *
-// * @throws IllegalStateException
-// * @see #complete
-// * @see #resume
-// * @since 3.0
-// */
-// public void suspend() throws IllegalStateException {
-// request.suspend();
-// }
-//
-// /**
-// * Resume a suspended request
-// *
-// * @throws IllegalStateException if the request is not suspended
-// * @see #suspend
-// * @since 3.0
-// */
-// public void resume() throws IllegalStateException {
-// request.resume();
-// }
-//
-// /**
-// * @return if the request is suspended
-// * @since 3.0
-// */
-// public boolean isSuspended() {
-// return request.isSuspended();
-// }
-//
-// /**
-// * @return if the request is resumed
-// * @since 3.0
-// */
-// public boolean isResumed() {
-// return request.isResumed();
-// }
-//
-// /**
-// * @return if the request is timed out
-// * @since 3.0
-// */
-// public boolean isTimeout() {
-// return request.isTimeout();
-// }
-//
-// /**
-// * @return if the request has never been suspended (or resumed)
-// * @since 3.0
-// */
-// public boolean isInitial() {
-// return request.isInitial();
-// }
-
}
Modified: trunk/java/javax/servlet/ServletResponse.java
===================================================================
--- trunk/java/javax/servlet/ServletResponse.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletResponse.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
import java.io.IOException;
@@ -55,7 +92,6 @@
* are still evolving.
*
* @author Various
- * @version $Version$
*
* @see ServletOutputStream
*
@@ -96,9 +132,10 @@
* have been specified using {@link #setContentType}
* before the response is committed. If no content type
* has been specified, this method returns null.
- * If a content type has been specified and a
+ * If a content type has been specified, and a
* character encoding has been explicitly or implicitly
- * specified as described in {@link #getCharacterEncoding},
+ * specified as described in {@link #getCharacterEncoding}
+ * or {@link #getWriter} has been called,
* the charset parameter is included in the string returned.
* If no character encoding has been specified, the
* charset parameter is omitted.
@@ -159,7 +196,7 @@
* @return a <code>PrintWriter</code> object that
* can return character data to the client
*
- * @exception java.io.UnsupportedEncodingException
+ * @exception UnsupportedEncodingException
* if the character encoding returned
* by <code>getCharacterEncoding</code> cannot be used
*
@@ -440,31 +477,14 @@
* have no effect. If no locale has been specified,
* the container's default locale is returned.
*
- * @return locale specified for this response
* @see #setLocale
+ *
*/
public Locale getLocale();
- /**
- * Helper for suspend/resume: disables output
- * @since 3.0
- */
- void disable();
- /**
- * Helper for suspend/resume: enables output
- * @since 3.0
- */
- void enable();
- /**
- * Helper for suspend/resume, shows disabled state
- * @return true if disable is most recent disable/enable call
- * @since 3.0
- */
- boolean isDisabled();
-
}
Modified: trunk/java/javax/servlet/ServletResponseWrapper.java
===================================================================
--- trunk/java/javax/servlet/ServletResponseWrapper.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/ServletResponseWrapper.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
import java.io.IOException;
@@ -31,7 +68,6 @@
* calling through to the wrapped response object.
*
* @author Various
- * @version $Version$
* @since v 2.3
*
* @see javax.servlet.ServletResponse
@@ -212,35 +248,59 @@
return this.response.getLocale();
}
- /**
- * Helper for suspend/resume: disables output
- *
- * @since 3.0
- */
- public void disable() {
- response.disable();
- }
/**
- * Helper for suspend/resume: enables output
+ * Checks (recursively) if this ServletResponseWrapper wraps the given
+ * {@link ServletResponse} instance.
*
+ * @param wrapped the ServletResponse instance to search for
+ *
+ * @return true if this ServletResponseWrapper wraps the
+ * given ServletResponse instance, false otherwise
+ *
* @since 3.0
*/
- public void enable() {
- response.enable();
+ public boolean isWrapperFor(ServletResponse wrapped) {
+ if (response == wrapped) {
+ return true;
+ } else if (response instanceof ServletResponseWrapper) {
+ return ((ServletResponseWrapper) response).isWrapperFor(wrapped);
+ } else {
+ return false;
+ }
}
+
/**
- * Helper for suspend/resume, shows disabled state
+ * Checks (recursively) if this ServletResponseWrapper wraps a
+ * {@link ServletResponse} of the given class type.
*
- * @return true if disable is most recent disable/enable call
+ * @param wrappedType the ServletResponse class type to
+ * search for
+ *
+ * @return true if this ServletResponseWrapper wraps a
+ * ServletResponse of the given class type, false otherwise
+ *
+ * @throws IllegalArgumentException if the given class does not
+ * implement {@link ServletResponse}
+ *
* @since 3.0
*/
- public boolean isDisabled() {
- return response.isDisabled();
+ public boolean isWrapperFor(Class wrappedType) {
+ if (!ServletResponse.class.isAssignableFrom(wrappedType)) {
+ throw new IllegalArgumentException("Given class " +
+ wrappedType.getName() + " not a subinterface of " +
+ ServletResponse.class.getName());
+ }
+ if (wrappedType.isAssignableFrom(response.getClass())) {
+ return true;
+ } else if (response instanceof ServletResponseWrapper) {
+ return ((ServletResponseWrapper) response).isWrapperFor(wrappedType);
+ } else {
+ return false;
+ }
}
-
}
Modified: trunk/java/javax/servlet/SessionCookieConfig.java
===================================================================
--- trunk/java/javax/servlet/SessionCookieConfig.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/SessionCookieConfig.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,38 +1,285 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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]"
+ *
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ *
*/
-
package javax.servlet;
/**
- * @version $Rev: 751589 $ $Date: 2009-03-09 06:35:08 +0100 (Mon, 09 Mar 2009) $
+ * Class that may be used to configure various properties of cookies
+ * used for session tracking purposes.
+ *
+ * <p>An instance of this class is acquired by a call to
+ * {@link ServletContext#getSessionCookieConfig}.
+ *
* @since 3.0
*/
public interface SessionCookieConfig {
- String getDomain();
+ /**
+ * Sets the name that will be assigned to any session tracking
+ * cookies created on behalf of the <tt>ServletContext</tt> from
+ * which this <tt>SessionCookieConfig</tt> was acquired.
+ *
+ * <p>NOTE: Changing the name of session tracking cookies may break
+ * other tiers (for example, a load balancing frontend) that assume
+ * the cookie name to be equal to the default <tt>JSESSIONID</tt>,
+ * and therefore should only be done cautiously.
+ *
+ * @param name the cookie name to use
+ *
+ * @throws IllegalStateException if the <tt>ServletContext</tt>
+ * from which this <tt>SessionCookieConfig</tt> was acquired has
+ * already been initialized
+ */
+ public void setName(String name);
- String getPath();
- String getComment();
+ /**
+ * Gets the name that will be assigned to any session tracking
+ * cookies created on behalf of the <tt>ServletContext</tt> from
+ * which this <tt>SessionCookieConfig</tt> was acquired.
+ *
+ * <p>By default, <tt>JSESSIONID</tt> will be used as the cookie name.
+ *
+ * @return the cookie name set via {@link #setName}, or
+ * <tt>null</tt> if {@link #setName} was never called
+ *
+ * @see javax.servlet.http.Cookie#getName()
+ */
+ public String getName();
- boolean isHttpOnly();
- boolean isSecure();
+ /**
+ * Sets the domain name that will be assigned to any session tracking
+ * cookies created on behalf of the <tt>ServletContext</tt> from
+ * which this <tt>SessionCookieConfig</tt> was acquired.
+ *
+ * @param domain the cookie domain to use
+ *
+ * @throws IllegalStateException if the <tt>ServletContext</tt>
+ * from which this <tt>SessionCookieConfig</tt> was acquired has
+ * already been initialized
+ *
+ * @see javax.servlet.http.Cookie#setDomain(String)
+ */
+ public void setDomain(String domain);
+
+
+ /**
+ * Gets the domain name that will be assigned to any session tracking
+ * cookies created on behalf of the <tt>ServletContext</tt> from
+ * which this <tt>SessionCookieConfig</tt> was acquired.
+ *
+ * @return the cookie domain set via {@link #setDomain}, or
+ * <tt>null</tt> if {@link #setDomain} was never called
+ *
+ * @see javax.servlet.http.Cookie#getDomain()
+ */
+ public String getDomain();
+
+
+ /**
+ * Sets the path that will be assigned to any session tracking
+ * cookies created on behalf of the <tt>ServletContext</tt> from
+ * which this <tt>SessionCookieConfig</tt> was acquired.
+ *
+ * @param path the cookie path to use
+ *
+ * @throws IllegalStateException if the <tt>ServletContext</tt>
+ * from which this <tt>SessionCookieConfig</tt> was acquired has
+ * already been initialized
+ *
+ * @see javax.servlet.http.Cookie#setPath(String)
+ */
+ public void setPath(String path);
+
+
+ /**
+ * Gets the path that will be assigned to any session tracking
+ * cookies created on behalf of the <tt>ServletContext</tt> from
+ * which this <tt>SessionCookieConfig</tt> was acquired.
+ *
+ * <p>By default, the context path of the <tt>ServletContext</tt>
+ * from which this <tt>SessionCookieConfig</tt> was acquired will
+ * be used.
+ *
+ * @return the cookie path set via {@link #setPath}, or <tt>null</tt>
+ * if {@link #setPath} was never called
+ *
+ * @see javax.servlet.http.Cookie#getPath()
+ */
+ public String getPath();
+
+
+ /**
+ * Sets the comment that will be assigned to any session tracking
+ * cookies created on behalf of the <tt>ServletContext</tt> from
+ * which this <tt>SessionCookieConfig</tt> was acquired.
+ *
+ * @param comment the cookie comment to use
+ *
+ * @throws IllegalStateException if the <tt>ServletContext</tt>
+ * from which this <tt>SessionCookieConfig</tt> was acquired has
+ * already been initialized
+ *
+ * @see javax.servlet.http.Cookie#setComment(String)
+ */
+ public void setComment(String comment);
+
+
+ /**
+ * Gets the comment that will be assigned to any session tracking
+ * cookies created on behalf of the <tt>ServletContext</tt> from
+ * which this <tt>SessionCookieConfig</tt> was acquired.
+ *
+ * @return the cookie comment set via {@link #setComment}, or
+ * <tt>null</tt> if {@link #setComment} was never called
+ *
+ * @see javax.servlet.http.Cookie#getComment()
+ */
+ public String getComment();
+
+
+ /**
+ * Marks or unmarks the session tracking cookies created on behalf
+ * of the <tt>ServletContext</tt> from which this
+ * <tt>SessionCookieConfig</tt> was acquired as <i>HttpOnly</i>.
+ *
+ * <p>A cookie is marked as <tt>HttpOnly</tt> by adding the
+ * <tt>HttpOnly</tt> attribute to it. <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 httpOnly true if the session tracking cookies created
+ * on behalf of the <tt>ServletContext</tt> from which this
+ * <tt>SessionCookieConfig</tt> was acquired shall be marked as
+ * <i>HttpOnly</i>, false otherwise
+ *
+ * @throws IllegalStateException if the <tt>ServletContext</tt>
+ * from which this <tt>SessionCookieConfig</tt> was acquired has
+ * already been initialized
+ *
+ * @see javax.servlet.http.Cookie#setHttpOnly(boolean)
+ */
+ public void setHttpOnly(boolean httpOnly);
+
+
+ /**
+ * Checks if the session tracking cookies created on behalf of the
+ * <tt>ServletContext</tt> from which this <tt>SessionCookieConfig</tt>
+ * was acquired will be marked as <i>HttpOnly</i>.
+ *
+ * @return true if the session tracking cookies created on behalf of the
+ * <tt>ServletContext</tt> from which this <tt>SessionCookieConfig</tt>
+ * was acquired will be marked as <i>HttpOnly</i>, false otherwise
+ *
+ * @see javax.servlet.http.Cookie#isHttpOnly()
+ */
+ public boolean isHttpOnly();
+
+
+ /**
+ * Marks or unmarks the session tracking cookies created on behalf of the
+ * <tt>ServletContext</tt> from which this <tt>SessionCookieConfig</tt>
+ * was acquired as <i>secure</i>.
+ *
+ * <p>One use case for marking a session tracking cookie as
+ * <tt>secure</tt>, even though the request that initiated the session
+ * came over HTTP, is to support a topology where the web container is
+ * front-ended by an SSL offloading load balancer.
+ * In this case, the traffic between the client and the load balancer
+ * will be over HTTPS, whereas the traffic between the load balancer
+ * and the web container will be over HTTP.
+ *
+ * @param secure true if the session tracking cookies created on
+ * behalf of the <tt>ServletContext</tt> from which this
+ * <tt>SessionCookieConfig</tt> was acquired shall be marked as
+ * <i>secure</i> even if the request that initiated the corresponding
+ * session is using plain HTTP instead of HTTPS, and false if they
+ * shall be marked as <i>secure</i> only if the request that initiated
+ * the corresponding session was also secure
+ *
+ * @throws IllegalStateException if the <tt>ServletContext</tt>
+ * from which this <tt>SessionCookieConfig</tt> was acquired has
+ * already been initialized
+ *
+ * @see javax.servlet.http.Cookie#setSecure(boolean)
+ * @see ServletRequest#isSecure()
+ */
+ public void setSecure(boolean secure);
+
+
+ /**
+ * Checks if the session tracking cookies created on behalf of the
+ * <tt>ServletContext</tt> from which this <tt>SessionCookieConfig</tt>
+ * was acquired will be marked as <i>secure</i> even if the request
+ * that initiated the corresponding session is using plain HTTP
+ * instead of HTTPS.
+ *
+ * @return true if the session tracking cookies created on behalf of the
+ * <tt>ServletContext</tt> from which this <tt>SessionCookieConfig</tt>
+ * was acquired will be marked as <i>secure</i> even if the request
+ * that initiated the corresponding session is using plain HTTP
+ * instead of HTTPS, and false if they will be marked as <i>secure</i>
+ * only if the request that initiated the corresponding session was
+ * also secure
+ *
+ * @see javax.servlet.http.Cookie#getSecure()
+ * @see ServletRequest#isSecure()
+ */
+ public boolean isSecure();
+
+
+ /**
+ * Sets the lifetime (in seconds) for the session tracking cookies
+ * created on behalf of the <tt>ServletContext</tt> from which this
+ * <tt>SessionCookieConfig</tt> was acquired.
+ *
+ * @param maxAge the lifetime (in seconds) of the session tracking
+ * cookies created on behalf of the <tt>ServletContext</tt> from which
+ * this <tt>SessionCookieConfig</tt> was acquired.
+ *
+ * @see javax.servlet.http.Cookie#setMaxAge
+ */
+ public void setMaxAge(int maxAge);
+
+
+ /**
+ * Gets the lifetime (in seconds) of the session tracking cookies
+ * created on behalf of the <tt>ServletContext</tt> from which this
+ * <tt>SessionCookieConfig</tt> was acquired.
+ *
+ * <p>By default, <tt>-1</tt> is returned.
+ *
+ * @return the lifetime (in seconds) of the session tracking
+ * cookies created on behalf of the <tt>ServletContext</tt> from which
+ * this <tt>SessionCookieConfig</tt> was acquired, or <tt>-1</tt> (the
+ * default)
+ *
+ * @see javax.servlet.http.Cookie#getMaxAge
+ */
+ public int getMaxAge();
}
Modified: trunk/java/javax/servlet/SessionTrackingMode.java
===================================================================
--- trunk/java/javax/servlet/SessionTrackingMode.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/SessionTrackingMode.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,33 +1,38 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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]"
+ *
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ *
*/
-
package javax.servlet;
/**
- * @version $Rev: 675701 $ $Date: 2008-07-10 21:49:52 +0200 (Thu, 10 Jul 2008) $
+ * Enumeration of session tracking modes.
+ *
* @since 3.0
*/
public enum SessionTrackingMode {
-
COOKIE,
- SSL,
- URL
-
+ URL,
+ SSL
}
Modified: trunk/java/javax/servlet/SingleThreadModel.java
===================================================================
--- trunk/java/javax/servlet/SingleThreadModel.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/SingleThreadModel.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
/**
@@ -42,7 +79,6 @@
*
*
* @author Various
- * @version $Version$
*
* @deprecated As of Java Servlet API 2.4, with no direct
* replacement.
Modified: trunk/java/javax/servlet/UnavailableException.java
===================================================================
--- trunk/java/javax/servlet/UnavailableException.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/UnavailableException.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,24 +1,62 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet;
+
/**
* Defines an exception that a servlet or filter throws to indicate
* that it is permanently or temporarily unavailable.
@@ -45,7 +83,6 @@
*
*
* @author Various
- * @version $Version$
*
*/
Added: trunk/java/javax/servlet/annotation/HandlesTypes.java
===================================================================
--- trunk/java/javax/servlet/annotation/HandlesTypes.java (rev 0)
+++ trunk/java/javax/servlet/annotation/HandlesTypes.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ *
+ */
+
+
+package javax.servlet.annotation;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * This annotation is used to declare the types an instance of the
+ * ServletContainerInitializer can handle.
+ *
+ * <p>
+ *
+ * @see javax.servlet.ServletContainerInitializer
+ *
+ * @since 3.0
+ */
+(a)Target({ElementType.TYPE})
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface HandlesTypes {
+ /**
+ * The types that a <tt>ServletContainerInitializer</tt> expresses interesst in. When this annotation
+ * is applied on an implementation of <tt>ServletContainerInitializer</tt> the <tt>onStartup</tt> method
+ * of the ServletContainerInitializer instance will get a <tt>Set</tt> of classes that were either annotated
+ * with, or extends / implements the types listed via this annotation.
+ */
+ Class[] value();
+}
Added: trunk/java/javax/servlet/annotation/WebFilter.java
===================================================================
--- trunk/java/javax/servlet/annotation/WebFilter.java (rev 0)
+++ trunk/java/javax/servlet/annotation/WebFilter.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+
+package javax.servlet.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.servlet.DispatcherType;
+
+/**
+ * Annotation used to declare a servlet filter.
+ *
+ * <p>This annotation is processed by the container at deployment time,
+ * and the corresponding filter applied to the specified URL patterns,
+ * servlets, and dispatcher types.
+ *
+ * @see javax.servlet.Filter
+ *
+ * @since 3.0
+ */
+(a)Target({ElementType.TYPE})
+(a)Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface WebFilter {
+
+ /**
+ * The description of the filter
+ */
+ String description() default "";
+
+ /**
+ * The display name of the filter
+ */
+ String displayName() default "";
+
+ /**
+ * The init parameters of the filter
+ */
+ WebInitParam[] initParams() default {};
+
+ /**
+ * The name of the filter
+ */
+ String filterName() default "";
+
+ /**
+ * The small-icon of the filter
+ */
+ String smallIcon() default "";
+
+ /**
+ * The large-icon of the filter
+ */
+ String largeIcon() default "";
+
+ /**
+ * The names of the servlets to which the filter applies.
+ */
+ String[] servletNames() default {};
+
+ /**
+ * The URL patterns to which the filter applies
+ */
+ String[] value() default {};
+
+ /**
+ * The URL patterns to which the filter applies
+ */
+ String[] urlPatterns() default {};
+
+ /**
+ * The dispatcher types to which the filter applies
+ */
+ DispatcherType[] dispatcherTypes() default {DispatcherType.REQUEST};
+
+ /**
+ * Declares whether the filter supports asynchronous operation mode.
+ *
+ * @see javax.servlet.ServletRequest#startAsync
+ * @see javax.servlet.ServletRequest#startAsync(ServletRequest,
+ * ServletResponse)
+ */
+ boolean asyncSupported() default false;
+
+ /**
+ * The timeout for asynchronous operations initiated by the
+ * filter.
+ *
+ * @see javax.servlet.ServletRequest#setAsyncTimeout
+ */
+ long asyncTimeout() default 60000;
+}
Added: trunk/java/javax/servlet/annotation/WebInitParam.java
===================================================================
--- trunk/java/javax/servlet/annotation/WebInitParam.java (rev 0)
+++ trunk/java/javax/servlet/annotation/WebInitParam.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+
+package javax.servlet.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.Documented;
+
+/**
+ * Used to declare init params in servlets in filters
+ *
+ * @since Servlet 3.0
+ */
+(a)Target({ElementType.TYPE})
+(a)Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface WebInitParam {
+ /**
+ * Name of the init param
+ */
+ String name();
+
+ /**
+ * Value of the init param
+ */
+
+ String value();
+
+ /**
+ * Description of the init param
+ */
+ String description() default "";
+}
Added: trunk/java/javax/servlet/annotation/WebListener.java
===================================================================
--- trunk/java/javax/servlet/annotation/WebListener.java (rev 0)
+++ trunk/java/javax/servlet/annotation/WebListener.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+package javax.servlet.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation is used to declare a WebListener
+ *
+ *@since Servlet 3.0
+ */
+(a)Target({ElementType.TYPE})
+(a)Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface WebListener {
+ /**
+ * Description of the listener
+ */
+ String description() default "";
+}
+
Added: trunk/java/javax/servlet/annotation/WebServlet.java
===================================================================
--- trunk/java/javax/servlet/annotation/WebServlet.java (rev 0)
+++ trunk/java/javax/servlet/annotation/WebServlet.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -0,0 +1,119 @@
+/*
+ * 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.
+ */
+
+
+package javax.servlet.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Documented;
+
+/**
+ * Annotation used to declare a servlet.
+ *
+ * <p>This annotation is processed by the container at deployment time,
+ * and the corresponding servlet made available at the specified URL
+ * patterns.
+ *
+ * @see javax.servlet.Servlet
+ *
+ * @since 3.0
+ */
+(a)Target({ElementType.TYPE})
+(a)Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface WebServlet {
+
+ /**
+ * The name of the servlet
+ */
+ String name() default "";
+
+ /**
+ * The URL patterns of the servlet
+ */
+ String[] value() default {};
+
+ /**
+ * The URL patterns of the servlet
+ */
+ String[] urlPatterns() default {};
+
+ /**
+ * The load-on-startup order of the servlet
+ */
+ int loadOnStartup() default -1;
+
+ /**
+ * The init parameters of the servlet
+ */
+ WebInitParam [] initParams() default {};
+
+ /**
+ * Declares whether the servlet supports asynchronous operation mode.
+ *
+ * @see javax.servlet.ServletRequest#startAsync
+ * @see javax.servlet.ServletRequest#startAsync(ServletRequest,
+ * ServletResponse)
+ */
+ boolean asyncSupported() default false;
+
+ /**
+ * The timeout for asynchronous operations initiated by the
+ * servlet.
+ *
+ * @see javax.servlet.ServletRequest#setAsyncTimeout
+ */
+ long asyncTimeout() default 60000;
+
+ /**
+ * The small-icon of the servlet
+ */
+ String smallIcon() default "";
+
+ /**
+ * The large-icon of the servlet
+ */
+ String largeIcon() default "";
+
+ /**
+ * The description of the servlet
+ */
+ String description() default "";
+
+}
Added: trunk/java/javax/servlet/annotation/package.html
===================================================================
--- trunk/java/javax/servlet/annotation/package.html (rev 0)
+++ trunk/java/javax/servlet/annotation/package.html 2009-04-02 23:28:07 UTC (rev 982)
@@ -0,0 +1,49 @@
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
+
+ The contents of this file are subject to the terms of either the GNU
+ General Public License Version 2 only ("GPL") or the Common Development
+ and Distribution License("CDDL") (collectively, the "License"). You
+ may not use this file except in compliance with the License. You can obtain
+ a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ language governing permissions and limitations under the License.
+
+ When distributing the software, include this License Header Notice in each
+ file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ Sun designates this particular file as subject to the "Classpath" exception
+ as provided by Sun in the GPL Version 2 section of the License file that
+ accompanied this code. If applicable, add the following below the License
+ Header, with the fields enclosed by brackets [] replaced by your own
+ identifying information: "Portions Copyrighted [year]
+ [name of copyright owner]"
+
+ Contributor(s):
+
+ If you wish your version of this file to be governed by only the CDDL or
+ only the GPL Version 2, indicate your decision by adding "[Contributor]
+ elects to include this software in this distribution under the [CDDL or GPL
+ Version 2] license." If you don't indicate a single choice of license, a
+ recipient has the option to distribute your version of this file under
+ either the CDDL, the GPL Version 2 or to extend the choice of license to
+ its licensees as provided above. However, if you add GPL Version 2 code
+ and therefore, elected the GPL Version 2 license, then the option applies
+ only if the new code is made subject to such option by the copyright
+ holder.
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<HTML>
+<HEAD>
+
+
+</HEAD>
+<BODY BGCOLOR="white">
+
+The javax.servlet.annotation package contains a number of annotations
+that allow users to use annotations to declare servlets, filters,
+listeners and specify the metadata for the declared component.
+
+</BODY>
+</HTML>
Modified: trunk/java/javax/servlet/http/Cookie.java
===================================================================
--- trunk/java/javax/servlet/http/Cookie.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/Cookie.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet.http;
import java.text.MessageFormat;
@@ -58,8 +95,6 @@
*
*
* @author Various
- * @version $Version$
- *
*/
// XXX would implement java.io.Serializable too, but can't do that
@@ -91,9 +126,10 @@
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 httpOnly;
+ private boolean isHttpOnly = false;
+
+
-
/**
* Constructs a cookie with a specified name and value.
*
@@ -536,23 +572,36 @@
throw new RuntimeException(e.getMessage());
}
}
-
- /**
- *
- * @return whether cookie is http only
- * @since servlet 3.0
- */
- public boolean isHttpOnly() {
- return httpOnly;
- }
-
- /**
- *
- * @param httpOnly httpOnly setting
- * @since servlet 3.0
- */
- public void setHttpOnly(boolean httpOnly) {
- this.httpOnly = httpOnly;
- }
+ /**
+ * 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 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 3.0
+ */
+ public boolean isHttpOnly() {
+ return isHttpOnly;
+ }
}
Modified: trunk/java/javax/servlet/http/HttpServlet.java
===================================================================
--- trunk/java/javax/servlet/http/HttpServlet.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/HttpServlet.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,60 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
+
package javax.servlet.http;
import java.io.IOException;
@@ -76,8 +114,6 @@
* information on handling multiple threads in a Java program.
*
* @author Various
- * @version $Version$
- *
*/
@@ -272,7 +308,7 @@
NoBodyResponse response = new NoBodyResponse(resp);
doGet(req, response);
- response.setContentLength();
+ response.setContentLength();
}
@@ -469,8 +505,11 @@
}
- private static Method[] getAllDeclaredMethods(Class c) {
+
+
+ private Method[] getAllDeclaredMethods(Class<?> c) {
+
if (c.equals(javax.servlet.http.HttpServlet.class)) {
return null;
}
@@ -493,6 +532,10 @@
}
+
+
+
+
/**
* Called by the server (via the <code>service</code> method)
* to allow a servlet to handle a OPTIONS request.
@@ -559,7 +602,7 @@
String allow = null;
if (ALLOW_GET)
- if (allow==null) allow=METHOD_GET;
+ allow=METHOD_GET;
if (ALLOW_HEAD)
if (allow==null) allow=METHOD_HEAD;
else allow += ", " + METHOD_HEAD;
@@ -624,10 +667,10 @@
String responseString = "TRACE "+ req.getRequestURI()+
" " + req.getProtocol();
- Enumeration reqHeaderEnum = req.getHeaderNames();
+ Enumeration<String> reqHeaderEnum = req.getHeaderNames();
while( reqHeaderEnum.hasMoreElements() ) {
- String headerName = (String)reqHeaderEnum.nextElement();
+ String headerName = reqHeaderEnum.nextElement();
responseString += CRLF + headerName + ": " +
req.getHeader(headerName);
}
@@ -640,8 +683,6 @@
resp.setContentLength(responseLength);
ServletOutputStream out = resp.getOutputStream();
out.print(responseString);
- out.close();
- return;
}
@@ -814,56 +855,69 @@
* A response that includes no body, for use in (dumb) "HEAD" support.
* This just swallows that body, counting the bytes in order to set
* the content length appropriately. All other methods delegate directly
- * to the HTTP Servlet Response object used to construct this one.
+ * to the wrapped HTTP Servlet Response object.
*/
// file private
class NoBodyResponse extends HttpServletResponseWrapper {
+
+ private static final ResourceBundle lStrings
+ = ResourceBundle.getBundle("javax.servlet.http.LocalStrings");
+
private NoBodyOutputStream noBody;
private PrintWriter writer;
private boolean didSetContentLength;
+ private boolean usingOutputStream;
// file private
NoBodyResponse(HttpServletResponse r) {
- super(r);
+ super(r);
noBody = new NoBodyOutputStream();
}
// file private
void setContentLength() {
- if (!didSetContentLength)
- super.setContentLength(noBody.getContentLength());
+ if (!didSetContentLength) {
+ if (writer != null) {
+ writer.flush();
+ }
+ setContentLength(noBody.getContentLength());
+ }
}
-
- // SERVLET RESPONSE interface methods
-
public void setContentLength(int len) {
- super.setContentLength(len);
- didSetContentLength = true;
+ super.setContentLength(len);
+ didSetContentLength = true;
}
- public ServletOutputStream getOutputStream() throws IOException
- { return noBody; }
+ public ServletOutputStream getOutputStream() throws IOException {
- public PrintWriter getWriter() throws UnsupportedEncodingException
- {
- if (writer == null) {
- OutputStreamWriter w;
+ if (writer != null) {
+ throw new IllegalStateException(
+ lStrings.getString("err.ise.getOutputStream"));
+ }
+ usingOutputStream = true;
- w = new OutputStreamWriter(noBody, getCharacterEncoding());
- writer = new PrintWriter(w);
- }
- return writer;
+ return noBody;
}
-}
+ public PrintWriter getWriter() throws UnsupportedEncodingException {
+ if (usingOutputStream) {
+ throw new IllegalStateException(
+ lStrings.getString("err.ise.getWriter"));
+ }
+ if (writer == null) {
+ OutputStreamWriter w = new OutputStreamWriter(
+ noBody, getCharacterEncoding());
+ writer = new PrintWriter(w);
+ }
+ return writer;
+ }
+}
-
-
/*
* Servlet output stream that gobbles up all its data.
*/
@@ -896,11 +950,9 @@
if (len >= 0) {
contentLength += len;
} else {
- // XXX
- // isn't this really an IllegalArgumentException?
-
- String msg = lStrings.getString("err.io.negativelength");
- throw new IOException("negative length");
+ // This should have thrown an IllegalArgumentException, but
+ // changing this would break backwards compatibility
+ throw new IOException(lStrings.getString("err.io.negativelength"));
}
}
}
Modified: trunk/java/javax/servlet/http/HttpServletRequest.java
===================================================================
--- trunk/java/javax/servlet/http/HttpServletRequest.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/HttpServletRequest.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,24 +1,61 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
package javax.servlet.http;
+import java.io.IOException;
+import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import java.util.Enumeration;
@@ -33,9 +70,6 @@
*
*
* @author Various
- * @version $Version$
- *
- *
*/
public interface HttpServletRequest extends ServletRequest {
@@ -165,7 +199,6 @@
-
/**
*
* Returns all the values of the specified request header
@@ -194,7 +227,7 @@
*
*/
- public Enumeration getHeaders(String name);
+ public Enumeration<String> getHeaders(String name);
@@ -221,7 +254,7 @@
*
*/
- public Enumeration getHeaderNames();
+ public Enumeration<String> getHeaderNames();
@@ -331,17 +364,26 @@
/**
*
* Returns the portion of the request URI that indicates the context
- * of the request. The context path always comes first in a request
- * URI. The path starts with a "/" character but does not end with a "/"
- * character. For servlets in the default (root) context, this method
+ * of the request. The context path always comes first in a request
+ * URI. The path starts with a "/" character but does not end with a "/"
+ * character. For servlets in the default (root) context, this method
* returns "". The container does not decode this string.
*
+ * <p>It is possible that a servlet container may match a context by
+ * more than one context path. In such cases this method will return the
+ * actual context path used by the request and it may differ from the
+ * path returned by the
+ * {@link javax.servlet.ServletContext#getContextPath()} method.
+ * The context path returned by
+ * {@link javax.servlet.ServletContext#getContextPath()}
+ * should be considered as the prime or preferred context path of the
+ * application.
*
* @return a <code>String</code> specifying the
* portion of the request URI that indicates the context
* of the request
*
- *
+ * @see javax.servlet.ServletContext#getContextPath()
*/
public String getContextPath();
@@ -488,6 +530,11 @@
* number, and server path, but it does not include query
* string parameters.
*
+ * <p>If this request has been forwarded using
+ * {@link javax.servlet.RequestDispatcher#forward}, the server path in the
+ * reconstructed URL must reflect the path used to obtain the
+ * RequestDispatcher, and not the server path specified by the client.
+ *
* <p>Because this method returns a <code>StringBuffer</code>,
* not a string, you can modify the URL easily, for example,
* to append query parameters.
@@ -594,6 +641,9 @@
*
* Checks whether the requested session ID is still valid.
*
+ * <p>If the client did not specify any session ID, this method returns
+ * <code>false</code>.
+ *
* @return <code>true</code> if this
* request has an id for a valid session
* in the current session context;
@@ -659,5 +709,88 @@
public boolean isRequestedSessionIdFromUrl();
+ /**
+ * Use the container login mechanism configured for the
+ * <code>ServletContext</code> to authenticate the user making
+ * this request.
+ *
+ * <p>This method may modify and commit the argument
+ * <code>HttpServletResponse</code>.
+ *
+ * @param response The <code>HttpServletResponse</code>
+ * associated with this <code>HttpServletRequest</code>
+ *
+ * @return <code>true</code> when non-null values were or have been
+ * established as the values returned by <code>getUserPrincipal</code>,
+ * <code>getRemoteUser</code>, and <code>getAuthType</code>. Return
+ * <code>false</code> if authentication is incomplete and the underlying
+ * login mechanism has committed, in the response, the message (e.g.,
+ * challenge) and HTTP status code to be returned to the user.
+ *
+ * @exception IOException if an error occurs while writing
+ * the response.
+ *
+ * @exception ServletException if the authentication failed and
+ * the caller is responsible for
+ * handling the error (i.e., the
+ * underlying login mechanism did
+ * NOT establish the message and
+ * HTTP status code to be returned
+ * to the user).
+ */
+ public boolean login(HttpServletResponse response)
+ throws IOException,ServletException;
+
+
+ /**
+ * Validate the provided username and password in the password validation
+ * realm used by the web container login mechanism configured for the
+ * <code>ServletContext</code>.
+ *
+ * <p>This method returns without throwing a <code>ServletException</code>
+ * when the login mechanism configured for the <code>ServletContext</code>
+ * supports username password validation, and when, at the time of the
+ * call to login, the identity of the caller of the request had
+ * not been established (i.e, all of <code>getUserPrincipal</code>,
+ * <code>getRemoteUser</code>, and <code>getAuthType</code> return null),
+ * and when validation of the provided credentials is successful.
+ * Otherwise, this method throws a <code>ServletException</code> as
+ * described below.
+ *
+ * <p>When this method returns without throwing an exception, it must
+ * have established non-null values as the values returned by
+ * <code>getUserPrincipal</code>, <code>getRemoteUser</code>, and
+ * <code>getAuthType</code>.
+ *
+ * @param username The <code>String</code> value corresponding to
+ * the login identifier of the user.
+ *
+ * @param password The password <code>String</code> corresponding
+ * to the identified user.
+ *
+ * @exception ServletException if the configured login mechanism
+ * does not support username
+ * password authentication, or if a
+ * non-null caller identity had
+ * already been established (prior
+ * to the call to login), or if
+ * validation of the provided
+ * username and password fails.
+ */
+ public void login(String username, String password)
+ throws ServletException;
+
+ /**
+ * Establish <code>null</code> as the value returned when
+ * <code>getUserPrincipal</code>, <code>getRemoteUser</code>,
+ * and <code>getAuthType</code> is called on the request.
+ *
+ * @exception ServletException ff logout fails.
+ */
+ public void logout() throws ServletException;
+
}
+
+
+
Modified: trunk/java/javax/servlet/http/HttpServletRequestWrapper.java
===================================================================
--- trunk/java/javax/servlet/http/HttpServletRequestWrapper.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/HttpServletRequestWrapper.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,24 +1,61 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
package javax.servlet.http;
+import java.io.IOException;
+import javax.servlet.ServletException;
import javax.servlet.ServletRequestWrapper;
import java.util.Enumeration;
@@ -87,7 +124,7 @@
* The default behavior of this method is to return getHeaders(String name)
* on the wrapped request object.
*/
- public Enumeration getHeaders(String name) {
+ public Enumeration<String> getHeaders(String name) {
return this._getHttpServletRequest().getHeaders(name);
}
@@ -96,13 +133,13 @@
* on the wrapped request object.
*/
- public Enumeration getHeaderNames() {
+ public Enumeration<String> getHeaderNames() {
return this._getHttpServletRequest().getHeaderNames();
}
/**
- * The default behavior of this method is to return getIntHeader(String name)
- * on the wrapped request object.
+ * The default behavior of this method is to return
+ * getIntHeader(String name) on the wrapped request object.
*/
public int getIntHeader(String name) {
@@ -245,13 +282,15 @@
return this._getHttpServletRequest().isRequestedSessionIdFromCookie();
}
- /**
+
+ /**
* The default behavior of this method is to return isRequestedSessionIdFromURL()
* on the wrapped request object.
*/
public boolean isRequestedSessionIdFromURL() {
- return this._getHttpServletRequest().isRequestedSessionIdFromURL();
+ return this._getHttpServletRequest().isRequestedSessionIdFromURL();
}
+
/**
* The default behavior of this method is to return isRequestedSessionIdFromUrl()
@@ -262,5 +301,31 @@
}
-
+ /**
+ * The default behavior of this method is to call login on the wrapped
+ * request object.
+ */
+ public boolean login(HttpServletResponse response)
+ throws IOException, ServletException {
+ return this._getHttpServletRequest().login(response);
+ }
+
+
+ /**
+ * The default behavior of this method is to call login on the wrapped
+ * request object
+ */
+ public void login(String username, String password)
+ throws ServletException {
+ this._getHttpServletRequest().login(username,password);
+ }
+
+
+ /**
+ * The default behavior of this method is to call login on the wrapped
+ * request object
+ */
+ public void logout() throws ServletException {
+ this._getHttpServletRequest().logout();
+ }
}
Modified: trunk/java/javax/servlet/http/HttpServletResponse.java
===================================================================
--- trunk/java/javax/servlet/http/HttpServletResponse.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/HttpServletResponse.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet.http;
import java.io.IOException;
@@ -35,7 +72,6 @@
*
*
* @author Various
- * @version $Version$
*
* @see javax.servlet.ServletResponse
*
@@ -324,7 +360,68 @@
public void setStatus(int sc, String sm);
+
+ /**
+ * Gets the current status code of this response.
+ *
+ * @return the current status code of this response
+ */
+ public int getStatus();
+
+
+ /**
+ * Gets the value of the response header with the given name.
+ *
+ * <p>If a response header with the given name exists and contains
+ * multiple values, the value that was added first will be returned.
+ *
+ * <p>This method considers only response headers set or added via
+ * {@link #setHeader}, {@link #addHeader}, {@link #setDateHeader},
+ * {@link #addDateHeader}, {@link #setIntHeader}, or
+ * {@link #addIntHeader}, respectively.
+ *
+ * @param name the name of the response header whose value to return
+ *
+ * @return the value of the response header with the given name,
+ * or <tt>null</tt> if no header with the given name has been set
+ * on this response
+ */
+ public String getHeader(String name);
+
+
+ /**
+ * Gets the values of the response header with the given name
+ * as an <tt>Iterable</tt> of <tt>String</tt> objects.
+ *
+ * <p>This method considers only response headers set or added via
+ * {@link #setHeader}, {@link #addHeader}, {@link #setDateHeader},
+ * {@link #addDateHeader}, {@link #setIntHeader}, or
+ * {@link #addIntHeader}, respectively.
+ *
+ * @param name the name of the response header whose values to return
+ *
+ * @return the values of the response header with the given name,
+ * or an empty <tt>Iterable</tt> if no header with the given name
+ * has been set on this response
+ */
+ public Iterable<String> getHeaders(String name);
+
+ /**
+ * Gets the names of the headers of this response
+ * as an <tt>Iterable</tt> of <tt>String</tt> objects.
+ *
+ * <p>This method considers only response headers set or added via
+ * {@link #setHeader}, {@link #addHeader}, {@link #setDateHeader},
+ * {@link #addDateHeader}, {@link #setIntHeader}, or
+ * {@link #addIntHeader}, respectively.
+ *
+ * @return the names of the headers of this response, or an empty
+ * <tt>Iterable</tt> if no headers have been set on this response
+ */
+ public Iterable<String> getHeaderNames();
+
+
/*
* Server status codes; see RFC 2068.
*/
Modified: trunk/java/javax/servlet/http/HttpServletResponseWrapper.java
===================================================================
--- trunk/java/javax/servlet/http/HttpServletResponseWrapper.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/HttpServletResponseWrapper.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet.http;
import java.io.IOException;
@@ -31,8 +68,7 @@
* calling through to the wrapped response object.
*
* @author Various
- * @version $Version$
- * @since v 2.3
+ * @since v 2.3
*
* @see javax.servlet.http.HttpServletResponse
*
@@ -90,14 +126,20 @@
/**
* The default behavior of this method is to call encodeUrl(String url)
* on the wrapped response object.
+ *
+ * @deprecated As of version 2.1, use {@link #encodeURL(String url)}
+ * instead
*/
public String encodeUrl(String url) {
return this._getHttpServletResponse().encodeUrl(url);
}
/**
- * The default behavior of this method is to return encodeRedirectUrl(String url)
- * on the wrapped response object.
+ * The default behavior of this method is to return
+ * encodeRedirectUrl(String url) on the wrapped response object.
+ *
+ * @deprecated As of version 2.1, use
+ * {@link #encodeRedirectURL(String url)} instead
*/
public String encodeRedirectUrl(String url) {
return this._getHttpServletResponse().encodeRedirectUrl(url);
@@ -181,19 +223,79 @@
* The default behavior of this method is to call setStatus(int sc)
* on the wrapped response object.
*/
-
-
public void setStatus(int sc) {
this._getHttpServletResponse().setStatus(sc);
}
/**
- * The default behavior of this method is to call setStatus(int sc, String sm)
- * on the wrapped response object.
+ * The default behavior of this method is to call
+ * setStatus(int sc, String sm) on the wrapped response object.
+ *
+ * @deprecated As of version 2.1, due to ambiguous meaning of the
+ * message parameter. To set a status code
+ * use {@link #setStatus(int)}, to send an error with a description
+ * use {@link #sendError(int, String)}
*/
public void setStatus(int sc, String sm) {
this._getHttpServletResponse().setStatus(sc, sm);
}
+
+ /**
+ * The default behaviour of this method is to call
+ * {@link HttpServletResponse#getStatus} on the wrapped response
+ * object.
+ *
+ * @return the current status code of the wrapped response
+ */
+ public int getStatus() {
+ return _getHttpServletResponse().getStatus();
+ }
+
+
+ /**
+ * The default behaviour of this method is to call
+ * {@link HttpServletResponse#getHeader} on the wrapped response
+ * object.
+ *
+ * @param name the name of the response header whose value to return
+ *
+ * @return the value of the response header with the given name,
+ * or <tt>null</tt> if no header with the given name has been set
+ * on the wrapped response
+ */
+ public String getHeader(String name) {
+ return _getHttpServletResponse().getHeader(name);
+ }
+
+
+ /**
+ * The default behaviour of this method is to call
+ * {@link HttpServletResponse#getHeaders} on the wrapped response
+ * object.
+ *
+ * @param name the name of the response header whose values to return
+ *
+ * @return the values of the response header with the given name,
+ * or an empty <tt>Iterable</tt> if no header with the given name
+ * has been set on the wrapped response
+ */
+ public Iterable<String> getHeaders(String name) {
+ return _getHttpServletResponse().getHeaders(name);
+ }
+
+
+ /**
+ * The default behaviour of this method is to call
+ * {@link HttpServletResponse#getHeaderNames} on the wrapped response
+ * object.
+ *
+ * @return the names of the headers of the wrapped response, or an empty
+ * <tt>Iterable</tt> if no headers have been set on the wrapped
+ * response
+ */
+ public Iterable<String> getHeaderNames() {
+ return _getHttpServletResponse().getHeaderNames();
+ }
}
Modified: trunk/java/javax/servlet/http/HttpSession.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSession.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/HttpSession.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,20 +1,55 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
package javax.servlet.http;
@@ -68,9 +103,7 @@
* will not be directly visible in another.
*
* @author Various
- * @version $Version$
*
- *
* @see HttpSessionBindingListener
* @see HttpSessionContext
*
@@ -109,10 +142,6 @@
*
* @return a string specifying the identifier
* assigned to this session
- *
- * @exception IllegalStateException if this method is called on an
- * invalidated session
- *
*/
public String getId();
@@ -260,7 +289,7 @@
*
*/
- public Enumeration getAttributeNames();
+ public Enumeration<String> getAttributeNames();
@@ -418,10 +447,7 @@
* already invalidated session
*
*/
-
public boolean isNew();
-
-
}
Modified: trunk/java/javax/servlet/http/HttpSessionActivationListener.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSessionActivationListener.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/HttpSessionActivationListener.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet.http;
import java.util.EventListener;
Modified: trunk/java/javax/servlet/http/HttpSessionAttributeListener.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSessionAttributeListener.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/HttpSessionAttributeListener.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet.http;
import java.util.EventListener;
Modified: trunk/java/javax/servlet/http/HttpSessionBindingEvent.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSessionBindingEvent.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/HttpSessionBindingEvent.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,25 +1,66 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
+
package javax.servlet.http;
+
+
/**
+ *
* Events of this type are either sent to an object that implements
* {@link HttpSessionBindingListener} when it is bound or
* unbound from a session, or to a {@link HttpSessionAttributeListener}
@@ -33,13 +74,17 @@
*
*
* @author Various
- * @version $Version$
*
* @see HttpSession
* @see HttpSessionBindingListener
* @see HttpSessionAttributeListener
*/
+
public class HttpSessionBindingEvent extends HttpSessionEvent {
+
+
+
+
/* The name to which the object is being bound or unbound */
private String name;
Modified: trunk/java/javax/servlet/http/HttpSessionBindingListener.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSessionBindingListener.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/HttpSessionBindingListener.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,26 +1,68 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
+
package javax.servlet.http;
import java.util.EventListener;
+
+
+
+
/**
* Causes an object to be notified when it is bound to
* or unbound from a session. The object is notified
@@ -30,12 +72,16 @@
*
*
* @author Various
- * @version $Version$
*
* @see HttpSession
* @see HttpSessionBindingEvent
+ *
*/
+
public interface HttpSessionBindingListener extends EventListener {
+
+
+
/**
*
* Notifies the object that it is being bound to
Modified: trunk/java/javax/servlet/http/HttpSessionContext.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSessionContext.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/HttpSessionContext.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,29 +1,67 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
+
package javax.servlet.http;
import java.util.Enumeration;
/**
+ *
* @author Various
- * @version $Version$
*
* @deprecated As of Java(tm) Servlet API 2.1
* for security reasons, with no replacement.
@@ -35,6 +73,8 @@
* @see HttpSessionBindingListener
*
*/
+
+
public interface HttpSessionContext {
/**
@@ -60,7 +100,7 @@
*
*/
- public Enumeration getIds();
+ public Enumeration<String> getIds();
}
Modified: trunk/java/javax/servlet/http/HttpSessionEvent.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSessionEvent.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/HttpSessionEvent.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,24 +1,62 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet.http;
+
/** This is the class representing event notifications for
* changes to sessions within a web application.
* @since v 2.3
Modified: trunk/java/javax/servlet/http/HttpSessionListener.java
===================================================================
--- trunk/java/javax/servlet/http/HttpSessionListener.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/HttpSessionListener.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,22 +1,59 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
+
+
package javax.servlet.http;
import java.util.EventListener;
Modified: trunk/java/javax/servlet/http/HttpUtils.java
===================================================================
--- trunk/java/javax/servlet/http/HttpUtils.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/HttpUtils.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,20 +1,55 @@
/*
- * 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
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * The 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.
*/
package javax.servlet.http;
@@ -31,9 +66,7 @@
* with the default encoding and have been moved
* to the request interfaces.
*
-*/
-
-
+ */
public class HttpUtils {
private static final String LSTRING_FILE =
@@ -42,20 +75,13 @@
ResourceBundle.getBundle(LSTRING_FILE);
-
/**
* Constructs an empty <code>HttpUtils</code> object.
- *
*/
-
public HttpUtils() {}
-
-
-
/**
- *
* Parses a query string passed from the client to the
* server and builds a <code>HashTable</code> object
* with key-value pairs.
@@ -81,23 +107,21 @@
* @return a <code>HashTable</code> object built
* from the parsed key-value pairs
*
- * @exception IllegalArgumentException if the query string
- * is invalid
- *
+ * @exception IllegalArgumentException if the query string is invalid
*/
+ public static Hashtable<String, String[]> parseQueryString(String s) {
- static public Hashtable parseQueryString(String s) {
-
String valArray[] = null;
if (s == null) {
throw new IllegalArgumentException();
}
- Hashtable ht = new Hashtable();
+
+ Hashtable<String, String[]> ht = new Hashtable<String, String[]>();
StringBuffer sb = new StringBuffer();
StringTokenizer st = new StringTokenizer(s, "&");
while (st.hasMoreTokens()) {
- String pair = (String)st.nextToken();
+ String pair = st.nextToken();
int pos = pair.indexOf('=');
if (pos == -1) {
// XXX
@@ -107,7 +131,7 @@
String key = parseName(pair.substring(0, pos), sb);
String val = parseName(pair.substring(pos+1, pair.length()), sb);
if (ht.containsKey(key)) {
- String oldVals[] = (String []) ht.get(key);
+ String oldVals[] = ht.get(key);
valArray = new String[oldVals.length + 1];
for (int i = 0; i < oldVals.length; i++)
valArray[i] = oldVals[i];
@@ -118,12 +142,11 @@
}
ht.put(key, valArray);
}
+
return ht;
}
-
-
/**
*
* Parses data from an HTML form that the client sends to
@@ -143,8 +166,6 @@
* sent in hexadecimal notation (like <i>%xx</i>) are
* converted to ASCII characters.
*
- *
- *
* @param len an integer specifying the length,
* in characters, of the
* <code>ServletInputStream</code>
@@ -158,21 +179,18 @@
* @return a <code>HashTable</code> object built
* from the parsed key-value pairs
*
- *
- * @exception IllegalArgumentException if the data
- * sent by the POST method is invalid
- *
+ * @exception IllegalArgumentException if the data
+ * sent by the POST method is invalid
*/
-
-
- static public Hashtable parsePostData(int len,
- ServletInputStream in)
- {
+ public static Hashtable<String, String[]> parsePostData(int len,
+ ServletInputStream in) {
// XXX
// should a length of 0 be an IllegalArgumentException
- if (len <=0)
- return new Hashtable(); // cheap hack to return an empty hash
+ if (len <=0) {
+ // cheap hack to return an empty hash
+ return new Hashtable<String, String[]>();
+ }
if (in == null) {
throw new IllegalArgumentException();
@@ -214,13 +232,10 @@
}
-
-
/*
* Parse a name in the query string.
*/
-
- static private String parseName(String s, StringBuffer sb) {
+ private static String parseName(String s, StringBuffer sb) {
sb.setLength(0);
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
@@ -250,12 +265,11 @@
break;
}
}
+
return sb.toString();
}
-
-
/**
*
* Reconstructs the URL the client used to make the request,
@@ -276,9 +290,7 @@
*
* @return a <code>StringBuffer</code> object containing
* the reconstructed URL
- *
*/
-
public static StringBuffer getRequestURL (HttpServletRequest req) {
StringBuffer url = new StringBuffer ();
String scheme = req.getScheme ();
@@ -301,6 +313,7 @@
//if (pathInfo != null)
// url.append (pathInfo);
url.append(urlPath);
+
return url;
}
}
Modified: trunk/java/javax/servlet/http/LocalStrings.properties
===================================================================
--- trunk/java/javax/servlet/http/LocalStrings.properties 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/LocalStrings.properties 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,32 +1,65 @@
-##
-## 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.
-##
+#
+# 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.
+#
-##
-## $Rev: 600957 $ $Date: 2007-12-04 15:01:31 +0100 (Tue, 04 Dec 2007) $
-##
-
# Default localized string information
# Localized for Locale en_US
err.cookie_name_is_token=Cookie name \"{0}\" is a reserved token
-err.io.negativelength=Negative Length given in write method
+err.io.negativelength=Negative length given in write method
err.io.short_read=Short Read
+err.ise.getWriter=Illegal to call getWriter() after getOutputStream() has been called
+err.ise.getOutputStream=Illegal to call getOutputStream() after getWriter() has been called
http.method_not_implemented=Method {0} is not defined in RFC 2068 and is not supported by the Servlet API
Modified: trunk/java/javax/servlet/http/LocalStrings_es.properties
===================================================================
--- trunk/java/javax/servlet/http/LocalStrings_es.properties 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/LocalStrings_es.properties 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,26 +1,59 @@
-##
-## 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.
-##
+#
+# 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.
+#
-##
-## $Rev: 600957 $ $Date: 2007-12-04 15:01:31 +0100 (Tue, 04 Dec 2007) $
-##
-
+# $Id: LocalStrings_es.properties,v 1.1.1.1 2003/01/27 16:07:47 ja120114 Exp $
+#
# Default localized string information
# Localized para Locale es_ES
Modified: trunk/java/javax/servlet/http/LocalStrings_fr.properties
===================================================================
--- trunk/java/javax/servlet/http/LocalStrings_fr.properties 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/LocalStrings_fr.properties 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,26 +1,57 @@
-##
-## 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.
-##
+#
+# 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.
+#
-##
-## $Rev: 600957 $ $Date: 2007-12-04 15:01:31 +0100 (Tue, 04 Dec 2007) $
-##
-
# Default localized string information
# Localized for Locale fr_FR
Modified: trunk/java/javax/servlet/http/LocalStrings_ja.properties
===================================================================
--- trunk/java/javax/servlet/http/LocalStrings_ja.properties 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/javax/servlet/http/LocalStrings_ja.properties 2009-04-02 23:28:07 UTC (rev 982)
@@ -1,26 +1,57 @@
-##
-## 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.
-##
+#
+# 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.
+#
-##
-## $Rev: 600957 $ $Date: 2007-12-04 15:01:31 +0100 (Tue, 04 Dec 2007) $
-##
-
# Default localized string information
# Localized for Locale ja_JP
Added: trunk/java/javax/servlet/http/package.html
===================================================================
--- trunk/java/javax/servlet/http/package.html (rev 0)
+++ trunk/java/javax/servlet/http/package.html 2009-04-02 23:28:07 UTC (rev 982)
@@ -0,0 +1,69 @@
+<!--
+ 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.
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<HTML>
+<HEAD>
+
+
+</HEAD>
+<BODY BGCOLOR="white">
+
+The javax.servlet.http package contains a number of classes and interfaces
+that describe and define the contracts between a servlet class
+running under the HTTP protocol and the runtime environment provided
+for an instance of such a class by a conforming servlet container.
+
+
+</BODY>
+</HTML>
Added: trunk/java/javax/servlet/package.html
===================================================================
--- trunk/java/javax/servlet/package.html (rev 0)
+++ trunk/java/javax/servlet/package.html 2009-04-02 23:28:07 UTC (rev 982)
@@ -0,0 +1,69 @@
+<!--
+ 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.
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<HTML>
+<HEAD>
+
+
+</HEAD>
+<BODY BGCOLOR="white">
+
+The javax.servlet package contains a number of classes and interfaces that
+describe and define the contracts between a servlet class and the
+runtime environment provided for an instance of such a class by a
+conforming servlet container.
+
+
+</BODY>
+</HTML>
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -69,6 +69,7 @@
import javax.servlet.FilterChain;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletRequestAttributeEvent;
@@ -2433,8 +2434,11 @@
if ( (session != null) && (getContext() != null)
&& getContext().getCookies()
&& !(isRequestedSessionIdFromCookie() && (session.getIdInternal().equals(getRequestedSessionId()))) ) {
- Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME,
- session.getIdInternal());
+ String cookieName = context.getSessionCookie().getName();
+ if (cookieName == null) {
+ cookieName = Globals.SESSION_COOKIE_NAME;
+ }
+ Cookie cookie = new Cookie(cookieName, session.getIdInternal());
configureSessionCookie(cookie);
response.addCookieInternal(cookie);
}
@@ -2454,7 +2458,7 @@
* @param cookie The JSESSIONID cookie to be configured
*/
protected void configureSessionCookie(Cookie cookie) {
- cookie.setMaxAge(-1);
+ cookie.setMaxAge(context.getSessionCookie().getMaxAge());
if (context.getSessionCookie().getPath() != null) {
cookie.setPath(context.getSessionCookie().getPath());
} else {
@@ -2821,6 +2825,22 @@
return asyncContext;
}
+ public boolean login(HttpServletResponse response) throws IOException,
+ ServletException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void login(String username, String password) throws ServletException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void logout() throws ServletException {
+ // TODO Auto-generated method stub
+
+ }
+
public DispatcherType getDispatcherType() {
if (dispatcherType == null) {
return DispatcherType.REQUEST;
@@ -2870,10 +2890,14 @@
resume();
}
+ public void dispatch(String path) {
+ this.path = path;
+ resume();
+ }
+
public void dispatch(ServletContext servletContext, String path) {
this.servletContext = servletContext;
this.path = path;
- // FIXME: No idea what the servletContext means right now
resume();
}
@@ -2885,7 +2909,7 @@
return response;
}
- public boolean hasOriginalRequestAndResonse() {
+ public boolean hasOriginalRequestAndResponse() {
return (request == getRequestFacade() && response == getResponseFacade());
}
Modified: trunk/java/org/apache/catalina/connector/RequestFacade.java
===================================================================
--- trunk/java/org/apache/catalina/connector/RequestFacade.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/connector/RequestFacade.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -31,19 +31,19 @@
import javax.servlet.DispatcherType;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.catalina.Globals;
+import org.apache.catalina.security.SecurityUtil;
import org.apache.catalina.util.StringManager;
-
-import org.apache.catalina.security.SecurityUtil;
-
/**
* Facade class that wraps a Coyote request object.
* All methods are delegated to the wrapped request.
@@ -1050,4 +1050,35 @@
return request.getResponse().getResponse();
}
+
+ public boolean login(HttpServletResponse response) throws IOException,
+ ServletException {
+ if (request == null) {
+ throw new IllegalStateException(
+ sm.getString("requestFacade.nullRequest"));
+ }
+
+ return request.login(response);
+ }
+
+
+ public void login(String username, String password) throws ServletException {
+ if (request == null) {
+ throw new IllegalStateException(
+ sm.getString("requestFacade.nullRequest"));
+ }
+
+ request.login(username, password);
+ }
+
+
+ public void logout() throws ServletException {
+ if (request == null) {
+ throw new IllegalStateException(
+ sm.getString("requestFacade.nullRequest"));
+ }
+
+ request.logout();
+ }
+
}
Modified: trunk/java/org/apache/catalina/connector/Response.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Response.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/connector/Response.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -866,22 +866,6 @@
}
- public void disable() {
- // TODO Auto-generated method stub
-
- }
-
- public void enable() {
- // TODO Auto-generated method stub
-
- }
-
- public boolean isDisabled() {
- // TODO Auto-generated method stub
- return false;
- }
-
-
// --------------------------------------------------- HttpResponse Methods
@@ -911,7 +895,7 @@
* Return an array of all the header names set for this response, or
* a zero-length array if no headers have been set.
*/
- public String[] getHeaderNames() {
+ public Iterable<String> getHeaderNames() {
MimeHeaders headers = coyoteResponse.getMimeHeaders();
int n = headers.size();
@@ -919,6 +903,24 @@
for (int i = 0; i < n; i++) {
result[i] = headers.getName(i).toString();
}
+ // FIXME
+ return null;
+
+ }
+
+
+ /**
+ * Return an array of all the header names set for this response, or
+ * a zero-length array if no headers have been set.
+ */
+ public String[] getHeaderNamesArray() {
+
+ MimeHeaders headers = coyoteResponse.getMimeHeaders();
+ int n = headers.size();
+ String[] result = new String[n];
+ for (int i = 0; i < n; i++) {
+ result[i] = headers.getName(i).toString();
+ }
return result;
}
@@ -931,6 +933,19 @@
*
* @param name Header name to look up
*/
+ public Iterable<String> getHeaders(String name) {
+ // FIXME
+ return null;
+ }
+
+
+ /**
+ * Return an array of all the header values associated with the
+ * specified header name, or an zero-length array if there are no such
+ * header values.
+ *
+ * @param name Header name to look up
+ */
public String[] getHeaderValues(String name) {
Enumeration enumeration = coyoteResponse.getMimeHeaders().values(name);
Modified: trunk/java/org/apache/catalina/connector/ResponseFacade.java
===================================================================
--- trunk/java/org/apache/catalina/connector/ResponseFacade.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/connector/ResponseFacade.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -31,8 +31,8 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.Globals;
+import org.apache.catalina.security.SecurityUtil;
import org.apache.catalina.util.StringManager;
-import org.apache.catalina.security.SecurityUtil;
/**
* Facade class that wraps a Coyote response object.
@@ -553,33 +553,43 @@
}
- public void disable() {
+ public String getHeader(String name) {
if (response == null) {
throw new IllegalStateException(
sm.getString("responseFacade.nullResponse"));
}
- response.disable();
+ return response.getHeader(name);
}
- public void enable() {
+ public Iterable<String> getHeaderNames() {
if (response == null) {
throw new IllegalStateException(
sm.getString("responseFacade.nullResponse"));
}
- response.enable();
+ return response.getHeaderNames();
}
- public boolean isDisabled() {
+ public Iterable<String> getHeaders(String name) {
if (response == null) {
throw new IllegalStateException(
sm.getString("responseFacade.nullResponse"));
}
- return response.isDisabled();
+ return response.getHeaders(name);
}
+
+ public int getStatus() {
+ if (response == null) {
+ throw new IllegalStateException(
+ sm.getString("responseFacade.nullResponse"));
+ }
+
+ return response.getStatus();
+ }
+
}
Modified: trunk/java/org/apache/catalina/core/ApplicationContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -34,12 +34,14 @@
import javax.naming.Binding;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;
+import javax.servlet.Filter;
import javax.servlet.FilterRegistration;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextAttributeEvent;
import javax.servlet.ServletContextAttributeListener;
+import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;
@@ -860,7 +862,7 @@
* used by this context has the attribute <code>secure</code> set to
* <code>true</code>.
*/
- public EnumSet<SessionTrackingMode> getDefaultSessionTrackingModes() {
+ public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
return context.getDefaultSessionTrackingModes();
}
@@ -868,7 +870,7 @@
* Return the supplied value if one was previously set, else return the
* defaults.
*/
- public EnumSet<SessionTrackingMode> getEffectiveSessionTrackingModes() {
+ public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
return context.getSessionTrackingModes();
}
@@ -877,7 +879,7 @@
return context.getSessionCookie();
}
-
+/* FIXME gone ?
public void setSessionCookieConfig(SessionCookieConfig sessionCookieConfig) {
SessionCookie sessionCookie = new SessionCookie();
sessionCookie.setComment(sessionCookieConfig.getComment());
@@ -885,7 +887,7 @@
sessionCookie.setHttpOnly(sessionCookieConfig.isHttpOnly());
sessionCookie.setSecure(sessionCookieConfig.isSecure());
context.setSessionCookie(sessionCookie);
- }
+ }*/
public ServletRegistration addServlet(String servletName,
@@ -895,6 +897,39 @@
}
+ public FilterRegistration addFilter(String filterName, Filter filter) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public FilterRegistration addFilter(String filterName,
+ Class<? extends Filter> filterClass) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public ServletRegistration addServlet(String servletName, Servlet servlet) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public <T extends Filter> T createFilter(Class<T> c)
+ throws ServletException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public <T extends Servlet> T createServlet(Class<T> c)
+ throws ServletException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
public boolean setInitParameter(String name, String value) {
context.addParameter(name, value);
// FIXME: return value ?
@@ -909,7 +944,7 @@
* If an unsupported tracking mode is
* requested
*/
- public void setSessionTrackingModes(EnumSet<SessionTrackingMode> sessionTrackingModes) {
+ public void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes) {
if (context.getAvailable()) {
throw new IllegalStateException(
Modified: trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContextFacade.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/core/ApplicationContextFacade.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -32,6 +32,7 @@
import java.util.HashMap;
import java.util.Set;
+import javax.servlet.Filter;
import javax.servlet.FilterRegistration;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
@@ -383,6 +384,27 @@
}
+ public FilterRegistration addFilter(String filterName, Filter filter) {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (FilterRegistration) doPrivileged("addFilter",
+ new Object[]{filterName, filter});
+ } else {
+ return context.addFilter(filterName, filter);
+ }
+ }
+
+
+ public FilterRegistration addFilter(String filterName,
+ Class<? extends Filter> filterClass) {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (FilterRegistration) doPrivileged("addFilter",
+ new Object[]{filterName, filterClass});
+ } else {
+ return context.addFilter(filterName, filterClass);
+ }
+ }
+
+
public ServletRegistration addServlet(String servletName, String className)
throws IllegalArgumentException, IllegalStateException {
if (SecurityUtil.isPackageProtectionEnabled()) {
@@ -406,6 +428,36 @@
}
+ public ServletRegistration addServlet(String servletName, Servlet servlet) {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (ServletRegistration) doPrivileged("addServlet",
+ new Object[]{servletName, servlet});
+ } else {
+ return context.addServlet(servletName, servlet);
+ }
+ }
+
+
+ public <T extends Filter> T createFilter(Class<T> c)
+ throws ServletException {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (T) doPrivileged("createFilter", new Object[]{c});
+ } else {
+ return context.createFilter(c);
+ }
+ }
+
+
+ public <T extends Servlet> T createServlet(Class<T> c)
+ throws ServletException {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (T) doPrivileged("createServlet", new Object[]{c});
+ } else {
+ return context.createServlet(c);
+ }
+ }
+
+
public boolean setInitParameter(String name, String value) {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (Boolean) doPrivileged("setInitParameter",
@@ -436,7 +488,7 @@
}
- public EnumSet<SessionTrackingMode> getDefaultSessionTrackingModes() {
+ public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (EnumSet<SessionTrackingMode>)
doPrivileged("getDefaultSessionTrackingModes", null);
@@ -446,7 +498,7 @@
}
- public EnumSet<SessionTrackingMode> getEffectiveSessionTrackingModes() {
+ public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (EnumSet<SessionTrackingMode>)
doPrivileged("getEffectiveSessionTrackingModes", null);
@@ -465,7 +517,7 @@
}
}
-
+/*
public void setSessionCookieConfig(SessionCookieConfig sessionCookieConfig) {
if (SecurityUtil.isPackageProtectionEnabled()) {
doPrivileged("setSessionCookieConfig",
@@ -473,11 +525,10 @@
} else {
context.setSessionCookieConfig(sessionCookieConfig);
}
- }
+ }*/
- public void setSessionTrackingModes(
- EnumSet<SessionTrackingMode> sessionTrackingModes) {
+ public void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes) {
if (SecurityUtil.isPackageProtectionEnabled()) {
doPrivileged("setSessionTrackingModes",
new Object[]{sessionTrackingModes});
Modified: trunk/java/org/apache/catalina/core/ClassLoadingAnnotationScanner.java
===================================================================
--- trunk/java/org/apache/catalina/core/ClassLoadingAnnotationScanner.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/core/ClassLoadingAnnotationScanner.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -21,11 +21,11 @@
import java.io.File;
import java.util.jar.JarEntry;
-import javax.servlet.http.annotation.FilterMapping;
-import javax.servlet.http.annotation.InitParam;
-import javax.servlet.http.annotation.Servlet;
-import javax.servlet.http.annotation.ServletContextListener;
-import javax.servlet.http.annotation.ServletFilter;
+import javax.servlet.annotation.HandlesTypes;
+import javax.servlet.annotation.WebFilter;
+import javax.servlet.annotation.WebInitParam;
+import javax.servlet.annotation.WebListener;
+import javax.servlet.annotation.WebServlet;
import org.apache.catalina.Context;
@@ -39,11 +39,11 @@
// Load the class using the classloader, and see if it implements one of the web annotations
try {
Class<?> clazz = context.getLoader().getClassLoader().loadClass(className);
- if (clazz.isAnnotationPresent(InitParam.class)
- || clazz.isAnnotationPresent(ServletFilter.class)
- || clazz.isAnnotationPresent(FilterMapping.class)
- || clazz.isAnnotationPresent(Servlet.class)
- || clazz.isAnnotationPresent(ServletContextListener.class)) {
+ if (clazz.isAnnotationPresent(HandlesTypes.class)
+ || clazz.isAnnotationPresent(WebFilter.class)
+ || clazz.isAnnotationPresent(WebInitParam.class)
+ || clazz.isAnnotationPresent(WebListener.class)
+ || clazz.isAnnotationPresent(WebServlet.class)) {
return clazz;
}
} catch (Throwable t) {
Modified: trunk/java/org/apache/catalina/core/DummyRequest.java
===================================================================
--- trunk/java/org/apache/catalina/core/DummyRequest.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/core/DummyRequest.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -36,11 +36,13 @@
import javax.servlet.FilterChain;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.catalina.Context;
@@ -282,6 +284,10 @@
ServletResponse servletResponse) throws IllegalStateException { return null; }
public DispatcherType getDispatcherType() { return null; }
public ServletResponse getServletResponse() { return null; }
+ public boolean login(HttpServletResponse response) throws IOException,
+ ServletException { return false; }
+ public void login(String username, String password) throws ServletException {}
+ public void logout() throws ServletException {}
}
Modified: trunk/java/org/apache/catalina/core/DummyResponse.java
===================================================================
--- trunk/java/org/apache/catalina/core/DummyResponse.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/core/DummyResponse.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -97,7 +97,7 @@
public Cookie[] getCookies() { return null; }
public String getHeader(String name) { return null; }
- public String[] getHeaderNames() { return null; }
+ public Iterable<String> getHeaderNames() { return null; }
public String[] getHeaderValues(String name) { return null; }
public String getMessage() { return null; }
public int getStatus() { return -1; }
@@ -123,6 +123,7 @@
public void disable() {}
public void enable() {}
public boolean isDisabled() { return false; }
+ public Iterable<String> getHeaders(String name) { return null; }
}
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -33,6 +33,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
@@ -292,14 +293,14 @@
* Session tracking modes.
*/
// FIXME: see about SSL tracking mode
- private EnumSet<SessionTrackingMode> defaultSessionTrackingModes =
+ private Set<SessionTrackingMode> defaultSessionTrackingModes =
EnumSet.of(SessionTrackingMode.URL, SessionTrackingMode.COOKIE /*, SessionTrackingMode.SSL*/);
/**
* Session tracking modes.
*/
- private EnumSet<SessionTrackingMode> sessionTrackingModes = defaultSessionTrackingModes;
+ private Set<SessionTrackingMode> sessionTrackingModes = defaultSessionTrackingModes;
/**
@@ -1732,18 +1733,18 @@
}
- public EnumSet<SessionTrackingMode> getDefaultSessionTrackingModes() {
+ public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
return defaultSessionTrackingModes;
}
- public EnumSet<SessionTrackingMode> getSessionTrackingModes() {
+ public Set<SessionTrackingMode> getSessionTrackingModes() {
return sessionTrackingModes;
}
public void setSessionTrackingModes(
- EnumSet<SessionTrackingMode> sessionTrackingModes) {
+ Set<SessionTrackingMode> sessionTrackingModes) {
this.sessionTrackingModes = sessionTrackingModes;
}
Modified: trunk/java/org/apache/catalina/core/StandardFilterFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardFilterFacade.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/core/StandardFilterFacade.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -85,7 +85,7 @@
// --------------------------------------------- FilterRegistration Methods
- public void addMappingForServletNames(EnumSet<DispatcherType> dispatcherTypes,
+ public boolean addMappingForServletNames(EnumSet<DispatcherType> dispatcherTypes,
boolean isMatchAfter, String... servletNames) {
if (context.isInitialized()) {
throw new IllegalStateException(sm.getString("filterRegistration.addFilterMapping.ise", context.getPath()));
@@ -103,10 +103,11 @@
} else {
context.addFilterMapBefore(filterMap);
}
+ return true;
}
- public void addMappingForUrlPatterns(
+ public boolean addMappingForUrlPatterns(
EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
String... urlPatterns) {
if (context.isInitialized()) {
@@ -125,19 +126,20 @@
} else {
context.addFilterMapBefore(filterMap);
}
+ return true;
}
- public void setAsyncSupported(boolean asyncSupported) {
+ public boolean setAsyncSupported(boolean asyncSupported) {
filterDef.setAsyncSupported(asyncSupported);
context.addFilterDef(filterDef);
+ return true;
}
public boolean setDescription(String description) {
filterDef.setDescription(description);
context.addFilterDef(filterDef);
- // FIXME: return value ???
return true;
}
@@ -145,17 +147,17 @@
public boolean setInitParameter(String name, String value) {
filterDef.addInitParameter(name, value);
context.addFilterDef(filterDef);
- // FIXME: return value ???
return true;
}
- public void setInitParameters(Map<String, String> initParameters) {
+ public boolean setInitParameters(Map<String, String> initParameters) {
Iterator<String> parameterNames = initParameters.keySet().iterator();
while (parameterNames.hasNext()) {
String parameterName = parameterNames.next();
filterDef.addInitParameter(parameterName, initParameters.get(parameterName));
}
+ return true;
}
Modified: trunk/java/org/apache/catalina/core/StandardWrapperFacade.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapperFacade.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/core/StandardWrapperFacade.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -106,48 +106,51 @@
}
- public void addMapping(String... urlPatterns) {
+ public boolean addMapping(String... urlPatterns) {
if (((Context) wrapper.getParent()).isInitialized()) {
throw new IllegalStateException(sm.getString
("servletRegistration.addServletMapping.ise", ((Context) wrapper.getParent()).getPath()));
}
- if (urlPatterns == null) {
- return;
+ if (urlPatterns != null) {
+ for (int i = 0; i < urlPatterns.length; i++) {
+ ((Context) wrapper.getParent()).addServletMapping(urlPatterns[i], wrapper.getName());
+ }
}
- for (int i = 0; i < urlPatterns.length; i++) {
- ((Context) wrapper.getParent()).addServletMapping(urlPatterns[i], wrapper.getName());
- }
+ return true;
}
- public void setAsyncSupported(boolean asyncSupported) {
+ public boolean setAsyncSupported(boolean asyncSupported) {
wrapper.setAsyncSupported(asyncSupported);
+ return true;
}
- public void setDescription(String description) {
+ public boolean setDescription(String description) {
wrapper.setDescription(description);
+ return true;
}
public boolean setInitParameter(String name, String value) {
wrapper.addInitParameter(name, value);
- // FIXME: return value
return true;
}
- public void setInitParameters(Map<String, String> initParameters) {
+ public boolean setInitParameters(Map<String, String> initParameters) {
Iterator<String> parameterNames = initParameters.keySet().iterator();
while (parameterNames.hasNext()) {
String parameterName = parameterNames.next();
wrapper.addInitParameter(parameterName, initParameters.get(parameterName));
}
+ return true;
}
- public void setLoadOnStartup(int loadOnStartup) {
+ public boolean setLoadOnStartup(int loadOnStartup) {
wrapper.setLoadOnStartup(loadOnStartup);
+ return true;
}
Modified: trunk/java/org/apache/catalina/core/StandardWrapperValve.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -461,6 +461,10 @@
// and invoke the Servlet
// FIXME: Also check how cross context works, but it is be ok to do from here
// (or do another distpatcher object similar to the current request dispatcher)
+ if (asyncContext.getServletContext() != null) {
+ // Cross context
+ // FIXME
+ }
} else {
// Create the filter chain and reinvoke the same Servlet
// FIXME
Modified: trunk/java/org/apache/catalina/deploy/SessionCookie.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/SessionCookie.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/deploy/SessionCookie.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -28,6 +28,8 @@
protected String comment = null;
protected boolean httpOnly = false;
protected boolean secure = false;
+ protected int maxAge = -1;
+ protected String name = null;
public SessionCookie() {
}
@@ -71,4 +73,21 @@
public void setSecure(boolean secure) {
this.secure = secure;
}
+
+ public int getMaxAge() {
+ return maxAge;
+ }
+
+ public void setMaxAge(int maxAge) {
+ this.maxAge = maxAge;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
}
Modified: trunk/java/org/apache/catalina/startup/ContextConfig.java
===================================================================
--- trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -29,13 +29,14 @@
import java.util.Map;
import java.util.Properties;
+import javax.jws.soap.InitParam;
import javax.servlet.DispatcherType;
import javax.servlet.ServletContext;
-import javax.servlet.http.annotation.FilterMapping;
-import javax.servlet.http.annotation.InitParam;
-import javax.servlet.http.annotation.Servlet;
-import javax.servlet.http.annotation.ServletContextListener;
-import javax.servlet.http.annotation.ServletFilter;
+import javax.servlet.annotation.HandlesTypes;
+import javax.servlet.annotation.WebFilter;
+import javax.servlet.annotation.WebInitParam;
+import javax.servlet.annotation.WebListener;
+import javax.servlet.annotation.WebServlet;
import org.apache.catalina.Authenticator;
import org.apache.catalina.Container;
@@ -305,73 +306,70 @@
Iterator<Class<?>> annotatedClasses = (new ClassLoadingAnnotationScanner()).scan(context).iterator();
while (annotatedClasses.hasNext()) {
Class<?> clazz = annotatedClasses.next();
- if (clazz.isAnnotationPresent(InitParam.class)) {
- InitParam annotation = clazz.getAnnotation(InitParam.class);
+ if (clazz.isAnnotationPresent(WebInitParam.class)) {
+ WebInitParam annotation = clazz.getAnnotation(WebInitParam.class);
// Add init param
context.addParameter(annotation.name(), annotation.value());
}
- String filterName = null;
- if (clazz.isAnnotationPresent(ServletFilter.class)) {
- ServletFilter annotation = clazz.getAnnotation(ServletFilter.class);
+ if (clazz.isAnnotationPresent(HandlesTypes.class)) {
+ HandlesTypes annotation = clazz.getAnnotation(HandlesTypes.class);
+ // FIXME: Ok, this is complex ....
+ }
+ if (clazz.isAnnotationPresent(WebFilter.class)) {
+ WebFilter annotation = clazz.getAnnotation(WebFilter.class);
// Add servlet filter
- filterName = annotation.filterName();
+ String filterName = annotation.filterName();
FilterDef filterDef = new FilterDef();
filterDef.setFilterName(annotation.filterName());
filterDef.setFilterClass(clazz.getName());
- InitParam[] params = annotation.initParams();
+ WebInitParam[] params = annotation.initParams();
for (int i = 0; i < params.length; i++) {
filterDef.addInitParameter(params[i].name(), params[i].value());
}
context.addFilterDef(filterDef);
- }
- if (clazz.isAnnotationPresent(FilterMapping.class)) {
- FilterMapping annotation = clazz.getAnnotation(FilterMapping.class);
- // Add filter mapping
- if (filterName != null) {
- FilterMap filterMap = new FilterMap();
- filterMap.setFilterName(filterName);
- String[] urlPatterns = annotation.urlPattern();
- if (urlPatterns != null) {
- for (int i = 0; i < urlPatterns.length; i++) {
- filterMap.addURLPattern(urlPatterns[i]);
- }
+ FilterMap filterMap = new FilterMap();
+ filterMap.setFilterName(filterName);
+ String[] urlPatterns = annotation.urlPatterns();
+ if (urlPatterns != null) {
+ for (int i = 0; i < urlPatterns.length; i++) {
+ filterMap.addURLPattern(urlPatterns[i]);
}
- String[] servletNames = annotation.servletNames();
- if (servletNames != null) {
- for (int i = 0; i < servletNames.length; i++) {
- filterMap.addServletName(servletNames[i]);
- }
+ }
+ String[] servletNames = annotation.servletNames();
+ if (servletNames != null) {
+ for (int i = 0; i < servletNames.length; i++) {
+ filterMap.addServletName(servletNames[i]);
}
- DispatcherType[] dispatcherTypes = annotation.dispatcherTypes();
- if (dispatcherTypes != null) {
- for (int i = 0; i < dispatcherTypes.length; i++) {
- filterMap.setDispatcher(dispatcherTypes[i].toString());
- }
+ }
+ DispatcherType[] dispatcherTypes = annotation.dispatcherTypes();
+ if (dispatcherTypes != null) {
+ for (int i = 0; i < dispatcherTypes.length; i++) {
+ filterMap.setDispatcher(dispatcherTypes[i].toString());
}
- context.addFilterMap(filterMap);
}
+ context.addFilterMap(filterMap);
}
- if (clazz.isAnnotationPresent(Servlet.class)) {
- Servlet annotation = clazz.getAnnotation(Servlet.class);
+ if (clazz.isAnnotationPresent(WebServlet.class)) {
+ WebServlet annotation = clazz.getAnnotation(WebServlet.class);
// Add servlet
Wrapper wrapper = context.createWrapper();
wrapper.setName(annotation.name());
wrapper.setServletClass(clazz.getName());
wrapper.setLoadOnStartup(annotation.loadOnStartup());
- InitParam[] params = annotation.initParams();
+ WebInitParam[] params = annotation.initParams();
for (int i = 0; i < params.length; i++) {
wrapper.addInitParameter(params[i].name(), params[i].value());
}
context.addChild(wrapper);
- String[] urlMappings = annotation.urlMappings();
- if (urlMappings != null) {
- for (int i = 0; i < urlMappings.length; i++) {
- context.addServletMapping(urlMappings[i], annotation.name());
+ String[] urlPatterns = annotation.urlPatterns();
+ if (urlPatterns != null) {
+ for (int i = 0; i < urlPatterns.length; i++) {
+ context.addServletMapping(urlPatterns[i], annotation.name());
}
}
}
- if (clazz.isAnnotationPresent(ServletContextListener.class)) {
- ServletContextListener annotation = clazz.getAnnotation(ServletContextListener.class);
+ if (clazz.isAnnotationPresent(WebListener.class)) {
+ WebListener annotation = clazz.getAnnotation(WebListener.class);
// Add listener
context.addApplicationListener(clazz.getName());
}
Modified: trunk/java/org/apache/catalina/valves/RequestDumperValve.java
===================================================================
--- trunk/java/org/apache/catalina/valves/RequestDumperValve.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/catalina/valves/RequestDumperValve.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -161,7 +161,7 @@
rcookies[i].getValue() + "; domain=" +
rcookies[i].getDomain() + "; path=" + rcookies[i].getPath());
}
- String rhnames[] = response.getHeaderNames();
+ String rhnames[] = response.getHeaderNamesArray();
for (int i = 0; i < rhnames.length; i++) {
String rhvalues[] = response.getHeaderValues(rhnames[i]);
for (int j = 0; j < rhvalues.length; j++)
Modified: trunk/java/org/apache/jasper/servlet/JspCServletContext.java
===================================================================
--- trunk/java/org/apache/jasper/servlet/JspCServletContext.java 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/java/org/apache/jasper/servlet/JspCServletContext.java 2009-04-02 23:28:07 UTC (rev 982)
@@ -30,6 +30,7 @@
import java.util.Set;
import java.util.Vector;
+import javax.servlet.Filter;
import javax.servlet.FilterRegistration;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
@@ -502,4 +503,37 @@
}
+ public FilterRegistration addFilter(String filterName, Filter filter) {
+ return null;
+ }
+
+
+ public FilterRegistration addFilter(String filterName,
+ Class<? extends Filter> filterClass) {
+ return null;
+ }
+
+
+ public ServletRegistration addServlet(String servletName, Servlet servlet) {
+ return null;
+ }
+
+
+ public <T extends Filter> T createFilter(Class<T> c)
+ throws ServletException {
+ return null;
+ }
+
+
+ public <T extends Servlet> T createServlet(Class<T> c)
+ throws ServletException {
+ return null;
+ }
+
+
+ public void setSessionTrackingModes(
+ Set<SessionTrackingMode> sessionTrackingModes) {
+ }
+
+
}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-04-02 19:03:32 UTC (rev 981)
+++ trunk/webapps/docs/changelog.xml 2009-04-02 23:28:07 UTC (rev 982)
@@ -61,7 +61,7 @@
Add support for non IO events in all connectors. (remm)
</update>
<fix>
- Fix handling of timeout values <= 0 with the poller refactoring. (remm)
+ Fix handling of timeout values <= 0 with the poller refactoring. (remm)
</fix>
</changelog>
</subsection>
15 years, 1 month
JBossWeb SVN: r981 - in trunk: java/org/apache/catalina/connector and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-02 15:03:32 -0400 (Thu, 02 Apr 2009)
New Revision: 981
Modified:
trunk/NOTICE
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/core/StandardWrapperValve.java
Log:
- Update my notices.
Modified: trunk/NOTICE
===================================================================
--- trunk/NOTICE 2009-04-02 16:47:16 UTC (rev 980)
+++ trunk/NOTICE 2009-04-02 19:03:32 UTC (rev 981)
@@ -1,9 +1,12 @@
JBoss Web
-Copyright 2006-2008 Red Hat Middleware, LLC. All rights reserved.
+Copyright 2006-2009 Red Hat Middleware, LLC. All rights reserved.
Apache Tomcat
-Copyright 1999-2008 The Apache Software Foundation
+Copyright 1999-2009 The Apache Software Foundation
+Servlet API 3.0
+Copyright 1997-2009 Sun Microsystems, Inc
+
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-04-02 16:47:16 UTC (rev 980)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-04-02 19:03:32 UTC (rev 981)
@@ -18,6 +18,29 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 1999-2009 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
Modified: trunk/java/org/apache/catalina/core/StandardWrapperValve.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-04-02 16:47:16 UTC (rev 980)
+++ trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-04-02 19:03:32 UTC (rev 981)
@@ -18,6 +18,29 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 1999-2009 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
15 years, 1 month
JBossWeb SVN: r980 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-04-02 12:47:16 -0400 (Thu, 02 Apr 2009)
New Revision: 980
Modified:
trunk/java/org/apache/catalina/servlets/WebdavServlet.java
trunk/webapps/docs/changelog.xml
Log:
- Port patch.
Modified: trunk/java/org/apache/catalina/servlets/WebdavServlet.java
===================================================================
--- trunk/java/org/apache/catalina/servlets/WebdavServlet.java 2009-04-02 16:17:25 UTC (rev 979)
+++ trunk/java/org/apache/catalina/servlets/WebdavServlet.java 2009-04-02 16:47:16 UTC (rev 980)
@@ -734,7 +734,7 @@
return;
}
- if (req.getInputStream().available() > 0) {
+ if (req.getContentLength() > 0) {
DocumentBuilder documentBuilder = getDocumentBuilder();
try {
// Document document =
@@ -745,7 +745,7 @@
} catch(SAXException saxe) {
// Parse error - assume invalid content
- resp.sendError(WebdavStatus.SC_BAD_REQUEST);
+ resp.sendError(WebdavStatus.SC_UNSUPPORTED_MEDIA_TYPE);
return;
}
}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-04-02 16:17:25 UTC (rev 979)
+++ trunk/webapps/docs/changelog.xml 2009-04-02 16:47:16 UTC (rev 980)
@@ -47,6 +47,9 @@
<update>
Move InstanceManager and PeriodicEventListener to org.apache.tomcat. (markt)
</update>
+ <fix>
+ Wrong MKCOL status code for errors. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
15 years, 1 month