11package express ;
22
3- import com .sun .istack .internal .NotNull ;
43import com .sun .net .httpserver .HttpServer ;
54import com .sun .net .httpserver .HttpsConfigurator ;
65import com .sun .net .httpserver .HttpsServer ;
@@ -52,7 +51,7 @@ public class Express implements Router {
5251 *
5352 * @param hostname The host name
5453 */
55- public Express (@ NotNull String hostname ) {
54+ public Express (String hostname ) {
5655 this .hostname = hostname ;
5756 }
5857
@@ -61,7 +60,7 @@ public Express(@NotNull String hostname) {
6160 *
6261 * @param httpsConfigurator The HttpsConfigurator for https
6362 */
64- public Express (@ NotNull HttpsConfigurator httpsConfigurator ) {
63+ public Express (HttpsConfigurator httpsConfigurator ) {
6564 this .httpsConfigurator = httpsConfigurator ;
6665 }
6766
@@ -72,7 +71,7 @@ public Express(@NotNull HttpsConfigurator httpsConfigurator) {
7271 * @param hostname The host name
7372 * @param httpsConfigurator The HttpsConfigurator for https
7473 */
75- public Express (@ NotNull String hostname , HttpsConfigurator httpsConfigurator ) {
74+ public Express (String hostname , HttpsConfigurator httpsConfigurator ) {
7675 this .hostname = hostname ;
7776 this .httpsConfigurator = httpsConfigurator ;
7877 }
@@ -96,7 +95,7 @@ public boolean isSecure() {
9695 * @param param The parameter name.
9796 * @param request An request handler.
9897 */
99- public void onParam (@ NotNull String param , @ NotNull HttpRequest request ) {
98+ public void onParam (String param , HttpRequest request ) {
10099 PARAMETER_LISTENER .put (param , request );
101100 }
102101
@@ -133,7 +132,7 @@ public Object get(String key) {
133132 * @param executor The new executor.
134133 * @throws IOException If the server is currently running
135134 */
136- public void setExecutor (@ NotNull Executor executor ) throws IOException {
135+ public void setExecutor (Executor executor ) throws IOException {
137136 if (httpServer != null ) {
138137 throw new IOException ("Cannot set the executor after the server has starderd!" );
139138 } else {
@@ -146,7 +145,7 @@ public void setExecutor(@NotNull Executor executor) throws IOException {
146145 *
147146 * @param router The router.
148147 */
149- public void use (@ NotNull ExpressRouter router ) {
148+ public void use (ExpressRouter router ) {
150149 this .HANDLER .combine (router .getHandler ());
151150 this .WORKER .addAll (router .getWorker ());
152151 }
@@ -158,7 +157,7 @@ public void use(@NotNull ExpressRouter router) {
158157 * @param router The router.
159158 */
160159 @ SuppressWarnings ("unchecked" )
161- public void use (@ NotNull String root , @ NotNull ExpressRouter router ) {
160+ public void use (String root , ExpressRouter router ) {
162161
163162 router .getHandler ().forEach (fl -> fl .getFilter ().forEach (layer -> {
164163 ((FilterImpl ) layer ).setRoot (root );
@@ -168,100 +167,95 @@ public void use(@NotNull String root, @NotNull ExpressRouter router) {
168167 this .WORKER .addAll (router .getWorker ());
169168 }
170169
171- public void use (@ NotNull HttpRequest middleware ) {
170+ public void use (HttpRequest middleware ) {
172171 addMiddleware ("*" , "*" , middleware );
173172 }
174173
175- public void use (@ NotNull String context , @ NotNull HttpRequest middleware ) {
174+ public void use (String context , HttpRequest middleware ) {
176175 addMiddleware ("*" , context , middleware );
177176 }
178177
179- public void use (@ NotNull String context , @ NotNull String requestMethod , @ NotNull HttpRequest middleware ) {
178+ public void use (String context , String requestMethod , HttpRequest middleware ) {
180179 addMiddleware (requestMethod .toUpperCase (), context , middleware );
181180 }
182181
183182 // Internal service to handle middleware
184- private void addMiddleware (@ NotNull String requestMethod , @ NotNull String context , HttpRequest middleware ) {
183+ private void addMiddleware (String requestMethod , String context , HttpRequest middleware ) {
185184 if (middleware instanceof FilterTask ) {
186185 WORKER .add (new FilterWorker ((FilterTask ) middleware ));
187186 }
188187
189188 HANDLER .add (0 , new FilterImpl (requestMethod , context , middleware ));
190189 }
191190
192- public void all (@ NotNull HttpRequest request ) {
191+ public void all (HttpRequest request ) {
193192 HANDLER .add (1 , new FilterImpl ("*" , "*" , request ));
194193 }
195194
196- public void all (@ NotNull String context , @ NotNull HttpRequest request ) {
195+ public void all (String context , HttpRequest request ) {
197196 HANDLER .add (1 , new FilterImpl ("*" , context , request ));
198197 }
199198
200- public void all (@ NotNull String context , @ NotNull String requestMethod , @ NotNull HttpRequest request ) {
199+ public void all (String context , String requestMethod , HttpRequest request ) {
201200 HANDLER .add (1 , new FilterImpl (requestMethod , context , request ));
202201 }
203202
204- public void get (@ NotNull String context , @ NotNull HttpRequest request ) {
203+ public void get (String context , HttpRequest request ) {
205204 HANDLER .add (1 , new FilterImpl ("GET" , context , request ));
206205 }
207206
208- public void post (@ NotNull String context , @ NotNull HttpRequest request ) {
207+ public void post (String context , HttpRequest request ) {
209208 HANDLER .add (1 , new FilterImpl ("POST" , context , request ));
210209 }
211210
212- public void put (@ NotNull String context , @ NotNull HttpRequest request ) {
211+ public void put (String context , HttpRequest request ) {
213212 HANDLER .add (1 , new FilterImpl ("PUT" , context , request ));
214213 }
215214
216- public void delete (@ NotNull String context , @ NotNull HttpRequest request ) {
215+ public void delete (String context , HttpRequest request ) {
217216 HANDLER .add (1 , new FilterImpl ("DELETE" , context , request ));
218217 }
219218
220- public void patch (@ NotNull String context , @ NotNull HttpRequest request ) {
219+ public void patch (String context , HttpRequest request ) {
221220 HANDLER .add (1 , new FilterImpl ("PATCH" , context , request ));
222221 }
223222
224223 /**
225224 * Start the HTTP-Server on port 80.
226- * This method is asyncronous so be sure to add an listener or keep it in mind!
227- *
228- * @throws IOException - If an IO-Error occurs, eg. the port is already in use.
225+ * This method is asynchronous so be sure to add an listener or keep it in mind!
229226 */
230- public void listen () throws IOException {
227+ public void listen () {
231228 listen (null , 80 );
232229 }
233230
234231 /**
235232 * Start the HTTP-Server on a specific port
236- * This method is asyncronous so be sure to add an listener or keep it in mind!
233+ * This method is asynchronous so be sure to add an listener or keep it in mind!
237234 *
238235 * @param port The port.
239- * @throws IOException - If an IO-Error occurs, eg. the port is already in use.
240236 */
241- public void listen (int port ) throws IOException {
237+ public void listen (int port ) {
242238 listen (null , port );
243239 }
244240
245241 /**
246242 * Start the HTTP-Server on port 80.
247- * This method is asyncronous so be sure to add an listener or keep it in mind!
243+ * This method is asynchronous so be sure to add an listener or keep it in mind!
248244 *
249245 * @param onStart An listener which will be fired after the server is stardet.
250- * @throws IOException - If an IO-Error occurs, eg. the port is already in use.
251246 */
252- public void listen (ExpressListener onStart ) throws IOException {
247+ public void listen (ExpressListener onStart ) {
253248 listen (onStart , 80 );
254249 }
255250
256251 /**
257252 * Start the HTTP-Server on a specific port.
258- * This method is asyncronous so be sure to add an listener or keep it in mind!
253+ * This method is asynchronous so be sure to add an listener or keep it in mind!
259254 *
260255 * @param onStart An listener which will be fired after the server is stardet.
261256 * @param port The port.
262- * @throws IOException - If an IO-Error occurs, eg. the port is already in use.
263257 */
264- public void listen (ExpressListener onStart , int port ) throws IOException {
258+ public void listen (ExpressListener onStart , int port ) {
265259 new Thread (() -> {
266260 try {
267261 // Fire worker threads
0 commit comments