org.vfny.geoserver
Class ServiceException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byorg.vfny.geoserver.ServiceException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
WfsException, WmsException

public class ServiceException
extends java.lang.Exception

Represents a standard OGC service exception. Able to turn itself into the proper xml response.

JG - here is my guess on what the parameters do:


 [?xml version="1.0" ?
 [ServiceExceptionReport
    version="1.2.0"
    xmlns="http://www.opengis.net/ogc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.opengis.net/ogc SchemaBaseUrl wfs/1.0.0/OGC-exception.xsd"]
   [ServiceException code="code"
                     locator="locator"]
     preMessage:getMessage()
     stack trace
   [/ServiceException]
 [/ServiceExceptionReport]     
 

Where:

Java Exception have recently developed the ability to contain other exceptions. By calling initCause on your ServiceConfig Exception you can get the real exception included in the stacktrace above.

See Also:
Serialized Form

Field Summary
protected  java.lang.String code
          Diagnostic code
protected  java.lang.String locator
          full classpath of originating GeoServer class
protected  java.lang.String preMessage
          message inserted by GeoServer as to what it thinks happened
 
Constructor Summary
ServiceException()
          Empty constructor.
ServiceException(java.lang.String message)
          Empty constructor.
ServiceException(java.lang.String message, java.lang.String locator)
          Empty constructor.
ServiceException(java.lang.String message, java.lang.Throwable cause)
          This should be the most used entry point.
ServiceException(java.lang.Throwable e)
          Empty constructor.
ServiceException(java.lang.Throwable e, java.lang.String preMessage, java.lang.String locator)
          DOCUMENT ME!
 
Method Summary
 java.lang.String getXmlMessage(boolean printStackTrace)
          gets the message, encoding it with the proper escaped xml characters.
 java.lang.String getXmlResponse()
          DOCUMENT ME!
 java.lang.String getXmlResponse(boolean printStackTrace)
          Return request type.
protected  boolean isEmpty(java.lang.String testString)
          DOCUMENT ME!
 void setCode(java.lang.String code)
          Assigns a diagnostic code to this exception.
 
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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

preMessage

protected java.lang.String preMessage
message inserted by GeoServer as to what it thinks happened


locator

protected java.lang.String locator
full classpath of originating GeoServer class


code

protected java.lang.String code
Diagnostic code

Constructor Detail

ServiceException

public ServiceException()
Empty constructor.


ServiceException

public ServiceException(java.lang.String message)
Empty constructor.

Parameters:
message - The message for the .

ServiceException

public ServiceException(java.lang.String message,
                        java.lang.Throwable cause)
This should be the most used entry point.

Parameters:
message - User message
cause - The origional exception that caused failure

ServiceException

public ServiceException(java.lang.Throwable e)
Empty constructor.

Parameters:
e - The message for the .

ServiceException

public ServiceException(java.lang.String message,
                        java.lang.String locator)
Empty constructor.

Parameters:
message - The message for the .
locator - The message for the .

ServiceException

public ServiceException(java.lang.Throwable e,
                        java.lang.String preMessage,
                        java.lang.String locator)
DOCUMENT ME!

Parameters:
e - The message for the .
preMessage - The message to tack on the front.
locator - The message for the .
Method Detail

setCode

public void setCode(java.lang.String code)
Assigns a diagnostic code to this exception.

Parameters:
code - The diagnostic code.

isEmpty

protected boolean isEmpty(java.lang.String testString)
DOCUMENT ME!

Parameters:
testString - DOCUMENT ME!
Returns:
DOCUMENT ME!

getXmlResponse

public java.lang.String getXmlResponse()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getXmlMessage

public java.lang.String getXmlMessage(boolean printStackTrace)
gets the message, encoding it with the proper escaped xml characters. If requested it prints the whole stack trace in the response.

Parameters:
printStackTrace - set to true if the full stack trace should be returned to client apps.
Returns:
The message of this error, with xml escapes.

getXmlResponse

public java.lang.String getXmlResponse(boolean printStackTrace)
Return request type.

Parameters:
printStackTrace - whether the stack trace should be included.
Returns:
The ServiceExceptionReport of this error.