Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

Commit baf6145

Browse files
committed
Add SimpleHttpsServer front
1 parent b7d4d99 commit baf6145

2 files changed

Lines changed: 105 additions & 0 deletions

File tree

src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpServer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*
1515
* @see HttpServer
1616
* @see HttpHandler
17+
* @see SimpleHttpsServer
1718
* @see SimpleHttpHandler
1819
* @since 02.00.00
1920
* @version 03.04.00
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
package com.kttdevelopment.simplehttpserver;
2+
3+
import com.sun.net.httpserver.*;
4+
5+
import java.io.IOException;
6+
7+
/**
8+
* <i>This class is a simplified implementation of {@link HttpsServer}.</i><br>
9+
* At least one {@link HttpHandler} must be created in order to process requests. When handling requests the server will use the most specific context. If no handler can be found it is rejected with a 404 response. <br>
10+
* <b>Contexts are case-sensitive.</b>
11+
*
12+
* @see HttpsServer
13+
* @see HttpHandler
14+
* @see SimpleHttpServer
15+
* @see SimpleHttpHandler
16+
* @since 02.00.00
17+
* @version 03.04.00
18+
* @author Ktt Development
19+
*/
20+
public abstract class SimpleHttpsServer extends SimpleHttpServer {
21+
22+
/**
23+
* Create an empty {@link SimpleHttpsServer}. Applications don't use this method.
24+
*
25+
* @see SimpleHttpsServerImpl#create(Integer, Integer)
26+
* @since 02.00.00
27+
* @author Ktt Development
28+
*/
29+
SimpleHttpsServer(){ }
30+
31+
//
32+
33+
/**
34+
* Creates a {@link SimpleHttpsServer}.
35+
*
36+
* @return a {@link SimpleHttpsServer}
37+
* @throws IOException uncaught exception
38+
*
39+
* @since 03.04.00
40+
* @author Ktt Development
41+
*/
42+
public static SimpleHttpsServer create() throws IOException {
43+
return SimpleHttpsServerImpl.create(null,null);
44+
}
45+
46+
/**
47+
* Creates a {@link SimpleHttpsServer} bounded to a port.
48+
*
49+
* @param port port to bind to
50+
* @return a {@link SimpleHttpsServer}
51+
* @throws java.net.BindException if server can not bind to port
52+
* @throws NullPointerException if address is <code>null</code>
53+
* @throws IllegalArgumentException if port is out of range
54+
* @throws IOException uncaught exception
55+
*
56+
* @since 03.04.00
57+
* @author Ktt Development
58+
*/
59+
public static SimpleHttpsServer create(final int port) throws IOException {
60+
return SimpleHttpsServerImpl.create(port,null);
61+
}
62+
63+
/**
64+
* Creates a {@link SimpleHttpsServer} bounded to a port.
65+
*
66+
* @param port port to bind to
67+
* @param backlog request backlog
68+
* @return a {@link SimpleHttpsServer}
69+
* @throws java.net.BindException if server can not bind to port
70+
* @throws NullPointerException if address is <code>null</code>
71+
* @throws IllegalArgumentException if port is out of range
72+
* @throws IOException uncaught exception
73+
*
74+
* @since 03.04.00
75+
* @author Ktt Development
76+
*/
77+
public static SimpleHttpsServer create(final int port, final int backlog) throws IOException {
78+
return SimpleHttpsServerImpl.create(port,backlog);
79+
}
80+
81+
//
82+
83+
/**
84+
* Sets a https configurator for the server
85+
*
86+
* @param config the https configurator
87+
* @throws NullPointerException if config is null
88+
*
89+
* @since 03.04.00
90+
* @author Ktt Development
91+
*/
92+
public abstract void setHttpsConfigurator(HttpsConfigurator config);
93+
94+
/**
95+
* Returns the https configurator of the server
96+
*
97+
* @return the https configurator
98+
*
99+
* @since 03.04.00
100+
* @author Ktt Development
101+
*/
102+
public abstract HttpsConfigurator getHttpsConfigurator();
103+
104+
}

0 commit comments

Comments
 (0)