@@ -19,10 +19,20 @@ public static final class RequestContext {
1919 this .connection = connection ;
2020 }
2121
22+ /**
23+ * Get the logical TUS request method for this request.
24+ *
25+ * @return The request method.
26+ */
2227 public String getMethod () {
2328 return method ;
2429 }
2530
31+ /**
32+ * Get the HTTP connection for this request.
33+ *
34+ * @return The mutable HTTP connection.
35+ */
2636 public HttpURLConnection getConnection () {
2737 return connection ;
2838 }
@@ -32,19 +42,37 @@ public HttpURLConnection getConnection() {
3242 * Callback invoked before transport sends the request.
3343 */
3444 public interface BeforeRequest {
45+ /**
46+ * Handle a request before it is sent.
47+ *
48+ * @param context The request context.
49+ * @throws IOException when the request should fail.
50+ */
3551 void beforeRequest (RequestContext context ) throws IOException ;
3652 }
3753
3854 /**
3955 * Callback invoked after transport receives the response.
4056 */
4157 public interface AfterResponse {
58+ /**
59+ * Handle a response after it has been received.
60+ *
61+ * @param context The request context.
62+ * @throws IOException when the response should fail.
63+ */
4264 void afterResponse (RequestContext context ) throws IOException ;
4365 }
4466
4567 private final BeforeRequest beforeRequest ;
4668 private final AfterResponse afterResponse ;
4769
70+ /**
71+ * Create request lifecycle hooks.
72+ *
73+ * @param beforeRequest Callback invoked before a request is sent.
74+ * @param afterResponse Callback invoked after a response is received.
75+ */
4876 public TusRequestLifecycleHooks (BeforeRequest beforeRequest , AfterResponse afterResponse ) {
4977 this .beforeRequest = beforeRequest ;
5078 this .afterResponse = afterResponse ;
0 commit comments