From: markt Date: Tue, 6 Jan 2009 15:15:32 +0000 (+0000) Subject: First attempt at updating the javax.servlet package for the 3.0 spec X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=4289c3ef172fd5774fc9244b3f0fe27bc0060c4d;p=tomcat7.0 First attempt at updating the javax.servlet package for the 3.0 spec It compiles and runs but 99.9% of the implementation is stubbed out and marked with TODO SERVLET3 git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@731967 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/TOMCAT-7-RELEASE-PLAN.txt b/TOMCAT-7-RELEASE-PLAN.txt index 7fe09c2a9..77edfd855 100644 --- a/TOMCAT-7-RELEASE-PLAN.txt +++ b/TOMCAT-7-RELEASE-PLAN.txt @@ -22,8 +22,10 @@ $Id: $ ===================================================== 1. Update trunk with new API from Servlet Spec 3.0 PR + - Done 2. Provide NOOP implementations with TODO SRV3 markers so it will build + - Done 3. Implement all the new Servlet 3 features diff --git a/build.properties.default b/build.properties.default index c6cf1e98d..156cd27d5 100644 --- a/build.properties.default +++ b/build.properties.default @@ -25,7 +25,7 @@ # ----------------------------------------------------------------------------- # ----- Vesion Control Flags ----- -version.major=6 +version.major=7 version.minor=0 version.build=0 version.patch=0 diff --git a/java/javax/servlet/AsyncContext.java b/java/javax/servlet/AsyncContext.java new file mode 100644 index 000000000..cf36c697c --- /dev/null +++ b/java/javax/servlet/AsyncContext.java @@ -0,0 +1,33 @@ +/* +* 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; + +/** + * @since 3.0 + * $Id$ + * TODO SERVLET3 + */ +public interface AsyncContext { + ServletRequest getRequest(); + ServletResponse getResponse(); + boolean hasOriginalRequestAndResponse(); + void forward(); + void forward(String path); + void forward(ServletContext context, String path); + void complete(); + void start(Runnable run); +} diff --git a/java/javax/servlet/AsyncEvent.java b/java/javax/servlet/AsyncEvent.java new file mode 100644 index 000000000..1d5d77e1f --- /dev/null +++ b/java/javax/servlet/AsyncEvent.java @@ -0,0 +1,40 @@ +/* +* 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; + +/** + * @since 3.0 + * $Id$ + * TODO SERVLET3 + */ +public class AsyncEvent { + private ServletRequest request; + private ServletResponse response; + + AsyncEvent(ServletRequest request, ServletResponse response) { + this.request = request; + this.response = response; + } + + public ServletRequest getRequest() { + return request; + } + + public ServletResponse getResponse() { + return response; + } +} diff --git a/java/javax/servlet/AsyncListener.java b/java/javax/servlet/AsyncListener.java new file mode 100644 index 000000000..20ac2ac1c --- /dev/null +++ b/java/javax/servlet/AsyncListener.java @@ -0,0 +1,29 @@ +/* +* 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; + +import java.io.IOException; + +/** + * @since 3.0 + * $Id$ + * TODO SERVLET3 + */ +public interface AsyncListener { + void onComplete(AsyncEvent event) throws IOException; + void onTimeout(AsyncEvent event) throws IOException; +} diff --git a/java/javax/servlet/DispatcherType.java b/java/javax/servlet/DispatcherType.java new file mode 100644 index 000000000..6abf4e8b0 --- /dev/null +++ b/java/javax/servlet/DispatcherType.java @@ -0,0 +1,29 @@ +/* +* 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; + +/** + * @since 3.0 + * $Id$ + * TODO SERVLET3 + */ +public enum DispatcherType { + FORWARD, + INCLUDE, + REQUEST, + ERROR +} diff --git a/java/javax/servlet/ServletContext.java b/java/javax/servlet/ServletContext.java index cb32eb857..cbaab95be 100644 --- a/java/javax/servlet/ServletContext.java +++ b/java/javax/servlet/ServletContext.java @@ -19,7 +19,9 @@ package javax.servlet; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; +import java.util.EnumSet; import java.util.Enumeration; +import java.util.Map; import java.util.Set; @@ -90,10 +92,10 @@ public interface ServletContext { /** * 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 * */ @@ -104,10 +106,10 @@ public interface ServletContext { /** * 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 * */ @@ -641,6 +643,87 @@ public interface ServletContext { */ public String getServletContextName(); + + /** + * + * @param servletName + * @param urlPatterns + * @since 3.0 + */ + public void addServletMapping(String servletName, String[] urlPatterns); + + /** + * + * @param filterName + * @param description + * @param className + * @param initParameters + * @param isAsyncSupported + * @since 3.0 + */ + public void addFilter(String filterName, String description, + String className, Map initParameters, + boolean isAsyncSupported); + + /** + * + * @param filterName + * @param dispatcherTypes + * @param isMatchAfter + * @param servletNames + * @since 3.0 + */ + public void addFilterMappingForServletNames(String filterName, + EnumSet dispatcherTypes, boolean isMatchAfter, + String... servletNames); + + /** + * + * @param filterName + * @param dispatcherTypes + * @param isMatchAfter + * @param urlPatterns + * @since 3.0 + */ + public void addFilterMappingForUrlPatterns(String filterName, + EnumSet dispatcherTypes, boolean isMatchAfter, + String... urlPatterns); + + /** + * + * @param sessionCookieConfig + * @since 3.0 + */ + public void setSessionCookieConfig(SessionCookieConfig sessionCookieConfig); + + /** + * + * @return + * @since 3.0 + */ + public SessionCookieConfig getSessionCookieConfig(); + + /** + * + * @param sessionTrackingModes + * @since 3.0 + */ + public void setSessionTrackingModes( + EnumSet sessionTrackingModes); + + /** + * + * @return + * @since 3.0 + */ + public EnumSet getDefaultSessionTrackingModes(); + + /** + * + * @return + * @since 3.0 + */ + public EnumSet getEffectiveSessionTrackingModes(); } diff --git a/java/javax/servlet/ServletRequest.java b/java/javax/servlet/ServletRequest.java index 39b359ff7..c090ae293 100644 --- a/java/javax/servlet/ServletRequest.java +++ b/java/javax/servlet/ServletRequest.java @@ -594,5 +594,76 @@ public interface ServletRequest { */ public int getLocalPort(); + /** + * + * @return + * @since 3.0 + */ + public ServletContext getServletContext(); + + /** + * + * @return + * @throws java.lang.IllegalStateException + * @since 3.0 + */ + public AsyncContext startAsync() throws java.lang.IllegalStateException; + + /** + * + * @param servletRequest + * @param servletResponse + * @return + * @throws java.lang.IllegalStateException + * @since 3.0 + */ + public AsyncContext startAsync(ServletRequest servletRequest, + ServletResponse servletResponse) + throws java.lang.IllegalStateException; + + /** + * + * @return + * @since 3.0 + */ + public boolean isAsyncStarted(); + + /** + * + * @return + * @since 3.0 + */ + public boolean isAsyncSupported(); + + /** + * + * @return + * @since 3.0 + */ + public AsyncContext getAsyncContext(); + + /** + * + * @param listener + * @since 3.0 + */ + public void addAsyncListener(AsyncListener listener); + + /** + * + * @param listener + * @param servletRequest + * @param servletResponse + * @since 3.0 + */ + public void addAsyncListener(AsyncListener listener, + ServletRequest servletRequest, ServletResponse servletResponse); + + /** + * + * @param timeout + * @since 3.0 + */ + public void setAsyncTimeout(long timeout); } diff --git a/java/javax/servlet/ServletRequestWrapper.java b/java/javax/servlet/ServletRequestWrapper.java index aa80a8f50..a863ee845 100644 --- a/java/javax/servlet/ServletRequestWrapper.java +++ b/java/javax/servlet/ServletRequestWrapper.java @@ -396,6 +396,116 @@ public class ServletRequestWrapper implements ServletRequest { public int getLocalPort(){ return this.request.getLocalPort(); } + + /** + * The default behavior of this method is to return + * getServletContext() on the wrapped request object. + * + * @return + * @since 3.0 + */ + public ServletContext getServletContext() { + return request.getServletContext(); + } + + /** + * The default behavior of this method is to return + * startAsync() on the wrapped request object. + * + * @return + * @throws java.lang.IllegalStateException + * @since 3.0 + */ + public AsyncContext startAsync() throws java.lang.IllegalStateException { + return request.startAsync(); + } + + /** + * The default behavior of this method is to return + * startAsync(ServletRequest, ServletResponse) on the wrapped request + * object. + * + * @param servletRequest + * @param servletResponse + * @return + * @throws java.lang.IllegalStateException + * @since 3.0 + */ + public AsyncContext startAsync(ServletRequest servletRequest, + ServletResponse servletResponse) + throws java.lang.IllegalStateException { + return request.startAsync(servletRequest, servletResponse); + } + + /** + * The default behavior of this method is to return + * isAsyncStarted() on the wrapped request object. + * + * @return + * @since 3.0 + */ + public boolean isAsyncStarted() { + return request.isAsyncStarted(); + } + + /** + * The default behavior of this method is to return + * isAsyncSupported() on the wrapped request object. + * + * @return + * @since 3.0 + */ + public boolean isAsyncSupported() { + return request.isAsyncSupported(); + } + /** + * The default behavior of this method is to return + * getAsyncContext() on the wrapped request object. + * + * @return + * @since 3.0 + */ + public AsyncContext getAsyncContext() { + return request.getAsyncContext(); + } + + /** + * The default behavior of this method is to call + * addAsyncListener(AsyncListener) on the wrapped request object. + * + * @param listener + * @since 3.0 + */ + public void addAsyncListener(AsyncListener listener) { + request.addAsyncListener(listener); + } + + /** + * The default behavior of this method is to call + * addAsyncListener(AsyncListener, ServletRequest, ServletResponse) on the + * wrapped request object. + * + * @param listener + * @param servletRequest + * @param servletResponse + * @since 3.0 + */ + public void addAsyncListener(AsyncListener listener, + ServletRequest servletRequest, ServletResponse servletResponse) { + addAsyncListener(listener, servletRequest, servletResponse); + } + + /** + * The default behavior of this method is to call + * startAsync() on the wrapped request object. + * + * @param timeout + * @since 3.0 + */ + public void setAsyncTimeout(long timeout) { + request.setAsyncTimeout(timeout); + } + } diff --git a/java/javax/servlet/SessionCookieConfig.java b/java/javax/servlet/SessionCookieConfig.java new file mode 100644 index 000000000..01c3c1f37 --- /dev/null +++ b/java/javax/servlet/SessionCookieConfig.java @@ -0,0 +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 + * + * 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; + +/** + * + * @since 3.0 + * $Id$ + * TODO SERVLET3 + */ +public class SessionCookieConfig { + private String domain; + private String path; + private String comment; + private boolean isHttpOnly; + private boolean isSecure; + + public SessionCookieConfig(String domain, String path, String comment, + boolean isHttpOnly, boolean isSecure) { + this.domain = domain; + this.path = path; + this.comment = comment; + this.isHttpOnly = isHttpOnly; + this.isSecure = isSecure; + } + + public java.lang.String getDomain() { + return domain; + } + + public java.lang.String getPath() { + return path; + } + + public java.lang.String getComment() { + return comment; + } + + public boolean isHttpOnly() { + return isHttpOnly; + } + + public boolean isSecure() { + return isSecure; + } +} diff --git a/java/javax/servlet/SessionTrackingMode.java b/java/javax/servlet/SessionTrackingMode.java new file mode 100644 index 000000000..e3b1ff6dd --- /dev/null +++ b/java/javax/servlet/SessionTrackingMode.java @@ -0,0 +1,28 @@ +/* +* 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; + +/** + * @since 3.0 + * $Id$ + * TODO SERVLET3 + */ +public enum SessionTrackingMode { + COOKIE, + URL, + SSL +} diff --git a/java/javax/servlet/annotation/InitParam.java b/java/javax/servlet/annotation/InitParam.java new file mode 100644 index 000000000..5460fe1b3 --- /dev/null +++ b/java/javax/servlet/annotation/InitParam.java @@ -0,0 +1,37 @@ +/* + * 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.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; + +/** + * @since 3.0 + * $Id$ + * TODO SERVLET3 + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface InitParam { + String name(); + String value(); + String description() default ""; +} diff --git a/java/javax/servlet/annotation/ServletFilter.java b/java/javax/servlet/annotation/ServletFilter.java new file mode 100644 index 000000000..82694f41a --- /dev/null +++ b/java/javax/servlet/annotation/ServletFilter.java @@ -0,0 +1,47 @@ +/* + * 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.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; + +import javax.servlet.DispatcherType; + +/** + * @since 3.0 + * $Id$ + * TODO SERVLET3 + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface ServletFilter { + String description() default ""; + String displayName() default ""; + InitParam[] initParams() default {}; + String filterName() default ""; + String icon() default ""; + String[] servletNames() default {}; + String[] value() default {}; + String[] urlPatterns() default {}; + DispatcherType[] dispatcherTypes() default {DispatcherType.REQUEST}; + boolean asyncSupported() default false; + long asyncTimeout() default 60000L; +} diff --git a/java/javax/servlet/annotation/WebServlet.java b/java/javax/servlet/annotation/WebServlet.java new file mode 100644 index 000000000..9ca6eff7d --- /dev/null +++ b/java/javax/servlet/annotation/WebServlet.java @@ -0,0 +1,43 @@ +/* + * 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.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; + +/** + * @since 3.0 + * $Id$ + * TODO SERVLET3 + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface WebServlet { + String name() default ""; + String[] value() default {}; + String[] urlPatterns() default {}; + int loadOnStartup() default -1; + InitParam[] initParams() default {}; + boolean asyncSupported() default false; + long asyncTimeout() default 60000L; + String icon() default ""; + String description() default ""; +} diff --git a/java/javax/servlet/annotation/WebServletContextListener.java b/java/javax/servlet/annotation/WebServletContextListener.java new file mode 100644 index 000000000..9dfb0e897 --- /dev/null +++ b/java/javax/servlet/annotation/WebServletContextListener.java @@ -0,0 +1,35 @@ +/* + * 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.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; + +/** + * @since 3.0 + * $Id$ + * TODO SERVLET3 + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface WebServletContextListener { + String description() default ""; +} diff --git a/java/javax/servlet/http/Cookie.java b/java/javax/servlet/http/Cookie.java index 7c62f606e..53b90ad99 100644 --- a/java/javax/servlet/http/Cookie.java +++ b/java/javax/servlet/http/Cookie.java @@ -19,6 +19,8 @@ package javax.servlet.http; import java.text.MessageFormat; import java.util.ResourceBundle; +import javax.servlet.DispatcherType; + /** * * Creates a cookie, a small amount of information sent by a servlet to @@ -81,14 +83,15 @@ public class Cookie implements Cloneable { // Attributes encoded in the header's cookie fields. // - private String comment; // ;Comment=VALUE ... describes cookie's use - // ;Discard ... implied by maxAge < 0 - private String domain; // ;Domain=VALUE ... domain that sees cookie - private int maxAge = -1; // ;Max-Age=VALUE ... cookies auto-expire - private String path; // ;Path=VALUE ... URLs that see the cookie - private boolean secure; // ;Secure ... e.g. use SSL - private int version = 0; // ;Version=1 ... means RFC 2109++ style - + private String comment; // ;Comment=VALUE ... describes cookie's use + // ;Discard ... implied by maxAge < 0 + private String domain; // ;Domain=VALUE ... domain that sees cookie + private int maxAge = -1; // ;Max-Age=VALUE ... cookies auto-expire + private String path; // ;Path=VALUE ... URLs that see the cookie + private boolean secure; // ;Secure ... e.g. use SSL + private int version = 0; // ;Version=1 ... means RFC 2109++ style + // TODO SERVLET3 + private boolean httpOnly; // Not in the spec but supported by most browsers /** @@ -533,5 +536,23 @@ public class Cookie implements Cloneable { throw new RuntimeException(e.getMessage()); } } + + /** + * + * @return + * @since 3.0 + */ + public boolean isHttpOnly() { + return httpOnly; + } + + /** + * + * @param httpOnly + * since 3.0 + */ + public void setHttpOnly(boolean httpOnly) { + this.httpOnly = httpOnly; + } } diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index 8519fa03f..cf63f0c65 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -35,12 +35,16 @@ import java.util.TimeZone; import java.util.TreeMap; import javax.security.auth.Subject; +import javax.servlet.AsyncContext; +import javax.servlet.AsyncListener; import javax.servlet.FilterChain; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletInputStream; +import javax.servlet.ServletRequest; import javax.servlet.ServletRequestAttributeEvent; import javax.servlet.ServletRequestAttributeListener; +import javax.servlet.ServletResponse; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; @@ -1485,6 +1489,50 @@ public class Request } + public void addAsyncListener(AsyncListener listener, + ServletRequest servletRequest, ServletResponse servletResponse) { + // TODO SERVLET3 + } + + public void addAsyncListener(AsyncListener listener) { + // TODO SERVLET3 + } + + public AsyncContext getAsyncContext() { + // TODO SERVLET3 + return null; + } + + public ServletContext getServletContext() { + // TODO SERVLET3 + return null; + } + + public boolean isAsyncStarted() { + // TODO SERVLET3 + return false; + } + + public boolean isAsyncSupported() { + // TODO SERVLET3 + return false; + } + + public void setAsyncTimeout(long timeout) { + // TODO SERVLET3 + } + + public AsyncContext startAsync() throws IllegalStateException { + // TODO SERVLET3 + return null; + } + + public AsyncContext startAsync(ServletRequest servletRequest, + ServletResponse servletResponse) throws IllegalStateException { + // TODO SERVLET3 + return null; + } + // ---------------------------------------------------- HttpRequest Methods diff --git a/java/org/apache/catalina/connector/RequestFacade.java b/java/org/apache/catalina/connector/RequestFacade.java index 237f79161..825c0aa13 100644 --- a/java/org/apache/catalina/connector/RequestFacade.java +++ b/java/org/apache/catalina/connector/RequestFacade.java @@ -26,8 +26,13 @@ import java.util.Enumeration; import java.util.Locale; import java.util.Map; +import javax.servlet.AsyncContext; +import javax.servlet.AsyncListener; import javax.servlet.RequestDispatcher; +import javax.servlet.ServletContext; 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.HttpSession; @@ -932,4 +937,57 @@ public class RequestFacade implements HttpServletRequest { return request.getRemotePort(); } + + public void addAsyncListener(AsyncListener listener, + ServletRequest servletRequest, ServletResponse servletResponse) { + // TODO SERVLET3 + } + + + public void addAsyncListener(AsyncListener listener) { + // TODO SERVLET3 + } + + + public AsyncContext getAsyncContext() { + // TODO SERVLET3 + return null; + } + + + public ServletContext getServletContext() { + // TODO SERVLET3 + return null; + } + + + public boolean isAsyncStarted() { + // TODO SERVLET3 + return false; + } + + + public boolean isAsyncSupported() { + // TODO SERVLET3 + return false; + } + + + public void setAsyncTimeout(long timeout) { + // TODO SERVLET3 + } + + + public AsyncContext startAsync() throws IllegalStateException { + // TODO SERVLET3 + return null; + } + + + public AsyncContext startAsync(ServletRequest servletRequest, + ServletResponse servletResponse) throws IllegalStateException { + // TODO SERVLET3 + return null; + } + } diff --git a/java/org/apache/catalina/core/ApplicationContext.java b/java/org/apache/catalina/core/ApplicationContext.java index 67f9b1fcb..fdb42bf54 100644 --- a/java/org/apache/catalina/core/ApplicationContext.java +++ b/java/org/apache/catalina/core/ApplicationContext.java @@ -24,6 +24,7 @@ import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; +import java.util.EnumSet; import java.util.Enumeration; import java.util.Iterator; import java.util.Map; @@ -33,11 +34,14 @@ import java.util.concurrent.ConcurrentHashMap; import javax.naming.Binding; import javax.naming.NamingException; import javax.naming.directory.DirContext; +import javax.servlet.DispatcherType; import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; import javax.servlet.ServletContext; import javax.servlet.ServletContextAttributeEvent; import javax.servlet.ServletContextAttributeListener; +import javax.servlet.SessionCookieConfig; +import javax.servlet.SessionTrackingMode; import org.apache.catalina.Context; import org.apache.catalina.Host; @@ -805,6 +809,61 @@ public class ApplicationContext } + public void addFilter(String filterName, String description, + String className, Map initParameters, + boolean isAsyncSupported) { + // TODO SERVLET3 + } + + + public void addFilterMappingForServletNames(String filterName, + EnumSet dispatcherTypes, boolean isMatchAfter, + String... servletNames) { + // TODO SERVLET3 + } + + + public void addFilterMappingForUrlPatterns(String filterName, + EnumSet dispatcherTypes, boolean isMatchAfter, + String... urlPatterns) { + // TODO SERVLET3 + } + + + public void addServletMapping(String servletName, String[] urlPatterns) { + // TODO SERVLET3 + } + + + public EnumSet getDefaultSessionTrackingModes() { + // TODO SERVLET3 + return null; + } + + + public EnumSet getEffectiveSessionTrackingModes() { + // TODO SERVLET3 + return null; + } + + + public SessionCookieConfig getSessionCookieConfig() { + // TODO SERVLET3 + return null; + } + + + public void setSessionCookieConfig(SessionCookieConfig sessionCookieConfig) { + // TODO SERVLET3 + } + + + public void setSessionTrackingModes( + EnumSet sessionTrackingModes) { + // TODO SERVLET3 + } + + // -------------------------------------------------------- Package Methods protected StandardContext getContext() { return this.context; diff --git a/java/org/apache/catalina/core/ApplicationContextFacade.java b/java/org/apache/catalina/core/ApplicationContextFacade.java index 2f6588816..8f5a3e9d7 100644 --- a/java/org/apache/catalina/core/ApplicationContextFacade.java +++ b/java/org/apache/catalina/core/ApplicationContextFacade.java @@ -27,14 +27,19 @@ import java.net.URL; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import java.util.EnumSet; import java.util.Enumeration; import java.util.HashMap; +import java.util.Map; import java.util.Set; +import javax.servlet.DispatcherType; import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; import javax.servlet.ServletContext; import javax.servlet.ServletException; +import javax.servlet.SessionCookieConfig; +import javax.servlet.SessionTrackingMode; import org.apache.catalina.Globals; import org.apache.catalina.security.SecurityUtil; @@ -364,6 +369,61 @@ public final class ApplicationContextFacade } + public void addFilter(String filterName, String description, + String className, Map initParameters, + boolean isAsyncSupported) { + // TODO SERVLET3 + } + + + public void addFilterMappingForServletNames(String filterName, + EnumSet dispatcherTypes, boolean isMatchAfter, + String... servletNames) { + // TODO SERVLET3 + } + + + public void addFilterMappingForUrlPatterns(String filterName, + EnumSet dispatcherTypes, boolean isMatchAfter, + String... urlPatterns) { + // TODO SERVLET3 + } + + + public void addServletMapping(String servletName, String[] urlPatterns) { + // TODO SERVLET3 + } + + + public EnumSet getDefaultSessionTrackingModes() { + // TODO SERVLET3 + return null; + } + + + public EnumSet getEffectiveSessionTrackingModes() { + // TODO SERVLET3 + return null; + } + + + public SessionCookieConfig getSessionCookieConfig() { + // TODO SERVLET3 + return null; + } + + + public void setSessionCookieConfig(SessionCookieConfig sessionCookieConfig) { + // TODO SERVLET3 + } + + + public void setSessionTrackingModes( + EnumSet sessionTrackingModes) { + // TODO SERVLET3 + } + + /** * Use reflection to invoke the requested method. Cache the method object * to speed up the process diff --git a/java/org/apache/catalina/core/Constants.java b/java/org/apache/catalina/core/Constants.java index 59256eb79..c0bff3ea3 100644 --- a/java/org/apache/catalina/core/Constants.java +++ b/java/org/apache/catalina/core/Constants.java @@ -22,8 +22,8 @@ package org.apache.catalina.core; public class Constants { public static final String Package = "org.apache.catalina.core"; - public static final int MAJOR_VERSION = 2; - public static final int MINOR_VERSION = 5; + public static final int MAJOR_VERSION = 3; + public static final int MINOR_VERSION = 0; public static final String JSP_SERVLET_CLASS = "org.apache.jasper.servlet.JspServlet"; diff --git a/java/org/apache/catalina/core/DummyRequest.java b/java/org/apache/catalina/core/DummyRequest.java index b70ae56d3..5e3959064 100644 --- a/java/org/apache/catalina/core/DummyRequest.java +++ b/java/org/apache/catalina/core/DummyRequest.java @@ -30,10 +30,14 @@ import java.util.Iterator; import java.util.Locale; import java.util.Map; +import javax.servlet.AsyncContext; +import javax.servlet.AsyncListener; import javax.servlet.FilterChain; import javax.servlet.RequestDispatcher; +import javax.servlet.ServletContext; 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.HttpSession; @@ -263,6 +267,17 @@ public class DummyRequest public String getLocalName() { return null; } public int getLocalPort() { return -1; } public int getRemotePort() { return -1; } - + public void addAsyncListener(AsyncListener listener, ServletRequest req, + ServletResponse res) {} + public void addAsyncListener(AsyncListener listener) {} + public AsyncContext getAsyncContext() { return null; } + public ServletContext getServletContext() { return null; } + public boolean isAsyncStarted() { return false; } + public boolean isAsyncSupported() { return false; } + public void setAsyncTimeout(long timeout) {} + public AsyncContext startAsync() throws IllegalStateException { + return null; } + public AsyncContext startAsync(ServletRequest req, ServletResponse res) + throws IllegalStateException { return null; } } diff --git a/java/org/apache/jasper/servlet/JspCServletContext.java b/java/org/apache/jasper/servlet/JspCServletContext.java index d7bf26ff8..b71fabef4 100644 --- a/java/org/apache/jasper/servlet/JspCServletContext.java +++ b/java/org/apache/jasper/servlet/JspCServletContext.java @@ -23,16 +23,21 @@ import java.io.InputStream; import java.io.PrintWriter; import java.net.MalformedURLException; import java.net.URL; +import java.util.EnumSet; import java.util.Enumeration; import java.util.HashSet; import java.util.Hashtable; +import java.util.Map; import java.util.Set; import java.util.Vector; +import javax.servlet.DispatcherType; import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; import javax.servlet.ServletContext; import javax.servlet.ServletException; +import javax.servlet.SessionCookieConfig; +import javax.servlet.SessionTrackingMode; /** @@ -159,7 +164,7 @@ public class JspCServletContext implements ServletContext { */ public int getMajorVersion() { - return (2); + return (3); } @@ -181,7 +186,7 @@ public class JspCServletContext implements ServletContext { */ public int getMinorVersion() { - return (3); + return (0); } @@ -437,5 +442,58 @@ public class JspCServletContext implements ServletContext { } + public void addFilter(String filterName, String description, + String className, Map initParameters, + boolean isAsyncSupported) { + // TODO SERVLET3 + } + + + public void addFilterMappingForServletNames(String filterName, + EnumSet dispatcherTypes, boolean isMatchAfter, + String... servletNames) { + // TODO SERVLET3 + } + + + public void addFilterMappingForUrlPatterns(String filterName, + EnumSet dispatcherTypes, boolean isMatchAfter, + String... urlPatterns) { + // TODO SERVLET3 + } + + + public void addServletMapping(String servletName, String[] urlPatterns) { + // TODO SERVLET3 + } + + + public EnumSet getDefaultSessionTrackingModes() { + // TODO SERVLET3 + return null; + } + + + public EnumSet getEffectiveSessionTrackingModes() { + // TODO SERVLET3 + return null; + } + + + public SessionCookieConfig getSessionCookieConfig() { + // TODO SERVLET3 + return null; + } + + + public void setSessionCookieConfig(SessionCookieConfig sessionCookieConfig) { + // TODO SERVLET3 + } + + + public void setSessionTrackingModes( + EnumSet sessionTrackingModes) { + // TODO SERVLET3 + } }