bb.net
Class HttpUtil

java.lang.Object
  extended by bb.net.HttpUtil

public final class HttpUtil
extends Object

Provides miscellaneous static utility methods for dealing with the http protocol.

This class is multithread safe: it is stateless.

Author:
Brent Boyer
See Also:
HttpParameters

Constructor Summary
private HttpUtil()
          This sole private constructor suppresses the default (public) constructor, ensuring non-instantiability outside of this class.
 
Method Summary
static void sendPostMessage(HttpURLConnection connection, HttpParameters parameters)
          This method: sets the request method of the connection arg to "POST" adds the request property "Content-Type"/"application/x-www-form-urlencoded" writes parameters.toPostParameterString() to connection's OutputStream Note: this method performs no cleanup actions (e.g. closing the OutputStream).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpUtil

private HttpUtil()
This sole private constructor suppresses the default (public) constructor, ensuring non-instantiability outside of this class.

Method Detail

sendPostMessage

public static void sendPostMessage(HttpURLConnection connection,
                                   HttpParameters parameters)
                            throws IllegalArgumentException,
                                   IOException
This method:
  1. sets the request method of the connection arg to "POST"
  2. adds the request property "Content-Type"/"application/x-www-form-urlencoded"
  3. writes parameters.toPostParameterString() to connection's OutputStream

Note: this method performs no cleanup actions (e.g. closing the OutputStream).

Throws:
IllegalArgumentException - if connection or parameters is null
IOException - if an I/O problem occurs