java.lang.Object
org.miaixz.bus.http.plugin.httpz.TextCallback
- All Implemented Interfaces:
Callback
An abstract
Callback implementation for handling responses where the body is expected to be a text string.- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidHandles request failures by logging the error.voidonResponse(NewCall call, Response response, String id) Handles the successful HTTP response by consuming the response body as a string and passing it to theonSuccess(NewCall, String, String)method.abstract voidAbstract callback method invoked when a successful response with a text body is received.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.miaixz.bus.http.Callback
on, onFailure, onResponse
-
Constructor Details
-
TextCallback
public TextCallback()
-
-
Method Details
-
onResponse
Handles the successful HTTP response by consuming the response body as a string and passing it to theonSuccess(NewCall, String, String)method.- Specified by:
onResponsein interfaceCallback- Parameters:
call- TheNewCallthat resulted in this response.response- The HTTPResponse.id- The unique ID of the request.
-
onFailure
Handles request failures by logging the error. -
onSuccess
Abstract callback method invoked when a successful response with a text body is received. Subclasses must implement this method to handle the response string.- Parameters:
call- TheNewCallthat resulted in this response.response- The response body as a string.id- The unique ID of the request.
-