Package org.xnio.http

# Class RedirectException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
org.xnio.http.RedirectException

All Implemented Interfaces:
  `Serializable`

public class RedirectException extends IOException
An extension of `IOException` used to convey that a connection has failed as a redirect has been encountered.

Author:
  Darran Lofthouse
See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`RedirectException(int statusCode, String location)`
Constructs a new `RedirectException` instance.
`RedirectException(String msg, int statusCode, String location)`
Constructs a new `RedirectException` instance with an initial message.
`RedirectException(String msg, Throwable cause, int statusCode, String location)`
Constructs a new `RedirectException` instance with an initial message and cause.
`RedirectException(Throwable cause, int statusCode, String location)`
Constructs a new `RedirectException` instance with an initial cause.

## Method Summary

Modifier and Type
Method
Description
`String`
`getLocation()`
Get the redirection target location.
`int`
`getStatusCode()`
Get the HTTP status code.

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

`addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

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

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

## Constructor Details

### RedirectException

public RedirectException(int statusCode, String location)
Constructs a new `RedirectException` instance. The message is left blank (`null`), and no cause is specified.

Parameters:
  `statusCode` - the status code
  `location` - the redirection location, if any

### RedirectException

public RedirectException(String msg, int statusCode, String location)
Constructs a new `RedirectException` instance with an initial message. No cause is specified.

Parameters:
  `msg` - the message
  `statusCode` - the status code
  `location` - the redirection location, if any

### RedirectException

public RedirectException(Throwable cause, int statusCode, String location)
Constructs a new `RedirectException` instance with an initial cause. If a non-`null` cause is specified, its message is used to initialize the message of this `RedirectException`; otherwise the message is left blank (`null`).

Parameters:
  `cause` - the cause
  `statusCode` - the status code
  `location` - the redirection location, if any

### RedirectException

public RedirectException(String msg, Throwable cause, int statusCode, String location)
Constructs a new `RedirectException` instance with an initial message and cause.

Parameters:
  `msg` - the message
  `cause` - the cause
  `statusCode` - the status code
  `location` - the redirection location, if any

## Method Details

### getStatusCode

public int getStatusCode()
Get the HTTP status code. This is the reason for the redirect.

Returns:
  the status code

### getLocation

public String getLocation()
Get the redirection target location.

Returns:
  the redirection target location