soapdust.urlhandler.test
Class Handler

java.lang.Object
  extended by java.net.URLStreamHandler
      extended by soapdust.urlhandler.test.Handler

public class Handler
extends java.net.URLStreamHandler

This class handles test: urls. The jvm is automatically initialized so that this class is used to resolve test: urls. test: urls allows you to test an application that access to a http server by pointing your application to a test: url instead of a http: url. With a test: url, you can specify the http status code you want the http request to return and also a file which content will be returned as the http response content or error content. test: may be of the form : test:status:500 => requesting this url will result in a 500 http status test:file:test/response.xml => requesting this url will return the content of the given file test:status:500;file:test/response.xml status: is optionnal and defaults to 200 file: if optionnal and defaults to empty file One can consult the data written "to" a test: url by accessing the public HashTable saved in this class. Data is indexed by url. See HandlerTest.java for examples of using this class.


Field Summary
static java.util.Hashtable<java.lang.String,java.io.ByteArrayOutputStream> saved
           
 
Constructor Summary
Handler()
           
 
Method Summary
protected  java.net.URLConnection openConnection(java.net.URL url)
           
 
Methods inherited from class java.net.URLStreamHandler
equals, getDefaultPort, getHostAddress, hashCode, hostsEqual, openConnection, parseURL, sameFile, setURL, setURL, toExternalForm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

saved

public static java.util.Hashtable<java.lang.String,java.io.ByteArrayOutputStream> saved
Constructor Detail

Handler

public Handler()
Method Detail

openConnection

protected java.net.URLConnection openConnection(java.net.URL url)
                                         throws java.io.IOException
Specified by:
openConnection in class java.net.URLStreamHandler
Throws:
java.io.IOException