Package org.apache.sling.maven.bundlesupport.deploy.method

# Class ResponseCodeEnforcingResponseHandler

java.lang.Object
org.apache.sling.maven.bundlesupport.deploy.method.ResponseCodeEnforcingResponseHandler

All Implemented Interfaces:
  `org.apache.hc.core5.http.io.HttpClientResponseHandler<Integer>`

public final class ResponseCodeEnforcingResponseHandler extends Object implements org.apache.hc.core5.http.io.HttpClientResponseHandler<Integer>
Throws `HttpResponseException` for all response codes except for the accepted ones. In addition optionally checks for a certain content type and content of the response. Returns the response code if all checks pass.

## Constructor Summary

Constructors
Constructor
Description
`ResponseCodeEnforcingResponseHandler(Integer... allowedCodes)`
`ResponseCodeEnforcingResponseHandler(String expectedContentType, Integer... allowedCodes)`
`ResponseCodeEnforcingResponseHandler(String expectedContentType, Predicate<String> responseStringPredicate, Integer... allowedCodes)`

## Method Summary

Modifier and Type
Method
Description
`Integer`
`handleResponse(org.apache.hc.core5.http.ClassicHttpResponse response)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ResponseCodeEnforcingResponseHandler

public ResponseCodeEnforcingResponseHandler(Integer... allowedCodes)

### ResponseCodeEnforcingResponseHandler

public ResponseCodeEnforcingResponseHandler(String expectedContentType, Integer... allowedCodes)

### ResponseCodeEnforcingResponseHandler

public ResponseCodeEnforcingResponseHandler(String expectedContentType, Predicate<String> responseStringPredicate, Integer... allowedCodes)

## Method Details

### handleResponse

public Integer handleResponse(org.apache.hc.core5.http.ClassicHttpResponse response) throws org.apache.hc.core5.http.HttpException, IOException

Specified by:
  `handleResponse` in interface `org.apache.hc.core5.http.io.HttpClientResponseHandler<Integer>`
Throws:
  `org.apache.hc.core5.http.HttpException`
  `IOException`