--- /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 3.0
+ * $Id$
+ * TODO SERVLET3
+ */
+public interface AsyncContext {
+ public static final String ASYNC_REQUEST_URI =
+ "javax.servlet.async.request_uri";
+ public static final String ASYNC_CONTEXT_PATH =
+ "javax.servlet.async.context_path";
+ public static final String ASYNC_PATH_INFO =
+ "javax.servlet.async.path_info";
+ public static final String ASYNC_SERVLET_PATH =
+ "javax.servlet.async.servlet_path";
+ public static final String ASYNC_QUERY_STRING =
+ "javax.servlet.async.query_string";
+
+ ServletRequest getRequest();
+
+ ServletResponse getResponse();
+
+ boolean hasOriginalRequestAndResponse();
+
+ /**
+ *
+ * @throws IllegalStateException
+ */
+ void dispatch();
+
+ /**
+ *
+ * @param path
+ * @throws IllegalStateException
+ */
+ void dispatch(String path);
+
+ /**
+ *
+ * @param context
+ * @param path
+ * @throws IllegalStateException
+ */
+ void dispatch(ServletContext context, String path);
+
+ void complete();
+
+ void start(Runnable run);
+}
+++ /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 3.0
- * TODO SERVLET3 - Add comments
- */
-public interface AsyncDispatcher {
- void forward(ServletRequest request, ServletResponse response)
- throws IllegalStateException;
-}
* TODO SERVLET3 - Add comments
*/
public interface AsyncListener extends EventListener {
- void onDoneAsync(AsyncEvent event) throws IOException;
+ void onComplete(AsyncEvent event) throws IOException;
void onTimeout(AsyncEvent event) throws IOException;
}
FORWARD,
INCLUDE,
REQUEST,
+ ASYNC,
ERROR
}
--- /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.EnumSet;
+
+/**
+ * @since 3.0
+ * $Id$
+ * TODO SERVLET3 - Add comments
+ */
+public interface FilterRegistration extends Registration {
+
+ /**
+ *
+ * @param dispatcherTypes
+ * @param isMatchAfter
+ * @param servletNames
+ * @throws IllegalArgumentException
+ * @throws IllegalStateException
+ */
+ public void addMappingForServletNames(EnumSet<DispatcherType> dispatcherTypes,
+ boolean isMatchAfter, String... servletNames);
+
+ /**
+ *
+ * @param dispatcherTypes
+ * @param isMatchAfter
+ * @param urlPatterns
+ * @throws IllegalArgumentException
+ * @throws IllegalStateException
+ */
+ public void addMappingForUrlPatterns(EnumSet<DispatcherType> dispatcherTypes,
+ boolean isMatchAfter, String... urlPatterns);
+
+ public static interface Dynamic
+ extends FilterRegistration, Registration.Dynamic {
+ }
+}
--- /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.Map;
+import java.util.Set;
+
+/**
+ * @since 3.0
+ * $Id$
+ * TODO SERVLET3 - Add comments
+ */
+public interface Registration {
+
+ public boolean setInitParameter(String name, String value)
+ throws IllegalArgumentException, IllegalStateException;
+
+ public Set<String> setInitParameters(Map<String,String> initParameters)
+ throws IllegalArgumentException, IllegalStateException;
+
+ public interface Dynamic {
+
+ public void setDescription(String description)
+ throws IllegalStateException;
+
+ public void setAsyncSupported(boolean isAsyncSupported)
+ throws IllegalStateException;
+ }
+}
public interface RequestDispatcher {
-
+ public static final String ERROR_EXCEPTION =
+ "javax.servlet.error.exception";
+ public static final String ERROR_EXCEPTION_TYPE =
+ "javax.servlet.error.exception_type";
+ public static final String ERROR_MESSAGE =
+ "javax.servlet.error.message";
+ public static final String ERROR_REQUEST_URI =
+ "javax.servlet.error.request_uri";
+ public static final String ERROR_SERVLET_NAME =
+ "javax.servlet.error.servlet_name";
+ public static final String ERROR_STATUS_CODE =
+ "javax.servlet.error.status_code";
+ public static final String FORWARD_CONTEXT_PATH =
+ "javax.servlet.forward.context_path";
+ public static final String FORWARD_PATH_INFO =
+ "javax.servlet.forward.path_info";
+ public static final String FORWARD_QUERY_STRING =
+ "javax.servlet.forward.query_string";
+ public static final String FORWARD_REQUEST_URI =
+ "javax.servlet.forward.request_uri";
+ public static final String FORWARD_SERVLET_PATH =
+ "javax.servlet.forward.servlet_path";
+ public static final String INCLUDE_CONTEXT_PATH =
+ "javax.servlet.include.context_path";
+ public static final String INCLUDE_PATH_INFO =
+ "javax.servlet.include.path_info";
+ public static final String INCLUDE_QUERY_STRING =
+ "javax.servlet.include.query_string";
+ public static final String INCLUDE_REQUEST_URI =
+ "javax.servlet.include.request_uri";
+ public static final String INCLUDE_SERVLET_PATH =
+ "javax.servlet.include.servlet_path";
--- /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 3.0
+ * $Id$
+ * TODO SERVLET3 - Add comments
+ */
+public interface ServletContainerInitializer {
+ public void onStartup(java.util.Set<java.lang.Class<?>> c,
+ ServletContext ctx);
+}
import java.net.URL;
import java.util.EnumSet;
import java.util.Enumeration;
-import java.util.Map;
import java.util.Set;
-
/**
*
* 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";
/**
* Returns a <code>ServletContext</code> object that
public Enumeration<String> getInitParameterNames();
-
+ /**
+ *
+ * @param name
+ * @param value
+ * @return
+ * @throws IllegalStateException
+ * @since Servlet 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.
/**
*
* @param servletName
- * @param description
* @param className
- * @param initParameters
- * @param loadOnStartup
- * @throws IllegalArgumentException If the servlet name already exists
* @throws IllegalStateException If the context has already been
* initialised
* @since 3.0
*/
- public void addServlet(String servletName, String description,
- String className, Map<String,String> initParameters,
- int loadOnStartup)
- throws IllegalArgumentException, IllegalStateException;
+ public ServletRegistration.Dynamic addServlet(String servletName,
+ String className);
/**
*
* @param servletName
- * @param urlPatterns
- * @throws IllegalArgumentException If urlPatters is null or empty
+ * @param servlet
+ * @since 3.0
* @throws IllegalStateException If the context has already been
* initialised
+ */
+ public ServletRegistration.Dynamic addServlet(String servletName,
+ Servlet servlet);
+
+
+ /**
*
+ * @param servletName
+ * @param servletClass
* @since 3.0
+ * @throws IllegalStateException If the context has already been
+ * initialised
*/
- public void addServletMapping(String servletName, String[] urlPatterns)
- throws IllegalArgumentException, IllegalStateException;
+ public ServletRegistration.Dynamic addServlet(String servletName,
+ Class<? extends Servlet> servletClass);
+
+
+ /**
+ *
+ * @param c
+ * @return
+ * @throws ServletException
+ * @since Servlet 3.0
+ */
+ public <T extends Servlet> T createServlet(Class<T> c)
+ throws ServletException;
+
+
+ /**
+ *
+ * @param servletName
+ * @return
+ * @since Servlet 3.0
+ */
+ public ServletRegistration findServletRegistration(String servletName);
+
/**
*
* @param filterName
- * @param description
* @param className
- * @param initParameters
- * @throws IllegalArgumentException If the filter name already exists
* @throws IllegalStateException If the context has already been
* initialised
*
* @since 3.0
*/
- public void addFilter(String filterName, String description,
- String className, Map<String,String> initParameters)
- throws IllegalArgumentException, IllegalStateException;
+ public FilterRegistration.Dynamic addFilter(String filterName,
+ String className);
+
/**
*
* @param filterName
- * @param dispatcherTypes
- * @param isMatchAfter
- * @param servletNames
- * @throws IllegalArgumentException If servletNames is null or empty
+ * @param filter
* @throws IllegalStateException If the context has already been
* initialised
+ *
* @since 3.0
*/
- public void addFilterMappingForServletNames(String filterName,
- EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
- String... servletNames)
- throws IllegalArgumentException, IllegalStateException;
+ public FilterRegistration.Dynamic addFilter(String filterName,
+ Filter filter);
+
/**
*
* @param filterName
- * @param dispatcherTypes
- * @param isMatchAfter
- * @param urlPatterns
-4 *
+ * @param filterClass
+ * @throws IllegalStateException If the context has already been
+ * initialised
+ *
* @since 3.0
*/
- public void addFilterMappingForUrlPatterns(String filterName,
- EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
- String... urlPatterns)
- throws IllegalArgumentException, IllegalStateException;
+ public FilterRegistration.Dynamic addFilter(String filterName,
+ Class<? extends Filter> filterClass);
/**
*
- * @param sessionCookieConfig
- * @throws IllegalStateException If the context has already been
- * initialised
- * @since 3.0
+ * @param c
+ * @return
+ * @throws ServletException
+ * @since Servlet 3.0
*/
- public void setSessionCookieConfig(SessionCookieConfig sessionCookieConfig)
- throws IllegalStateException;
+ public <T extends Filter> T createFilter(Class<T> c)
+ throws ServletException;
+
/**
*
+ * @param filterName
+ * @return
+ * @since Servlet 3.0
+ */
+ public FilterRegistration findFilterRegistration(String filterName);
+
+
+ /**
+ *
* @return
* @since 3.0
*/
*/
public EnumSet<SessionTrackingMode> getEffectiveSessionTrackingModes();
- /**
- *
- * @param path
- * @return
- * @since 3.0
- */
- public AsyncDispatcher getAsyncDispatcher(String path);
}
--- /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.Set;
+
+/**
+ * @since 3.0
+ * $Id$
+ * TODO SERVLET3 - Add comments
+ */
+public interface ServletRegistration extends Registration {
+
+ /**
+ *
+ * @param urlPatterns
+ * @return
+ * @throws IllegalArgumentException if urlPattern is null or empty
+ * @throws IllegalStateException if the associated ServletContext has
+ * already been initialised
+ */
+ public Set<String> addMapping(String... urlPatterns);
+
+ public static interface Dynmaic
+ extends ServletRegistration, Registration.Dynamic {
+
+ }
+}
* this request
* @since 3.0
*/
- public void startAsync() throws java.lang.IllegalStateException;
+ public AsyncContext startAsync();
/**
*
- * @param runnable
+ * @param servletRequest
+ * @param servletResponse
* @return
* @throws java.lang.IllegalStateException
* @since 3.0
*/
- public void startAsync(Runnable runnable)
- throws java.lang.IllegalStateException;
+ public AsyncContext startAsync(ServletRequest servletRequest,
+ ServletResponse servletResponse);
/**
*
/**
*
- * @throws IllegalStateException If startAsync was never called
- * @since 3.0
- */
- public void doneAsync() throws IllegalStateException;
-
- /**
- *
* @return
* @since 3.0
*/
/**
*
* @return
+ * @throws java.lang.IllegalStateException
* @since 3.0
*/
- public AsyncDispatcher getAsyncDispatcher();
+ public AsyncContext getAsyncContext();
/**
*
- * @param path
- * @return
+ * @param listener
* @since 3.0
*/
- public AsyncDispatcher getAsyncDispatcher(String path);
+ public void addAsyncListener(AsyncListener listener);
/**
*
public void addAsyncListener(AsyncListener listener,
ServletRequest servletRequest, ServletResponse servletResponse);
+ /**
+ *
+ * @param timeout
+ * @throws java.lang.IllegalStateException
+ * @since 3.0
+ */
+ public void setAsyncTimeout(long timeout);
+
+
+ /**
+ *
+ * @return
+ * @since 3.0
+ */
+ public long getAsyncTimeout();
+
+
+ /**
+ *
+ * @return
+ * @since 3.0
+ */
+ public DispatcherType getDispatcherType();
}
* @throws java.lang.IllegalStateException
* @since 3.0
*/
- public void startAsync() throws java.lang.IllegalStateException {
- request.startAsync();
+ public AsyncContext startAsync() {
+ return request.startAsync();
}
/**
* The default behavior of this method is to return
* startAsync(Runnable) on the wrapped request object.
*
- * @param runnable
+ * @param servletRequest
+ * @param servletResponse
* @return
* @throws java.lang.IllegalStateException
* @since 3.0
*/
- public void startAsync(Runnable runnable)
+ public AsyncContext startAsync(ServletRequest servletRequest,
+ ServletResponse servletResponse)
throws java.lang.IllegalStateException {
- request.startAsync(runnable);
+ return request.startAsync(servletRequest, servletResponse);
}
/**
/**
* The default behavior of this method is to return
- * doneAsync() on the wrapped request object.
- * @throws java.lang.IllegalStateException
- * @since 3.0
- */
- public void doneAsync() throws IllegalStateException {
- request.doneAsync();
- }
-
- /**
- * The default behavior of this method is to return
* isAsyncSupported() on the wrapped request object.
*
* @return
/**
* The default behavior of this method is to return
- * getAsyncDispatcher() on the wrapped request object.
+ * getAsyncContext() on the wrapped request object.
*
* @return
* @since 3.0
*/
- public AsyncDispatcher getAsyncDispatcher() {
- return request.getAsyncDispatcher();
+ public AsyncContext getAsyncContext() {
+ return request.getAsyncContext();
}
/**
- * The default behavior of this method is to return
- * getAsyncDispatcher(path) on the wrapped request object.
+ * The default behavior of this method is to call
+ * addAsyncListener(AsyncListener) on the wrapped request object.
*
- * @return
+ * @param listener
* @since 3.0
*/
- public AsyncDispatcher getAsyncDispatcher(String path) {
- return request.getAsyncDispatcher(path);
+ public void addAsyncListener(AsyncListener listener) {
+ request.addAsyncListener(listener);
}
-
+
/**
* The default behavior of this method is to call
* addAsyncListener(AsyncListener, ServletRequest, ServletResponse) on the
request.addAsyncListener(listener, servletRequest, servletResponse);
}
+ /**
+ * The default behavior of this method is to call
+ * setAsyncTimeout(long) on the wrapped request object.
+ *
+ * @param listener
+ * @since 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 3.0
+ */
+ public long getAsyncTimeout() {
+ return request.getAsyncTimeout();
+ }
+
+ /**
+ *
+ * @param listener
+ * @since 3.0
+ */
+ public boolean isWrapperFor(ServletRequest wrapped) {
+ if (request == wrapped) {
+ return true;
+ }
+ if (request instanceof ServletRequestWrapper) {
+ return ((ServletRequestWrapper)request).isWrapperFor(wrapped);
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @param listener
+ * @since 3.0
+ */
+ public boolean isWrapperFor(Class<? extends ServletRequest> wrappedType) {
+ if (wrappedType.isAssignableFrom(request.getClass())) {
+ return true;
+ }
+ if (request instanceof ServletRequestWrapper) {
+ return ((ServletRequestWrapper)request).isWrapperFor(wrappedType);
+ }
+ return false;
+ }
+
+ /**
+ * The default behavior of this method is to call
+ * getDispatcherType() on the wrapped request object.
+ *
+ * @since 3.0
+ */
+ public DispatcherType getDispatcherType() {
+ return this.request.getDispatcherType();
+ }
}
return this.response.getLocale();
}
+ /**
+ *
+ * @param listener
+ * @since 3.0
+ */
+ public boolean isWrapperFor(ServletResponse wrapped) {
+ if (response == wrapped) {
+ return true;
+ }
+ if (response instanceof ServletResponseWrapper) {
+ return ((ServletResponseWrapper)response).isWrapperFor(wrapped);
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @param listener
+ * @since 3.0
+ */
+ public boolean isWrapperFor(Class<? extends ServletResponse> wrappedType) {
+ if (wrappedType.isAssignableFrom(response.getClass())) {
+ return true;
+ }
+ if (response instanceof ServletResponseWrapper) {
+ return ((ServletResponseWrapper)response).isWrapperFor(wrappedType);
+ }
+ return false;
+ }
+
}
* @since 3.0
* $Id$
*/
-public class SessionCookieConfig {
- private String domain;
- private String path;
- private String comment;
- private boolean httpOnly;
- private boolean secure;
-
+public interface SessionCookieConfig {
+
+ /**
+ *
+ * @param name
+ * @throws IllegalStateException
+ */
+ public void setName(String name);
+
+ public String getName();
+
/**
*
- * @param domain Domain to use for session cookies generated for a
- * {@link ServletContext} in which this
- * {@link SessionCookieConfig} has been set
- * @param path Path to use for session cookies generated for a
- * {@link ServletContext} in which this
- * {@link SessionCookieConfig} has been set. If null
- * {@link ServletContext#getContextPath()} is used
- * @param comment Comment to use for session cookies generated for a
- * {@link ServletContext} in which this
- * {@link SessionCookieConfig} has been set
- * @param isHttpOnly HttpOnly flag to use for session cookies generated for
- * a {@link ServletContext} in which this
- * {@link SessionCookieConfig} has been set
- * @param isSecure If <code>true</code>, the cookie will always be marked
- * as secure. If <code>false</code> the cookie will only
- * be marked as secure if the request is secure.
+ * @param domain
+ * @throws IllegalStateException
*/
- public SessionCookieConfig(String domain, String path, String comment,
- boolean isHttpOnly, boolean isSecure) {
- this.domain = domain;
- this.path = path;
- this.comment = comment;
- this.httpOnly = isHttpOnly;
- this.secure = isSecure;
- }
+ public void setDomain(String domain);
- public java.lang.String getDomain() {
- return domain;
- }
+ public String getDomain();
- public java.lang.String getPath() {
- return path;
- }
+ /**
+ *
+ * @param path
+ * @throws IllegalStateException
+ */
+ public void setPath(String path);
+
+ public String getPath();
+
+ /**
+ *
+ * @param comment
+ * @throws IllegalStateException
+ */
+ public void setComment(String comment);
- public java.lang.String getComment() {
- return comment;
- }
+ public String getComment();
+
+ /**
+ *
+ * @param httpOnly
+ * @throws IllegalStateException
+ */
+ public void setHttpOnly(boolean httpOnly);
+
+ public boolean isHttpOnly();
+
+ /**
+ *
+ * @param secure
+ * @throws IllegalStateException
+ */
+ public void setSecure(boolean secure);
+
+ public boolean isSecure();
+
+ /**
+ *
+ * @param maxAge
+ * @throws IllegalStateException
+ */
+ public void setMaxAge(int MaxAge);
- public boolean isHttpOnly() {
- return httpOnly;
- }
+ public int getHttpOnly();
- public boolean isSecure() {
- return secure;
- }
}
*/
public enum SessionTrackingMode {
COOKIE,
- SSL,
- URL
+ URL,
+ SSL
}
--- /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.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @since 3.0
+ * $Id$
+ * TODO SERVLET3
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface HandlesTypes {
+ Class<?>[] value();
+}
+++ /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.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 "";
-}
--- /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.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @since 3.0
+ * $Id$
+ * TODO SERVLET3
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface MultipartConfig {
+ String location() default "";
+ int maxFileSize() default 0;
+ int maxRequestSize() default 0;
+ 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.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;
-}
--- /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.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 WebFilter {
+ String description() default "";
+ String displayName() default "";
+ WebInitParam[] initParams() default {};
+ String filterName() default "";
+ String smallIcon() default "";
+ String largeIcon() default "";
+ String[] servletNames() default {};
+ String[] value() default {};
+ String[] urlPatterns() default {};
+ DispatcherType[] dispatcherTypes() default {DispatcherType.REQUEST};
+ boolean asyncSupported() default false;
+}
--- /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.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 WebInitParam {
+ String name();
+ String value();
+ String description() 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.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 WebListener {
+ String description();
+}
String[] value() default {};
String[] urlPatterns() default {};
int loadOnStartup() default -1;
- InitParam[] initParams() default {};
+ WebInitParam[] initParams() default {};
boolean asyncSupported() default false;
- long asyncTimeout() default 60000L;
- String icon() default "";
+ String smallIcon() default "";
+ String largeIcon() default "";
String description() 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.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 "";
-}
package javax.servlet.http;
+import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
+
+import java.io.IOException;
import java.util.Enumeration;
/**
public boolean isRequestedSessionIdFromUrl();
+ /**
+ *
+ * @param response
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ * @since Servlet 3.0
+ */
+ public boolean login(HttpServletResponse response)
+ throws IOException, ServletException;
+
+
+ /**
+ *
+ * @param username
+ * @param password
+ * @throws ServletException
+ * @since Servlet 3.0
+ */
+ public void login(java.lang.String username, String password)
+ throws ServletException;
+
+ /**
+ *
+ * @throws ServletException
+ * @since Servlet 3.0
+ */
+ public void logout() throws ServletException;
+
+
+ /**
+ *
+ * @return
+ * @since Servlet 3.0
+ */
+ public Iterable<Part> getParts();
+
+
+ /**
+ *
+ * @param name
+ * @return
+ * @throws IllegalArgumentException
+ * @since Servlet 3.0
+ */
+ public Part getPart(java.lang.String name);
}
*/
package javax.servlet.http;
+import javax.servlet.ServletException;
import javax.servlet.ServletRequestWrapper;
+
+import java.io.IOException;
import java.util.Enumeration;
/**
return this._getHttpServletRequest().isRequestedSessionIdFromUrl();
}
+ /**
+ * @since Servlet 3.0
+ */
+ public boolean login(HttpServletResponse response)
+ throws IOException, ServletException {
+ return this._getHttpServletRequest().login(response);
+ }
+
+ /**
+ * @since Servlet 3.0
+ */
+ public void login(String username, String password) throws ServletException {
+ this._getHttpServletRequest().login(username, password);
+ }
+
+ /**
+ * @since Servlet 3.0
+ */
+ public void logout() throws ServletException {
+ this._getHttpServletRequest().logout();
+ }
+
+
+ /**
+ * @since Servlet 3.0
+ */
+ public Iterable<Part> getParts() {
+ return this._getHttpServletRequest().getParts();
+ }
+
+ /**
+ * @since Servlet 3.0
+ */
+ public Part getPart(String name) {
+ return this._getHttpServletRequest().getPart(name);
+ }
-
}
public void setStatus(int sc, String sm);
+ /**
+ *
+ * @return
+ * @since Servlet 3.0
+ */
+ public int getStatus();
+
+
+ /**
+ *
+ * @param name
+ * @return
+ * @since Servlet 3.0
+ */
+ public String getHeader(String name);
+
+
+ /**
+ *
+ * @param name
+ * @return
+ * @since Servlet 3.0
+ */
+ public Iterable<String> getHeaders(String name);
+
+
+ /**
+ *
+ * @return
+ * @since Servlet 3.0
+ */
+ public Iterable<String> getHeaderNames();
+
+
/*
* Server status codes; see RFC 2068.
*/
this._getHttpServletResponse().setStatus(sc, sm);
}
-
+
+ /**
+ * @since Servlet 3.0
+ */
+ public int getStatus() {
+ return this._getHttpServletResponse().getStatus();
+ }
+
+
+ /**
+ * @since Servlet 3.0
+ */
+ public String getHeader(String name) {
+ return this._getHttpServletResponse().getHeader(name);
+ }
+
+
+ /**
+ * @since Servlet 3.0
+ */
+ public Iterable<String> getHeaders(String name) {
+ return this._getHttpServletResponse().getHeaders(name);
+ }
+
+ /**
+ * @since Servlet 3.0
+ */
+ public Iterable<String> getHeaderNames() {
+ return this._getHttpServletResponse().getHeaderNames();
+ }
+
}
--- /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.http;
+
+import javax.servlet.ServletInputStream;
+import java.util.Hashtable;
+import java.util.ResourceBundle;
+import java.util.StringTokenizer;
+import java.io.IOException;
+
+/**
+ * @deprecated As of Java(tm) Servlet API 2.3.
+ * These methods were only useful
+ * with the default encoding and have been moved
+ * to the request interfaces.
+ *
+*/
+
+
+public class HttpUtils {
+
+ private static final String LSTRING_FILE =
+ "javax.servlet.http.LocalStrings";
+ private static ResourceBundle lStrings =
+ ResourceBundle.getBundle(LSTRING_FILE);
+
+
+ /**
+ * Constructs an empty <code>HttpUtils</code> object.
+ *
+ */
+ public HttpUtils() {
+ // NOOP
+ }
+
+
+ /**
+ *
+ * Parses a query string passed from the client to the
+ * server and builds a <code>HashTable</code> object
+ * with key-value pairs.
+ * The query string should be in the form of a string
+ * packaged by the GET or POST method, that is, it
+ * should have key-value pairs in the form <i>key=value</i>,
+ * with each pair separated from the next by a & character.
+ *
+ * <p>A key can appear more than once in the query string
+ * with different values. However, the key appears only once in
+ * the hashtable, with its value being
+ * an array of strings containing the multiple values sent
+ * by the query string.
+ *
+ * <p>The keys and values in the hashtable are stored in their
+ * decoded form, so
+ * any + characters are converted to spaces, and characters
+ * sent in hexadecimal notation (like <i>%xx</i>) are
+ * converted to ASCII characters.
+ *
+ * @param s a string containing the query to be parsed
+ *
+ * @return a <code>HashTable</code> object built
+ * from the parsed key-value pairs
+ *
+ * @exception IllegalArgumentException if the query string
+ * is invalid
+ *
+ */
+ static public Hashtable<String,String[]> parseQueryString(String s) {
+
+ String valArray[] = null;
+
+ if (s == null) {
+ throw new IllegalArgumentException();
+ }
+ Hashtable<String,String[]> ht = new Hashtable<String,String[]>();
+ StringBuffer sb = new StringBuffer();
+ StringTokenizer st = new StringTokenizer(s, "&");
+ while (st.hasMoreTokens()) {
+ String pair = st.nextToken();
+ int pos = pair.indexOf('=');
+ if (pos == -1) {
+ // XXX
+ // should give more detail about the illegal argument
+ throw new IllegalArgumentException();
+ }
+ String key = parseName(pair.substring(0, pos), sb);
+ String val = parseName(pair.substring(pos+1, pair.length()), sb);
+ if (ht.containsKey(key)) {
+ String oldVals[] = ht.get(key);
+ valArray = new String[oldVals.length + 1];
+ for (int i = 0; i < oldVals.length; i++)
+ valArray[i] = oldVals[i];
+ valArray[oldVals.length] = val;
+ } else {
+ valArray = new String[1];
+ valArray[0] = val;
+ }
+ ht.put(key, valArray);
+ }
+ return ht;
+ }
+
+
+ /**
+ *
+ * Parses data from an HTML form that the client sends to
+ * the server using the HTTP POST method and the
+ * <i>application/x-www-form-urlencoded</i> MIME type.
+ *
+ * <p>The data sent by the POST method contains key-value
+ * pairs. A key can appear more than once in the POST data
+ * with different values. However, the key appears only once in
+ * the hashtable, with its value being
+ * an array of strings containing the multiple values sent
+ * by the POST method.
+ *
+ * <p>The keys and values in the hashtable are stored in their
+ * decoded form, so
+ * any + characters are converted to spaces, and characters
+ * 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>
+ * object that is also passed to this
+ * method
+ *
+ * @param in the <code>ServletInputStream</code>
+ * object that contains the data sent
+ * from the client
+ *
+ * @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
+ *
+ */
+ static public Hashtable<String,String[]> parsePostData(int len,
+ ServletInputStream in) {
+ // XXX
+ // should a length of 0 be an IllegalArgumentException
+
+ // cheap hack to return an empty hash
+ if (len <=0)
+ return new Hashtable<String,String[]>();
+
+ if (in == null) {
+ throw new IllegalArgumentException();
+ }
+
+ // Make sure we read the entire POSTed body.
+ byte[] postedBytes = new byte [len];
+ try {
+ int offset = 0;
+
+ do {
+ int inputLen = in.read (postedBytes, offset, len - offset);
+ if (inputLen <= 0) {
+ String msg = lStrings.getString("err.io.short_read");
+ throw new IllegalArgumentException (msg);
+ }
+ offset += inputLen;
+ } while ((len - offset) > 0);
+
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+
+ // XXX we shouldn't assume that the only kind of POST body
+ // is FORM data encoded using ASCII or ISO Latin/1 ... or
+ // that the body should always be treated as FORM data.
+ try {
+ String postedBody = new String(postedBytes, 0, len, "8859_1");
+ return parseQueryString(postedBody);
+ } catch (java.io.UnsupportedEncodingException e) {
+ // XXX function should accept an encoding parameter & throw this
+ // exception. Otherwise throw something expected.
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+
+
+ /*
+ * Parse a name in the query string.
+ */
+ static private String parseName(String s, StringBuffer sb) {
+ sb.setLength(0);
+ for (int i = 0; i < s.length(); i++) {
+ char c = s.charAt(i);
+ switch (c) {
+ case '+':
+ sb.append(' ');
+ break;
+ case '%':
+ try {
+ sb.append((char) Integer.parseInt(s.substring(i+1, i+3),
+ 16));
+ i += 2;
+ } catch (NumberFormatException e) {
+ // XXX
+ // need to be more specific about illegal arg
+ throw new IllegalArgumentException();
+ } catch (StringIndexOutOfBoundsException e) {
+ String rest = s.substring(i);
+ sb.append(rest);
+ if (rest.length()==2)
+ i++;
+ }
+
+ break;
+ default:
+ sb.append(c);
+ break;
+ }
+ }
+ return sb.toString();
+ }
+
+
+ /**
+ *
+ * Reconstructs the URL the client used to make the request,
+ * using information in the <code>HttpServletRequest</code> object.
+ * The returned URL contains a protocol, server name, port
+ * number, and server path, but it does not include query
+ * string parameters.
+ *
+ * <p>Because this method returns a <code>StringBuffer</code>,
+ * not a string, you can modify the URL easily, for example,
+ * to append query parameters.
+ *
+ * <p>This method is useful for creating redirect messages
+ * and for reporting errors.
+ *
+ * @param req a <code>HttpServletRequest</code> object
+ * containing the client's request
+ *
+ * @return a <code>StringBuffer</code> object containing
+ * the reconstructed URL
+ *
+ */
+ public static StringBuffer getRequestURL (HttpServletRequest req) {
+ StringBuffer url = new StringBuffer ();
+ String scheme = req.getScheme ();
+ int port = req.getServerPort ();
+ String urlPath = req.getRequestURI();
+
+ url.append (scheme); // http, https
+ url.append ("://");
+ url.append (req.getServerName ());
+ if ((scheme.equals ("http") && port != 80)
+ || (scheme.equals ("https") && port != 443)) {
+ url.append (':');
+ url.append (req.getServerPort ());
+ }
+
+ url.append(urlPath);
+ return url;
+ }
+}
+
+
+
--- /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.http;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @since Servlet 3.0
+ */
+public interface Part {
+ public InputStream getInputStream() throws IOException;
+ public String getContentType();
+ public String getName();
+ public long getSize();
+ 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();
+}
req.serverName().setString(proxyName);
}
- // Parse session Id
+ // Parse session Id before decoding / removal of path params
parseSessionId(req, request);
// URI decoding
import java.util.TreeMap;
import javax.security.auth.Subject;
-import javax.servlet.AsyncDispatcher;
+import javax.servlet.AsyncContext;
import javax.servlet.AsyncListener;
+import javax.servlet.DispatcherType;
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;
import javax.servlet.SessionTrackingMode;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import javax.servlet.http.Part;
import org.apache.tomcat.util.buf.B2CConverter;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.catalina.realm.GenericPrincipal;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.ParameterMap;
-import org.apache.catalina.util.RequestUtil;
import org.apache.catalina.util.StringManager;
import org.apache.catalina.util.StringParser;
return context.getServletContext();
}
- public void startAsync() throws IllegalStateException {
+ public AsyncContext startAsync() {
// TODO SERVLET3
+ return null;
}
- public void startAsync(Runnable runnable) throws IllegalStateException {
+ public AsyncContext startAsync(ServletRequest request,
+ ServletResponse response) {
// TODO SERVLET3
+ return null;
}
public boolean isAsyncStarted() {
return false;
}
- public void doneAsync() throws IllegalStateException {
- // TODO SERVLET3
- }
-
public boolean isAsyncSupported() {
// TODO SERVLET3
return false;
}
- public AsyncDispatcher getAsyncDispatcher() {
+ public AsyncContext getAsyncContext() {
// TODO SERVLET3
return null;
}
- public AsyncDispatcher getAsyncDispatcher(String path) {
+ public void addAsyncListener(AsyncListener listener) {
// TODO SERVLET3
- return null;
}
-
public void addAsyncListener(AsyncListener listener,
ServletRequest servletRequest, ServletResponse servletResponse) {
// TODO SERVLET3
}
+ public void setAsyncTimeout(long timeout) {
+ // TODO SERVLET3
+ }
+
+ public long getAsyncTimeout() {
+ // TODO SERVLET3
+ return 0;
+ }
+
+ public DispatcherType getDispatcherType() {
+ // TODO SERVLET3
+ return null;
+ }
+
// ---------------------------------------------------- HttpRequest Methods
return requestedSessionSSL;
}
+ public boolean login(HttpServletResponse response) throws IOException {
+ // TODO Servlet 3
+ return false;
+ }
+
+ public void login(String username, String password)
+ throws ServletException {
+ // TODO Servlet 3
+ }
+
+ public void logout() throws ServletException {
+ // TODO Servlet 3
+ }
+
+ public Iterable<Part> getParts() {
+ // TODO Servlet 3
+ return null;
+ }
+ public Part getPart(String name) throws IllegalArgumentException {
+ // TODO Servlet 3.0
+ return null;
+ }
+
// ------------------------------------------------------ Protected Methods
import java.util.Locale;
import java.util.Map;
-import javax.servlet.AsyncDispatcher;
+import javax.servlet.AsyncContext;
import javax.servlet.AsyncListener;
+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 javax.servlet.http.Part;
import org.apache.catalina.Globals;
import org.apache.catalina.util.StringManager;
}
- public void startAsync() throws IllegalStateException {
- request.startAsync();
+ public AsyncContext startAsync() throws IllegalStateException {
+ return request.startAsync();
}
- public void startAsync(Runnable runnable) throws IllegalStateException {
- request.startAsync(runnable);
+ public AsyncContext startAsync(ServletRequest request, ServletResponse response)
+ throws IllegalStateException {
+ return request.startAsync(request, response);
}
}
- public void doneAsync() throws IllegalStateException {
- request.doneAsync();
- }
-
-
public boolean isAsyncSupported() {
return request.isAsyncStarted();
}
- public AsyncDispatcher getAsyncDispatcher() {
- return request.getAsyncDispatcher();
+ public void addAsyncListener(AsyncListener listener) {
+ request.addAsyncListener(listener);
}
- public AsyncDispatcher getAsyncDispatcher(String path) {
- return request.getAsyncDispatcher(path);
+ 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 addAsyncListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse) {
- request.addAsyncListener(listener,servletRequest,servletResponse);
+ public void setAsyncTimeout(long timeout) {
+ request.setAsyncTimeout(timeout);
+ }
+
+ public DispatcherType getDispatcherType() {
+ return request.getDispatcherType();
+ }
+
+ public boolean login(HttpServletResponse response) throws IOException {
+ return request.login(response);
}
+ public void login(String username, String password)
+ throws ServletException {
+ login(username, password);
+ }
+
+ public void logout() throws ServletException {
+ request.logout();
+ }
+
+ public Iterable<Part> getParts() {
+ return request.getParts();
+ }
+
+ public Part getPart(String name) {
+ return request.getPart(name);
+ }
public boolean getAllowTrace() {
return request.getConnector().getAllowTrace();
}
+
}
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.Vector;
/**
- * Return an array of all the header names set for this response, or
- * a zero-length array if no headers have been set.
+ * Return an Iterable of all the header names set for this response.
*/
- public String[] getHeaderNames() {
+ public Iterable<String> getHeaderNames() {
MimeHeaders headers = coyoteResponse.getMimeHeaders();
int n = headers.size();
- String[] result = new String[n];
+ List<String> result = new ArrayList<String>(n);
for (int i = 0; i < n; i++) {
- result[i] = headers.getName(i).toString();
+ result.add(headers.getName(i).toString());
}
return result;
/**
- * 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.
+ * Return an Iterable of all the header values associated with the
+ * specified header name.
*
* @param name Header name to look up
*/
- public String[] getHeaderValues(String name) {
+ public Iterable<String> getHeaders(String name) {
Enumeration<String> enumeration =
coyoteResponse.getMimeHeaders().values(name);
while (enumeration.hasMoreElements()) {
result.addElement(enumeration.nextElement());
}
- String[] resultArray = new String[result.size()];
- result.copyInto(resultArray);
- return resultArray;
-
+ return result;
}
response.setCharacterEncoding(arg0);
}
+ public int getStatus() {
+ return response.getStatus();
+ }
+
+ public String getHeader(String name) {
+ return response.getHeader(name);
+ }
+
+ public Iterable<String> getHeaderNames() {
+ return response.getHeaderNames();
+ }
+
+ public Iterable<String> getHeaders(String name) {
+ return response.getHeaders(name);
+ }
}
import javax.naming.Binding;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;
-import javax.servlet.AsyncDispatcher;
-import javax.servlet.DispatcherType;
+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;
import org.apache.catalina.Host;
import org.apache.catalina.Wrapper;
import org.apache.catalina.deploy.ApplicationParameter;
-import org.apache.catalina.deploy.FilterDef;
-import org.apache.catalina.deploy.FilterMap;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.RequestUtil;
import org.apache.catalina.util.ResourceSet;
}
- public void addFilter(String filterName, String description,
- String className, Map<String, String> initParameters)
- throws IllegalArgumentException, IllegalStateException {
+ public FilterRegistration.Dynamic addFilter(String filterName,
+ String className) throws IllegalStateException {
+
+ if (context.initialized) {
+ //TODO Spec breaking enhancement to ignore this restriction
+ throw new IllegalStateException(
+ sm.getString("applicationContext.addFilter.ise",
+ getContextPath()));
+ }
if (context.findFilterDef(filterName) != null) {
- throw new IllegalArgumentException(sm.getString(
- "applicationContext.addFilter.iae", filterName,
- getContextPath()));
+ return null;
}
+ // TODO Servlet 3
+ return null;
+ }
+
+
+ public FilterRegistration.Dynamic addFilter(String filterName,
+ Filter filter) throws IllegalStateException {
+
if (context.initialized) {
//TODO Spec breaking enhancement to ignore this restriction
throw new IllegalStateException(
sm.getString("applicationContext.addFilter.ise",
getContextPath()));
}
- FilterDef filterDef = new FilterDef();
- filterDef.setFilterName(filterName);
- filterDef.setDescription(description);
- filterDef.setFilterClass(className);
- filterDef.getParameterMap().putAll(initParameters);
- context.addFilterDef(filterDef);
+
+ if (context.findFilterDef(filterName) != null) {
+ return null;
+ }
+
+ // TODO Servlet 3
+ return null;
}
- public void addServlet(String servletName, String description,
- String className, Map<String, String> initParameters,
- int loadOnStartup)
- throws IllegalArgumentException, IllegalStateException {
+ public FilterRegistration.Dynamic addFilter(String filterName,
+ Class<? extends Filter> filterClass) throws IllegalStateException {
- if (context.findFilterDef(servletName) != null) {
- throw new IllegalArgumentException(sm.getString(
- "applicationContext.addServlet.iae", servletName,
- getContextPath()));
- }
-
if (context.initialized) {
//TODO Spec breaking enhancement to ignore this restriction
throw new IllegalStateException(
- sm.getString("applicationContext.addServlet.ise",
+ sm.getString("applicationContext.addFilter.ise",
getContextPath()));
}
- Wrapper wrapper = context.createWrapper();
- wrapper.setName(servletName);
- // Description is ignored
- wrapper.setServletClass(className);
- for (Map.Entry<String,String> initParam : initParameters.entrySet()) {
- wrapper.addInitParameter(initParam.getKey(), initParam.getValue());
+
+ if (context.findFilterDef(filterName) != null) {
+ return null;
}
- wrapper.setLoadOnStartup(loadOnStartup);
- context.addChild(wrapper);
+
+ // TODO Servlet 3
+ return null;
}
+
+ public <T extends Filter> T createFilter(Class<T> c)
+ throws ServletException {
+ // TODO Servlet 3
+ return null;
+ }
- public void addFilterMappingForServletNames(String filterName,
- EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
- String... servletNames)
- throws IllegalArgumentException, IllegalStateException {
-
- if (servletNames == null || servletNames.length == 0) {
- throw new IllegalArgumentException(sm.getString(
- "applicationContext.addFilterMapping.iae.servlet"));
- }
+ public FilterRegistration findFilterRegistration(String filterName) {
+ // TODO Servlet 3.0
+ return null;
+ }
+
+ public ServletRegistration.Dynmaic addServlet(String servletName,
+ String className) throws IllegalStateException {
+
if (context.initialized) {
//TODO Spec breaking enhancement to ignore this restriction
- throw new IllegalStateException(sm.getString(
- "applicationContext.addFilterMapping.ise",
- getContextPath()));
- }
- FilterMap filterMap = new FilterMap();
- for (String servletName : servletNames) {
- filterMap.addServletName(servletName);
- }
- filterMap.setFilterName(filterName);
- for (DispatcherType dispatcherType: dispatcherTypes) {
- filterMap.setDispatcher(dispatcherType.name());
+ throw new IllegalStateException(
+ sm.getString("applicationContext.addServlet.ise",
+ getContextPath()));
}
- if (isMatchAfter) {
- context.addFilterMap(filterMap);
- } else {
- context.addFilterMapBefore(filterMap);
+
+ if (context.findChild(servletName) != null) {
+ return null;
}
+
+ // TODO Servlet 3
+ return null;
}
- public void addFilterMappingForUrlPatterns(String filterName,
- EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
- String... urlPatterns)
- throws IllegalArgumentException, IllegalStateException {
-
- if (urlPatterns == null || urlPatterns.length == 0) {
- throw new IllegalArgumentException(sm.getString(
- "applicationContext.addFilterMapping.iae.url",
- getContextPath()));
- }
+ public ServletRegistration.Dynmaic addServlet(String servletName,
+ Servlet servlet) throws IllegalStateException {
if (context.initialized) {
//TODO Spec breaking enhancement to ignore this restriction
- throw new IllegalStateException(sm.getString(
- "applicationContext.addFilterMapping.ise",
- getContextPath()));
- }
- FilterMap filterMap = new FilterMap();
- for (String urlPattern : urlPatterns) {
- filterMap.addURLPattern(urlPattern);
- }
- filterMap.setFilterName(filterName);
- for (DispatcherType dispatcherType: dispatcherTypes) {
- filterMap.setDispatcher(dispatcherType.name());
+ throw new IllegalStateException(
+ sm.getString("applicationContext.addServlet.ise",
+ getContextPath()));
}
- if (isMatchAfter) {
- context.addFilterMap(filterMap);
- } else {
- context.addFilterMapBefore(filterMap);
+
+ if (context.findChild(servletName) != null) {
+ return null;
}
- }
+ // TODO Servlet 3
+ return null;
+ }
- public void addServletMapping(String servletName, String[] urlPatterns)
- throws IllegalArgumentException, IllegalStateException {
- if (urlPatterns == null || urlPatterns.length == 0) {
- throw new IllegalArgumentException(sm.getString(
- "applicationContext.addServletMapping.iae"));
- }
+
+ public ServletRegistration.Dynmaic addServlet(String servletName,
+ Class <? extends Servlet> servletClass)
+ throws IllegalStateException {
if (context.initialized) {
//TODO Spec breaking enhancement to ignore this restriction
- throw new IllegalStateException(sm.getString(
- "applicationContext.addServletMapping.ise", getContextPath()));
+ throw new IllegalStateException(
+ sm.getString("applicationContext.addServlet.ise",
+ getContextPath()));
}
- for (String urlPattern : urlPatterns) {
- boolean jspWildCard = ("*.jsp".equals(urlPattern));
- context.addServletMapping(servletName, urlPattern, jspWildCard);
+
+ if (context.findChild(servletName) != null) {
+ return null;
}
+
+ // TODO Servlet 3
+ return null;
}
+ public <T extends Servlet> T createServlet(Class<T> c)
+ throws ServletException {
+ // TODO Servlet 3
+ return null;
+ }
+
+
+ public ServletRegistration findServletRegistration(String servletName) {
+ // TODO Servlet 3.0
+ return null;
+ }
+
+
/**
* By default {@link SessionTrackingMode#URL} is always supported, {@link
* SessionTrackingMode#COOKIE} is supported unless the <code>cookies</code>
}
- public void setSessionCookieConfig(SessionCookieConfig sessionCookieConfig)
- throws IllegalArgumentException {
-
- if (context.initialized) {
- //TODO Spec breaking enhancement to ignore this restriction
- throw new IllegalStateException(sm.getString(
- "applicationContext.setSessionCookieConfig.ise",
- getContextPath()));
- }
-
- this.sessionCookieConfig = sessionCookieConfig;
- }
-
-
/**
* @throws IllegalStateException if the context has already been initialised
* @throws IllegalArgumentException If SSL is requested in combination with
}
- public AsyncDispatcher getAsyncDispatcher(String path) {
- // TODO SERVLET 3
- return null;
+ public boolean setInitParameter(String name, String value) {
+ // TODO Servlet 3
+ return false;
}
+
// -------------------------------------------------------- Package Methods
protected StandardContext getContext() {
return this.context;
import java.util.EnumSet;
import java.util.Enumeration;
import java.util.HashMap;
-import java.util.Map;
import java.util.Set;
-import javax.servlet.AsyncDispatcher;
-import javax.servlet.DispatcherType;
+import javax.servlet.Filter;
+import javax.servlet.FilterRegistration;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;
}
- public void addFilter(String filterName, String description,
- String className, Map<String, String> initParameters) {
+ public FilterRegistration.Dynamic addFilter(String filterName,
+ String className) {
if (SecurityUtil.isPackageProtectionEnabled()) {
- doPrivileged("addFilter", new Object[]{filterName, description,
- className, initParameters});
+ return (FilterRegistration.Dynamic) doPrivileged(
+ "addFilter", new Object[]{filterName, className});
} else {
- context.addFilter(filterName, description, className,
- initParameters);
+ return context.addFilter(filterName, className);
}
}
- public void addFilterMappingForServletNames(String filterName,
- EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
- String... servletNames) {
+ public FilterRegistration.Dynamic addFilter(String filterName,
+ Filter filter) {
if (SecurityUtil.isPackageProtectionEnabled()) {
- doPrivileged("addFilterMappingForServletNames",
- new Object[]{filterName, dispatcherTypes,
- Boolean.valueOf(isMatchAfter), servletNames});
+ return (FilterRegistration.Dynamic) doPrivileged(
+ "addFilter", new Object[]{filterName, filter});
} else {
- context.addFilterMappingForServletNames(filterName, dispatcherTypes,
- isMatchAfter, servletNames);
+ return context.addFilter(filterName, filter);
}
}
- public void addFilterMappingForUrlPatterns(String filterName,
- EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
- String... urlPatterns) {
+ public FilterRegistration.Dynamic addFilter(String filterName,
+ Class<? extends Filter> filterClass) {
if (SecurityUtil.isPackageProtectionEnabled()) {
- doPrivileged("addFilterMappingForUrlPatterns",
- new Object[]{filterName, dispatcherTypes,
- Boolean.valueOf(isMatchAfter), urlPatterns});
+ return (FilterRegistration.Dynamic) doPrivileged(
+ "addFilter", new Object[]{filterName, filterClass});
} else {
- context.addFilterMappingForUrlPatterns(filterName, dispatcherTypes,
- isMatchAfter, urlPatterns);
+ return context.addFilter(filterName, filterClass);
}
}
- public void addServlet(String servletName, String description,
- String className, Map<String, String> initParameters,
- int loadOnStartup) {
+ public <T extends Filter> T createFilter(Class<T> c)
+ throws ServletException {
if (SecurityUtil.isPackageProtectionEnabled()) {
- doPrivileged("addServlet", new Object[]{servletName, description,
- className, initParameters, Integer.valueOf(loadOnStartup)});
+ return (T) doPrivileged(
+ "createFilter", new Object[]{c});
} else {
- context.addServlet(servletName, description, className, initParameters,
- loadOnStartup);
+ return context.createFilter(c);
+ }
+ }
+
+
+ public FilterRegistration findFilterRegistration(String filterName) {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (FilterRegistration) doPrivileged(
+ "findFilterRegistration", new Object[]{filterName});
+ } else {
+ return context.findFilterRegistration(filterName);
}
}
- public void addServletMapping(String servletName, String[] urlPatterns) {
+ public ServletRegistration.Dynmaic addServlet(String servletName,
+ String className) {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (ServletRegistration.Dynmaic) doPrivileged(
+ "addServlet", new Object[]{servletName, className});
+ } else {
+ return context.addServlet(servletName, className);
+ }
+ }
+
+
+ public ServletRegistration.Dynmaic addServlet(String servletName,
+ Servlet servlet) {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (ServletRegistration.Dynmaic) doPrivileged(
+ "addServlet", new Object[]{servletName, servlet});
+ } else {
+ return context.addServlet(servletName, servlet);
+ }
+ }
+
+
+ public ServletRegistration.Dynmaic addServlet(String servletName,
+ Class <? extends Servlet> servletClass) {
if (SecurityUtil.isPackageProtectionEnabled()) {
- doPrivileged("addServletMapping",
- new Object[]{servletName, urlPatterns});
+ return (ServletRegistration.Dynmaic) doPrivileged(
+ "addServlet", new Object[]{servletName, servletClass});
} else {
- context.addServletMapping(servletName, urlPatterns);
+ return context.addServlet(servletName, servletClass);
}
}
+ 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 ServletRegistration findServletRegistration(String servletName) {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (ServletRegistration) doPrivileged(
+ "findServletRegistration", new Object[]{servletName});
+ } else {
+ return context.findServletRegistration(servletName);
+ }
+ }
+
+
public EnumSet<SessionTrackingMode> getDefaultSessionTrackingModes() {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (EnumSet<SessionTrackingMode>)
}
- public void setSessionCookieConfig(SessionCookieConfig sessionCookieConfig) {
- if (SecurityUtil.isPackageProtectionEnabled()) {
- doPrivileged("setSessionCookieConfig",
- new Object[]{sessionCookieConfig});
- } else {
- context.setSessionCookieConfig(sessionCookieConfig);
- }
- }
-
-
public void setSessionTrackingModes(
EnumSet<SessionTrackingMode> sessionTrackingModes) {
if (SecurityUtil.isPackageProtectionEnabled()) {
}
- public AsyncDispatcher getAsyncDispatcher(String path) {
+ public boolean setInitParameter(String name, String value) {
if (SecurityUtil.isPackageProtectionEnabled()) {
- return (AsyncDispatcher)
- doPrivileged("getAsyncDispatcher",
- new Object[]{path});
+ return ((Boolean) doPrivileged("setInitParameter",
+ new Object[]{name, value})).booleanValue();
} else {
- return context.getAsyncDispatcher(path);
+ return context.setInitParameter(name, value);
}
}
import java.util.Locale;
import java.util.Map;
-import javax.servlet.AsyncDispatcher;
+import javax.servlet.AsyncContext;
import javax.servlet.AsyncListener;
+import javax.servlet.DispatcherType;
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 javax.servlet.http.Part;
import org.apache.catalina.Context;
import org.apache.catalina.Host;
ServletResponse res) {}
public ServletContext getServletContext() { return null; }
public boolean isAsyncStarted() { return false; }
- public void doneAsync() {}
public boolean isAsyncSupported() { return false; }
- public void startAsync() throws IllegalStateException {}
- public void startAsync(Runnable runnable) throws IllegalStateException {}
- public AsyncDispatcher getAsyncDispatcher() { return null; }
- public AsyncDispatcher getAsyncDispatcher(String path) { return null; }
+ public AsyncContext startAsync() throws IllegalStateException {
+ return null;
+ }
+ public Part getPart(String name) { return null; }
+ public Iterable<Part> getParts() { 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 {}
+ 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; }
}
public void setLocale(Locale locale) {}
public Cookie[] getCookies() { return null; }
- public String getHeader(@SuppressWarnings("unused") String name) {
- return null;
- }
- public String[] getHeaderNames() { return null; }
+ public String getHeader(String name) { return null; }
+ public Iterable<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; }
}
# See the License for the specific language governing permissions and
# limitations under the License.
-applicationContext.addFilter.iae=The filter name {0} already exists in context {1}
applicationContext.addFilter.ise=Filters can not be added to context {0} as the context has been initialised
-applicationContext.addFilterMapping.iae.servlet=The list of servletNames provided was null or empty
-applicationContext.addFilterMapping.iae.url=The list of urlPatterns provided was null or empty
-applicationContext.addFilterMapping.ise=Filter mappings can not be added to context {0} as the context has been initialised
-applicationContext.addServlet.iae=The servlet name {0} already exists in context {1}
applicationContext.addServlet.ise=Servlets can not be added to context {0} as the context has been initialised
-applicationContext.addServletMapping.iae=The list of urlPatterns provided was null or empty
-applicationContext.addServletMapping.ise=Servlet mappings can not be added to context {0} as the context has been initialised
applicationContext.attributeEvent=Exception thrown by attributes event listener
applicationContext.mapping.error=Error during mapping
applicationContext.requestDispatcher.iae=Path {0} does not start with a "/" character
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
+import java.util.Iterator;
import java.util.List;
import java.util.TimeZone;
public void addElement(StringBuffer buf, Date date, Request request,
Response response, long time) {
if (null != response) {
- String[] values = response.getHeaderValues(header);
- if(values.length > 0) {
- for (int i = 0; i < values.length; i++) {
- String string = values[i];
- buf.append(string) ;
- if(i+1<values.length)
- buf.append(",");
+ Iterator<String> iter = response.getHeaders(header).iterator();
+ boolean first = true;
+ while (iter.hasNext()) {
+ if (!first) {
+ buf.append(",");
}
- return ;
+ buf.append(iter.next());
}
+ return ;
}
buf.append("-");
}
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
+import java.util.Iterator;
import java.util.List;
import java.util.TimeZone;
public void addElement(StringBuffer buf, Date date, Request request,
Response response, long time) {
- if (null != response) {
- String[] values = response.getHeaderValues(header);
- if(values.length > 0) {
+ if (null != response) {
+ Iterator<String> iter = response.getHeaders(header).iterator();
+ if (iter.hasNext()) {
StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < values.length; i++) {
- String string = values[i];
- buffer.append(string) ;
- if(i+1<values.length)
+ boolean first = true;
+ while (iter.hasNext()) {
+ if (!first) {
buffer.append(",");
+ }
+ buffer.append(iter.next());
}
buf.append(wrap(buffer.toString()));
- return ;
}
+ return ;
}
buf.append("-");
}
rcookies[i].getValue() + "; domain=" +
rcookies[i].getDomain() + "; path=" + rcookies[i].getPath());
}
- String rhnames[] = response.getHeaderNames();
- for (int i = 0; i < rhnames.length; i++) {
- String rhvalues[] = response.getHeaderValues(rhnames[i]);
- for (int j = 0; j < rhvalues.length; j++)
- log.info(" header=" + rhnames[i] + "=" + rhvalues[j]);
+ Iterable<String> rhnames = response.getHeaderNames();
+ for (String rhname : rhnames) {
+ Iterable<String> rhvalues = response.getHeaders(rhname);
+ for (String rhvalue : rhvalues)
+ log.info(" header=" + rhname + "=" + rhvalue);
}
log.info(" message=" + response.getMessage());
log.info(" remoteUser=" + request.getRemoteUser());
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.AsyncDispatcher;
-import javax.servlet.DispatcherType;
+import javax.servlet.Filter;
+import javax.servlet.FilterRegistration;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;
+import javax.servlet.FilterRegistration.Dynamic;
/**
}
- public void addFilter(String filterName, String description,
- String className, Map<String, String> initParameters) {
- // Do nothing
+ public FilterRegistration.Dynamic addFilter(String filterName,
+ String className) {
+ return null;
}
- public void addFilterMappingForServletNames(String filterName,
- EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
- String... servletNames) {
- // Do nothing
+ public ServletRegistration.Dynmaic addServlet(String servletName,
+ String className) {
+ return null;
}
- public void addFilterMappingForUrlPatterns(String filterName,
- EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
- String... urlPatterns) {
- // Do nothing
+ public EnumSet<SessionTrackingMode> getDefaultSessionTrackingModes() {
+ return EnumSet.noneOf(SessionTrackingMode.class);
}
- public void addServlet(String servletName, String description,
- String className, Map<String, String> initParameters,
- int loadOnStartup) throws IllegalArgumentException,
- IllegalStateException {
- // Do nothing
+ public EnumSet<SessionTrackingMode> getEffectiveSessionTrackingModes() {
+ return EnumSet.noneOf(SessionTrackingMode.class);
}
- public void addServletMapping(String servletName, String[] urlPatterns) {
+ public SessionCookieConfig getSessionCookieConfig() {
+ return null;
+ }
+
+
+ public void setSessionTrackingModes(
+ EnumSet<SessionTrackingMode> sessionTrackingModes) {
// Do nothing
}
- public EnumSet<SessionTrackingMode> getDefaultSessionTrackingModes() {
- return EnumSet.noneOf(SessionTrackingMode.class);
+ public Dynamic addFilter(String filterName, Filter filter) {
+ return null;
}
- public EnumSet<SessionTrackingMode> getEffectiveSessionTrackingModes() {
- return EnumSet.noneOf(SessionTrackingMode.class);
+ public Dynamic addFilter(String filterName,
+ Class<? extends Filter> filterClass) {
+ return null;
}
- public SessionCookieConfig getSessionCookieConfig() {
+ public javax.servlet.Registration.Dynamic addServlet(String servletName,
+ Servlet servlet) {
return null;
}
- public void setSessionCookieConfig(SessionCookieConfig sessionCookieConfig) {
- // Do nothing
+ public javax.servlet.Registration.Dynamic addServlet(String servletName,
+ Class<? extends Servlet> servletClass) {
+ return null;
}
- public void setSessionTrackingModes(
- EnumSet<SessionTrackingMode> sessionTrackingModes) {
- // Do nothing
+ public <T extends Filter> T createFilter(Class<T> c)
+ throws ServletException {
+ return null;
}
- public AsyncDispatcher getAsyncDispatcher(String path) {
- // Do nothing
+ public <T extends Servlet> T createServlet(Class<T> c)
+ throws ServletException {
return null;
}
+
+ public FilterRegistration findFilterRegistration(String filterName) {
+ return null;
+ }
+
+
+ public ServletRegistration findServletRegistration(String servletName) {
+ return null;
+ }
+
+
+ public boolean setInitParameter(String name, String value) {
+ return false;
+ }
+
}