org.rhq.plugins.www.util
Class WWWUtils

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

public abstract class WWWUtils
extends Object

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

Author:
Ian Springer

Constructor Summary
WWWUtils()
           
 
Method Summary
static String getServerHeader(URL httpURL)
          Get the content of the 'Server' header.
static boolean isAvailable(URL httpURL)
          Sends a HEAD request for 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
 

Constructor Detail

WWWUtils

public WWWUtils()
Method Detail

isAvailable

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

Parameters:
httpURL - a http or https URL to check
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.