org.apache.commons.httpclient

Class HttpException

Implemented Interfaces:
Serializable
Known Direct Subclasses:
HttpContentTooLargeException, HttpRecoverableException, ProtocolException, URIException

public class HttpException
extends IOException

Signals that an HTTP or HttpClient exception has occurred.
See Also:
Serialized Form

Constructor Summary

HttpException()
Creates a new HttpException with a null detail message.
HttpException(String message)
Creates a new HttpException with the specified detail message.
HttpException(String message, Throwable cause)
Creates a new HttpException with the specified detail message and cause.

Method Summary

Throwable
getCause()
Return the Throwable that caused this exception, or null if the cause is unavailable, unknown, or not a Throwable.
String
getReason()
Deprecated. HttpClient no longer uses this for itself.
int
getReasonCode()
Deprecated. HttpClient no longer uses this for itself.
void
printStackTrace()
Print this HttpException and its stack trace to the standard error stream.
void
printStackTrace(PrintStream s)
Print this HttpException and its stack trace to the specified print stream.
void
printStackTrace(PrintWriter s)
Print this HttpException and its stack trace to the specified print writer.
void
setReason(String reason)
Deprecated. HttpClient no longer uses this for itself.
void
setReasonCode(int code)
Deprecated. HttpClient no longer uses this for itself.

Methods inherited from class java.lang.Throwable

fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

HttpException

public HttpException()
Creates a new HttpException with a null detail message.

HttpException

public HttpException(String message)
Creates a new HttpException with the specified detail message.
Parameters:
message - the exception detail message

HttpException

public HttpException(String message,
                     Throwable cause)
Creates a new HttpException with the specified detail message and cause.
Parameters:
message - the exception detail message
cause - the Throwable that caused this exception, or null if the cause is unavailable, unknown, or not a Throwable
Since:
3.0

Method Details

getCause

public Throwable getCause()
Return the Throwable that caused this exception, or null if the cause is unavailable, unknown, or not a Throwable.
Overrides:
getCause in interface Throwable
Returns:
the Throwable that caused this exception, or null if the cause is unavailable, unknown, or not a Throwable
Since:
3.0

getReason

public String getReason()

Deprecated. HttpClient no longer uses this for itself. It is only provided for compatibility with existing clients, and will be removed in a future release.

Get the text description of the reason for an exception.

getReasonCode

public int getReasonCode()

Deprecated. HttpClient no longer uses this for itself. It is only provided for compatibility with existing clients, and will be removed in a future release.

Get the status code description of the reason for an exception.

printStackTrace

public void printStackTrace()
Print this HttpException and its stack trace to the standard error stream.
Overrides:
printStackTrace in interface Throwable
Since:
3.0
Usages and Demos :

View More Examples of printStackTrace()
   1: import org.apache.commons.httpclient.HttpClient;
   2: import org.apache.commons.httpclient.HttpException;
   3: import org.apache.commons.httpclient.methods.PostMethod;
   4:         ...
   5:             }
   6:         } catch (HttpException httpe) {
   7:         ...
   8:             httpe.printStackTrace();
   9:             throw createTxException(httpe);
  10:         ...
  11:         } catch (IOException ioe) {
  12:             ioe.printStackTrace();

View Full Code Here
   1: import org.apache.commons.httpclient.HttpClient;
   2: import org.apache.commons.httpclient.HttpException;
   3: import org.apache.commons.httpclient.methods.GetMethod;
   4:         ...
   5:             }
   6:         } catch (HttpException httpe) {
   7:         ...
   8:             httpe.printStackTrace();
   9:             throw new TransmitterException(httpe);
  10:         ...
  11:         } catch (IOException ioe) {
  12:             ioe.printStackTrace();

View Full Code Here

printStackTrace

public void printStackTrace(PrintStream s)
Print this HttpException and its stack trace to the specified print stream.
Overrides:
printStackTrace in interface Throwable
Parameters:
s - the PrintStream to which the exception and its stack trace should be written
Since:
3.0

printStackTrace

public void printStackTrace(PrintWriter s)
Print this HttpException and its stack trace to the specified print writer.
Overrides:
printStackTrace in interface Throwable
Parameters:
s - the PrintWriter to which the exception and its stack trace should be written
Since:
3.0

setReason

public void setReason(String reason)

Deprecated. HttpClient no longer uses this for itself. It is only provided for compatibility with existing clients, and will be removed in a future release.

Sets the text description of the reason for an exception.
Parameters:
reason - The reason for the exception.

setReasonCode

public void setReasonCode(int code)

Deprecated. HttpClient no longer uses this for itself. It is only provided for compatibility with existing clients, and will be removed in a future release.

Sets the status code description of the reason for an exception.
Parameters:
code - The reason for the exception. This is intended to be an HTTP status code.