org.jasig.cas.util
Class HttpClient

java.lang.Object
  extended by org.jasig.cas.util.HttpClient
All Implemented Interfaces:
java.io.Serializable, org.springframework.beans.factory.DisposableBean

public final class HttpClient
extends java.lang.Object
implements java.io.Serializable, org.springframework.beans.factory.DisposableBean

Since:
3.1
Version:
$Revision: 48180 $ $Date: 2010-03-14 00:05:58 -0500 (Sun, 14 Mar 2010) $
Author:
Scott Battaglia
See Also:
Serialized Form

Constructor Summary
HttpClient()
           
 
Method Summary
 void destroy()
           
 boolean isValidEndPoint(java.lang.String url)
           
 boolean isValidEndPoint(java.net.URL url)
           
 boolean sendMessageToEndPoint(java.lang.String url, java.lang.String message, boolean async)
          Sends a message to a particular endpoint.
 void setAcceptableCodes(int[] acceptableCodes)
          Set the acceptable HTTP status codes that we will use to determine if the response from the URL was correct.
 void setConnectionTimeout(int connectionTimeout)
           
 void setExecutorService(java.util.concurrent.ExecutorService executorService)
          Note that changing this executor will affect all httpClients.
 void setReadTimeout(int readTimeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpClient

public HttpClient()
Method Detail

setExecutorService

public void setExecutorService(java.util.concurrent.ExecutorService executorService)
Note that changing this executor will affect all httpClients. While not ideal, this change was made because certain ticket registries were persisting the HttpClient and thus getting serializable exceptions.

Parameters:
executorService -

sendMessageToEndPoint

public boolean sendMessageToEndPoint(java.lang.String url,
                                     java.lang.String message,
                                     boolean async)
Sends a message to a particular endpoint. Option of sending it without waiting to ensure a response was returned.

This is useful when it doesn't matter about the response as you'll perform no action based on the response.

Parameters:
url - the url to send the message to
message - the message itself
async - true if you don't want to wait for the response, false otherwise.
Returns:
boolean if the message was sent, or async was used. false if the message failed.

isValidEndPoint

public boolean isValidEndPoint(java.lang.String url)

isValidEndPoint

public boolean isValidEndPoint(java.net.URL url)

setAcceptableCodes

public final void setAcceptableCodes(int[] acceptableCodes)
Set the acceptable HTTP status codes that we will use to determine if the response from the URL was correct.

Parameters:
acceptableCodes - an array of status code integers.

setConnectionTimeout

public void setConnectionTimeout(int connectionTimeout)

setReadTimeout

public void setReadTimeout(int readTimeout)

destroy

public void destroy()
             throws java.lang.Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
java.lang.Exception


Copyright © 2004-2010 Java Architectures Special Interest Group. All Rights Reserved.