home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-07-18 | 7.1 KB | 219 lines |
- /*
- * @(#)HttpServletResponse.java 1.15 97/05/22
- *
- * Copyright (c) 1995-1997 Sun Microsystems, Inc. All Rights Reserved.
- *
- * This software is the confidential and proprietary information of Sun
- * Microsystems, Inc. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Sun.
- *
- * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
- * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
- * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
- * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
- * THIS SOFTWARE OR ITS DERIVATIVES.
- *
- * CopyrightVersion 1.0
- */
-
- package javax.servlet.http;
-
- import javax.servlet.ServletResponse;
- import java.io.IOException;
-
- /**
- * This interface, implemented by network service developers,
- * represents an HTTP servlet response. It allows a servlet's service
- * method to manipulate HTTP-protocol specified header information, and
- * return data to its client.
- *
- * @version 1.15, 05/22/97
- * @author David Connelly
- */
- public
- interface HttpServletResponse extends ServletResponse {
- /**
- * Returns true if the response message header has a field with
- * the specified name.
- * @param name the header field name
- */
- public boolean containsHeader(String name);
-
- /**
- * Sets the status code and message for this response.
- * @param sc the status code
- * @param sm the status message
- */
- public void setStatus(int sc, String sm);
-
- /**
- * Sets the status code and a default message for this response.
- * @param sc the status code
- */
- public void setStatus(int sc);
-
- /**
- *
- * Adds a field to the response header with a given name and
- * value. If the field had already been set, the new value
- * overwrites the previous one. The containsHeader method can be
- * used to test for the presence of a header before setting its
- * value.
- *
- * @param name the header field name
- * @param value the header field value */
- public void setHeader(String name, String value);
-
- /**
- *
- * Adds a field to the response header with a given name and
- * integer value. If the field had already been set, the new
- * value overwrites the previous one. The containsHeader method
- * can be used to test for the presence of a header before setting
- * its value.
- *
- * @param name the header field name
- * @param value the header field integer value */
- public void setIntHeader(String name, int value);
-
- /**
- *
- * Adds a field to the response header with a given name and
- * date-valued field. The date is specified in terms of
- * milliseconds since the epoch. If the date field had already
- * been set, the new value overwrites the previous one. The
- * containsHeader method can be used to test for the presence of a
- * header before setting its value.
- *
- * @param name the header field name
- * @param value the header field date value */
- public void setDateHeader(String name, long date);
-
- /**
- * Sends an error response to the client using the specified status
- * code and descriptive message.
- * @param sc the status code
- * @param msg the detail message
- * @exception IOException If an I/O error has occurred.
- */
- public void sendError(int sc, String msg) throws IOException;
-
- /**
- * Sends an error response to the client using the specified
- * status code and a default message.
- * @param sc the status code
- * @exception IOException If an I/O error has occurred.
- */
- public void sendError(int sc) throws IOException;
-
- /**
- * Sends a redirect response to the client using the specified
- * redirect location URL. The URL must be absolute (e.g.,
- * <code><em>https://hostname/path/file.html</em></code>).
- * Relative URLs are not permitted here.
- *
- * @param location the redirect location URL
- * @exception IOException If an I/O error has occurred.
- */
- public void sendRedirect(String location) throws IOException;
-
- /*
- * Server status codes; see RFC 1945.
- */
-
- /**
- * Status code (200) indicating the request succeeded normally.
- */
- public static final int SC_OK = 200;
-
- /**
- * Status code (201) indicating the request succeeded and created
- * a new resource on the server.
- */
- public static final int SC_CREATED = 201;
-
- /**
- * Status code (202) indicating that a request was accepted for
- * processing, but was not completed.
- */
- public static final int SC_ACCEPTED = 202;
-
- /**
- * Status code (204) indicating that the request succeeded but that
- * there was no new information to return.
- */
- public static final int SC_NO_CONTENT = 204;
-
- /**
- * Status code (301) indicating that the resource has permanently
- * moved to a new location, and that future references should use a
- * new URI with their requests.
- */
- public static final int SC_MOVED_PERMANENTLY = 301;
-
- /**
- * Status code (302) indicating that the resource has temporarily
- * moved to another location, but that future references should
- * still use the original URI to access the resource.
- */
- public static final int SC_MOVED_TEMPORARILY = 302;
-
- /**
- * Status code (304) indicating that a conditional GET operation
- * found that the resource was available and not modified.
- */
- public static final int SC_NOT_MODIFIED = 304;
-
- /**
- * Status code (400) indicating the request sent by the client was
- * syntactically incorrect.
- */
- public static final int SC_BAD_REQUEST = 400;
-
- /**
- * Status code (401) indicating that the request requires HTTP
- * authentication.
- */
- public static final int SC_UNAUTHORIZED = 401;
-
- /**
- * Status code (403) indicating the server understood the request
- * but refused to fulfill it.
- */
- public static final int SC_FORBIDDEN = 403;
-
- /**
- * Status code (404) indicating that the requested resource is not
- * available.
- */
- public static final int SC_NOT_FOUND = 404;
-
- /**
- * Status code (500) indicating an error inside the HTTP service
- * which prevented it from fulfilling the request.
- */
- public static final int SC_INTERNAL_SERVER_ERROR = 500;
-
- /**
- * Status code (501) indicating the HTTP service does not support
- * the functionality needed to fulfill the request.
- */
- public static final int SC_NOT_IMPLEMENTED = 501;
-
- /**
- * Status code (502) indicating that the HTTP server received an
- * invalid response from a server it consulted when acting as a
- * proxy or gateway.
- */
- public static final int SC_BAD_GATEWAY = 502;
-
- /**
- * Status code (503) indicating that the HTTP service is
- * temporarily overloaded, and unable to handle the request.
- */
- public static final int SC_SERVICE_UNAVAILABLE = 503;
- }
-