webtester.packages.apps
Class httpProxyGUI

java.lang.Object
  |
  +--webtester.packages.apps.httpProxyGUI

public class httpProxyGUI
extends java.lang.Object

Provides a GUI interface for the http proxy.

Author:
Aaron DeLong

Field Summary
private static java.net.ServerSocket acceptor
          The socket which listens for browser connections.
private static boolean bEndProxy
          Indicates whether the proxy has finished recording.
private static boolean bFirst
          Indiciates whether this is the first testcase which has been recorded.
private static boolean bPostRedirect
          Indicates whether a POST request sent a redirec request.
private static boolean bRecord
          Indicates whether the proxy is currently recording.
private static java.util.HashMap hServerTypes
          Contains server type information.
private static int iDefaultPort
          The default port on which to listen for browser connections.
private static int iDividerLocation
          Divider location for the split pane.
private static int iMaxTries
          Maximum number of times the application will try to read data from the browser input streams.
private static int iSleepTime
          The amount of time to sleep while waiting for a thread to execute.
private static int iTextAreaCols
          The number of columns in the text area.
private static int iTextAreaRows
          The number of rows in the text area.
private static int iTextFieldLen
          Default length of a text field.
private static int iTextFieldLen2
          Default length for other text fields.
private static int iTextLength
          Length at which the text area is cleared.
private static javax.swing.JLabel label
          Label used to provide instructions to user.
private static java.lang.String sExcludeFile
          Name of file which contains regexes to exclude from tokenized HTML.
private static java.lang.String sName
          The test case name.
private static java.lang.String sPathSeparator
          The path separator for the OS executing the application.
private static javax.swing.JTextArea text
          Text area used to display information to the user.
private static javax.swing.JTextField textField
          Text field for user to enter a test case name.
private static javax.swing.tree.DefaultMutableTreeNode top
          The top node of the tree.
private static javax.swing.JTree tree
          The component used to display the tree to the user.
private static javax.swing.tree.DefaultTreeModel treeModel
          The tree model used to dynamically modify the tree.
 
Constructor Summary
httpProxyGUI()
           
 
Method Summary
private static java.lang.String getHttpHeaders(java.io.InputStream in, java.io.OutputStream out)
          Retrieve http headers from the browsers' streams.
private static java.lang.String getURL(java.lang.String sStr)
          Parse the request headers into a hashmap.
static void main(java.lang.String[] argv)
          The main method, the entry point into the application.
private static boolean normalProxy(java.lang.String sURL, boolean bVal)
          Determine if the normal proxy should be used.
private static void processClientRequest(java.net.Socket client, boolean bVal)
          Call the thread which processes the requests.
private static void updateTree()
          Update the JTree which appears on the right side of the screen to display a list of all recorded URLs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

treeModel

private static javax.swing.tree.DefaultTreeModel treeModel
The tree model used to dynamically modify the tree.


top

private static javax.swing.tree.DefaultMutableTreeNode top
The top node of the tree.


tree

private static javax.swing.JTree tree
The component used to display the tree to the user.


iTextAreaRows

private static final int iTextAreaRows
The number of rows in the text area.

See Also:
Constant Field Values

iTextAreaCols

private static final int iTextAreaCols
The number of columns in the text area.

See Also:
Constant Field Values

text

private static final javax.swing.JTextArea text
Text area used to display information to the user.


iTextFieldLen

private static final int iTextFieldLen
Default length of a text field.

See Also:
Constant Field Values

iTextFieldLen2

private static final int iTextFieldLen2
Default length for other text fields.

See Also:
Constant Field Values

textField

private static final javax.swing.JTextField textField
Text field for user to enter a test case name.


label

private static final javax.swing.JLabel label
Label used to provide instructions to user.


acceptor

private static java.net.ServerSocket acceptor
The socket which listens for browser connections.


bRecord

private static boolean bRecord
Indicates whether the proxy is currently recording.


bEndProxy

private static boolean bEndProxy
Indicates whether the proxy has finished recording.


hServerTypes

private static java.util.HashMap hServerTypes
Contains server type information.


bFirst

private static boolean bFirst
Indiciates whether this is the first testcase which has been recorded.


bPostRedirect

private static boolean bPostRedirect
Indicates whether a POST request sent a redirec request.


sName

private static java.lang.String sName
The test case name.


sExcludeFile

private static java.lang.String sExcludeFile
Name of file which contains regexes to exclude from tokenized HTML.


sPathSeparator

private static java.lang.String sPathSeparator
The path separator for the OS executing the application.


iSleepTime

private static final int iSleepTime
The amount of time to sleep while waiting for a thread to execute.

See Also:
Constant Field Values

iDividerLocation

private static final int iDividerLocation
Divider location for the split pane.

See Also:
Constant Field Values

iDefaultPort

private static final int iDefaultPort
The default port on which to listen for browser connections.

See Also:
Constant Field Values

iTextLength

private static final int iTextLength
Length at which the text area is cleared.

See Also:
Constant Field Values

iMaxTries

private static final int iMaxTries
Maximum number of times the application will try to read data from the browser input streams.

See Also:
Constant Field Values
Constructor Detail

httpProxyGUI

public httpProxyGUI()
Method Detail

main

public static void main(java.lang.String[] argv)
The main method, the entry point into the application.

Parameters:
argv - command-line arguments

updateTree

private static void updateTree()
Update the JTree which appears on the right side of the screen to display a list of all recorded URLs.


getHttpHeaders

private static java.lang.String getHttpHeaders(java.io.InputStream in,
                                               java.io.OutputStream out)
Retrieve http headers from the browsers' streams.

Parameters:
in - the input stream from the browser
out - the output stream from the browser
Returns:
a String containing the header information

getURL

private static java.lang.String getURL(java.lang.String sStr)
Parse the request headers into a hashmap.

Parameters:
sStr - the header data represented as a String
Returns:
a String that contains the URL being accessed

normalProxy

private static boolean normalProxy(java.lang.String sURL,
                                   boolean bVal)
Determine if the normal proxy should be used.

Parameters:
sURL - the URL parsed from HTTP headers
bVal - indicates if images are being recorded
Returns:
FALSE if the fast proxy should be used instead

processClientRequest

private static void processClientRequest(java.net.Socket client,
                                         boolean bVal)
                                  throws java.io.IOException
Call the thread which processes the requests.

Parameters:
client - the client socket, i.e. the connection to the browser
bVal - indicates whether images are being recorded
Throws:
java.io.IOException - if a socket error occurs.