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

Commit b7d4d99

Browse files
committed
Depreciated
1 parent 4185bc0 commit b7d4d99

File tree

2 files changed

+0
-307
lines changed

2 files changed

+0
-307
lines changed

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

Lines changed: 0 additions & 225 deletions
Original file line numberDiff line numberDiff line change
@@ -339,231 +339,6 @@ public static SimpleHttpServer create(final int port, final int backlog) throws
339339
*/
340340
public abstract HttpContext createContext(final String context, final HttpHandler handler, final Authenticator authenticator);
341341

342-
//
343-
344-
// region depreciated - temporary context
345-
346-
/**
347-
* Creates a temporary context at a random address that will remove itself after the first connection. This type of context is typically used for single use downloads or media file hosting. <br>
348-
* To get the context use {@link HttpContext#getPath()}.
349-
*
350-
* @deprecated Use {@link com.kttdevelopment.simplehttpserver.handler.TemporaryHandler} instead
351-
*
352-
* @return the http context associated with the context
353-
*
354-
* @see HttpContext
355-
* @see #createTemporaryContext(long)
356-
* @see #createTemporaryContext(HttpHandler)
357-
* @see #createTemporaryContext(HttpHandler, long)
358-
* @see #createTemporaryContext(String)
359-
* @see #createTemporaryContext(String, long)
360-
* @see #createTemporaryContext(String, HttpHandler)
361-
* @see #createTemporaryContext(String, HttpHandler, long)
362-
* @see #removeContext(String)
363-
* @see #removeContext(HttpContext)
364-
* @since 02.00.00
365-
* @author Ktt Development
366-
*/
367-
@Deprecated
368-
public abstract HttpContext createTemporaryContext();
369-
370-
/**
371-
* Creates a temporary context at a random address that will remove itself after the first connection or after the max time is passed. This type of context is typically used for single use downloads or media file hosting. <br>
372-
* To get the context use {@link HttpContext#getPath()}.
373-
*
374-
* @deprecated Use {@link com.kttdevelopment.simplehttpserver.handler.TemporaryHandler} instead
375-
*
376-
* @param maxTime the maximum time the context may exist for (in milliseconds)
377-
* @return the http context associated with the context
378-
*
379-
* @see HttpContext
380-
* @see #createTemporaryContext()
381-
* @see #createTemporaryContext(HttpHandler)
382-
* @see #createTemporaryContext(HttpHandler, long)
383-
* @see #createTemporaryContext(String)
384-
* @see #createTemporaryContext(String, long)
385-
* @see #createTemporaryContext(String, HttpHandler)
386-
* @see #createTemporaryContext(String, HttpHandler, long)
387-
* @see #removeContext(String)
388-
* @see #removeContext(HttpContext)
389-
* @since 02.00.00
390-
* @author Ktt Development
391-
*/
392-
@Deprecated
393-
public abstract HttpContext createTemporaryContext(final long maxTime);
394-
395-
/**
396-
* Creates a temporary context at a random address that will remove itself after the first connection. This type of context is typically used for single use downloads or media file hosting. <br>
397-
* To get the context use {@link HttpContext#getPath()}. <br>
398-
* This method encapsulates the handler with a temporary one, so {@link HttpContext#getHandler()} will not return the one passed in the parameter, instead it will return the encapsulating handler.
399-
*
400-
* @deprecated Use {@link com.kttdevelopment.simplehttpserver.handler.TemporaryHandler} instead
401-
*
402-
* @param handler handler to use
403-
* @return the http context associated with the context
404-
*
405-
* @see HttpContext
406-
* @see HttpHandler
407-
* @see #createTemporaryContext()
408-
* @see #createTemporaryContext(long)
409-
* @see #createTemporaryContext(HttpHandler, long)
410-
* @see #createTemporaryContext(String)
411-
* @see #createTemporaryContext(String, long)
412-
* @see #createTemporaryContext(String, HttpHandler)
413-
* @see #createTemporaryContext(String, HttpHandler, long)
414-
* @see #removeContext(String)
415-
* @see #removeContext(HttpContext)
416-
* @since 02.00.00
417-
* @author Ktt Development
418-
*/
419-
@Deprecated
420-
public abstract HttpContext createTemporaryContext(final HttpHandler handler);
421-
422-
/**
423-
* Creates a temporary context at a random address that will remove itself after the first connection or after the max time is passed. This type of context is typically used for single use downloads or media file hosting. <br>
424-
* To get the context use {@link HttpContext#getPath()}. <br>
425-
* This method encapsulates the handler with a temporary one, so {@link HttpContext#getHandler()} will not return the one passed in the parameter, instead it will return the encapsulating handler.
426-
*
427-
* @deprecated Use {@link com.kttdevelopment.simplehttpserver.handler.TemporaryHandler} instead
428-
*
429-
* @param handler handler to use
430-
* @param maxTime the maximum time the context may exist for (in milliseconds)
431-
* @return the http context associated with the context
432-
*
433-
* @see HttpContext
434-
* @see HttpHandler
435-
* @see #createTemporaryContext()
436-
* @see #createTemporaryContext(long)
437-
* @see #createTemporaryContext(HttpHandler)
438-
* @see #createTemporaryContext(String)
439-
* @see #createTemporaryContext(String, long)
440-
* @see #createTemporaryContext(String, HttpHandler)
441-
* @see #createTemporaryContext(String, HttpHandler, long)
442-
* @see #removeContext(String)
443-
* @see #removeContext(HttpContext)
444-
* @since 02.00.00
445-
* @author Ktt Development
446-
*/
447-
@Deprecated
448-
public abstract HttpContext createTemporaryContext(final HttpHandler handler, final long maxTime);
449-
450-
/**
451-
* Creates a temporary context at a specified address that will remove itself after the first connection. This type of context is typically used for single use downloads or media file hosting. <br>
452-
*
453-
* @deprecated Use {@link com.kttdevelopment.simplehttpserver.handler.TemporaryHandler} instead
454-
*
455-
* @param context the context
456-
* @return the http context associated with the context
457-
* @throws IllegalArgumentException if the context is invalid or taken
458-
* @throws NullPointerException if the context is null
459-
*
460-
* @see HttpContext
461-
* @see #createTemporaryContext()
462-
* @see #createTemporaryContext(long)
463-
* @see #createTemporaryContext(HttpHandler)
464-
* @see #createTemporaryContext(HttpHandler, long)
465-
* @see #createTemporaryContext(String, long)
466-
* @see #createTemporaryContext(String, HttpHandler)
467-
* @see #createTemporaryContext(String, HttpHandler, long)
468-
* @see #removeContext(String)
469-
* @see #removeContext(HttpContext)
470-
* @since 02.00.00
471-
* @author Ktt Development
472-
*/
473-
@Deprecated
474-
public abstract HttpContext createTemporaryContext(final String context);
475-
476-
/**
477-
* Creates a temporary context at a specified address that will remove itself after the first connection or after the max time is passed. This type of context is typically used for single use downloads or media file hosting. <br>
478-
*
479-
* @deprecated Use {@link com.kttdevelopment.simplehttpserver.handler.TemporaryHandler} instead
480-
*
481-
* @param context the context
482-
* @param maxTime the maximum time the context may exist for (in milliseconds)
483-
* @return the http context associated with the context
484-
* @throws IllegalArgumentException if the context is invalid or taken
485-
* @throws NullPointerException if the context is null
486-
*
487-
* @see HttpContext
488-
* @see HttpHandler
489-
* @see #createTemporaryContext()
490-
* @see #createTemporaryContext(long)
491-
* @see #createTemporaryContext(HttpHandler)
492-
* @see #createTemporaryContext(HttpHandler, long)
493-
* @see #createTemporaryContext(String)
494-
* @see #createTemporaryContext(String, HttpHandler)
495-
* @see #createTemporaryContext(String, HttpHandler, long)
496-
* @see #removeContext(String)
497-
* @see #removeContext(HttpContext)
498-
* @since 02.00.00
499-
* @author Ktt Development
500-
*/
501-
@Deprecated
502-
public abstract HttpContext createTemporaryContext(final String context, final long maxTime);
503-
504-
/**
505-
* Creates a temporary context at a specified address that will remove itself after the first connection. This type of context is typically used for single use downloads or media file hosting. <br>
506-
* This method encapsulates the handler with a temporary one, so {@link HttpContext#getHandler()} will not return the one passed in the parameter, instead it will return the encapsulating handler.
507-
*
508-
* @deprecated Use {@link com.kttdevelopment.simplehttpserver.handler.TemporaryHandler} instead
509-
*
510-
* @param context the context
511-
* @param handler handler to use
512-
* @return the http context associated with the context
513-
* @throws IllegalArgumentException if the context is invalid or taken
514-
* @throws NullPointerException if the context is null
515-
*
516-
* @see HttpContext
517-
* @see HttpHandler
518-
* @see #createTemporaryContext()
519-
* @see #createTemporaryContext(long)
520-
* @see #createTemporaryContext(HttpHandler)
521-
* @see #createTemporaryContext(HttpHandler, long)
522-
* @see #createTemporaryContext(String)
523-
* @see #createTemporaryContext(String, long)
524-
* @see #createTemporaryContext(String, HttpHandler, long)
525-
* @see #removeContext(String)
526-
* @see #removeContext(HttpContext)
527-
* @since 02.00.00
528-
* @author Ktt Development
529-
*/
530-
@Deprecated
531-
public abstract HttpContext createTemporaryContext(final String context, final HttpHandler handler);
532-
533-
534-
/**
535-
* Creates a temporary context at a random address that will remove itself after the first connection or after the max time is passed. This type of context is typically used for single use downloads or media file hosting. <br>
536-
* To get the context use {@link HttpContext#getPath()}. <br>
537-
* This method encapsulates the handler with a temporary one, so {@link HttpContext#getHandler()} will not return the one passed in the parameter, instead it will return the encapsulating handler.
538-
*
539-
* @deprecated Use {@link com.kttdevelopment.simplehttpserver.handler.TemporaryHandler} instead
540-
*
541-
* @param context the context
542-
* @param handler handler to use
543-
* @param maxTime the maximum time the context may exist for (in milliseconds)
544-
* @return the http context associated with the context
545-
* @throws IllegalArgumentException if the context is invalid or taken
546-
* @throws NullPointerException if the context is null
547-
*
548-
* @see HttpContext
549-
* @see HttpHandler
550-
* @see #createTemporaryContext()
551-
* @see #createTemporaryContext(long)
552-
* @see #createTemporaryContext(HttpHandler)
553-
* @see #createTemporaryContext(HttpHandler, long)
554-
* @see #createTemporaryContext(String)
555-
* @see #createTemporaryContext(String, long)
556-
* @see #createTemporaryContext(String, HttpHandler)
557-
* @see #removeContext(String)
558-
* @see #removeContext(HttpContext)
559-
* @since 02.00.00
560-
* @author Ktt Development
561-
*/
562-
@Deprecated
563-
public abstract HttpContext createTemporaryContext(final String context, final HttpHandler handler, final long maxTime);
564-
565-
// endregion
566-
567342
//
568343

569344
/**

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

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -167,88 +167,6 @@ public synchronized final HttpContext createContext(final String path, final Htt
167167

168168
//
169169

170-
@Deprecated
171-
private String generateRandomContext(){
172-
String targetContext;
173-
174-
do targetContext = UUID.randomUUID().toString();
175-
while(getContextHandler(targetContext) != null);
176-
177-
return targetContext;
178-
}
179-
180-
//
181-
182-
// region depreciated - temporary context
183-
184-
@Override @Deprecated
185-
public synchronized final HttpContext createTemporaryContext(){
186-
return createTemporaryContext(generateRandomContext());
187-
}
188-
189-
@Override @Deprecated
190-
public synchronized final HttpContext createTemporaryContext(final long maxTime){
191-
return createTemporaryContext(generateRandomContext(),maxTime);
192-
}
193-
194-
@Override @Deprecated
195-
public synchronized final HttpContext createTemporaryContext(final HttpHandler handler){
196-
return createTemporaryContext(generateRandomContext(),handler);
197-
}
198-
199-
@Override @Deprecated
200-
public synchronized final HttpContext createTemporaryContext(final HttpHandler handler, final long maxTime){
201-
return createTemporaryContext(generateRandomContext(),handler,maxTime);
202-
}
203-
204-
@Override @Deprecated
205-
public synchronized final HttpContext createTemporaryContext(final String context){
206-
return createContext(context, (HttpExchange exchange) -> removeContext(context));
207-
}
208-
209-
@Override @Deprecated
210-
public synchronized final HttpContext createTemporaryContext(final String context, final long maxTime){
211-
final HttpContext httpContext = createContext(context, (HttpExchange exchange) -> removeContext(context));
212-
213-
new Thread(() -> {
214-
try{
215-
Thread.sleep(maxTime);
216-
}catch(final InterruptedException ignored){ }
217-
removeContext(httpContext);
218-
}).start();
219-
220-
return httpContext;
221-
}
222-
223-
@Override @Deprecated
224-
public synchronized final HttpContext createTemporaryContext(final String context, final HttpHandler handler){
225-
return createContext(context, (HttpExchange exchange) -> {
226-
handler.handle(exchange);
227-
removeContext(context);
228-
});
229-
}
230-
231-
@Override @Deprecated
232-
public synchronized final HttpContext createTemporaryContext(final String context, final HttpHandler handler, final long maxTime){
233-
final HttpContext httpContext = createContext(context, (HttpExchange exchange) -> {
234-
handler.handle(exchange);
235-
removeContext(context);
236-
});
237-
238-
new Thread(() -> {
239-
try{
240-
Thread.sleep(maxTime);
241-
}catch(final InterruptedException ignored){ }
242-
removeContext(httpContext);
243-
}).start();
244-
245-
return httpContext;
246-
}
247-
248-
// endregion
249-
250-
//
251-
252170
@Override
253171
public synchronized final void removeContext(final String path){
254172
server.removeContext(getContext(path));

0 commit comments

Comments
 (0)