edu.pdx.cs399J.web
Class HttpRequestHelper

java.lang.Object
  extended by edu.pdx.cs399J.web.HttpRequestHelper

public class HttpRequestHelper
extends Object

A helper class that provides methods for requesting resources via HTTP


Nested Class Summary
static class HttpRequestHelper.Response
          Encapsulates a response to an HTTP request
 
Constructor Summary
HttpRequestHelper()
           
 
Method Summary
protected  HttpRequestHelper.Response get(String urlString, String... parameters)
          Performs an HTTP GET on the given URL
static void main(String[] args)
          A main method that requests a resource from a URL using a given HTTP method
protected  HttpRequestHelper.Response post(String urlString, String... parameters)
          Performs an HTTP POST to the given URL
protected  HttpRequestHelper.Response put(String urlString, String... parameters)
          Performs an HTTP PUT on the given URL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpRequestHelper

public HttpRequestHelper()
Method Detail

get

protected HttpRequestHelper.Response get(String urlString,
                                         String... parameters)
                                  throws IOException
Performs an HTTP GET on the given URL

Parameters:
urlString - The URL to get
parameters - The key/value query parameters
Returns:
A Response summarizing the result of the GET
Throws:
IOException

post

protected HttpRequestHelper.Response post(String urlString,
                                          String... parameters)
                                   throws IOException
Performs an HTTP POST to the given URL

Parameters:
urlString - The URL to post to
parameters - The key/value parameters
Returns:
A Response summarizing the result of the POST
Throws:
IOException

put

protected HttpRequestHelper.Response put(String urlString,
                                         String... parameters)
                                  throws IOException
Performs an HTTP PUT on the given URL

Parameters:
urlString - The URL to put to
parameters - key/value parameters to the put
Returns:
A Reponse summarizing the result of the PUT
Throws:
IOException

main

public static void main(String[] args)
                 throws IOException
A main method that requests a resource from a URL using a given HTTP method

Throws:
IOException


Copyright © 2000-2009 Portland State University. All Rights Reserved.