openrat-java-client

Unnamed repository; edit this file 'description' to name the repository.
git clone http://git.code.weiherhei.de/openrat-java-client.git
Log | Files | Refs

HttpStatus.java (838B)


      1 package de.openrat.client.util;
      2 
      3 public class HttpStatus
      4 {
      5 
      6 	private int statusCode;
      7 	private String serverMessage;
      8 
      9 	public HttpStatus(int statusCode, String serverMessage)
     10 	{
     11 		super();
     12 		this.statusCode = statusCode;
     13 		this.serverMessage = serverMessage;
     14 	}
     15 
     16 	public boolean isSuccess()
     17 	{
     18 		return statusCode / 100 == 2;
     19 	}
     20 
     21 	public boolean isRedirect()
     22 	{
     23 		return statusCode / 100 == 3;
     24 	}
     25 
     26 	public boolean isClientError()
     27 	{
     28 		return statusCode / 100 == 4;
     29 	}
     30 
     31 	public boolean isServerError()
     32 	{
     33 		return statusCode / 100 == 5;
     34 	}
     35 
     36 	/**
     37 	 * Inhalt des Feldes <code>statusCode</code>.
     38 	 * 
     39 	 * @return statusCode
     40 	 */
     41 	public int getStatusCode()
     42 	{
     43 		return statusCode;
     44 	}
     45 
     46 	/**
     47 	 * Inhalt des Feldes <code>serverMessage</code>.
     48 	 * 
     49 	 * @return serverMessage
     50 	 */
     51 	public String getServerMessage()
     52 	{
     53 		return serverMessage;
     54 	}
     55 
     56 }