com.javaranch.common
Class HTTP

java.lang.Object
  |
  +--com.javaranch.common.HTTP

public class HTTP
extends java.lang.Object

This class simplifies the exchange of objects with Servlets via the HTTP protocol.

This class is usually used by Applets, but it can also be used by applications and other servlets.

All sending is embedded within an HTTP POST command.

All objects sent and received must implement Serializable.

The client-side methods in this class interact with the server-side methods in com.digitalglobe.common.Servlets, or a servlet that extends com.digitalglobe.common.ObjectServlet.

- - - - - - - - - - - - - - - - -

Copyright (c) 1999-2004 Paul Wheaton

Copyright (c) 1999-2000 EarthWatch, Inc. You are welcome to do whatever you want to with this source file provided that you maintain this comment fragment (between the dashed lines). Modify it, change the package name, change the class name ... personal or business use ... sell it, share it ... add a copyright for the portions you add ...

My goal in giving this away and maintaining the copyright is to hopefully direct developers back to JavaRanch.

I originally developed this class while working as a contractor at EarthWatch, Inc. in Longmont, Colorado. They gave me permission to distribute this code this way provided that their message would also be carried along. Their message is that they hire Java programmers and would like you to consider working with them. I have to say that my experience with them was first rate and I would encourage engineers to work there. Check out their web site at http://www.digitalglobe.com.

The original source can be found at JavaRanch

- - - - - - - - - - - - - - - - -

Author:
Paul Wheaton


Method Summary
static java.lang.String normalizeURL(java.lang.String s)
          Will eliminate leading typos and make sure the string starts with "http://" or doesn't.
static java.lang.Object send(java.lang.String servlet, java.lang.Object obj)
          Send an HTTP POST command and an object to a servlet and absorb Exceptions, if any.
static java.lang.Object sendE(java.lang.String servlet, java.lang.Object obj)
          Send an HTTP POST command and an object to a servlet and generate Exceptions, if any.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

sendE

public static java.lang.Object sendE(java.lang.String servlet,
                                     java.lang.Object obj)
                              throws java.lang.Exception
Send an HTTP POST command and an object to a servlet and generate Exceptions, if any.

Parameters:
servlet - The URL for the servlet being accessed.

obj - Any serializable object.

java.lang.Exception

send

public static java.lang.Object send(java.lang.String servlet,
                                    java.lang.Object obj)
Send an HTTP POST command and an object to a servlet and absorb Exceptions, if any.

Exceptions will be printed to STDOUT.

Parameters:
servlet - The URL for the servlet being accessed.

obj - Any serializable object.


normalizeURL

public static java.lang.String normalizeURL(java.lang.String s)
Will eliminate leading typos and make sure the string starts with "http://" or doesn't.



Copyright ©2004 Paul Wheaton All Rights Reserved