2
|
1 |
/*
|
5506
|
2 |
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
2
|
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
|
5506
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
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 |
*
|
5506
|
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.
|
2
|
24 |
*/
|
|
25 |
|
|
26 |
package sun.net.httpserver;
|
|
27 |
|
|
28 |
import java.net.*;
|
|
29 |
import java.io.*;
|
|
30 |
import java.nio.*;
|
|
31 |
import java.security.*;
|
|
32 |
import java.nio.channels.*;
|
|
33 |
import java.util.*;
|
|
34 |
import java.util.concurrent.*;
|
|
35 |
import javax.net.ssl.*;
|
|
36 |
import com.sun.net.httpserver.*;
|
|
37 |
import com.sun.net.httpserver.spi.*;
|
|
38 |
|
|
39 |
public class HttpServerImpl extends HttpServer {
|
|
40 |
|
|
41 |
ServerImpl server;
|
|
42 |
|
|
43 |
HttpServerImpl () throws IOException {
|
|
44 |
this (new InetSocketAddress(80), 0);
|
|
45 |
}
|
|
46 |
|
|
47 |
HttpServerImpl (
|
|
48 |
InetSocketAddress addr, int backlog
|
|
49 |
) throws IOException {
|
|
50 |
server = new ServerImpl (this, "http", addr, backlog);
|
|
51 |
}
|
|
52 |
|
|
53 |
public void bind (InetSocketAddress addr, int backlog) throws IOException {
|
|
54 |
server.bind (addr, backlog);
|
|
55 |
}
|
|
56 |
|
|
57 |
public void start () {
|
|
58 |
server.start();
|
|
59 |
}
|
|
60 |
|
|
61 |
public void setExecutor (Executor executor) {
|
|
62 |
server.setExecutor(executor);
|
|
63 |
}
|
|
64 |
|
|
65 |
public Executor getExecutor () {
|
|
66 |
return server.getExecutor();
|
|
67 |
}
|
|
68 |
|
|
69 |
public void stop (int delay) {
|
|
70 |
server.stop (delay);
|
|
71 |
}
|
|
72 |
|
|
73 |
public HttpContextImpl createContext (String path, HttpHandler handler) {
|
|
74 |
return server.createContext (path, handler);
|
|
75 |
}
|
|
76 |
|
|
77 |
public HttpContextImpl createContext (String path) {
|
|
78 |
return server.createContext (path);
|
|
79 |
}
|
|
80 |
|
|
81 |
public void removeContext (String path) throws IllegalArgumentException {
|
|
82 |
server.removeContext (path);
|
|
83 |
}
|
|
84 |
|
|
85 |
public void removeContext (HttpContext context) throws IllegalArgumentException {
|
|
86 |
server.removeContext (context);
|
|
87 |
}
|
|
88 |
|
|
89 |
public InetSocketAddress getAddress() {
|
|
90 |
return server.getAddress();
|
|
91 |
}
|
|
92 |
}
|