0N/A/*
2362N/A * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage com.sun.net.httpserver;
0N/Aimport java.net.*;
0N/Aimport java.io.*;
0N/Aimport java.util.*;
0N/A
0N/A/**
0N/A * HttpContext represents a mapping between the root URI path of an application
0N/A * to a {@link HttpHandler} which is invoked to handle requests destined
0N/A * for that path on the associated HttpServer or HttpsServer.
0N/A * <p>
0N/A * HttpContext instances are created by the create methods in HttpServer
0N/A * and HttpsServer
0N/A * <p>
0N/A * A chain of {@link Filter} objects can be added to a HttpContext. All exchanges processed by the
0N/A * context can be pre- and post-processed by each Filter in the chain.
0N/A * @since 1.6
0N/A */
0N/Apublic abstract class HttpContext {
0N/A
0N/A protected HttpContext () {
0N/A }
0N/A
0N/A /**
0N/A * returns the handler for this context
0N/A * @return the HttpHandler for this context
0N/A */
0N/A public abstract HttpHandler getHandler () ;
0N/A
0N/A /**
0N/A * Sets the handler for this context, if not already set.
0N/A * @param h the handler to set for this context
0N/A * @throws IllegalArgumentException if this context's handler is already set.
0N/A * @throws NullPointerException if handler is <code>null</code>
0N/A */
0N/A public abstract void setHandler (HttpHandler h) ;
0N/A
0N/A /**
0N/A * returns the path this context was created with
0N/A * @return this context's path
0N/A */
0N/A public abstract String getPath() ;
0N/A
0N/A /**
0N/A * returns the server this context was created with
0N/A * @return this context's server
0N/A */
0N/A public abstract HttpServer getServer () ;
0N/A
0N/A /**
0N/A * returns a mutable Map, which can be used to pass
0N/A * configuration and other data to Filter modules
0N/A * and to the context's exchange handler.
0N/A * <p>
0N/A * Every attribute stored in this Map will be visible to
0N/A * every HttpExchange processed by this context
0N/A */
0N/A public abstract Map<String,Object> getAttributes() ;
0N/A
0N/A /**
0N/A * returns this context's list of Filters. This is the
0N/A * actual list used by the server when dispatching requests
0N/A * so modifications to this list immediately affect the
0N/A * the handling of exchanges.
0N/A */
0N/A public abstract List<Filter> getFilters();
0N/A
0N/A /**
0N/A * Sets the Authenticator for this HttpContext. Once an authenticator
0N/A * is establised on a context, all client requests must be
0N/A * authenticated, and the given object will be invoked to validate each
0N/A * request. Each call to this method replaces any previous value set.
0N/A * @param auth the authenticator to set. If <code>null</code> then any
0N/A * previously set authenticator is removed,
0N/A * and client authentication will no longer be required.
0N/A * @return the previous Authenticator, if any set, or <code>null</code>
0N/A * otherwise.
0N/A */
0N/A public abstract Authenticator setAuthenticator (Authenticator auth);
0N/A
0N/A /**
0N/A * Returns the currently set Authenticator for this context
0N/A * if one exists.
0N/A * @return this HttpContext's Authenticator, or <code>null</code>
0N/A * if none is set.
0N/A */
0N/A public abstract Authenticator getAuthenticator ();
0N/A}