jdk/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpServer.java
changeset 45132 db2f2d72cd4f
parent 34894 3248b89d1921
child 46052 30afc40a7f6a
equal deleted inserted replaced
45131:bc590fe5c060 45132:db2f2d72cd4f
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    49  * Any request for which no handler can be found is rejected with a 404 response.
    49  * Any request for which no handler can be found is rejected with a 404 response.
    50  * Management of threads can be done external to this object by providing a
    50  * Management of threads can be done external to this object by providing a
    51  * {@link java.util.concurrent.Executor} object. If none is provided a default
    51  * {@link java.util.concurrent.Executor} object. If none is provided a default
    52  * implementation is used.
    52  * implementation is used.
    53  * <p>
    53  * <p>
    54  * <a name="mapping_description"></a>
    54  * <a id="mapping_description"></a>
    55  * <b>Mapping request URIs to HttpContext paths</b><p>
    55  * <b>Mapping request URIs to HttpContext paths</b><p>
    56  * When a HTTP request is received,
    56  * When a HTTP request is received,
    57  * the appropriate HttpContext (and handler) is located by finding the context
    57  * the appropriate HttpContext (and handler) is located by finding the context
    58  * whose path is the longest matching prefix of the request URI's path.
    58  * whose path is the longest matching prefix of the request URI's path.
    59  * Paths are matched literally, which means that the strings are compared
    59  * Paths are matched literally, which means that the strings are compared
    60  * case sensitively, and with no conversion to or from any encoded forms.
    60  * case sensitively, and with no conversion to or from any encoded forms.
    61  * For example. Given a HttpServer with the following HttpContexts configured.
    61  * For example. Given a HttpServer with the following HttpContexts configured.
    62  * <table>
    62  * <table><caption style="display:none">description</caption>
    63  * <tr><td><i>Context</i></td><td><i>Context path</i></td></tr>
    63  * <tr><td><i>Context</i></td><td><i>Context path</i></td></tr>
    64  * <tr><td>ctx1</td><td>"/"</td></tr>
    64  * <tr><td>ctx1</td><td>"/"</td></tr>
    65  * <tr><td>ctx2</td><td>"/apps/"</td></tr>
    65  * <tr><td>ctx2</td><td>"/apps/"</td></tr>
    66  * <tr><td>ctx3</td><td>"/apps/foo/"</td></tr>
    66  * <tr><td>ctx3</td><td>"/apps/foo/"</td></tr>
    67  * </table>
    67  * </table>
    68  * <p>
    68  * <p>
    69  * the following table shows some request URIs and which, if any context they would
    69  * the following table shows some request URIs and which, if any context they would
    70  * match with.
    70  * match with.
    71  * <table>
    71  * <table><caption style="display:none">description</caption>
    72  * <tr><td><i>Request URI</i></td><td><i>Matches context</i></td></tr>
    72  * <tr><td><i>Request URI</i></td><td><i>Matches context</i></td></tr>
    73  * <tr><td>"http://foo.com/apps/foo/bar"</td><td>ctx3</td></tr>
    73  * <tr><td>"http://foo.com/apps/foo/bar"</td><td>ctx3</td></tr>
    74  * <tr><td>"http://foo.com/apps/Foo/bar"</td><td>no match, wrong case</td></tr>
    74  * <tr><td>"http://foo.com/apps/Foo/bar"</td><td>no match, wrong case</td></tr>
    75  * <tr><td>"http://foo.com/apps/app1"</td><td>ctx2</td></tr>
    75  * <tr><td>"http://foo.com/apps/app1"</td><td>ctx2</td></tr>
    76  * <tr><td>"http://foo.com/foo"</td><td>ctx1</td></tr>
    76  * <tr><td>"http://foo.com/foo"</td><td>ctx1</td></tr>