it.could.webdav
Class DAVUtilities

java.lang.Object
  extended byit.could.webdav.DAVUtilities

public final class DAVUtilities
extends Object

A collection of static utilities.

Author:
Pier Fumagalli

Field Summary
static String SERVLET_INFORMATION
          The information detail of this package usable from a servlet.
static String SERVLET_SIGNATURE
          The signature of this package usable from a servlet.
 
Method Summary
static String formatHttpDate(Date date)
          Format a Date according to the HTTP/1.1 RFC.
static String formatIsoDate(Date date)
          Format a Date according to the ISO 8601 specification.
static String formatNumber(Number number)
          Format a Number into a String making sure that NullPointerExceptions are not thrown.
static String getMimeType(String name)
          Return the MIME Type configured for a given resource.
static String getProperty(String name)
          Return the value of a property configured for this package.
static String getStatusMessage(int status)
          Return a String message given an HTTP status code.
static Date parseHttpDate(String string)
          Parse a String into a Date according to the HTTP/1.1 RFC (Mon, 31 Jan 2000 11:59:00 GMT).
static Date parseIsoDate(String string)
          Parse a String into a Date according to the ISO 8601 specification (2000-12-31T11:59:00Z).
static Long parseNumber(String string)
          Parse a String into a Long.
static String toHexString(byte number)
          Return the HEX representation of a byte.
static String toHexString(byte[] buffer)
          Return the HEX representation of an array of bytes.
static String toHexString(char number)
          Return the HEX representation of a char.
static String toHexString(int number)
          Return the HEX representation of an integer.
static String toHexString(long number)
          Return the HEX representation of a long integer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVLET_SIGNATURE

public static final String SERVLET_SIGNATURE

The signature of this package usable from a servlet.


SERVLET_INFORMATION

public static final String SERVLET_INFORMATION

The information detail of this package usable from a servlet.

Method Detail

getProperty

public static String getProperty(String name)

Return the value of a property configured for this package.

Parameters:
name - the property name
Returns:
a String instance or null if unknown.

getMimeType

public static String getMimeType(String name)

Return the MIME Type configured for a given resource.

Parameters:
name - the resource name whose MIME Type needs to be looked up.
Returns:
a String instance or null if the type is unknown.

getStatusMessage

public static String getStatusMessage(int status)

Return a String message given an HTTP status code.


formatNumber

public static String formatNumber(Number number)

Format a Number into a String making sure that NullPointerExceptions are not thrown.

Parameters:
number - the Number to format.
Returns:
a String instance or null if the object was null.

parseNumber

public static Long parseNumber(String string)

Parse a String into a Long.

Parameters:
string - the String to parse.
Returns:
a Long instance or null if the date was null or if there was an error parsing the specified String.

formatHttpDate

public static String formatHttpDate(Date date)

Format a Date according to the HTTP/1.1 RFC.

Parameters:
date - the Date to format.
Returns:
a String instance or null if the date was null.

formatIsoDate

public static String formatIsoDate(Date date)

Format a Date according to the ISO 8601 specification.

Parameters:
date - the Date to format.
Returns:
a String instance or null if the date was null.

parseHttpDate

public static Date parseHttpDate(String string)

Parse a String into a Date according to the HTTP/1.1 RFC (Mon, 31 Jan 2000 11:59:00 GMT).

Parameters:
string - the String to parse.
Returns:
a Date instance or null if the date was null or if there was an error parsing the specified String.

parseIsoDate

public static Date parseIsoDate(String string)

Parse a String into a Date according to the ISO 8601 specification (2000-12-31T11:59:00Z).

Parameters:
string - the String to parse.
Returns:
a Date instance or null if the date was null or if there was an error parsing the specified String.

toHexString

public static String toHexString(byte[] buffer)

Return the HEX representation of an array of bytes.

Parameters:
buffer - the array of bytes to convert in a HEX String.
Returns:
a non-null String instance.

toHexString

public static String toHexString(long number)

Return the HEX representation of a long integer.

Parameters:
number - the long to convert in a HEX String.
Returns:
a non-null 16-characters String instance.

toHexString

public static String toHexString(int number)

Return the HEX representation of an integer.

Parameters:
number - the int to convert in a HEX String.
Returns:
a non-null 8-characters String instance.

toHexString

public static String toHexString(char number)

Return the HEX representation of a char.

Parameters:
number - the char to convert in a HEX String.
Returns:
a non-null 4-characters String instance.

toHexString

public static String toHexString(byte number)

Return the HEX representation of a byte.

Parameters:
number - the byte to convert in a HEX String.
Returns:
a non-null 2-characters String instance.