java.lang.Object
dev.katsute.simplehttpserver.handler.TemporaryHandler
- All Implemented Interfaces:
com.sun.net.httpserver.HttpHandler
Handler that removes itself after a single request, or after a set time, whichever comes first. This can be used for single use downloads or disposable links. A random unused context can be created by using
HttpServerExtensions.getRandomContext() or HttpServerExtensions.getRandomContext(String).- Since:
- 5.0.0
- Version:
- 5.0.0
- Author:
- Katsute
- See Also:
-
HttpServerExtensions.getRandomContext()HttpServerExtensions.getRandomContext(String)
-
Constructor Summary
ConstructorsConstructorDescriptionTemporaryHandler(com.sun.net.httpserver.HttpHandler handler) Creates a temporary handler that removes itself after the first request.TemporaryHandler(com.sun.net.httpserver.HttpHandler handler, long maxTime) Creates a temporary handler that removes itself after the first request, or after a set time. -
Method Summary
-
Constructor Details
-
TemporaryHandler
public TemporaryHandler(com.sun.net.httpserver.HttpHandler handler) Creates a temporary handler that removes itself after the first request.- Parameters:
handler- handler- Since:
- 5.0.0
-
TemporaryHandler
public TemporaryHandler(com.sun.net.httpserver.HttpHandler handler, long maxTime) Creates a temporary handler that removes itself after the first request, or after a set time.- Parameters:
handler- handlermaxTime- how long the handler should exists for in milliseconds- Since:
- 5.0.0
-
-
Method Details
-
handle
- Specified by:
handlein interfacecom.sun.net.httpserver.HttpHandler- Throws:
IOException
-
toString
-