Interface CpqClientUtil

All Known Implementing Classes:
DefaultCpqClientUtil

public interface CpqClientUtil
Provides re-use utility methods for interacting with CPQClient.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    checkContentType(String action, String expectedContentType, com.hybris.charon.RawResponse<?> rawResponse)
    CPQ may return in some error situations with HTTP 200/OK and issue and error page, instead of returning a JSON response.
    void
    checkHTTPStatusCode(String action, int expectedStatusCode, com.hybris.charon.RawResponse<?> rawResponse)
    CPQ may return in some error situations with HTTP 200/OK and issue and error page, instead of returning the expected HTTP 201/CREATED or 204/NO_CONTENT.
    Use this method to detect such situations and terminate gracefully, instead of running in parse errors while trying to parse unexpected content.
    In case you actually expect HTTP 200/OK, you should check the content type on top using checkContentType(String, String, RawResponse)
    <T> T
    toResponse(rx.Observable<T> response)
    Resolves a response observable, assuming there is only exactly one element.
  • Method Details

    • checkHTTPStatusCode

      void checkHTTPStatusCode(String action, int expectedStatusCode, com.hybris.charon.RawResponse<?> rawResponse)
      CPQ may return in some error situations with HTTP 200/OK and issue and error page, instead of returning the expected HTTP 201/CREATED or 204/NO_CONTENT.
      Use this method to detect such situations and terminate gracefully, instead of running in parse errors while trying to parse unexpected content.
      In case you actually expect HTTP 200/OK, you should check the content type on top using checkContentType(String, String, RawResponse)
      Parameters:
      action - log friendly string, indicating the triggering action
      expectedStatusCode - expected status HTTP code
      rawResponse - response containing the actual HTTP status code
    • toResponse

      <T> T toResponse(rx.Observable<T> response)
      Resolves a response observable, assuming there is only exactly one element.
      Parameters:
      response - observable to resolve
      Returns:
      actual response
    • checkContentType

      void checkContentType(String action, String expectedContentType, com.hybris.charon.RawResponse<?> rawResponse)
      CPQ may return in some error situations with HTTP 200/OK and issue and error page, instead of returning a JSON response.
      Parameters:
      action - log friendly string, indicating the triggering action
      expectedContentType - expected content type
      rawResponse - response containing the actual content type