org.rhq.plugins.www.util
Class WWWUtils

java.lang.Object
  extended by org.rhq.plugins.www.util.WWWUtils

public class WWWUtils
extends Object

Helper class that contains methods that send HTTP requests and evaluate results.

Author:
Ian Springer

Method Summary
static String getServerHeader(URL httpURL)
          Get the content of the 'Server' header.
static boolean isAvailable(URL httpURL, int timeout)
          Sends a HEAD request to the passed URL and returns true if the URL was reachable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isAvailable

public static boolean isAvailable(URL httpURL,
                                  int timeout)
Sends a HEAD request to the passed URL and returns true if the URL was reachable.

Parameters:
httpURL - a http or https URL to check
timeout - timeout, in milliseconds
Returns:
true if connecting to the URL succeeds, or false otherwise

getServerHeader

public static String getServerHeader(URL httpURL)
Get the content of the 'Server' header.

Parameters:
httpURL - a http or https URL to get the header from
Returns:
the contents of the header or null if anything went wrong or the field was not present.


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.