Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * The contents of this file are subject to the terms
   * of the Common Development and Distribution License
   * (the "License").  You may not use this file except
   * in compliance with the License.
   * 
   * You can obtain a copy of the license at
   * http://www.opensource.org/licenses/cddl1.php
   * See the License for the specific language governing
  * permissions and limitations under the License.
  */
 
 package javax.ws.rs;
 
Runtime exception for applications.

This exception may be thrown by a resource method, provider or javax.ws.rs.core.StreamingOutput implementation if a specific HTTP error response needs to be produced. Only effective if thrown prior to the response being committed.

Author(s):
Paul.Sandoz@Sun.Com
 
 public class WebApplicationException extends RuntimeException
 {
 
    private static final long serialVersionUID = 11660101L;
 
    private Response response;

   
Construct a new instance with a blank message and default HTTP status code of 500
 
    public WebApplicationException()
    {
       this(null..);
    }

   
Construct a new instance using the supplied response

Parameters:
response the response that will be returned to the client, a value of null will be replaced with an internal server error response (status code 500)
 
    public WebApplicationException(Response response)
    {
       this(nullresponse);
    }

   
Construct a new instance with a blank message and specified HTTP status code

Parameters:
status the HTTP status code that will be returned to the client
 
    public WebApplicationException(int status)
    {
       this(nullstatus);
    }

   
Construct a new instance with a blank message and specified HTTP status code

Parameters:
status the HTTP status code that will be returned to the client
Throws:
java.lang.IllegalArgumentException if status is null
 
    public WebApplicationException(Response.Status status)
    {
       this(nullstatus);
    }

   
Construct a new instance with a blank message and default HTTP status code of 500

Parameters:
cause the underlying cause of the exception
 
    public WebApplicationException(Throwable cause)
    {
       this(cause..);
    }

   
Construct a new instance using the supplied response

Parameters:
response the response that will be returned to the client, a value of null will be replaced with an internal server error response (status code 500)
cause the underlying cause of the exception
 
    public WebApplicationException(Throwable causeResponse response)
    {
       super(cause);
       if (response == null)
          this. = Response.serverError().build();
       else
          this. = response;
   }

   
Construct a new instance with a blank message and specified HTTP status code

Parameters:
status the HTTP status code that will be returned to the client
cause the underlying cause of the exception
   public WebApplicationException(Throwable causeint status)
   {
      this(cause, Response.status(status).build());
   }

   
Construct a new instance with a blank message and specified HTTP status code

Parameters:
status the HTTP status code that will be returned to the client
cause the underlying cause of the exception
Throws:
java.lang.IllegalArgumentException if status is null
   public WebApplicationException(Throwable causeResponse.Status status)
   {
      this(cause, Response.status(status).build());
   }

   
Get the HTTP response.

Returns:
the HTTP response.
   public Response getResponse()
   {
      return ;
   }
New to GrepCode? Check out our FAQ X