Showing the changes to java/pkg/com/sun/net/httpserver/HttpContext.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,112 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.net.httpserver; | ||
| 27 | import java.net.*; | ||
| 28 | import java.io.*; | ||
| 29 | import java.util.*; | ||
| 30 | |||
| 31 | /** | ||
| 32 | * HttpContext represents a mapping between the root URI path of an application | ||
| 33 | * to a {@link HttpHandler} which is invoked to handle requests destined | ||
| 34 | * for that path on the associated HttpServer or HttpsServer. | ||
| 35 | * <p> | ||
| 36 | * HttpContext instances are created by the create methods in HttpServer | ||
| 37 | * and HttpsServer | ||
| 38 | * <p> | ||
| 39 | * A chain of {@link Filter} objects can be added to a HttpContext. All exchanges processed by the | ||
| 40 | * context can be pre- and post-processed by each Filter in the chain. | ||
| 41 | * @since 1.6 | ||
| 42 | */ | ||
| 43 | public abstract class HttpContext { | ||
| 44 | |||
| 45 | protected HttpContext () { | ||
| 46 | } | ||
| 47 | |||
| 48 | /** | ||
| 49 | * returns the handler for this context | ||
| 50 | * @return the HttpHandler for this context | ||
| 51 | */ | ||
| 52 | public abstract HttpHandler getHandler () ; | ||
| 53 | |||
| 54 | /** | ||
| 55 | * Sets the handler for this context, if not already set. | ||
| 56 | * @param h the handler to set for this context | ||
| 57 | * @throws IllegalArgumentException if this context's handler is already set. | ||
| 58 | * @throws NullPointerException if handler is <code>null</code> | ||
| 59 | */ | ||
| 60 | public abstract void setHandler (HttpHandler h) ; | ||
| 61 | |||
| 62 | /** | ||
| 63 | * returns the path this context was created with | ||
| 64 | * @return this context's path | ||
| 65 | */ | ||
| 66 | public abstract String getPath() ; | ||
| 67 | |||
| 68 | /** | ||
| 69 | * returns the server this context was created with | ||
| 70 | * @return this context's server | ||
| 71 | */ | ||
| 72 | public abstract HttpServer getServer () ; | ||
| 73 | |||
| 74 | /** | ||
| 75 | * returns a mutable Map, which can be used to pass | ||
| 76 | * configuration and other data to Filter modules | ||
| 77 | * and to the context's exchange handler. | ||
| 78 | * <p> | ||
| 79 | * Every attribute stored in this Map will be visible to | ||
| 80 | * every HttpExchange processed by this context | ||
| 81 | */ | ||
| 82 | public abstract Map<String,Object> getAttributes() ; | ||
| 83 | |||
| 84 | /** | ||
| 85 | * returns this context's list of Filters. This is the | ||
| 86 | * actual list used by the server when dispatching requests | ||
| 87 | * so modifications to this list immediately affect the | ||
| 88 | * the handling of exchanges. | ||
| 89 | */ | ||
| 90 | public abstract List<Filter> getFilters(); | ||
| 91 | |||
| 92 | /** | ||
| 93 | * Sets the Authenticator for this HttpContext. Once an authenticator | ||
| 94 | * is establised on a context, all client requests must be | ||
| 95 | * authenticated, and the given object will be invoked to validate each | ||
| 96 | * request. Each call to this method replaces any previous value set. | ||
| 97 | * @param auth the authenticator to set. If <code>null</code> then any | ||
| 98 | * previously set authenticator is removed, | ||
| 99 | * and client authentication will no longer be required. | ||
| 100 | * @return the previous Authenticator, if any set, or <code>null</code> | ||
| 101 | * otherwise. | ||
| 102 | */ | ||
| 103 | public abstract Authenticator setAuthenticator (Authenticator auth); | ||
| 104 | |||
| 105 | /** | ||
| 106 | * Returns the currently set Authenticator for this context | ||
| 107 | * if one exists. | ||
| 108 | * @return this HttpContext's Authenticator, or <code>null</code> | ||
| 109 | * if none is set. | ||
| 110 | */ | ||
| 111 | public abstract Authenticator getAuthenticator (); | ||
| 112 | } | ||