com.univocity.api.net
Class HttpException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by com.univocity.api.exception.DataInputException
                  extended by com.univocity.api.net.HttpException
All Implemented Interfaces:
Serializable

public final class HttpException
extends DataInputException

A HttpException is thrown when a HTTP request made using a HttpRequest object did not result resulted a 2xx (i.e. 'OK') or 3xx (i.e. 'Redirect') HTTP response code

Author:
uniVocity Software Pty Ltd - dev@univocity.com
See Also:
Serialized Form

Constructor Summary
HttpException(String message, int statusCode, String statusMessage, HttpRequest request)
          Creates a new HTTP status exception
 
Method Summary
 String getMessage()
           
 HttpRequest getRequest()
          Returns the HttpRequest used to attempt to obtain a response from the remote server
 int getStatusCode()
          Returns the HTTP status code returned by the remote server.
 String getStatusMessage()
          Returns the HTTP status message returned by the remote server, if available.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpException

public HttpException(String message,
                     int statusCode,
                     String statusMessage,
                     HttpRequest request)
Creates a new HTTP status exception

Parameters:
message - message with information about the error.
statusCode - the HTTP status code returned by the remote server
statusMessage - the HTTP status message, describing the error code, if available.
request - the HttpRequest object used to attempt to obtain a response from the remote server
Method Detail

getStatusMessage

public final String getStatusMessage()
Returns the HTTP status message returned by the remote server, if available.

Returns:
the HTTP status message returned by the remote server, if available.

getStatusCode

public final int getStatusCode()
Returns the HTTP status code returned by the remote server. Will always be less than 200 or greater/equal to 400

Returns:
the HTTP status code returned by the remote server

getRequest

public final HttpRequest getRequest()
Returns the HttpRequest used to attempt to obtain a response from the remote server

Returns:
the HttpRequest that failed.

getMessage

public String getMessage()
Overrides:
getMessage in class Throwable


Copyright © 2018 uniVocity Software Pty Ltd. All rights reserved.