Package org.ametys.web.cache
Record Class FOCommHelper.FOResult
java.lang.Object
java.lang.Record
org.ametys.web.cache.FOCommHelper.FOResult
- Record Components:
uri- the requested URI (FO URI + path)code- the HTTP response code, -1 if the request failed.reason- the HTTP response reason phrase, can be null.body- the HTTP response body, can be null.exception- the exception that occurred in case of failure to communicate with the remote server, null in case of success
- Enclosing class:
FOCommHelper
public static record FOCommHelper.FOResult(URI uri, int code, String reason, byte[] body, Throwable exception)
extends Record
Result of a request to a front-office
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]body()Returns the value of thebodyrecord component.intcode()Returns the value of thecoderecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexceptionrecord component.final inthashCode()Returns a hash code value for this object.static FOCommHelper.FOResultBuild aFOCommHelper.FOResultrepresenting a failed request a requestprotected static FOCommHelper.FOResultof(org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.ClassicHttpResponse response) Build aFOCommHelper.FOResultfrom a request and response objectreason()Returns the value of thereasonrecord component.final StringtoString()Returns a string representation of this record class.uri()Returns the value of theurirecord component.
-
Constructor Details
-
FOResult
Creates an instance of aFOResultrecord class.
-
-
Method Details
-
of
protected static FOCommHelper.FOResult of(org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.ClassicHttpResponse response) throws org.apache.hc.core5.http.HttpException, IOException Build aFOCommHelper.FOResultfrom a request and response object- Parameters:
request- the HTTP request objectresponse- the HTTP response object- Returns:
- an
FOCommHelper.FOResultdescribing the request and response - Throws:
org.apache.hc.core5.http.HttpException- if an error occurs while handling the responseIOException- if an error occurs while reading the response
-
of
public static FOCommHelper.FOResult of(org.apache.hc.core5.http.ClassicHttpRequest request, Throwable e) throws org.apache.hc.core5.http.HttpException Build aFOCommHelper.FOResultrepresenting a failed request a request- Parameters:
request- the HTTP request objecte- the exception that occurred- Returns:
- an
FOCommHelper.FOResultdescribing the request and failed response - Throws:
org.apache.hc.core5.http.HttpException- if an error occurs while handling the response
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
uri
Returns the value of theurirecord component.- Returns:
- the value of the
urirecord component
-
code
Returns the value of thecoderecord component.- Returns:
- the value of the
coderecord component
-
reason
Returns the value of thereasonrecord component.- Returns:
- the value of the
reasonrecord component
-
body
Returns the value of thebodyrecord component.- Returns:
- the value of the
bodyrecord component
-
exception
Returns the value of theexceptionrecord component.- Returns:
- the value of the
exceptionrecord component
-