Class HttpProducer<A,​B>

    • Constructor Detail

      • HttpProducer

        public HttpProducer()
    • Method Detail

      • handleRedirection

        protected boolean handleRedirection()
      • ignoreServerResponseCode

        protected boolean ignoreServerResponseCode()
      • logHeaders

        protected void logHeaders​(java.lang.String header,
                                  java.lang.String message,
                                  java.util.Set headers)
      • withURL

        public <T extends HttpProducer> T withURL​(java.lang.String s)
      • getMethodProvider

        @NonNull
        public @NonNull RequestMethodProvider getMethodProvider()
        The request method.

        The default is 'POST'

      • setMethodProvider

        public void setMethodProvider​(@NonNull
                                      @NonNull RequestMethodProvider methodProvider)
        The request method.

        The default is 'POST'

      • getContentTypeProvider

        @NonNull
        public @NonNull ContentTypeProvider getContentTypeProvider()
        Content-Type header associated with the HTTP operation
      • setContentTypeProvider

        public void setContentTypeProvider​(@NonNull
                                           @NonNull ContentTypeProvider contentTypeProvider)
        Content-Type header associated with the HTTP operation
      • getResponseHeaderHandler

        @NonNull
        public @NonNull ResponseHeaderHandler<B> getResponseHeaderHandler()
        Specify how we handle headers from the HTTP response.

        The default behaviour will be to discard.

      • setResponseHeaderHandler

        public void setResponseHeaderHandler​(@NonNull
                                             @NonNull ResponseHeaderHandler<B> responseHeaderHandler)
        Specify how we handle headers from the HTTP response.

        The default behaviour will be to discard.

      • getRequestHeaderProvider

        @NonNull
        public @NonNull RequestHeaderProvider<A> getRequestHeaderProvider()
        Specify how we want to generate the initial set of HTTP Headers.

        The default behaviour is to not have any additional headers

      • setRequestHeaderProvider

        public void setRequestHeaderProvider​(@NonNull
                                             @NonNull RequestHeaderProvider<A> requestHeaderProvider)
        Specify how we want to generate the initial set of HTTP Headers.

        The default behaviour is to not have any additional headers

      • getIgnoreServerResponseCode

        public java.lang.Boolean getIgnoreServerResponseCode()
        Set whether to ignore the server response code.

        In some cases, you may wish to ignore any server response code (such as 500) as this may return meaningful data that you wish to use. If that's the case, make sure this flag is true. It defaults to false.

        In all cases the metadata key CoreConstants.HTTP_PRODUCER_RESPONSE_CODE is populated with the last server response.

      • setIgnoreServerResponseCode

        public void setIgnoreServerResponseCode​(java.lang.Boolean ignoreServerResponseCode)
        Set whether to ignore the server response code.

        In some cases, you may wish to ignore any server response code (such as 500) as this may return meaningful data that you wish to use. If that's the case, make sure this flag is true. It defaults to false.

        In all cases the metadata key CoreConstants.HTTP_PRODUCER_RESPONSE_CODE is populated with the last server response.

      • getAllowRedirect

        public java.lang.Boolean getAllowRedirect()
        Automatically handle redirection.

        The default is true if not otherwise specified

      • setAllowRedirect

        public void setAllowRedirect​(java.lang.Boolean allowRedirect)
        Automatically handle redirection.

        The default is true if not otherwise specified

      • getUrl

        public java.lang.String getUrl()
        The URL endpoint to access.
      • setUrl

        public void setUrl​(java.lang.String url)
        The URL endpoint to access.