public class HTTPSession extends java.lang.Object implements Deleteable, ScriptInstancesContainer, RunningHTTPSession, java.lang.Comparable, java.awt.datatransfer.Transferable, Folderable, Uniqueable
Modifier and Type | Field and Description |
---|---|
static HTTPTransaction[] |
EMPTY_HTTP_TRANSACTIONS |
(package private) static java.awt.datatransfer.DataFlavor[] |
flavors |
static java.awt.datatransfer.DataFlavor |
INFO_FLAVOR
Drag 'n drop stuff.
|
static org.apache.log4j.Logger |
log
Used for logging.
|
(package private) boolean |
usesProxySettings
Indicates whether or not the session uses proxy settings.
|
Constructor and Description |
---|
HTTPSession(int httpSessionID,
java.lang.String name,
int folderID,
java.lang.String keyStoreFilePath,
java.lang.String keyStorePassword)
Generates a new HTTPSession, loads it with its basic data, then loads it up with all of its HTTP transactions.
|
HTTPSession(java.lang.String name)
Generates a new HTTPSession, given a string.
|
Modifier and Type | Method and Description |
---|---|
void |
blockAll()
Blocks all of the HTTP transactions.
|
int |
compareTo(java.lang.Object object)
Required by the
Comparable interface. |
void |
delete()
Deletes the session from the database.
|
void |
deleteAllTransactions()
Removes all of the current HTTP transactions from the session.
|
void |
dumpToLog()
Dumps the HTTP session to the log.
|
static void |
exportProxySessionToFile(HTTPSession proxySession,
java.io.File file)
Exports a session to the given file, overwriting the file if it exists
|
boolean |
getDontLogBinaryFiles()
Indicates whether or not binary files should be tracked.
|
Folder |
getFolder()
Gets the folder containing this object.
|
ScrapingHttpClient |
getHttpClient()
Gets the HTTP client to be used in proxying.
|
HTTPTransaction |
getHTTPTransaction(int sequence)
Gets an HTTP transaction from the manager.
|
HTTPTransaction |
getHTTPTransactionByID(int httpTransactionID)
Gets an
HTTPTransaction based on its ID. |
protected java.util.TreeSet<HTTPTransaction> |
getHTTPTransactions()
Gets the HTTP transactions.
|
int |
getID()
Gets the ID.
|
java.lang.String |
getIdentifier()
Gets the identifier for this object.
|
java.util.ArrayList<ProxySearchResult> |
getJavaScriptCookies()
Gets cookies set via JavaScript.
|
java.lang.String |
getKeyStoreFilePath()
Gets the path to the keystore file.
|
java.lang.String |
getKeyStorePassword()
Gets the password to be used for the key store file.
|
java.lang.String |
getLog()
Gets the current value of the log as a string.
|
java.lang.String |
getName()
Gets the name.
|
boolean |
getNeedsToBeSaved()
Indicates whether or not the object needs to be saved.
|
javax.swing.tree.DefaultMutableTreeNode |
getNode()
Gets the node representing this session.
|
int |
getNumHTTPTransactions()
Returns the number of HTTP transactions currently held by the manager.
|
int |
getPort()
Gets the port.
|
ScrapingSessionState |
getScrapingSessionState()
Gets the session state for scripts as scrapeable files are being processed.
|
ScriptInstances |
getScriptInstances()
Returns a
ScriptInstances object containing all script instances associated with this scrapeable file. |
int |
getSequenceForHTTPTransaction(HTTPTransaction httpTransaction)
Gets the sequence for the given HTTP transaction.
|
java.lang.Object |
getTransferData(java.awt.datatransfer.DataFlavor df) |
java.awt.datatransfer.DataFlavor[] |
getTransferDataFlavors() |
boolean |
getUsesProxySettings()
Indicates whether or not the session uses proxy settings.
|
java.lang.Object |
getVariable(java.lang.String variable)
Gets the value of a session variable.
|
static HTTPSession |
importProxySessionFromFile(java.io.File file,
java.lang.String folderName)
Imports a proxy session from the file.
|
void |
insertHTTPTransaction(java.net.Socket socket)
Generates and inserts an HTTPTransaction into the manager for the given socket.
|
boolean |
isDataFlavorSupported(java.awt.datatransfer.DataFlavor df)
Transferable methods.
|
void |
load()
Loads the HTTP session with its HTTP transactions.
|
void |
log(java.lang.String message)
Sends off a message to be logged.
|
void |
moveToNewFolder(Folder folder)
Moves the object to a new folder.
|
protected void |
processBeginningOfSessionScripts()
Processes any scripts at the beginning of the session.
|
void |
removeFromFolder()
Removes the object from its current folder.
|
void |
removeHTTPTransaction(HTTPTransaction httpTransaction)
Removes an HTTP transaction from the manager.
|
void |
resetHttpClient()
Nulls out the HttpClient.
|
void |
save()
Saves the information related to this session to the database.
|
java.util.TreeSet<ProxySearchResult> |
searchNotes(java.lang.String textToFind,
boolean caseSensitive,
boolean regEx)
Searches the notes for the given text.
|
java.util.TreeSet<ProxySearchResult> |
searchRequestBody(java.lang.String textToFind,
boolean caseSensitive,
boolean regEx)
Searches the request body for the given text.
|
java.util.TreeSet<ProxySearchResult> |
searchRequestHeaders(java.lang.String textToFind,
boolean caseSensitive,
boolean regEx)
Searches the various request headers for the given text.
|
java.util.TreeSet<ProxySearchResult> |
searchResponseBody(java.lang.String textToFind,
boolean caseSensitive,
boolean regEx)
Searches the response body for the given text.
|
java.util.TreeSet<ProxySearchResult> |
searchResponseHeaders(java.lang.String textToFind,
boolean caseSensitive,
boolean regEx)
Searches the various response headers for the given text.
|
void |
sessionUpdated()
Indicates that something about the session changed, which necessitates that the view be refreshed.
|
void |
setDontLogBinaryFiles(boolean dontLogBinaryFiles)
Sets whether or not binary files should be tracked.
|
void |
setFilterTransactions(boolean filterTransactions)
Determines whether or not transactions should be filtered.
|
void |
setFolder(Folder folder)
Sets the folder containing this object.
|
void |
setHttpClient(ScrapingHttpClient httpClient)
Sets the HTTP client to be used in proxying.
|
void |
setID(int httpSessionID)
Sets the ID.
|
void |
setIdentifier(java.lang.String identifier)
Sets the identifier for this object.
|
void |
setKeyStoreFilePath(java.lang.String keyStoreFilePath)
Sets the path to the keystore file.
|
void |
setKeyStorePassword(java.lang.String keyStorePassword)
Sets the password to be used for the key store file.
|
void |
setName(java.lang.String name)
Sets the name.
|
void |
setNeedsToBeSaved(boolean needsToBeSaved)
Sets whether or not the object needs to be saved.
|
void |
setNode(javax.swing.tree.DefaultMutableTreeNode node)
Sets the node representing this session.
|
void |
setNotifiable(HTTPSessionNotifiable notifiable)
Sets the object that will need to be notified when changes in the session take place.
|
void |
setPort(int port)
Sets the port.
|
void |
setScrapingSessionState(ScrapingSessionState scrapingSessionState)
Explicitly sets the state variable for the session.
|
void |
setScriptInstances(ScriptInstances scriptInstances)
Sets the script instances to be associated with this scrapeable file.
|
void |
setVariable(java.lang.String variable,
java.lang.Object value)
Sets the value of a session variable.
|
java.lang.String |
toString()
Overridden so that the name appears as the title in the main tree.
|
void |
transactionDeleted(int sequence)
Indicates that something about the session changed, which necessitates that the view be refreshed.
|
void |
transactionInserted(int sequence)
Indicates that a transaction was inserted.
|
void |
transactionUpdated(HTTPTransaction transaction)
Indicates that a transaction was updated.
|
public static final HTTPTransaction[] EMPTY_HTTP_TRANSACTIONS
public static org.apache.log4j.Logger log
public static final java.awt.datatransfer.DataFlavor INFO_FLAVOR
static java.awt.datatransfer.DataFlavor[] flavors
boolean usesProxySettings
public HTTPSession(java.lang.String name)
name
- The name of the session.public HTTPSession(int httpSessionID, java.lang.String name, int folderID, java.lang.String keyStoreFilePath, java.lang.String keyStorePassword)
httpSessionID
- The ID.name
- The name of the session.folderID
- The ID of the folder containing the object.keyStoreFilePath
- The path to the keystore file.keyStorePassword
- The keystore password.@NotNull public static HTTPSession importProxySessionFromFile(@NotNull java.io.File file, @Nullable java.lang.String folderName)
file
- The file to importfolderName
- The name of the folder to import into, or null to use the rootjava.lang.IllegalArgumentException
- On error importing from the filepublic static void exportProxySessionToFile(@NotNull HTTPSession proxySession, @NotNull java.io.File file)
proxySession
- The session to exportfile
- The file to savepublic int getID()
getID
in interface ScriptInstancesContainer
public void setID(int httpSessionID)
httpSessionID
- The ID.public java.lang.String getName()
getName
in interface ScriptInstancesContainer
public void setName(java.lang.String name)
name
- The name.public Folder getFolder()
getFolder
in interface Folderable
public void setFolder(Folder folder)
setFolder
in interface Folderable
folder
- The folder.public void removeFromFolder()
removeFromFolder
in interface Folderable
public void moveToNewFolder(Folder folder)
moveToNewFolder
in interface Folderable
folder
- The Folder
to which the object should be moved.public int getPort()
public void setPort(int port)
port
- The port.public boolean getDontLogBinaryFiles()
public void setDontLogBinaryFiles(boolean dontLogBinaryFiles)
dontLogBinaryFiles
- A boolean.public void setNotifiable(HTTPSessionNotifiable notifiable)
notifiable
- An HTTPSessionNotifiable
object.public void log(java.lang.String message)
log
in interface RunningHTTPSession
message
- The message to be logged.public java.lang.String getLog()
public void sessionUpdated()
public void transactionDeleted(int sequence)
sequence
- The sequence of the transaction that was deleted.public void transactionInserted(int sequence)
sequence
- The sequence of the transaction that was inserted.public void transactionUpdated(HTTPTransaction transaction)
transaction
- The transaction that was updated.public java.lang.String toString()
toString
in class java.lang.Object
protected java.util.TreeSet<HTTPTransaction> getHTTPTransactions()
@Nullable public HTTPTransaction getHTTPTransactionByID(int httpTransactionID)
HTTPTransaction
based on its ID.httpTransactionID
- The ID of the HTTP transaction.HTTPTransaction
, if found.public int getNumHTTPTransactions()
public void insertHTTPTransaction(java.net.Socket socket)
socket
- The socket the HTTPTransaction is to use.public void deleteAllTransactions()
public void removeHTTPTransaction(HTTPTransaction httpTransaction)
httpTransaction
- The HTTP transaction to be removed.@Nullable public HTTPTransaction getHTTPTransaction(int sequence)
sequence
- The sequence of the HTTP transaction to be retrieved.public int getSequenceForHTTPTransaction(HTTPTransaction httpTransaction)
httpTransaction
- The HTTPTransaction
to match.public ScriptInstances getScriptInstances()
ScriptInstances
object containing all script instances associated with this scrapeable file.getScriptInstances
in interface ScriptInstancesContainer
public void setScriptInstances(ScriptInstances scriptInstances)
setScriptInstances
in interface ScriptInstancesContainer
scriptInstances
- The script instances.public ScrapingSessionState getScrapingSessionState()
public java.lang.Object getVariable(java.lang.String variable)
getVariable
in interface RunningHTTPSession
variable
- The name of the variable.public void setVariable(java.lang.String variable, java.lang.Object value)
setVariable
in interface RunningHTTPSession
variable
- The variable.value
- The value of the variable.public void setScrapingSessionState(ScrapingSessionState scrapingSessionState)
scrapingSessionState
- The ScrapingSessionState
public java.util.ArrayList<ProxySearchResult> getJavaScriptCookies()
ProxySearchResult
objects.protected void processBeginningOfSessionScripts()
public java.util.TreeSet<ProxySearchResult> searchNotes(java.lang.String textToFind, boolean caseSensitive, boolean regEx)
textToFind
- The text to find.caseSensitive
- Whether or not the search should be case sensitive.regEx
- Whether or not the search text should be treated as a regex.ArrayList
of ProxySearchResult
objects.public java.util.TreeSet<ProxySearchResult> searchRequestHeaders(java.lang.String textToFind, boolean caseSensitive, boolean regEx)
textToFind
- The text to find.caseSensitive
- Whether or not the search should be case sensitive.regEx
- Whether or not the search text should be treated as a regex.ArrayList
of ProxySearchResult
objects.public java.util.TreeSet<ProxySearchResult> searchRequestBody(java.lang.String textToFind, boolean caseSensitive, boolean regEx)
textToFind
- The text to find.caseSensitive
- Whether or not the search should be case sensitive.regEx
- Whether or not the search text should be treated as a regex.ArrayList
of ProxySearchResult
objects.public java.util.TreeSet<ProxySearchResult> searchResponseHeaders(java.lang.String textToFind, boolean caseSensitive, boolean regEx)
textToFind
- The text to find.caseSensitive
- Whether or not the search should be case sensitive.regEx
- Whether or not the search text should be treated as a regex.ArrayList
of ProxySearchResult
objects.public java.util.TreeSet<ProxySearchResult> searchResponseBody(java.lang.String textToFind, boolean caseSensitive, boolean regEx)
textToFind
- The text to find.caseSensitive
- Whether or not the search should be case sensitive.regEx
- Whether or not the search text should be treated as a regex.ArrayList
of ProxySearchResult
objects.public void setFilterTransactions(boolean filterTransactions)
filterTransactions
- A boolean.public void blockAll()
public void setNode(javax.swing.tree.DefaultMutableTreeNode node)
node
- A DefaultMutableTreeNode
.public javax.swing.tree.DefaultMutableTreeNode getNode()
DefaultMutableTreeNode
.public boolean getNeedsToBeSaved()
public void setNeedsToBeSaved(boolean needsToBeSaved)
needsToBeSaved
- A boolean.public java.lang.String getKeyStoreFilePath()
public void setKeyStoreFilePath(java.lang.String keyStoreFilePath)
keyStoreFilePath
- The path to the keystore file.public java.lang.String getKeyStorePassword()
public void setKeyStorePassword(java.lang.String keyStorePassword)
keyStorePassword
- The key store passwordpublic void resetHttpClient()
public boolean getUsesProxySettings()
public ScrapingHttpClient getHttpClient()
CloseableHttpClient
.public void setHttpClient(@Nullable ScrapingHttpClient httpClient)
httpClient
- A DefaultHttpClient
.public void save()
public void load()
public void delete()
delete
in interface Deleteable
public int compareTo(java.lang.Object object)
Comparable
interface.compareTo
in interface java.lang.Comparable
object
- The object to compare to.public java.lang.String getIdentifier()
Uniqueable
getIdentifier
in interface Uniqueable
public void setIdentifier(java.lang.String identifier)
Uniqueable
setIdentifier
in interface Uniqueable
identifier
- The identifier.public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor df)
isDataFlavorSupported
in interface java.awt.datatransfer.Transferable
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor df) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException
getTransferData
in interface java.awt.datatransfer.Transferable
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
getTransferDataFlavors
in interface java.awt.datatransfer.Transferable
public void dumpToLog()