You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by er...@apache.org on 2005/12/08 21:56:08 UTC
svn commit: r355208 [1/3] - in /incubator/felix/trunk/javax.servlet: ./ src/
src/main/ src/main/java/ src/main/java/javax/ src/main/java/javax/servlet/
src/main/java/javax/servlet/http/ src/main/resources/
Author: erodriguez
Date: Thu Dec 8 12:55:55 2005
New Revision: 355208
URL: http://svn.apache.org/viewcvs?rev=355208&view=rev
Log:
Added code contributed by BJ Hargrave to begin a Servlet 2.1 API bundle (FELIX-40).
Added:
incubator/felix/trunk/javax.servlet/
incubator/felix/trunk/javax.servlet/src/
incubator/felix/trunk/javax.servlet/src/main/
incubator/felix/trunk/javax.servlet/src/main/java/
incubator/felix/trunk/javax.servlet/src/main/java/javax/
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/GenericServlet.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/LocalStrings.properties (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/RequestDispatcher.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/Servlet.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletConfig.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletContext.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletException.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletInputStream.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletOutputStream.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletRequest.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletResponse.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/SingleThreadModel.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/UnavailableException.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/http/
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/http/Cookie.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/http/HttpServlet.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/http/HttpServletRequest.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/http/HttpServletResponse.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/http/HttpSession.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/http/HttpSessionBindingEvent.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/http/HttpSessionBindingListener.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/http/HttpSessionContext.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/http/HttpUtils.java (with props)
incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/http/LocalStrings.properties (with props)
incubator/felix/trunk/javax.servlet/src/main/resources/
incubator/felix/trunk/javax.servlet/src/main/resources/Manifest.mf (with props)
Added: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/GenericServlet.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/GenericServlet.java?rev=355208&view=auto
==============================================================================
--- incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/GenericServlet.java (added)
+++ incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/GenericServlet.java Thu Dec 8 12:55:55 2005
@@ -0,0 +1,308 @@
+/*
+ * Copyright 1999,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.servlet;
+
+import java.io.IOException;
+import java.util.Enumeration;
+
+/**
+ *
+ * Defines a generic, protocol-independent
+ * servlet. To write an HTTP servlet for use on the
+ * Web, extend {@link javax.servlet.http.HttpServlet} instead.
+ *
+ * <p><code>GenericServlet</code> implements the <code>Servlet</code>
+ * and <code>ServletConfig</code> interfaces. <code>GenericServlet</code>
+ * may be directly extended by a servlet, although it's more common to extend
+ * a protocol-specific subclass such as <code>HttpServlet</code>.
+ *
+ * <p><code>GenericServlet</code> makes writing servlets
+ * easier. It provides simple versions of the lifecycle methods
+ * <code>init</code> and <code>destroy</code> and of the methods
+ * in the <code>ServletConfig</code> interface. <code>GenericServlet</code>
+ * also implements the <code>log</code> method, declared in the
+ * <code>ServletContext</code> interface.
+ *
+ * <p>To write a generic servlet, you need only
+ * override the abstract <code>service</code> method.
+ *
+ *
+ * @author Various
+ * @version $Version$
+ *
+ *
+ *
+ */
+
+
+public abstract class GenericServlet
+ implements Servlet, ServletConfig, java.io.Serializable
+{
+
+ private transient ServletConfig config;
+
+
+ /**
+ *
+ * Does nothing. All of the servlet initialization
+ * is done by one of the <code>init</code> methods.
+ *
+ */
+
+ public GenericServlet() { }
+
+
+
+ /**
+ * Called by the servlet container to indicate to a servlet that the
+ * servlet is being taken out of service. See {@link Servlet#destroy}.
+ *
+ *
+ */
+
+ public void destroy() {
+ }
+
+
+
+ /**
+ * Returns a <code>String</code> containing the value of the named
+ * initialization parameter, or <code>null</code> if the parameter does
+ * not exist. See {@link ServletConfig#getInitParameter}.
+ *
+ * <p>This method is supplied for convenience. It gets the
+ * value of the named parameter from the servlet's
+ * <code>ServletConfig</code> object.
+ *
+ * @param name a <code>String</code> specifying the name
+ * of the initialization parameter
+ *
+ * @return String a <code>String</code> containing the value
+ * of the initalization parameter
+ *
+ */
+
+ public String getInitParameter(String name) {
+ return getServletConfig().getInitParameter(name);
+ }
+
+
+
+ /**
+ * Returns the names of the servlet's initialization parameters
+ * as an <code>Enumeration</code> of <code>String</code> objects,
+ * or an empty <code>Enumeration</code> if the servlet has no
+ * initialization parameters. See {@link
+ * ServletConfig#getInitParameterNames}.
+ *
+ * <p>This method is supplied for convenience. It gets the
+ * parameter names from the servlet's <code>ServletConfig</code> object.
+ *
+ *
+ * @return Enumeration an enumeration of <code>String</code>
+ * objects containing the names of
+ * the servlet's initialization parameters
+ *
+ */
+
+ public Enumeration getInitParameterNames() {
+ return getServletConfig().getInitParameterNames();
+ }
+
+
+
+
+
+ /**
+ * Returns this servlet's {@link ServletConfig} object.
+ *
+ * @return ServletConfig the <code>ServletConfig</code> object
+ * that initialized this servlet
+ *
+ */
+
+ public ServletConfig getServletConfig() {
+ return config;
+ }
+
+
+
+
+ /**
+ * Returns a reference to the {@link ServletContext} in which this servlet
+ * is running. See {@link ServletConfig#getServletContext}.
+ *
+ * <p>This method is supplied for convenience. It gets the
+ * context from the servlet's <code>ServletConfig</code> object.
+ *
+ *
+ * @return ServletContext the <code>ServletContext</code> object
+ * passed to this servlet by the <code>init</code>
+ * method
+ *
+ */
+
+ public ServletContext getServletContext() {
+ return getServletConfig().getServletContext();
+ }
+
+
+
+
+
+ /**
+ * Returns information about the servlet, such as
+ * author, version, and copyright.
+ * By default, this method returns an empty string. Override this method
+ * to have it return a meaningful value. See {@link
+ * Servlet#getServletInfo}.
+ *
+ *
+ * @return String information about this servlet, by default an
+ * empty string
+ *
+ */
+
+ public String getServletInfo() {
+ return "";
+ }
+
+
+
+
+ /**
+ *
+ * Called by the servlet container to indicate to a servlet that the
+ * servlet is being placed into service. See {@link Servlet#init}.
+ *
+ * <p>This implementation stores the {@link ServletConfig}
+ * object it receives from the servlet container for later use.
+ * When overriding this form of the method, call
+ * <code>super.init(config)</code>.
+ *
+ * @param config the <code>ServletConfig</code> object
+ * that contains configutation
+ * information for this servlet
+ *
+ * @exception ServletException if an exception occurs that
+ * interrupts the servlet's normal
+ * operation
+ *
+ *
+ * @see UnavailableException
+ *
+ */
+
+ public void init(ServletConfig config) throws ServletException {
+ this.config = config;
+ this.init();
+ }
+
+
+
+
+
+ /**
+ *
+ * A convenience method which can be overridden so that there's no need
+ * to call <code>super.init(config)</code>.
+ *
+ * <p>Instead of overriding {@link #init(ServletConfig)}, simply override
+ * this method and it will be called by
+ * <code>GenericServlet.init(ServletConfig config)</code>.
+ * The <code>ServletConfig</code> object can still be retrieved via {@link
+ * #getServletConfig}.
+ *
+ * @exception ServletException if an exception occurs that
+ * interrupts the servlet's
+ * normal operation
+ *
+ */
+
+ public void init() throws ServletException {
+
+ }
+
+
+
+
+ /**
+ *
+ * Writes the specified message to a servlet log file, prepended by the
+ * servlet's name. See {@link ServletContext#log(String)}.
+ *
+ * @param msg a <code>String</code> specifying
+ * the message to be written to the log file
+ *
+ */
+
+ public void log(String msg) {
+ getServletContext().log(getClass().getName() + ": "+ msg);
+ }
+
+
+
+
+ /**
+ * Writes an explanatory message and a stack trace
+ * for a given <code>Throwable</code> exception
+ * to the servlet log file, prepended by the servlet's name.
+ * See {@link ServletContext#log(String, Throwable)}.
+ *
+ *
+ * @param message a <code>String</code> that describes
+ * the error or exception
+ *
+ * @param t the <code>java.lang.Throwable</code> error
+ * or exception
+ *
+ *
+ */
+
+ public void log(String message, Throwable t) {
+ getServletContext().log(getClass().getName() + ": " + message, t);
+ }
+
+
+
+ /**
+ * Called by the servlet container to allow the servlet to respond to
+ * a request. See {@link Servlet#service}.
+ *
+ * <p>This method is declared abstract so subclasses, such as
+ * <code>HttpServlet</code>, must override it.
+ *
+ *
+ *
+ * @param req the <code>ServletRequest</code> object
+ * that contains the client's request
+ *
+ * @param res the <code>ServletResponse</code> object
+ * that will contain the servlet's response
+ *
+ * @exception ServletException if an exception occurs that
+ * interferes with the servlet's
+ * normal operation occurred
+ *
+ * @exception IOException if an input or output
+ * exception occurs
+ *
+ */
+
+ public abstract void service(ServletRequest req, ServletResponse res)
+ throws ServletException, IOException;
+}
Propchange: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/GenericServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/LocalStrings.properties
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/LocalStrings.properties?rev=355208&view=auto
==============================================================================
--- incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/LocalStrings.properties (added)
+++ incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/LocalStrings.properties Thu Dec 8 12:55:55 2005
@@ -0,0 +1,6 @@
+# Default localized string information
+# Localized for Locale en_US
+
+err.not_iso8859_1=Not an ISO 8859-1 character: {0}
+value.true=true
+value.false=false
Propchange: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/LocalStrings.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/RequestDispatcher.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/RequestDispatcher.java?rev=355208&view=auto
==============================================================================
--- incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/RequestDispatcher.java (added)
+++ incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/RequestDispatcher.java Thu Dec 8 12:55:55 2005
@@ -0,0 +1,132 @@
+/*
+ * Copyright 1999,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package javax.servlet;
+
+import java.io.IOException;
+
+
+/**
+ * Defines an object that receives requests from the client
+ * and sends them to any resource (such as a servlet,
+ * HTML file, or JSP file) on the server. The servlet
+ * container creates the <code>RequestDispatcher</code> object,
+ * which is used as a wrapper around a server resource located
+ * at a particular path or given by a particular name.
+ *
+ * <p>This interface is intended to wrap servlets,
+ * but a servlet container can create <code>RequestDispatcher</code>
+ * objects to wrap any type of resource.
+ *
+ * @author Various
+ * @version $Version$
+ *
+ * @see ServletContext#getRequestDispatcher(java.lang.String)
+ *
+ */
+
+public interface RequestDispatcher {
+
+
+
+
+
+/**
+ * Forwards a request from
+ * a servlet to another resource (servlet, JSP file, or
+ * HTML file) on the server. This method allows
+ * one servlet to do preliminary processing of
+ * a request and another resource to generate
+ * the response.
+ *
+ * <p>For a <code>RequestDispatcher</code> obtained via
+ * <code>getRequestDispatcher()</code>, the <code>ServletRequest</code>
+ * object has its path elements and parameters adjusted to match
+ * the path of the target resource.
+ *
+ * <p><code>forward</code> should be called before the response has been
+ * committed to the client (before response body output has been flushed).
+ * If the response already has been committed, this method throws
+ * an <code>IllegalStateException</code>.
+ * Uncommitted output in the response buffer is automatically cleared
+ * before the forward.
+ *
+ * <p>The request and response parameters must be the same
+ * objects as were passed to the calling servlet's service method.
+ *
+ *
+ * @param request a {@link ServletRequest} object
+ * that represents the request the client
+ * makes of the servlet
+ *
+ * @param response a {@link ServletResponse} object
+ * that represents the response the servlet
+ * returns to the client
+ *
+ * @exception ServletException if the target resource throws this exception
+ *
+ * @exception IOException if the target resource throws this exception
+ *
+ * @exception IllegalStateException if the response was already committed
+ *
+ */
+
+ public void forward(ServletRequest request, ServletResponse response)
+ throws ServletException, IOException;
+
+
+
+
+ /**
+ *
+ * Includes the content of a resource (servlet, JSP page,
+ * HTML file) in the response. In essence, this method enables
+ * programmatic server-side includes.
+ *
+ * <p>The {@link ServletResponse} object has its path elements
+ * and parameters remain unchanged from the caller's. The included
+ * servlet cannot change the response status code or set headers;
+ * any attempt to make a change is ignored.
+ *
+ * <p>The request and response parameters must be the same
+ * objects as were passed to the calling servlet's service method.
+ *
+ *
+ * @param request a {@link ServletRequest} object
+ * that contains the client's request
+ *
+ * @param response a {@link ServletResponse} object
+ * that contains the servlet's response
+ *
+ * @exception ServletException if the included resource throws this exception
+ *
+ * @exception IOException if the included resource throws this exception
+ *
+ *
+ */
+
+ public void include(ServletRequest request, ServletResponse response)
+ throws ServletException, IOException;
+}
+
+
+
+
+
+
+
+
Propchange: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/RequestDispatcher.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/Servlet.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/Servlet.java?rev=355208&view=auto
==============================================================================
--- incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/Servlet.java (added)
+++ incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/Servlet.java Thu Dec 8 12:55:55 2005
@@ -0,0 +1,192 @@
+/*
+ * Copyright 1999,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.servlet;
+
+import java.io.IOException;
+
+
+/**
+ * Defines methods that all servlets must implement.
+ *
+ * <p>A servlet is a small Java program that runs within a Web server.
+ * Servlets receive and respond to requests from Web clients,
+ * usually across HTTP, the HyperText Transfer Protocol.
+ *
+ * <p>To implement this interface, you can write a generic servlet
+ * that extends
+ * <code>javax.servlet.GenericServlet</code> or an HTTP servlet that
+ * extends <code>javax.servlet.http.HttpServlet</code>.
+ *
+ * <p>This interface defines methods to initialize a servlet,
+ * to service requests, and to remove a servlet from the server.
+ * These are known as life-cycle methods and are called in the
+ * following sequence:
+ * <ol>
+ * <li>The servlet is constructed, then initialized with the <code>init</code> method.
+ * <li>Any calls from clients to the <code>service</code> method are handled.
+ * <li>The servlet is taken out of service, then destroyed with the
+ * <code>destroy</code> method, then garbage collected and finalized.
+ * </ol>
+ *
+ * <p>In addition to the life-cycle methods, this interface
+ * provides the <code>getServletConfig</code> method, which the servlet
+ * can use to get any startup information, and the <code>getServletInfo</code>
+ * method, which allows the servlet to return basic information about itself,
+ * such as author, version, and copyright.
+ *
+ * @author Various
+ * @version $Version$
+ *
+ * @see GenericServlet
+ * @see javax.servlet.http.HttpServlet
+ *
+ */
+
+
+public interface Servlet {
+
+ /**
+ * Called by the servlet container to indicate to a servlet that the
+ * servlet is being placed into service.
+ *
+ * <p>The servlet container calls the <code>init</code>
+ * method exactly once after instantiating the servlet.
+ * The <code>init</code> method must complete successfully
+ * before the servlet can receive any requests.
+ *
+ * <p>The servlet container cannot place the servlet into service
+ * if the <code>init</code> method
+ * <ol>
+ * <li>Throws a <code>ServletException</code>
+ * <li>Does not return within a time period defined by the Web server
+ * </ol>
+ *
+ *
+ * @param config a <code>ServletConfig</code> object
+ * containing the servlet's
+ * configuration and initialization parameters
+ *
+ * @exception ServletException if an exception has occurred that
+ * interferes with the servlet's normal
+ * operation
+ *
+ * @see UnavailableException
+ * @see #getServletConfig
+ *
+ */
+
+ public void init(ServletConfig config) throws ServletException;
+
+
+
+ /**
+ *
+ * Returns a {@link ServletConfig} object, which contains
+ * initialization and startup parameters for this servlet.
+ * The <code>ServletConfig</code> object returned is the one
+ * passed to the <code>init</code> method.
+ *
+ * <p>Implementations of this interface are responsible for storing the
+ * <code>ServletConfig</code> object so that this
+ * method can return it. The {@link GenericServlet}
+ * class, which implements this interface, already does this.
+ *
+ * @return the <code>ServletConfig</code> object
+ * that initializes this servlet
+ *
+ * @see #init
+ *
+ */
+
+ public ServletConfig getServletConfig();
+
+
+
+ /**
+ * Called by the servlet container to allow the servlet to respond to
+ * a request.
+ *
+ * <p>This method is only called after the servlet's <code>init()</code>
+ * method has completed successfully.
+ *
+ * <p> The status code of the response always should be set for a servlet
+ * that throws or sends an error.
+ *
+ *
+ * <p>Servlets typically run inside multithreaded servlet containers
+ * that can handle multiple requests concurrently. Developers must
+ * be aware to synchronize access to any shared resources such as files,
+ * network connections, and as well as the servlet's class and instance
+ * variables.
+ * More information on multithreaded programming in Java is available in
+ * <a href="http://java.sun.com/Series/Tutorial/java/threads/multithreaded.html">
+ * the Java tutorial on multi-threaded programming</a>.
+ *
+ *
+ * @param req the <code>ServletRequest</code> object that contains
+ * the client's request
+ *
+ * @param res the <code>ServletResponse</code> object that contains
+ * the servlet's response
+ *
+ * @exception ServletException if an exception occurs that interferes
+ * with the servlet's normal operation
+ *
+ * @exception IOException if an input or output exception occurs
+ *
+ */
+
+ public void service(ServletRequest req, ServletResponse res)
+ throws ServletException, IOException;
+
+
+
+ /**
+ * Returns information about the servlet, such
+ * as author, version, and copyright.
+ *
+ * <p>The string that this method returns should
+ * be plain text and not markup of any kind (such as HTML, XML,
+ * etc.).
+ *
+ * @return a <code>String</code> containing servlet information
+ *
+ */
+
+ public String getServletInfo();
+
+
+
+ /**
+ *
+ * Called by the servlet container to indicate to a servlet that the
+ * servlet is being taken out of service. This method is
+ * only called once all threads within the servlet's
+ * <code>service</code> method have exited or after a timeout
+ * period has passed. After the servlet container calls this
+ * method, it will not call the <code>service</code> method again
+ * on this servlet.
+ *
+ * <p>This method gives the servlet an opportunity
+ * to clean up any resources that are being held (for example, memory,
+ * file handles, threads) and make sure that any persistent state is
+ * synchronized with the servlet's current state in memory.
+ *
+ */
+
+ public void destroy();
+}
Propchange: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/Servlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletConfig.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletConfig.java?rev=355208&view=auto
==============================================================================
--- incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletConfig.java (added)
+++ incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletConfig.java Thu Dec 8 12:55:55 2005
@@ -0,0 +1,81 @@
+/*
+ * Copyright 1999,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.servlet;
+
+import java.util.Enumeration;
+
+
+
+/**
+ *
+ * A servlet configuration object used by a servlet container
+ * used to pass information to a servlet during initialization.
+ *
+ */
+
+public interface ServletConfig {
+
+
+ /**
+ * Returns a reference to the {@link ServletContext} in which the caller
+ * is executing.
+ *
+ *
+ * @return a {@link ServletContext} object, used
+ * by the caller to interact with its servlet
+ * container
+ *
+ * @see ServletContext
+ *
+ */
+
+ public ServletContext getServletContext();
+
+ /**
+ * Returns a <code>String</code> containing the value of the
+ * named initialization parameter, or <code>null</code> if
+ * the parameter does not exist.
+ *
+ * @param name a <code>String</code> specifying the name
+ * of the initialization parameter
+ *
+ * @return a <code>String</code> containing the value
+ * of the initialization parameter
+ *
+ */
+
+ public String getInitParameter(String name);
+
+
+ /**
+ * Returns the names of the servlet's initialization parameters
+ * as an <code>Enumeration</code> of <code>String</code> objects,
+ * or an empty <code>Enumeration</code> if the servlet has
+ * no initialization parameters.
+ *
+ * @return an <code>Enumeration</code> of <code>String</code>
+ * objects containing the names of the servlet's
+ * initialization parameters
+ *
+ *
+ *
+ */
+
+ public Enumeration getInitParameterNames();
+
+
+}
Propchange: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletConfig.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletContext.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletContext.java?rev=355208&view=auto
==============================================================================
--- incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletContext.java (added)
+++ incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletContext.java Thu Dec 8 12:55:55 2005
@@ -0,0 +1,516 @@
+/*
+ * Copyright 1999,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.servlet;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.util.Enumeration;
+
+
+/**
+ *
+ * Defines a set of methods that a servlet uses to communicate with its
+ * servlet container, for example, to get the MIME type of a file, dispatch
+ * requests, or write to a log file.
+ *
+ * <p>There is one context per "web application" per Java Virtual Machine. (A
+ * "web application" is a collection of servlets and content installed under a
+ * specific subset of the server's URL namespace such as <code>/catalog</code>
+ * and possibly installed via a <code>.war</code> file.)
+ *
+ * <p>In the case of a web
+ * application marked "distributed" in its deployment descriptor, there will
+ * be one context instance for each virtual machine. In this situation, the
+ * context cannot be used as a location to share global information (because
+ * the information won't be truly global). Use an external resource like
+ * a database instead.
+ *
+ * <p>The <code>ServletContext</code> object is contained within
+ * the {@link ServletConfig} object, which the Web server provides the
+ * servlet when the servlet is initialized.
+ *
+ * @author Various
+ * @version $Version$
+ *
+ * @see Servlet#getServletConfig
+ * @see ServletConfig#getServletContext
+ *
+ */
+
+public interface ServletContext {
+
+
+ /**
+ * Returns a <code>ServletContext</code> object that
+ * corresponds to a specified URL on the server.
+ *
+ * <p>This method allows servlets to gain
+ * access to the context for various parts of the server, and as
+ * needed obtain {@link RequestDispatcher} objects from the context.
+ * The given path must be begin with "/", is interpreted relative
+ * to the server's document root and is matched against the context roots of
+ * other web applications hosted on this container.
+ *
+ * <p>In a security conscious environment, the servlet container may
+ * return <code>null</code> for a given URL.
+ *
+ * @param uripath a <code>String</code> specifying the context path of
+ * another web application in the container.
+ * @return the <code>ServletContext</code> object that
+ * corresponds to the named URL, or null if either
+ none exists or the container wishes to restrict
+ * this access.
+ *
+ * @see RequestDispatcher
+ *
+ */
+
+ public ServletContext getContext(String uripath);
+
+
+
+ /**
+ * Returns the major version of the Java Servlet API that this
+ * servlet container supports. All implementations that comply
+ * with Version 2.1 must have this method
+ * return the integer 2.
+ *
+ * @return 2
+ *
+ */
+
+ public int getMajorVersion();
+
+
+
+ /**
+ * Returns the minor version of the Servlet API that this
+ * servlet container supports. All implementations that comply
+ * with Version 2.1 must have this method
+ * return the integer 1.
+ *
+ * @return 1
+ *
+ */
+
+ public int getMinorVersion();
+
+
+
+ /**
+ * Returns the MIME type of the specified file, or <code>null</code> if
+ * the MIME type is not known. The MIME type is determined
+ * by the configuration of the servlet container, and may be specified
+ * in a web application deployment descriptor. Common MIME
+ * types are <code>"text/html"</code> and <code>"image/gif"</code>.
+ *
+ *
+ * @param file a <code>String</code> specifying the name
+ * of a file
+ *
+ * @return a <code>String</code> specifying the file's MIME type
+ *
+ */
+
+ public String getMimeType(String file);
+
+ /**
+ * Returns a URL to the resource that is mapped to a specified
+ * path. The path must begin with a "/" and is interpreted
+ * as relative to the current context root.
+ *
+ * <p>This method allows the servlet container to make a resource
+ * available to servlets from any source. Resources
+ * can be located on a local or remote
+ * file system, in a database, or in a <code>.war</code> file.
+ *
+ * <p>The servlet container must implement the URL handlers
+ * and <code>URLConnection</code> objects that are necessary
+ * to access the resource.
+ *
+ * <p>This method returns <code>null</code>
+ * if no resource is mapped to the pathname.
+ *
+ * <p>Some containers may allow writing to the URL returned by
+ * this method using the methods of the URL class.
+ *
+ * <p>The resource content is returned directly, so be aware that
+ * requesting a <code>.jsp</code> page returns the JSP source code.
+ * Use a <code>RequestDispatcher</code> instead to include results of
+ * an execution.
+ *
+ * <p>This method has a different purpose than
+ * <code>java.lang.Class.getResource</code>,
+ * which looks up resources based on a class loader. This
+ * method does not use class loaders.
+ *
+ * @param path a <code>String</code> specifying
+ * the path to the resource
+ *
+ * @return the resource located at the named path,
+ * or <code>null</code> if there is no resource
+ * at that path
+ *
+ * @exception MalformedURLException if the pathname is not given in
+ * the correct form
+ *
+ */
+
+ public URL getResource(String path) throws MalformedURLException;
+
+
+
+ /**
+ * Returns the resource located at the named path as
+ * an <code>InputStream</code> object.
+ *
+ * <p>The data in the <code>InputStream</code> can be
+ * of any type or length. The path must be specified according
+ * to the rules given in <code>getResource</code>.
+ * This method returns <code>null</code> if no resource exists at
+ * the specified path.
+ *
+ * <p>Meta-information such as content length and content type
+ * that is available via <code>getResource</code>
+ * method is lost when using this method.
+ *
+ * <p>The servlet container must implement the URL handlers
+ * and <code>URLConnection</code> objects necessary to access
+ * the resource.
+ *
+ * <p>This method is different from
+ * <code>java.lang.Class.getResourceAsStream</code>,
+ * which uses a class loader. This method allows servlet containers
+ * to make a resource available
+ * to a servlet from any location, without using a class loader.
+ *
+ *
+ * @param path a <code>String</code> specifying the path
+ * to the resource
+ *
+ * @return the <code>InputStream</code> returned to the
+ * servlet, or <code>null</code> if no resource
+ * exists at the specified path
+ *
+ *
+ */
+
+ public InputStream getResourceAsStream(String path);
+
+
+
+
+ /**
+ *
+ * Returns a {@link RequestDispatcher} object that acts
+ * as a wrapper for the resource located at the given path.
+ * A <code>RequestDispatcher</code> object can be used to forward
+ * a request to the resource or to include the resource in a response.
+ * The resource can be dynamic or static.
+ *
+ * <p>The pathname must begin with a "/" and is interpreted as relative
+ * to the current context root. Use <code>getContext</code> to obtain
+ * a <code>RequestDispatcher</code> for resources in foreign contexts.
+ * This method returns <code>null</code> if the <code>ServletContext</code>
+ * cannot return a <code>RequestDispatcher</code>.
+ *
+ * @param path a <code>String</code> specifying the pathname
+ * to the resource
+ *
+ * @return a <code>RequestDispatcher</code> object
+ * that acts as a wrapper for the resource
+ * at the specified path
+ *
+ * @see RequestDispatcher
+ * @see ServletContext#getContext
+ *
+ */
+
+ public RequestDispatcher getRequestDispatcher(String path);
+
+
+
+ /**
+ *
+ * @deprecated As of Java Servlet API 2.1, with no direct replacement.
+ *
+ * <p>This method was originally defined to retrieve a servlet
+ * from a <code>ServletContext</code>. In this version, this method
+ * always returns <code>null</code> and remains only to preserve
+ * binary compatibility. This method will be permanently removed
+ * in a future version of the Java Servlet API.
+ *
+ * <p>In lieu of this method, servlets can share information using the
+ * <code>ServletContext</code> class and can perform shared business logic
+ * by invoking methods on common non-servlet classes.
+ *
+ */
+
+ public Servlet getServlet(String name) throws ServletException;
+
+
+
+
+
+
+ /**
+ *
+ * @deprecated As of Java Servlet API 2.0, with no replacement.
+ *
+ * <p>This method was originally defined to return an <code>Enumeration</code>
+ * of all the servlets known to this servlet context. In this
+ * version, this method always returns an empty enumeration and
+ * remains only to preserve binary compatibility. This method
+ * will be permanently removed in a future version of the Java
+ * Servlet API.
+ *
+ */
+
+ public Enumeration getServlets();
+
+
+
+
+
+
+ /**
+ * @deprecated As of Java Servlet API 2.1, with no replacement.
+ *
+ * <p>This method was originally defined to return an
+ * <code>Enumeration</code>
+ * of all the servlet names known to this context. In this version,
+ * this method always returns an empty <code>Enumeration</code> and
+ * remains only to preserve binary compatibility. This method will
+ * be permanently removed in a future version of the Java Servlet API.
+ *
+ */
+
+ public Enumeration getServletNames();
+
+
+
+
+
+ /**
+ *
+ * Writes the specified message to a servlet log file, usually
+ * an event log. The name and type of the servlet log file is
+ * specific to the servlet container.
+ *
+ *
+ * @param msg a <code>String</code> specifying the
+ * message to be written to the log file
+ *
+ */
+
+ public void log(String msg);
+
+
+
+
+
+ /**
+ * @deprecated As of Java Servlet API 2.1, use
+ * {@link #log(String message, Throwable throwable)}
+ * instead.
+ *
+ * <p>This method was originally defined to write an
+ * exception's stack trace and an explanatory error message
+ * to the servlet log file.
+ *
+ */
+
+ public void log(Exception exception, String msg);
+
+
+
+
+
+ /**
+ * Writes an explanatory message and a stack trace
+ * for a given <code>Throwable</code> exception
+ * to the servlet log file. The name and type of the servlet log
+ * file is specific to the servlet container, usually an event log.
+ *
+ *
+ * @param message a <code>String</code> that
+ * describes the error or exception
+ *
+ * @param throwable the <code>Throwable</code> error
+ * or exception
+ *
+ */
+
+ public void log(String message, Throwable throwable);
+
+
+
+
+
+ /**
+ * Returns a <code>String</code> containing the real path
+ * for a given virtual path. For example, the path "/index.html"
+ * returns the absolute file path on the server's filesystem would be
+ * served by a request for "http://host/contextPath/index.html",
+ * where contextPath is the context path of this ServletContext..
+ *
+ * <p>The real path returned will be in a form
+ * appropriate to the computer and operating system on
+ * which the servlet container is running, including the
+ * proper path separators. This method returns <code>null</code>
+ * if the servlet container cannot translate the virtual path
+ * to a real path for any reason (such as when the content is
+ * being made available from a <code>.war</code> archive).
+ *
+ *
+ * @param path a <code>String</code> specifying a virtual path
+ *
+ *
+ * @return a <code>String</code> specifying the real path,
+ * or null if the translation cannot be performed
+ *
+ *
+ */
+
+ public String getRealPath(String path);
+
+
+
+
+ /**
+ * Returns the name and version of the servlet container on which
+ * the servlet is running.
+ *
+ * <p>The form of the returned string is
+ * <i>servername</i>/<i>versionnumber</i>.
+ * For example, the JavaServer Web Development Kit may return the string
+ * <code>JavaServer Web Dev Kit/1.0</code>.
+ *
+ * <p>The servlet container may return other optional information
+ * after the primary string in parentheses, for example,
+ * <code>JavaServer Web Dev Kit/1.0 (JDK 1.1.6; Windows NT 4.0 x86)</code>.
+ *
+ *
+ * @return a <code>String</code> containing at least the
+ * servlet container name and version number
+ *
+ */
+
+ public String getServerInfo();
+
+
+
+
+ /**
+ * Returns the servlet container attribute with the given name,
+ * or <code>null</code> if there is no attribute by that name.
+ * An attribute allows a servlet container to give the
+ * servlet additional information not
+ * already provided by this interface. See your
+ * server documentation for information about its attributes.
+ * A list of supported attributes can be retrieved using
+ * <code>getAttributeNames</code>.
+ *
+ * <p>The attribute is returned as a <code>java.lang.Object</code>
+ * or some subclass.
+ * Attribute names should follow the same convention as package
+ * names. The Java Servlet API specification reserves names
+ * matching <code>java.*</code>, <code>javax.*</code>,
+ * and <code>sun.*</code>.
+ *
+ *
+ * @param name a <code>String</code> specifying the name
+ * of the attribute
+ *
+ * @return an <code>Object</code> containing the value
+ * of the attribute, or <code>null</code>
+ * if no attribute exists matching the given
+ * name
+ *
+ * @see ServletContext#getAttributeNames
+ *
+ */
+
+ public Object getAttribute(String name);
+
+
+
+
+ /**
+ * Returns an <code>Enumeration</code> containing the
+ * attribute names available
+ * within this servlet context. Use the
+ * {@link #getAttribute} method with an attribute name
+ * to get the value of an attribute.
+ *
+ * @return an <code>Enumeration</code> of attribute
+ * names
+ *
+ * @see #getAttribute
+ *
+ */
+
+ public Enumeration getAttributeNames();
+
+
+
+
+ /**
+ *
+ * Binds an object to a given attribute name in this servlet context. If
+ * the name specified is already used for an attribute, this
+ * method will replace the attribute with the new to the new attribute.
+ *
+ * <p>Attribute names should follow the same convention as package
+ * names. The Java Servlet API specification reserves names
+ * matching <code>java.*</code>, <code>javax.*</code>, and
+ * <code>sun.*</code>.
+ *
+ *
+ * @param name a <code>String</code> specifying the name
+ * of the attribute
+ *
+ * @param object an <code>Object</code> representing the
+ * attribute to be bound
+ *
+ *
+ *
+ */
+
+ public void setAttribute(String name, Object object);
+
+
+
+
+
+ /**
+ * Removes the attribute with the given name from
+ * the servlet context. After removal, subsequent calls to
+ * {@link #getAttribute} to retrieve the attribute's value
+ * will return <code>null</code>.
+ *
+ *
+ * @param name a <code>String</code> specifying the name
+ * of the attribute to be removed
+ *
+ */
+
+ public void removeAttribute(String name);
+}
+
+
Propchange: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletException.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletException.java?rev=355208&view=auto
==============================================================================
--- incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletException.java (added)
+++ incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletException.java Thu Dec 8 12:55:55 2005
@@ -0,0 +1,142 @@
+/*
+ * Copyright 1999,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.servlet;
+
+
+/**
+ * Defines a general exception a servlet can throw when it
+ * encounters difficulty.
+ *
+ * @author Various
+ * @version $Version$
+ *
+ */
+
+
+public class ServletException extends Exception {
+
+ private Throwable rootCause;
+
+
+
+
+
+ /**
+ * Constructs a new servlet exception.
+ *
+ */
+
+ public ServletException() {
+ super();
+ }
+
+
+
+
+
+ /**
+ * Constructs a new servlet exception with the
+ * specified message. The message can be written
+ * to the server log and/or displayed for the user.
+ *
+ * @param message a <code>String</code>
+ * specifying the text of
+ * the exception message
+ *
+ */
+
+ public ServletException(String message) {
+ super(message);
+ }
+
+
+
+
+
+ /**
+ * Constructs a new servlet exception when the servlet
+ * needs to throw an exception and include a message
+ * about the "root cause" exception that interfered with its
+ * normal operation, including a description message.
+ *
+ *
+ * @param message a <code>String</code> containing
+ * the text of the exception message
+ *
+ * @param rootCause the <code>Throwable</code> exception
+ * that interfered with the servlet's
+ * normal operation, making this servlet
+ * exception necessary
+ *
+ */
+
+ public ServletException(String message, Throwable rootCause) {
+ super(message);
+ this.rootCause = rootCause;
+ }
+
+
+
+
+
+ /**
+ * Constructs a new servlet exception when the servlet
+ * needs to throw an exception and include a message
+ * about the "root cause" exception that interfered with its
+ * normal operation. The exception's message is based on the localized
+ * message of the underlying exception.
+ *
+ * <p>This method calls the <code>getLocalizedMessage</code> method
+ * on the <code>Throwable</code> exception to get a localized exception
+ * message. When subclassing <code>ServletException</code>,
+ * this method can be overridden to create an exception message
+ * designed for a specific locale.
+ *
+ * @param rootCause the <code>Throwable</code> exception
+ * that interfered with the servlet's
+ * normal operation, making the servlet exception
+ * necessary
+ *
+ */
+
+ public ServletException(Throwable rootCause) {
+ super(rootCause.getLocalizedMessage());
+ this.rootCause = rootCause;
+ }
+
+
+
+
+
+ /**
+ * Returns the exception that caused this servlet exception.
+ *
+ *
+ * @return the <code>Throwable</code>
+ * that caused this servlet exception
+ *
+ */
+
+ public Throwable getRootCause() {
+ return rootCause;
+ }
+}
+
+
+
+
+
Propchange: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletInputStream.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletInputStream.java?rev=355208&view=auto
==============================================================================
--- incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletInputStream.java (added)
+++ incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletInputStream.java Thu Dec 8 12:55:55 2005
@@ -0,0 +1,106 @@
+/*
+ * Copyright 1999,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.servlet;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+/**
+ *
+ * Provides an input stream for reading binary data from a client
+ * request, including an efficient <code>readLine</code> method
+ * for reading data one line at a time. With some protocols, such
+ * as HTTP POST and PUT, a <code>ServletInputStream</code>
+ * object can be used to read data sent from the client.
+ *
+ * <p>A <code>ServletInputStream</code> object is normally retrieved via
+ * the {@link ServletRequest#getInputStream} method.
+ *
+ *
+ * <p>This is an abstract class that a servlet container implements.
+ * Subclasses of this class
+ * must implement the <code>java.io.InputStream.read()</code> method.
+ *
+ *
+ * @author Various
+ * @version $Version$
+ *
+ * @see ServletRequest
+ *
+ */
+
+public abstract class ServletInputStream extends InputStream {
+
+
+
+ /**
+ * Does nothing, because this is an abstract class.
+ *
+ */
+
+ protected ServletInputStream() { }
+
+
+
+
+ /**
+ *
+ * Reads the input stream, one line at a time. Starting at an
+ * offset, reads bytes into an array, until it reads a certain number
+ * of bytes or reaches a newline character, which it reads into the
+ * array as well.
+ *
+ * <p>This method returns -1 if it reaches the end of the input
+ * stream before reading the maximum number of bytes.
+ *
+ *
+ *
+ * @param b an array of bytes into which data is read
+ *
+ * @param off an integer specifying the character at which
+ * this method begins reading
+ *
+ * @param len an integer specifying the maximum number of
+ * bytes to read
+ *
+ * @return an integer specifying the actual number of bytes
+ * read, or -1 if the end of the stream is reached
+ *
+ * @exception IOException if an input or output exception has occurred
+ *
+ */
+
+ public int readLine(byte[] b, int off, int len) throws IOException {
+
+ if (len <= 0) {
+ return 0;
+ }
+ int count = 0, c;
+
+ while ((c = read()) != -1) {
+ b[off++] = (byte)c;
+ count++;
+ if (c == '\n' || count == len) {
+ break;
+ }
+ }
+ return count > 0 ? count : -1;
+ }
+}
+
+
+
Propchange: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletInputStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletOutputStream.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletOutputStream.java?rev=355208&view=auto
==============================================================================
--- incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletOutputStream.java (added)
+++ incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletOutputStream.java Thu Dec 8 12:55:55 2005
@@ -0,0 +1,364 @@
+/*
+ * Copyright 1999,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.servlet;
+
+import java.io.OutputStream;
+import java.io.IOException;
+import java.io.CharConversionException;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+
+/**
+ * Provides an output stream for sending binary data to the
+ * client. A <code>ServletOutputStream</code> object is normally retrieved
+ * via the {@link ServletResponse#getOutputStream} method.
+ *
+ * <p>This is an abstract class that the servlet container implements.
+ * Subclasses of this class
+ * must implement the <code>java.io.OutputStream.write(int)</code>
+ * method.
+ *
+ *
+ * @author Various
+ * @version $Version$
+ *
+ * @see ServletResponse
+ *
+ */
+
+public abstract class ServletOutputStream extends OutputStream {
+
+ private static final String LSTRING_FILE = "javax.servlet.LocalStrings";
+ private static ResourceBundle lStrings =
+ ResourceBundle.getBundle(LSTRING_FILE);
+
+
+
+ /**
+ *
+ * Does nothing, because this is an abstract class.
+ *
+ */
+
+ protected ServletOutputStream() { }
+
+
+ /**
+ * Writes a <code>String</code> to the client,
+ * without a carriage return-line feed (CRLF)
+ * character at the end.
+ *
+ *
+ * @param s the <code>String</code to send to the client
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ */
+
+ public void print(String s) throws IOException {
+ if (s==null) s="null";
+ int len = s.length();
+ for (int i = 0; i < len; i++) {
+ char c = s.charAt (i);
+
+ //
+ // XXX NOTE: This is clearly incorrect for many strings,
+ // but is the only consistent approach within the current
+ // servlet framework. It must suffice until servlet output
+ // streams properly encode their output.
+ //
+ if ((c & 0xff00) != 0) { // high order byte must be zero
+ String errMsg = lStrings.getString("err.not_iso8859_1");
+ Object[] errArgs = new Object[1];
+ errArgs[0] = new Character(c);
+ errMsg = MessageFormat.format(errMsg, errArgs);
+ throw new CharConversionException(errMsg);
+ }
+ write (c);
+ }
+ }
+
+
+
+ /**
+ * Writes a <code>boolean</code> value to the client,
+ * with no carriage return-line feed (CRLF)
+ * character at the end.
+ *
+ * @param b the <code>boolean</code> value
+ * to send to the client
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ */
+
+ public void print(boolean b) throws IOException {
+ String msg;
+ if (b) {
+ msg = lStrings.getString("value.true");
+ } else {
+ msg = lStrings.getString("value.false");
+ }
+ print(msg);
+ }
+
+
+
+ /**
+ * Writes a character to the client,
+ * with no carriage return-line feed (CRLF)
+ * at the end.
+ *
+ * @param c the character to send to the client
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ */
+
+ public void print(char c) throws IOException {
+ print(String.valueOf(c));
+ }
+
+
+
+
+ /**
+ *
+ * Writes an int to the client,
+ * with no carriage return-line feed (CRLF)
+ * at the end.
+ *
+ * @param i the int to send to the client
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ */
+
+ public void print(int i) throws IOException {
+ print(String.valueOf(i));
+ }
+
+
+
+
+ /**
+ *
+ * Writes a <code>long</code> value to the client,
+ * with no carriage return-line feed (CRLF) at the end.
+ *
+ * @param l the <code>long</code> value
+ * to send to the client
+ *
+ * @exception IOException if an input or output exception
+ * occurred
+ *
+ */
+
+ public void print(long l) throws IOException {
+ print(String.valueOf(l));
+ }
+
+
+
+ /**
+ *
+ * Writes a <code>float</code> value to the client,
+ * with no carriage return-line feed (CRLF) at the end.
+ *
+ * @param f the <code>float</code> value
+ * to send to the client
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ *
+ */
+
+ public void print(float f) throws IOException {
+ print(String.valueOf(f));
+ }
+
+
+
+ /**
+ *
+ * Writes a <code>double</code> value to the client,
+ * with no carriage return-line feed (CRLF) at the end.
+ *
+ * @param d the <code>double</code> value
+ * to send to the client
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ */
+
+ public void print(double d) throws IOException {
+ print(String.valueOf(d));
+ }
+
+
+
+ /**
+ * Writes a carriage return-line feed (CRLF)
+ * to the client.
+ *
+ *
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ */
+
+ public void println() throws IOException {
+ print("\r\n");
+ }
+
+
+
+ /**
+ * Writes a <code>String</code> to the client,
+ * followed by a carriage return-line feed (CRLF).
+ *
+ *
+ * @param s the </code>String</code> to write to the client
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ */
+
+ public void println(String s) throws IOException {
+ print(s);
+ println();
+ }
+
+
+
+
+ /**
+ *
+ * Writes a <code>boolean</code> value to the client,
+ * followed by a
+ * carriage return-line feed (CRLF).
+ *
+ *
+ * @param b the <code>boolean</code> value
+ * to write to the client
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ */
+
+ public void println(boolean b) throws IOException {
+ print(b);
+ println();
+ }
+
+
+
+ /**
+ *
+ * Writes a character to the client, followed by a carriage
+ * return-line feed (CRLF).
+ *
+ * @param c the character to write to the client
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ */
+
+ public void println(char c) throws IOException {
+ print(c);
+ println();
+ }
+
+
+
+ /**
+ *
+ * Writes an int to the client, followed by a
+ * carriage return-line feed (CRLF) character.
+ *
+ *
+ * @param i the int to write to the client
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ */
+
+ public void println(int i) throws IOException {
+ print(i);
+ println();
+ }
+
+
+
+ /**
+ *
+ * Writes a <code>long</code> value to the client, followed by a
+ * carriage return-line feed (CRLF).
+ *
+ *
+ * @param l the <code>long</code> value to write to the client
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ */
+
+ public void println(long l) throws IOException {
+ print(l);
+ println();
+ }
+
+
+
+ /**
+ *
+ * Writes a <code>float</code> value to the client,
+ * followed by a carriage return-line feed (CRLF).
+ *
+ * @param f the <code>float</code> value
+ * to write to the client
+ *
+ *
+ * @exception IOException if an input or output exception
+ * occurred
+ *
+ */
+
+ public void println(float f) throws IOException {
+ print(f);
+ println();
+ }
+
+
+
+ /**
+ *
+ * Writes a <code>double</code> value to the client,
+ * followed by a carriage return-line feed (CRLF).
+ *
+ *
+ * @param d the <code>double</code> value
+ * to write to the client
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ */
+
+ public void println(double d) throws IOException {
+ print(d);
+ println();
+ }
+}
Propchange: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletOutputStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletRequest.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletRequest.java?rev=355208&view=auto
==============================================================================
--- incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletRequest.java (added)
+++ incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletRequest.java Thu Dec 8 12:55:55 2005
@@ -0,0 +1,393 @@
+/*
+ * Copyright 1999,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.servlet;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.util.Enumeration;
+
+
+
+/**
+ * Defines an object to provide client request information to a servlet. The
+ * servlet container creates a <code>ServletRequest</code> object and passes
+ * it as an argument to the servlet's <code>service</code> method.
+ *
+ * <p>A <code>ServletRequest</code> object provides data including
+ * parameter name and values, attributes, and an input stream.
+ * Interfaces that extend <code>ServletRequest</code> can provide
+ * additional protocol-specific data (for example, HTTP data is
+ * provided by {@link javax.servlet.http.HttpServletRequest}.
+ *
+ * @author Various
+ * @version $Version$
+ *
+ * @see javax.servlet.http.HttpServletRequest
+ *
+ */
+
+public interface ServletRequest {
+
+
+
+
+ /**
+ *
+ * Returns the value of the named attribute as an <code>Object</code>,
+ * or <code>null</code> if no attribute of the given name exists.
+ *
+ * <p> Attributes can be set two ways. The servlet container may set
+ * attributes to make available custom information about a request.
+ * For example, for requests made using HTTPS, the attribute
+ * <code>javax.servlet.request.X509Certificate</code> can be used to
+ * retrieve information on the certificate of the client. Attributes
+ * can also be set programatically using
+ * {@link ServletRequest#setAttribute}. This allows information to be
+ * embedded into a request before a {@link RequestDispatcher} call.
+ *
+ * <p>Attribute names should follow the same conventions as package
+ * names. This specification reserves names matching <code>java.*</code>,
+ * <code>javax.*</code>, and <code>sun.*</code>.
+ *
+ * @param name a <code>String</code> specifying the name of
+ * the attribute
+ *
+ * @return an <code>Object</code> containing the value
+ * of the attribute, or <code>null</code> if
+ * the attribute does not exist
+ *
+ */
+
+ public Object getAttribute(String name);
+
+
+
+ /**
+ * Returns an <code>Enumeration</code> containing the
+ * names of the attributes available to this request.
+ * This method returns an empty <code>Enumeration</code>
+ * if the request has no attributes available to it.
+ *
+ *
+ * @return an <code>Enumeration</code> of strings
+ * containing the names
+ * of the request's attributes
+ *
+ */
+
+ public Enumeration getAttributeNames();
+
+
+
+
+ /**
+ * Returns the name of the character encoding used in the body of this
+ * request. This method returns <code>null</code> if the request
+ * does not specify a character encoding
+ *
+ *
+ * @return a <code>String</code> containing the name of
+ * the chararacter encoding, or <code>null</code>
+ * if the request does not specify a character encoding
+ *
+ */
+
+ public String getCharacterEncoding();
+
+
+
+ /**
+ * Returns the length, in bytes, of the request body
+ * and made available by the input stream, or -1 if the
+ * length is not known. For HTTP servlets, same as the value
+ * of the CGI variable CONTENT_LENGTH.
+ *
+ * @return an integer containing the length of the
+ * request body or -1 if the length is not known
+ *
+ */
+
+ public int getContentLength();
+
+
+
+
+ /**
+ * Returns the MIME type of the body of the request, or
+ * <code>null</code> if the type is not known. For HTTP servlets,
+ * same as the value of the CGI variable CONTENT_TYPE.
+ *
+ * @return a <code>String</code> containing the name
+ * of the MIME type of
+ * the request, or null if the type is not known
+ *
+ */
+
+ public String getContentType();
+
+
+
+
+ /**
+ * Retrieves the body of the request as binary data using
+ * a {@link ServletInputStream}. Either this method or
+ * {@link #getReader} may be called to read the body, not both.
+ *
+ * @return a {@link ServletInputStream} object containing
+ * the body of the request
+ *
+ * @exception IllegalStateException if the {@link #getReader} method
+ * has already been called for this request
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ */
+
+ public ServletInputStream getInputStream() throws IOException;
+
+
+
+
+ /**
+ * Returns the value of a request parameter as a <code>String</code>,
+ * or <code>null</code> if the parameter does not exist. Request parameters
+ * are extra information sent with the request. For HTTP servlets,
+ * parameters are contained in the query string or posted form data.
+ *
+ * <p>You should only use this method when you are sure the
+ * parameter has only one value. If the parameter might have
+ * more than one value, use {@link #getParameterValues}.
+ *
+ * <p>If you use this method with a multivalued
+ * parameter, the value returned is equal to the first value
+ * in the array returned by <code>getParameterValues</code>.
+ *
+ * <p>If the parameter data was sent in the request body, such as occurs
+ * with an HTTP POST request, then reading the body directly via {@link
+ * #getInputStream} or {@link #getReader} can interfere
+ * with the execution of this method.
+ *
+ * @param name a <code>String</code> specifying the
+ * name of the parameter
+ *
+ * @return a <code>String</code> representing the
+ * single value of the parameter
+ *
+ * @see #getParameterValues
+ *
+ */
+
+ public String getParameter(String name);
+
+
+
+
+ /**
+ *
+ * Returns an <code>Enumeration</code> of <code>String</code>
+ * objects containing the names of the parameters contained
+ * in this request. If the request has
+ * no parameters, the method returns an
+ * empty <code>Enumeration</code>.
+ *
+ * @return an <code>Enumeration</code> of <code>String</code>
+ * objects, each <code>String</code> containing
+ * the name of a request parameter; or an
+ * empty <code>Enumeration</code> if the
+ * request has no parameters
+ *
+ */
+
+ public Enumeration getParameterNames();
+
+
+
+
+ /**
+ * Returns an array of <code>String</code> objects containing
+ * all of the values the given request parameter has, or
+ * <code>null</code> if the parameter does not exist.
+ *
+ * <p>If the parameter has a single value, the array has a length
+ * of 1.
+ *
+ * @param name a <code>String</code> containing the name of
+ * the parameter whose value is requested
+ *
+ * @return an array of <code>String</code> objects
+ * containing the parameter's values
+ *
+ * @see #getParameter
+ *
+ */
+
+ public String[] getParameterValues(String name);
+
+ /**
+ * Returns the name and version of the protocol the request uses
+ * in the form <i>protocol/majorVersion.minorVersion</i>, for
+ * example, HTTP/1.1. For HTTP servlets, the value
+ * returned is the same as the value of the CGI variable
+ * <code>SERVER_PROTOCOL</code>.
+ *
+ * @return a <code>String</code> containing the protocol
+ * name and version number
+ *
+ */
+
+ public String getProtocol();
+
+
+
+
+ /**
+ * Returns the name of the scheme used to make this request,
+ * for example,
+ * <code>http</code>, <code>https</code>, or <code>ftp</code>.
+ * Different schemes have different rules for constructing URLs,
+ * as noted in RFC 1738.
+ *
+ * @return a <code>String</code> containing the name
+ * of the scheme used to make this request
+ *
+ */
+
+ public String getScheme();
+
+
+
+
+ /**
+ * Returns the host name of the server that received the request.
+ * For HTTP servlets, same as the value of the CGI variable
+ * <code>SERVER_NAME</code>.
+ *
+ * @return a <code>String</code> containing the name
+ * of the server to which the request was sent
+ */
+
+ public String getServerName();
+
+
+
+
+ /**
+ * Returns the port number on which this request was received.
+ * For HTTP servlets, same as the value of the CGI variable
+ * <code>SERVER_PORT</code>.
+ *
+ * @return an integer specifying the port number
+ *
+ */
+
+ public int getServerPort();
+
+
+
+ /**
+ * Retrieves the body of the request as character data using
+ * a <code>BufferedReader</code>. The reader translates the character
+ * data according to the character encoding used on the body.
+ * Either this method or {@link #getInputStream} may be called to read the
+ * body, not both.
+ *
+ *
+ * @return a <code>BufferedReader</code>
+ * containing the body of the request
+ *
+ * @exception IllegalStateException if {@link #getInputStream} method
+ * has been called on this request
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ * @see #getInputStream
+ *
+ */
+
+ public BufferedReader getReader() throws IOException;
+
+
+
+
+ /**
+ * Returns the Internet Protocol (IP) address of the client
+ * that sent the request. For HTTP servlets, same as the value of the
+ * CGI variable <code>REMOTE_ADDR</code>.
+ *
+ * @return a <code>String</code> containing the
+ * IP address of the client that sent the request
+ *
+ */
+
+ public String getRemoteAddr();
+
+
+
+
+ /**
+ * Returns the fully qualified name of the client that sent the
+ * request. If the engine cannot or chooses not to resolve the hostname
+ * (to improve performance), this method returns the dotted-string form of
+ * the IP address. For HTTP servlets, same as the value of the CGI variable
+ * <code>REMOTE_HOST</code>.
+ *
+ * @return a <code>String</code> containing the fully
+ * qualified name of the client
+ *
+ */
+
+ public String getRemoteHost();
+
+
+
+
+ /**
+ *
+ * Stores an attribute in this request.
+ * Attributes are reset between requests. This method is most
+ * often used in conjunction with {@link RequestDispatcher}.
+ *
+ * <p>Attribute names should follow the same conventions as
+ * package names. Names beginning with <code>java.*</code>,
+ * <code>javax.*</code>, and <code>com.sun.*</code>, are
+ * reserved for use by Sun Microsystems.
+ *
+ *
+ * @param name a <code>String</code> specifying
+ * the name of the attribute
+ *
+ * @param o the <code>Object</code> to be stored
+ *
+ */
+
+ public void setAttribute(String name, Object o);
+
+
+
+
+ /**
+ *
+ * @deprecated As of Version 2.1 of the Java Servlet API,
+ * use {@link ServletContext#getRealPath} instead.
+ *
+ */
+
+ public String getRealPath(String path);
+
+
+}
+
Propchange: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletRequest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletResponse.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletResponse.java?rev=355208&view=auto
==============================================================================
--- incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletResponse.java (added)
+++ incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletResponse.java Thu Dec 8 12:55:55 2005
@@ -0,0 +1,186 @@
+/*
+ * Copyright 1999,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.servlet;
+
+import java.io.*;
+
+
+/**
+ * Defines an object to assist a servlet in sending a response to the client.
+ * The servlet container creates a <code>ServletResponse</code> object and
+ * passes it as an argument to the servlet's <code>service</code> method.
+ *
+ * <p>To send binary data in a MIME body response, use
+ * the {@link ServletOutputStream} returned by {@link #getOutputStream}.
+ * To send character data, use the <code>PrintWriter</code> object
+ * returned by {@link #getWriter}. To mix binary and text data,
+ * for example, to create a multipart response, use a
+ * <code>ServletOutputStream</code> and manage the character sections
+ * manually.
+ *
+ * <p>The charset for the MIME body response can be specified with
+ * {@link #setContentType}. For example, "text/html; charset=Shift_JIS".
+ * If no charset is specified, ISO-8859-1 will be used.
+ * The <code>setContentType</code> or <code>setLocale</code> method
+ * must be called before <code>getWriter</code> for the charset to
+ * affect the construction of the writer.
+ *
+ * <p>See the Internet RFCs such as
+ * <a href="http://info.internet.isi.edu/in-notes/rfc/files/rfc2045.txt">
+ * RFC 2045</a> for more information on MIME. Protocols such as SMTP
+ * and HTTP define profiles of MIME, and those standards
+ * are still evolving.
+ *
+ * @author Various
+ * @version $Version$
+ *
+ * @see ServletOutputStream
+ *
+ */
+
+public interface ServletResponse {
+
+
+
+ /**
+ * Returns the name of the charset used for
+ * the MIME body sent in this response.
+ *
+ * <p>If no charset has been assigned, it is implicitly
+ * set to <code>ISO-8859-1</code> (<code>Latin-1</code>).
+ *
+ * <p>See RFC 2047 (http://ds.internic.net/rfc/rfc2045.txt)
+ * for more information about character encoding and MIME.
+ *
+ * @return a <code>String</code> specifying the
+ * name of the charset, for
+ * example, <code>ISO-8859-1</code>
+ *
+ */
+
+ public String getCharacterEncoding();
+
+
+
+ /**
+ * Returns a {@link ServletOutputStream} suitable for writing binary
+ * data in the response. The servlet container does not encode the
+ * binary data.
+
+ * <p> Calling flush() on the ServletOutputStream commits the response.
+
+ * Either this method or {@link #getWriter} may
+ * be called to write the body, not both.
+ *
+ * @return a {@link ServletOutputStream} for writing binary data
+ *
+ * @exception IllegalStateException if the <code>getWriter</code> method
+ * has been called on this response
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ * @see #getWriter
+ *
+ */
+
+ public ServletOutputStream getOutputStream() throws IOException;
+
+
+
+ /**
+ * Returns a <code>PrintWriter</code> object that
+ * can send character text to the client.
+ * The character encoding used is the one specified
+ * in the <code>charset=</code> property of the
+ * {@link #setContentType} method, which must be called
+ * <i>before</i> calling this method for the charset to take effect.
+ *
+ * <p>If necessary, the MIME type of the response is
+ * modified to reflect the character encoding used.
+ *
+ * <p> Calling flush() on the PrintWriter commits the response.
+ *
+ * <p>Either this method or {@link #getOutputStream} may be called
+ * to write the body, not both.
+ *
+ *
+ * @return a <code>PrintWriter</code> object that
+ * can return character data to the client
+ *
+ * @exception UnsupportedEncodingException if the charset specified in
+ * <code>setContentType</code> cannot be
+ * used
+ *
+ * @exception IllegalStateException if the <code>getOutputStream</code>
+ * method has already been called for this
+ * response object
+ *
+ * @exception IOException if an input or output exception occurred
+ *
+ * @see #getOutputStream
+ * @see #setContentType
+ *
+ */
+
+ public PrintWriter getWriter() throws IOException;
+
+
+
+
+
+ /**
+ * Sets the length of the content body in the response
+ * In HTTP servlets, this method sets the HTTP Content-Length header.
+ *
+ *
+ * @param len an integer specifying the length of the
+ * content being returned to the client; sets
+ * the Content-Length header
+ *
+ */
+
+ public void setContentLength(int len);
+
+
+
+ /**
+ * Sets the content type of the response being sent to
+ * the client. The content type may include the type of character
+ * encoding used, for example, <code>text/html; charset=ISO-8859-4</code>.
+ *
+ * <p>If obtaining a <code>PrintWriter</code>, this method should be
+ * called first.
+ *
+ *
+ * @param type a <code>String</code> specifying the MIME
+ * type of the content
+ *
+ * @see #getOutputStream
+ * @see #getWriter
+ *
+ */
+
+ public void setContentType(String type);
+
+
+
+}
+
+
+
+
+
Propchange: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/ServletResponse.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/SingleThreadModel.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/SingleThreadModel.java?rev=355208&view=auto
==============================================================================
--- incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/SingleThreadModel.java (added)
+++ incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/SingleThreadModel.java Thu Dec 8 12:55:55 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 1999,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.servlet;
+
+/**
+ * Ensures that servlets handle
+ * only one request at a time. This interface has no methods.
+ *
+ * <p>If a servlet implements this interface, you are <i>guaranteed</i>
+ * that no two threads will execute concurrently in the
+ * servlet's <code>service</code> method. The servlet container
+ * can make this guarantee by synchronizing access to a single
+ * instance of the servlet, or by maintaining a pool of servlet
+ * instances and dispatching each new request to a free servlet.
+ *
+ * <p>This interface does not prevent
+ * synchronization problems that result from servlets accessing shared
+ * resources such as static class variables or classes outside
+ * the scope of the servlet.
+ *
+ *
+ * @author Various
+ * @version $Version$
+ *
+ */
+
+public interface SingleThreadModel {
+}
Propchange: incubator/felix/trunk/javax.servlet/src/main/java/javax/servlet/SingleThreadModel.java
------------------------------------------------------------------------------
svn:eol-style = native