void start(Runnable run);
- public long getAsyncTimeout();
+ void addListener(AsyncListener listener);
- public void setAsyncTimeout(long timeout);
+ void addListener(AsyncListener listener, ServletRequest request,
+ ServletResponse response);
+
+ <T extends AsyncListener> T createListener(Class<T> clazz)
+ throws ServletException;
+
+ long getTimeout();
+
+ void setTimeout(long timeout);
}
/**
* @since Servlet 3.0
- * $Id$
* TODO SERVLET3 - Add comments
*/
public class AsyncEvent {
+ private AsyncContext context;
private ServletRequest request;
private ServletResponse response;
+ private Throwable throwable;
- public AsyncEvent(ServletRequest request, ServletResponse response) {
+ public AsyncEvent(AsyncContext context) {
+ this.context = context;
+ }
+
+ public AsyncEvent(AsyncContext context, ServletRequest request,
+ ServletResponse response) {
+ this.context = context;
+ this.request = request;
+ this.response = response;
+ }
+
+ public AsyncEvent(AsyncContext context, Throwable throwable) {
+ this.context = context;
+ this.throwable = throwable;
+ }
+
+ public AsyncEvent(AsyncContext context, ServletRequest request,
+ ServletResponse response, Throwable throwable) {
+ this.context = context;
this.request = request;
this.response = response;
+ this.throwable = throwable;
}
- public ServletRequest getRequest() {
+ public AsyncContext getAsyncContext() {
+ return context;
+ }
+
+ public ServletRequest getSuppliedRequest() {
return request;
}
- public ServletResponse getResponse() {
+ public ServletResponse getSuppliedResponse() {
return response;
}
+
+ public Throwable getThrowable() {
+ return throwable;
+ }
}
void onComplete(AsyncEvent event) throws IOException;
void onTimeout(AsyncEvent event) throws IOException;
void onError(AsyncEvent event) throws IOException;
+ void onStartAsync(AsyncEvent event) throws IOException;
}
/**
* @since Servlet 3.0
- * $Id$
*/
public enum DispatcherType {
FORWARD,
*/
package javax.servlet;
+import java.util.Collection;
import java.util.EnumSet;
/**
* @since Servlet 3.0
- * $Id$
* TODO SERVLET3 - Add comments
*/
public interface FilterRegistration extends Registration {
public void addMappingForServletNames(
EnumSet<DispatcherType> dispatcherTypes,
boolean isMatchAfter, String... servletNames);
+ /**
+ *
+ * @return
+ */
+ public Collection<String> getServletNameMappings();
/**
*
EnumSet<DispatcherType> dispatcherTypes,
boolean isMatchAfter, String... urlPatterns);
+ /**
+ *
+ * @return
+ */
+ public Collection<String> getUrlPatternMappings();
+
public static interface Dynamic
extends FilterRegistration, Registration.Dynamic {
+ // No additional methods
}
}
--- /dev/null
+/*
+* 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.util.ResourceBundle;
+
+import javax.servlet.annotation.ServletSecurity.EmptyRoleSemantic;
+import javax.servlet.annotation.ServletSecurity.TransportGuarantee;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public class HttpConstraintElement {
+
+ private static final String LSTRING_FILE = "javax.servlet.LocalStrings";
+ protected static final ResourceBundle lStrings =
+ ResourceBundle.getBundle(LSTRING_FILE);
+
+ private EmptyRoleSemantic emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
+ private TransportGuarantee transportGuarantee = TransportGuarantee.NONE;
+ private String[] rolesAllowed = new String[0];
+
+ /**
+ * Default constraint is permit with no transport guarantee.
+ */
+ public HttpConstraintElement() {
+ // Default constructor
+ }
+
+ /**
+ * Convenience constructor for {@link EmptyRoleSemantic.DENY}.
+ *
+ */
+ public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic) {
+ this.emptyRoleSemantic = emptyRoleSemantic;
+ }
+
+ /**
+ * Convenience constructor to specify transport guarantee and/or roles.
+ */
+ public HttpConstraintElement(TransportGuarantee transportGuarantee,
+ String... rolesAllowed) {
+ this.transportGuarantee = transportGuarantee;
+ this.rolesAllowed = rolesAllowed;
+ }
+
+ /**
+ *
+ * @param emptyRoleSemantic
+ * @param transportGuarantee
+ * @param rolesAllowed
+ * @throws IllegalArgumentException if roles are specified when DENY is used
+ */
+ public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic,
+ TransportGuarantee transportGuarantee, String... rolesAllowed) {
+ if (rolesAllowed != null && rolesAllowed.length > 0 &&
+ EmptyRoleSemantic.DENY.equals(emptyRoleSemantic)) {
+ throw new IllegalArgumentException(lStrings.getString(
+ "httpConstraintElement.invalidRolesDeny"));
+ }
+ this.emptyRoleSemantic = emptyRoleSemantic;
+ this.transportGuarantee = transportGuarantee;
+ this.rolesAllowed = rolesAllowed;
+ }
+
+ public EmptyRoleSemantic getEmptyRoleSemantic() {
+ return emptyRoleSemantic;
+ }
+
+ public TransportGuarantee getTransportGuarantee() {
+ return transportGuarantee;
+ }
+
+ public String[] getRolesAllowed() {
+ return rolesAllowed;
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+* 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 Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public class HttpMethodConstraintElement extends HttpConstraintElement {
+
+ private String methodName;
+
+ public HttpMethodConstraintElement(String methodName) {
+ if (methodName == null || methodName.length() == 0) {
+ throw new IllegalArgumentException(lStrings.getString(
+ "httpMethodConstraintElement.invalidMethod"));
+ }
+ this.methodName = methodName;
+ }
+
+ public HttpMethodConstraintElement(String methodName,
+ HttpConstraintElement constraint) {
+ super(constraint.getEmptyRoleSemantic(),
+ constraint.getTransportGuarantee(),
+ constraint.getRolesAllowed());
+ if (methodName == null || methodName.length() == 0) {
+ throw new IllegalArgumentException(lStrings.getString(
+ "httpMethodConstraintElement.invalidMethod"));
+ }
+ this.methodName = methodName;
+ }
+
+ public String getMethodName() {
+ return methodName;
+ }
+}
\ No newline at end of file
err.not_iso8859_1=Not an ISO 8859-1 character: {0}
value.true=true
value.false=false
+
+httpConstraintElement.invalidRolesDeny=Roles may not be specified when using DENY
+httpMethodConstraintElement.invalidMethod=Invalid HTTP method
\ No newline at end of file
--- /dev/null
+/*
+* 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 javax.servlet.annotation.MultipartConfig;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public class MultipartConfigElement {
+
+ private String location = "";
+ private long maxFileSize = -1;
+ private long maxRequestSize = -1;
+ private int fileSizeThreshold = 0;
+
+ public MultipartConfigElement(String location) {
+ // Keep empty string default if location is null
+ if (location != null) {
+ this.location = location;
+ }
+ }
+
+ public MultipartConfigElement(String location, long maxFileSize,
+ long maxRequestSize, int fileSizeThreshold) {
+ // Keep empty string default if location is null
+ if (location != null) {
+ this.location = location;
+ }
+ this.maxFileSize = maxFileSize;
+ this.maxRequestSize = maxRequestSize;
+ this.fileSizeThreshold = fileSizeThreshold;
+ }
+
+ public MultipartConfigElement(MultipartConfig annotation) {
+ location = annotation.location();
+ maxFileSize = annotation.maxFileSize();
+ maxRequestSize = annotation.maxRequestSize();
+ fileSizeThreshold = annotation.fileSizeThreshold();
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public long getMaxFileSize() {
+ return maxFileSize;
+ }
+
+ public long getMaxRequestSize() {
+ return maxRequestSize;
+ }
+
+ public int getFileSizeThreshold() {
+ return fileSizeThreshold;
+ }
+}
\ No newline at end of file
*/
public interface Registration {
- public boolean setInitParameter(String name, String value)
- throws IllegalArgumentException, IllegalStateException;
+ public String getName();
+
+ public String getClassName();
- public Set<String> setInitParameters(Map<String,String> initParameters)
- throws IllegalArgumentException, IllegalStateException;
+ /**
+ *
+ * @param name
+ * @param value
+ * @return
+ * @throws IllegalArgumentException
+ * @throws IllegalStateException
+ */
+ public boolean setInitParameter(String name, String value);
- public interface Dynamic {
-
- public void setDescription(String description)
- throws IllegalStateException;
+ public String getInitParameter(String name);
+
+ /**
+ *
+ * @param initParameters
+ * @return
+ * @throws IllegalArgumentException
+ * @throws IllegalStateException
+ */
+ public Set<String> setInitParameters(Map<String,String> initParameters);
+
+ public Map<String, String> getInitParameters();
+
+ public interface Dynamic extends Registration {
- public void setAsyncSupported(boolean isAsyncSupported)
- throws IllegalStateException;
+ /**
+ *
+ * @param isAsyncSupported
+ * @throws IllegalStateException
+ */
+ public void setAsyncSupported(boolean isAsyncSupported);
}
}
*/
package javax.servlet;
+import java.util.Set;
+
/**
* @since Servlet 3.0
* $Id$
* TODO SERVLET3 - Add comments
*/
public interface ServletContainerInitializer {
- public void onStartup(java.util.Set<java.lang.Class<?>> c,
- ServletContext ctx);
+
+ /**
+ *
+ * @param c
+ * @param ctx
+ * @throws ServletException
+ */
+ public void onStartup(Set<java.lang.Class<?>> c, ServletContext ctx)
+ throws ServletException;
}
import java.net.URL;
import java.util.EnumSet;
import java.util.Enumeration;
+import java.util.EventListener;
+import java.util.Map;
import java.util.Set;
+import javax.servlet.descriptor.JspConfigDescriptor;
+
/**
*
* Defines a set of methods that a servlet uses to communicate with its
public interface ServletContext {
public static final String TEMPDIR = "javax.servlet.context.tempdir";
+
+ /**
+ * @since Servlet 3.0
+ */
+ public static final String ORDERED_LIBS =
+ "javax.servlet.context.orderedLibs";
/**
* Returns a <code>ServletContext</code> object that
public int getMinorVersion();
+ /**
+ *
+ * @return
+ * @throws UnsupportedOperationException
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+ public int getEffectiveMajorVersion();
+ /**
+ *
+ * @return
+ * @throws UnsupportedOperationException
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+ public int getEffectiveMinorVersion();
/**
* Returns the MIME type of the specified file, or <code>null</code> if
* @param value
* @return
* @throws IllegalStateException
+ * @throws UnsupportedOperationException
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
*
* @param servletName
* @return
+ * @throws UnsupportedOperationException
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+ public ServletRegistration getServletRegistration(String servletName);
+
+
+ /**
+ *
+ * @return
+ * @throws UnsupportedOperationException
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
- public ServletRegistration findServletRegistration(String servletName);
+ public Map<String, ? extends ServletRegistration> getServletRegistrations();
/**
*
* @param filterName
* @return
+ * @throws UnsupportedOperationException
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
- public FilterRegistration findFilterRegistration(String filterName);
+ public FilterRegistration getFilterRegistration(String filterName);
+ /**
+ *
+ * @return
+ * @throws UnsupportedOperationException
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+ public Map<String, ? extends FilterRegistration> getFilterRegistrations();
/**
*
* @return
+ * @throws UnsupportedOperationException
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
* {@link SessionTrackingMode}
* @throws IllegalStateException If the context has already been
* initialised
+ * @throws UnsupportedOperationException
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
- public EnumSet<SessionTrackingMode> getDefaultSessionTrackingModes();
+ public Set<SessionTrackingMode> getDefaultSessionTrackingModes();
+
+ /**
+ *
+ * @return
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+ public Set<SessionTrackingMode> getEffectiveSessionTrackingModes();
+
+ /**
+ *
+ * @param listenerClass
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+ public void addListener(Class <? extends EventListener> listenerClass);
+
+ /**
+ *
+ * @param className
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+ public void addListener(String className);
+
+ /**
+ *
+ * @param <T>
+ * @param t
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+ public <T extends EventListener> void addListener(T t);
+
+ /**
+ *
+ * @param <T>
+ * @param c
+ * @return
+ * @throws ServletException
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+ public <T extends EventListener> T createListener(Class<T> c)
+ throws ServletException;
+
+ /**
+ *
+ * @param roleNames
+ * @throws UnsupportedOperationException
+ * @throws IllegalArgumentException
+ * @throws IllegalStateException
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+ public void declareRoles(String... roleNames);
/**
*
* @return
+ * @throws UnsupportedOperationException
+ * @throws SecurityException
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
- public EnumSet<SessionTrackingMode> getEffectiveSessionTrackingModes();
+ public ClassLoader getClassLoader();
+ /**
+ *
+ * @return
+ * @throws UnsupportedOperationException
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+ public JspConfigDescriptor getJspConfigDescriptor();
}
public abstract class ServletOutputStream extends OutputStream {
private static final String LSTRING_FILE = "javax.servlet.LocalStrings";
- private static ResourceBundle lStrings =
- ResourceBundle.getBundle(LSTRING_FILE);
+ private static final ResourceBundle lStrings =
+ ResourceBundle.getBundle(LSTRING_FILE);
*/
package javax.servlet;
+import java.util.Collection;
import java.util.Set;
/**
* @throws IllegalStateException if the associated ServletContext has
* already been initialised
*/
- public Set<String> addMapping(String... urlPatterns);
+ public Set<String> addMapping(String... urlPatterns);
+
+ public Collection<String> getMappings();
+
+ public String getRunAsRole();
public static interface Dynamic
extends ServletRegistration, Registration.Dynamic {
-
+ public void setLoadOnStartup(int loadOnStartup);
+ public void setMultipartConfig(MultipartConfigElement multipartConfig);
+ public void setRunAsRole(String roleName);
+ public Set<String> setServletSecurity(ServletSecurityElement constraint);
}
}
/**
*
- * @param listener
- * @since Servlet 3.0
- * TODO SERVLET3 - Add comments
- */
- public void addAsyncListener(AsyncListener listener);
-
- /**
- *
- * @param listener
- * @param servletRequest
- * @param servletResponse
- * @since Servlet 3.0
- * TODO SERVLET3 - Add comments
- */
- public void addAsyncListener(AsyncListener listener,
- ServletRequest servletRequest, ServletResponse servletResponse);
-
- /**
- *
- * @param timeout
- * @throws java.lang.IllegalStateException
- * @since Servlet 3.0
- * TODO SERVLET3 - Add comments
- */
- public void setAsyncTimeout(long timeout);
-
-
- /**
- *
- * @return
- * @since Servlet 3.0
- * TODO SERVLET3 - Add comments
- */
- public long getAsyncTimeout();
-
-
- /**
- *
* @return
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
}
/**
- * The default behavior of this method is to call
- * addAsyncListener(AsyncListener) on the wrapped request object.
- *
- * @param listener
- * @since Servlet 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 Servlet 3.0
- */
- public void addAsyncListener(AsyncListener listener,
- ServletRequest servletRequest, ServletResponse servletResponse) {
- request.addAsyncListener(listener, servletRequest, servletResponse);
- }
-
- /**
- * The default behavior of this method is to call
- * setAsyncTimeout(long) on the wrapped request object.
- *
- * @param listener
- * @since Servlet 3.0
- */
- public void setAsyncTimeout(long timeout) {
- request.setAsyncTimeout(timeout);
- }
-
- /**
- * The default behavior of this method is to call
- * getAsyncTimeout() on the wrapped request object.
- *
- * @since Servlet 3.0
- */
- public long getAsyncTimeout() {
- return request.getAsyncTimeout();
- }
-
- /**
*
* @param wrapped
* @since Servlet 3.0
--- /dev/null
+/*
+ * 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.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.annotation.HttpMethodConstraint;
+import javax.servlet.annotation.ServletSecurity;
+
+/**
+ *
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public class ServletSecurityElement extends HttpConstraintElement {
+
+ private Map<String,HttpMethodConstraintElement> methodConstraints =
+ new HashMap<String,HttpMethodConstraintElement>();
+
+ /**
+ * Use default HttpConstraint.
+ */
+ public ServletSecurityElement() {
+ super();
+ }
+
+
+ /**
+ * Use specific constraints for specified methods and default
+ * HttpConstraintElement for all other methods.
+ * @param httpMethodConstraints
+ * @throws IllegalArgumentException if a method name is specified more than
+ * once
+ */
+ public ServletSecurityElement(
+ Collection<HttpMethodConstraintElement> httpMethodConstraints) {
+ super();
+ addHttpMethodConstraints(httpMethodConstraints);
+ }
+
+ /**
+ * Use specified HttpConstraintElement.
+ * @param httpConstraintElement
+ */
+ public ServletSecurityElement(HttpConstraintElement httpConstraintElement) {
+ this (httpConstraintElement, null);
+ }
+
+ /**
+ * Use specified HttpConstraintElement as default and specific constraints
+ * for specified methods.
+ * @param httpConstraintElement
+ * @param httpMethodConstraints
+ * @throws IllegalArgumentException if a method name is specified more than
+ */
+ public ServletSecurityElement(HttpConstraintElement httpConstraintElement,
+ Collection<HttpMethodConstraintElement> httpMethodConstraints) {
+ super(httpConstraintElement.getEmptyRoleSemantic(),
+ httpConstraintElement.getTransportGuarantee(),
+ httpConstraintElement.getRolesAllowed());
+ addHttpMethodConstraints(httpMethodConstraints);
+ }
+
+ /**
+ * Create from an annotation.
+ * @param annotation
+ * @throws IllegalArgumentException if a method name is specified more than
+ */
+ public ServletSecurityElement(ServletSecurity annotation) {
+ this(new HttpConstraintElement(annotation.value().value(),
+ annotation.value().transportGuarantee(),
+ annotation.value().rolesAllowed()));
+
+ List<HttpMethodConstraintElement> l =
+ new ArrayList<HttpMethodConstraintElement>();
+ HttpMethodConstraint[] constraints = annotation.httpMethodConstraints();
+ if (constraints != null) {
+ for (int i = 0; i < constraints.length; i++) {
+ HttpMethodConstraintElement e =
+ new HttpMethodConstraintElement(constraints[i].value(),
+ new HttpConstraintElement(
+ constraints[i].emptyRoleSemantic(),
+ constraints[i].transportGuarantee(),
+ constraints[i].rolesAllowed()));
+ l.add(e);
+ }
+ }
+ addHttpMethodConstraints(l);
+ }
+
+ public Collection<HttpMethodConstraintElement> getHttpMethodConstraints() {
+ return methodConstraints.values();
+ }
+
+ public Collection<String> getMethodNames() {
+ return methodConstraints.keySet();
+ }
+
+ private void addHttpMethodConstraints(
+ Collection<HttpMethodConstraintElement> httpMethodConstraints) {
+ if (httpMethodConstraints == null) {
+ return;
+ }
+ for (HttpMethodConstraintElement constraint : httpMethodConstraints) {
+ String method = constraint.getMethodName();
+ if (methodConstraints.containsKey(method)) {
+ throw new IllegalArgumentException(
+ "Duplicate method name: " + method);
+ }
+ methodConstraints.put(method, constraint);
+ }
+ }
+}
/**
* @since Servlet 3.0
- * $Id$
* TODO SERVLET3 - Add comments
*/
@Target({ElementType.TYPE})
--- /dev/null
+/*
+ * 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.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.servlet.annotation.ServletSecurity.EmptyRoleSemantic;
+import javax.servlet.annotation.ServletSecurity.TransportGuarantee;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface HttpConstraint {
+ EmptyRoleSemantic value() default EmptyRoleSemantic.PERMIT;
+ TransportGuarantee transportGuarantee() default TransportGuarantee.NONE;
+ String[] rolesAllowed() default {};
+}
--- /dev/null
+/*
+ * 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.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.servlet.annotation.ServletSecurity.EmptyRoleSemantic;
+import javax.servlet.annotation.ServletSecurity.TransportGuarantee;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface HttpMethodConstraint {
+ String value();
+ EmptyRoleSemantic emptyRoleSemantic() default EmptyRoleSemantic.PERMIT;
+ TransportGuarantee transportGuarantee() default TransportGuarantee.NONE;
+ String[] rolesAllowed() default {};
+}
/**
* @since Servlet 3.0
- * $Id$
* TODO SERVLET3 - Add comments
*/
@Target({ElementType.TYPE})
@Documented
public @interface MultipartConfig {
String location() default "";
- long maxFileSize() default 0L;
- long maxRequestSize() default 0L;
+ long maxFileSize() default -1L;
+ long maxRequestSize() default -1L;
int fileSizeThreshold() default 0;
}
--- /dev/null
+/*
+ * 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.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+@Inherited
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface ServletSecurity {
+ enum EmptyRoleSemantic {
+ PERMIT,
+ DENY
+ }
+ enum TransportGuarantee {
+ NONE,
+ CONFIDENTIAL
+ }
+ HttpConstraint value() default @HttpConstraint;
+ HttpMethodConstraint[] httpMethodConstraints() default {};
+}
/**
* @since Servlet 3.0
- * $Id$
* TODO SERVLET3 - Add comments
*/
@Target({ElementType.TYPE})
/**
* @since Servlet 3.0
- * $Id$
* TODO SERVLET3 - Add comments
*/
@Target({ElementType.TYPE})
/**
* @since Servlet 3.0
- * $Id$
* TODO SERVLET3 - Add comments
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface WebListener {
- String description() default "";
+ String value() default "";
}
/**
* @since Servlet 3.0
- * $Id$
* TODO SERVLET3 - Add comments
*/
@Target({ElementType.TYPE})
--- /dev/null
+/*
+ * 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.descriptor;
+
+import java.util.Collection;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public interface JspConfigDescriptor {
+ public Collection<TaglibDescriptor> getTaglibs();
+ public Collection<JspPropertyGroupDescriptor> getJspPropertyGroups();
+}
--- /dev/null
+/*
+ * 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.descriptor;
+
+import java.util.Collection;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public interface JspPropertyGroupDescriptor {
+ public Collection<String> getUrlPatterns();
+ public String getElIgnored();
+ public String getPageEncoding();
+ public String getScriptingInvalid();
+ public String getIsXml();
+ public Collection<String> getIncludePreludes();
+ public Collection<String> getIncludeCodas();
+ public String getDeferredSyntaxAllowedAsLiteral();
+ public String getTrimDirectiveWhitespaces();
+ public String getDefaultContentType();
+ public String getBuffer();
+ public String getErrorOnUndeclaredNamespace();
+}
--- /dev/null
+/*
+ * 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.descriptor;
+
+/**
+ * @since Servlet 3.0
+ * TODO SERVLET3 - Add comments
+ */
+public interface TaglibDescriptor {
+ public String getTaglidURI();
+ public String getTaglibLocation();
+}
import javax.servlet.ServletRequest;
import java.io.IOException;
+import java.util.Collection;
import java.util.Enumeration;
/**
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
- public void login(java.lang.String username, String password)
+ public void login(String username, String password)
throws ServletException;
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
- public Iterable<Part> getParts();
+ public Collection<Part> getParts() throws IOException, ServletException;
/**
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
- public Part getPart(java.lang.String name);
+ public Part getPart(String name);
}
import javax.servlet.ServletRequestWrapper;
import java.io.IOException;
+import java.util.Collection;
import java.util.Enumeration;
/**
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
- public Iterable<Part> getParts() {
+ public Collection<Part> getParts() throws IOException, ServletException {
return this._getHttpServletRequest().getParts();
}
package javax.servlet.http;
import java.io.IOException;
+import java.util.Collection;
import javax.servlet.ServletResponse;
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
- public Iterable<String> getHeaders(String name);
+ public Collection<String> getHeaders(String name);
/**
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
- public Iterable<String> getHeaderNames();
+ public Collection<String> getHeaderNames();
/*
package javax.servlet.http;
import java.io.IOException;
+import java.util.Collection;
import javax.servlet.ServletResponseWrapper;
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
- public Iterable<String> getHeaders(String name) {
+ public Collection<String> getHeaders(String name) {
return this._getHttpServletResponse().getHeaders(name);
}
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
- public Iterable<String> getHeaderNames() {
+ public Collection<String> getHeaderNames() {
return this._getHttpServletResponse().getHeaderNames();
}
import java.io.IOException;
import java.io.InputStream;
+import java.util.Collection;
/**
* @since Servlet 3.0
public void write(String fileName) throws IOException;
public void delete() throws IOException;
public String getHeader(String name);
- public Iterable<String> getHeaders(String name);
- public Iterable<String> getHeaderNames();
+ public Collection<String> getHeaders(String name);
+ public Collection<String> getHeaderNames();
}
import java.security.Principal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import javax.security.auth.Subject;
import javax.servlet.AsyncContext;
-import javax.servlet.AsyncListener;
import javax.servlet.DispatcherType;
import javax.servlet.FilterChain;
import javax.servlet.RequestDispatcher;
*/
protected volatile AsyncContextImpl asyncContext = null;
- /**
- * async timeout
- */
- protected long asyncTimeout = 0;
-
protected Boolean asyncSupported = null;
return this.asyncContext;
}
- public void addAsyncListener(AsyncListener listener) {
- // TODO SERVLET3 - async
- if (isAsyncSupported() && isAsyncStarted()) {
- this.asyncContext.addAsyncListener(listener);
- } else {
- throw new IllegalStateException("Async [Supported:"+isAsyncSupported()+"; Started:"+isAsyncStarted()+"]");
- }
- }
-
- public void addAsyncListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse) {
- // TODO SERVLET3 - async
- if (isAsyncSupported() && isAsyncStarted()) {
- this.asyncContext.addAsyncListener(listener,servletRequest,servletResponse);
- } else {
- throw new IllegalStateException("Async [Supported:"+isAsyncSupported()+"; Started:"+isAsyncStarted()+"]");
- }
- }
-
- public void setAsyncTimeout(long timeout) {
- // TODO SERVLET3 - async
- if (this.asyncTimeout!=timeout) {
- this.asyncTimeout = timeout;
- coyoteRequest.action(ActionCode.ACTION_ASYNC_SETTIMEOUT,new Long(timeout));
- }
- }
-
- public long getAsyncTimeout() {
- // TODO SERVLET3 - async
- return asyncTimeout;
- }
-
public DispatcherType getDispatcherType() {
// TODO SERVLET3 - dispatcher
if (internalDispatcherType==null) {
// TODO Servlet 3 - authentication
}
- public Iterable<Part> getParts() {
- // TODO Servlet 3 - authentication
+ public Collection<Part> getParts() {
+ // TODO Servlet 3 - file upload
return null;
}
import java.io.IOException;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.util.Collection;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
import javax.servlet.AsyncContext;
-import javax.servlet.AsyncListener;
import javax.servlet.DispatcherType;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
}
- public void addAsyncListener(AsyncListener listener) {
- request.addAsyncListener(listener);
- }
-
-
- public void addAsyncListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse) {
- request.addAsyncListener(listener,servletRequest,servletResponse);
- }
-
public AsyncContext getAsyncContext() {
return request.getAsyncContext();
}
- public long getAsyncTimeout() {
- return request.getAsyncTimeout();
- }
-
- public void setAsyncTimeout(long timeout) {
- request.setAsyncTimeout(timeout);
- }
-
public DispatcherType getDispatcherType() {
return request.getDispatcherType();
}
request.logout();
}
- public Iterable<Part> getParts() {
+ public Collection<Part> getParts() {
return request.getParts();
}
import java.security.PrivilegedExceptionAction;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Enumeration;
import java.util.List;
import java.util.Locale;
/**
* Return an Iterable of all the header names set for this response.
*/
- public Iterable<String> getHeaderNames() {
+ public Collection<String> getHeaderNames() {
MimeHeaders headers = coyoteResponse.getMimeHeaders();
int n = headers.size();
*
* @param name Header name to look up
*/
- public Iterable<String> getHeaders(String name) {
+ public Collection<String> getHeaders(String name) {
Enumeration<String> enumeration =
coyoteResponse.getMimeHeaders().values(name);
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
+import java.util.Collection;
import java.util.Locale;
import javax.servlet.ServletOutputStream;
return response.getHeader(name);
}
- public Iterable<String> getHeaderNames() {
+ public Collection<String> getHeaderNames() {
return response.getHeaderNames();
}
- public Iterable<String> getHeaders(String name) {
+ public Collection<String> getHeaders(String name) {
return response.getHeaders(name);
}
}
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.Enumeration;
+import java.util.EventListener;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import javax.servlet.ServletRegistration;
import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;
+import javax.servlet.descriptor.JspConfigDescriptor;
import org.apache.catalina.Context;
import org.apache.catalina.Engine;
}
- public FilterRegistration findFilterRegistration(String filterName) {
+ public FilterRegistration getFilterRegistration(String filterName) {
// TODO Servlet 3.0
return null;
}
}
- public ServletRegistration findServletRegistration(String servletName) {
+ public ServletRegistration getServletRegistration(String servletName) {
// TODO Servlet 3.0
return null;
}
}
+ @Override
public boolean setInitParameter(String name, String value) {
// TODO Servlet 3
return false;
}
+ @Override
+ public void addListener(Class<? extends EventListener> listenerClass) {
+ // TODO Servlet 3
+ }
+
+
+ @Override
+ public void addListener(String className) {
+ // TODO Servlet 3
+ }
+
+
+ @Override
+ public <T extends EventListener> void addListener(T t) {
+ // TODO Servlet 3
+ }
+
+
+ @Override
+ public <T extends EventListener> T createListener(Class<T> c)
+ throws ServletException {
+ // TODO Servlet 3
+ return null;
+ }
+
+
+ @Override
+ public void declareRoles(String... roleNames) {
+ // TODO Servlet 3
+ }
+
+
+ @Override
+ public ClassLoader getClassLoader() {
+ // TODO Servlet 3
+ return null;
+ }
+
+
+ @Override
+ public int getEffectiveMajorVersion() {
+ // TODO Servlet 3
+ return 0;
+ }
+
+
+ @Override
+ public int getEffectiveMinorVersion() {
+ // TODO Servlet 3
+ return 0;
+ }
+
+
+ @Override
+ public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
+ // TODO Servlet 3
+ return null;
+ }
+
+
+ @Override
+ public JspConfigDescriptor getJspConfigDescriptor() {
+ // TODO Servlet 3
+ return null;
+ }
+
+
+ @Override
+ public Map<String, ? extends ServletRegistration> getServletRegistrations() {
+ // TODO Servlet 3
+ return null;
+ }
+
+
// -------------------------------------------------------- Package Methods
protected StandardContext getContext() {
return this.context;
import java.security.PrivilegedExceptionAction;
import java.util.EnumSet;
import java.util.Enumeration;
+import java.util.EventListener;
import java.util.HashMap;
+import java.util.Map;
import java.util.Set;
import javax.servlet.Filter;
import javax.servlet.ServletRegistration;
import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;
+import javax.servlet.descriptor.JspConfigDescriptor;
import org.apache.catalina.Globals;
import org.apache.catalina.security.SecurityUtil;
}
- public FilterRegistration findFilterRegistration(String filterName) {
+ public FilterRegistration getFilterRegistration(String filterName) {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (FilterRegistration) doPrivileged(
"findFilterRegistration", new Object[]{filterName});
} else {
- return context.findFilterRegistration(filterName);
+ return context.getFilterRegistration(filterName);
}
}
}
- public ServletRegistration findServletRegistration(String servletName) {
+ public ServletRegistration getServletRegistration(String servletName) {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (ServletRegistration) doPrivileged(
"findServletRegistration", new Object[]{servletName});
} else {
- return context.findServletRegistration(servletName);
+ return context.getServletRegistration(servletName);
}
}
return context.setInitParameter(name, value);
}
}
-
-
+
+
+ @Override
+ public void addListener(Class<? extends EventListener> listenerClass) {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ doPrivileged("addListener",
+ new Object[]{listenerClass});
+ } else {
+ context.addListener(listenerClass);
+ }
+ }
+
+
+ @Override
+ public void addListener(String className) {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ doPrivileged("addListener",
+ new Object[]{className});
+ } else {
+ context.addListener(className);
+ }
+ }
+
+
+ @Override
+ public <T extends EventListener> void addListener(T t) {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ doPrivileged("addListener",
+ new Object[]{t});
+ } else {
+ context.addListener(t);
+ }
+ }
+
+
+ @Override
+ public <T extends EventListener> T createListener(Class<T> c)
+ throws ServletException {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (T) doPrivileged("createListener", new Object[]{c});
+ } else {
+ return context.createListener(c);
+ }
+ }
+
+
+ @Override
+ public void declareRoles(String... roleNames) {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ doPrivileged("declareRoles",
+ new Object[]{roleNames});
+ } else {
+ context.declareRoles(roleNames);
+ }
+ }
+
+
+ @Override
+ public ClassLoader getClassLoader() {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (ClassLoader) doPrivileged("getClassLoader", null);
+ } else {
+ return context.getClassLoader();
+ }
+ }
+
+
+ @Override
+ public int getEffectiveMajorVersion() {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return ((Integer) doPrivileged("getEffectiveMajorVersion",
+ null)).intValue();
+ } else {
+ return context.getEffectiveMajorVersion();
+ }
+ }
+
+
+ @Override
+ public int getEffectiveMinorVersion() {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return ((Integer) doPrivileged("getEffectiveMinorVersion",
+ null)).intValue();
+ } else {
+ return context.getEffectiveMinorVersion();
+ }
+ }
+
+
+ @Override
+ public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (Map<String, ? extends FilterRegistration>) doPrivileged(
+ "getFilterRegistrations", null);
+ } else {
+ return context.getFilterRegistrations();
+ }
+ }
+
+
+ @Override
+ public JspConfigDescriptor getJspConfigDescriptor() {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (JspConfigDescriptor) doPrivileged("getJspConfigDescriptor",
+ null);
+ } else {
+ return context.getJspConfigDescriptor();
+ }
+ }
+
+
+ @Override
+ public Map<String, ? extends ServletRegistration> getServletRegistrations() {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (Map<String, ? extends ServletRegistration>) doPrivileged(
+ "getServletRegistrations", null);
+ } else {
+ return context.getServletRegistrations();
+ }
+ }
+
/**
* Use reflection to invoke the requested method. Cache the method object
* to speed up the process
throw realException;
}
+
}
}
}
- public void addAsyncListener(AsyncListener listener) {
+ @Override
+ public void addListener(AsyncListener listener) {
AsyncListenerWrapper wrapper = new AsyncListenerWrapper();
wrapper.setListener(listener);
listeners.add(wrapper);
}
- public void addAsyncListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse) {
+ @Override
+ public void addListener(AsyncListener listener, ServletRequest servletRequest,
+ ServletResponse servletResponse) {
AsyncListenerWrapper wrapper = new AsyncListenerWrapper();
wrapper.setListener(listener);
listeners.add(wrapper);
}
-
+
+ @Override
+ public <T extends AsyncListener> T createListener(Class<T> clazz)
+ throws ServletException {
+ T listener = null;
+ try {
+ listener = clazz.newInstance();
+ } catch (InstantiationException e) {
+ ServletException se = new ServletException(e);
+ throw se;
+ } catch (IllegalAccessException e) {
+ ServletException se = new ServletException(e);
+ throw se;
+ }
+ return listener;
+ }
public void recycle() {
servletRequest = null;
state.set(st);
}
- public long getAsyncTimeout() {
+ public long getTimeout() {
return timeout;
}
- public void setAsyncTimeout(long timeout) {
+ public void setTimeout(long timeout) {
this.timeout = timeout;
request.getCoyoteRequest().action(ActionCode.ACTION_ASYNC_SETTIMEOUT,new Long(timeout));
}
public void init(ServletRequest request, ServletResponse response) {
this.servletRequest = request;
this.servletResponse = response;
- event = new AsyncEvent(request,response);
+ event = new AsyncEvent(this, request, response);
}
}
import java.io.UnsupportedEncodingException;
import java.net.Socket;
import java.security.Principal;
+import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import javax.servlet.AsyncContext;
-import javax.servlet.AsyncListener;
import javax.servlet.DispatcherType;
import javax.servlet.FilterChain;
import javax.servlet.RequestDispatcher;
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 ServletContext getServletContext() { return null; }
public boolean isAsyncStarted() { return false; }
public boolean isAsyncSupported() { return false; }
return null;
}
public Part getPart(String name) { return null; }
- public Iterable<Part> getParts() { return null; }
+ public Collection<Part> getParts() { return null; }
public boolean authenticate(HttpServletResponse response)
throws IOException, ServletException { return false; }
public void login(String username, String password)
throws ServletException {}
public void logout() throws ServletException {}
- public void addAsyncListener(AsyncListener listener) {}
public AsyncContext getAsyncContext() { return null; }
- public long getAsyncTimeout() { return 0; }
public DispatcherType getDispatcherType() { return null; }
- public void setAsyncTimeout(long timeout) {}
public AsyncContext startAsync(ServletRequest servletRequest,
ServletResponse servletResponse) { return null; }
}
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
+import java.util.Collection;
import java.util.Locale;
import javax.servlet.ServletOutputStream;
public Cookie[] getCookies() { return null; }
public String getHeader(String name) { return null; }
- public Iterable<String> getHeaderNames() { return null; }
+ public Collection<String> getHeaderNames() { return null; }
public String[] getHeaderValues(@SuppressWarnings("unused") String name) {
return null;
}
public void setStatus(int status) {}
/** @deprecated */
public void setStatus(int status, String message) {}
- public Iterable<String> getHeaders(String name) { return null; }
+ public Collection<String> getHeaders(String name) { return null; }
}
import java.net.URL;
import java.util.EnumSet;
import java.util.Enumeration;
+import java.util.EventListener;
import java.util.HashSet;
import java.util.Hashtable;
+import java.util.Map;
import java.util.Set;
import java.util.Vector;
import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;
import javax.servlet.FilterRegistration.Dynamic;
+import javax.servlet.descriptor.JspConfigDescriptor;
/**
}
- public FilterRegistration findFilterRegistration(String filterName) {
+ public FilterRegistration getFilterRegistration(String filterName) {
return null;
}
- public ServletRegistration findServletRegistration(String servletName) {
+ public ServletRegistration getServletRegistration(String servletName) {
return null;
}
return false;
}
+
+ @Override
+ public void addListener(Class<? extends EventListener> listenerClass) {
+ // NOOP
+ }
+
+
+ @Override
+ public void addListener(String className) {
+ // NOOP
+ }
+
+
+ @Override
+ public <T extends EventListener> void addListener(T t) {
+ // NOOP
+ }
+
+
+ @Override
+ public <T extends EventListener> T createListener(Class<T> c)
+ throws ServletException {
+ return null;
+ }
+
+
+ @Override
+ public void declareRoles(String... roleNames) {
+ // NOOP
+ }
+
+
+ @Override
+ public ClassLoader getClassLoader() {
+ return null;
+ }
+
+
+ @Override
+ public int getEffectiveMajorVersion() {
+ return 3;
+ }
+
+
+ @Override
+ public int getEffectiveMinorVersion() {
+ return 0;
+ }
+
+
+ @Override
+ public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
+ return null;
+ }
+
+
+ @Override
+ public JspConfigDescriptor getJspConfigDescriptor() {
+ return null;
+ }
+
+
+ @Override
+ public Map<String, ? extends ServletRegistration> getServletRegistrations() {
+ return null;
+ }
+
}
} else {
resp.setContentType("text/plain");
final AsyncContext actx = req.startAsync();
- actx.setAsyncTimeout(Long.MAX_VALUE);
+ actx.setTimeout(Long.MAX_VALUE);
Runnable run = new Runnable() {
public void run() {
try {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
final AsyncContext actx = req.startAsync();
- actx.setAsyncTimeout(30*1000);
+ actx.setTimeout(30*1000);
Runnable run = new Runnable() {
public void run() {
try {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
final AsyncContext actx = req.startAsync();
- actx.setAsyncTimeout(30*1000);
+ actx.setTimeout(30*1000);
Runnable run = new Runnable() {
public void run() {
try {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
final AsyncContext actx = req.startAsync();
- actx.setAsyncTimeout(30*1000);
+ actx.setTimeout(30*1000);
actx.dispatch("/jsp/async/async3.jsp");
actx.complete();
}