org.rhq.plugins.www.util
Class WWWUtils

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

public abstract class WWWUtils
extends java.lang.Object

Helper class that contains methods that send http requests and evaluate results

Author:
Ian Springer

Constructor Summary
WWWUtils()
           
 
Method Summary
static java.lang.String getServerHeader(java.net.URL httpURL)
          Get the content of the 'Server:' header
static boolean isAvailable(java.net.URL httpURL)
          Sends a HEAD request to the passed url and returns if the server 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(java.net.URL httpURL)
Sends a HEAD request to the passed url and returns if the server 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 java.lang.String getServerHeader(java.net.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-2009 Red Hat, Inc.. All Rights Reserved.