|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
COM.FutureTense.Util.FormPoster
Deprecated. Use HttpAccess APIs instead
public class FormPoster
This class allows for the construction and posting of multipart mime encoded messages much as would be sent from a web browser posting the results of an HTML form
Field Summary | |
---|---|
static java.lang.String |
Connect Deprecated. CONNECT action |
static java.lang.String |
Delete Deprecated. DELETE action |
static int |
ERRORBADRESPONSE Deprecated. Error server response did not contain handshake code |
static int |
ERRORFILEIO Deprecated. File I/O error |
static int |
ERRORGENERAL Deprecated. General error |
static int |
ERRORILLEGALDATAFORACTION Deprecated. File data used with Get Method error |
static int |
ERRORNETDISCONNECT Deprecated. Error network disconnected |
static int |
ERRORNOCONSERVER Deprecated. Error can't connect to server |
static int |
ERRORNOTAUTHENTICATED Deprecated. Server certificate does not match what is expected |
static int |
ERRORNOURLPARAM Deprecated. Error bad URL input params |
static int |
ERROROUTOFMEMORY Deprecated. Error - out of memory reading a server response |
static int |
ERRORSUCCESS Deprecated. Error success |
static int |
ERRORTIMEOUT Deprecated. Error network timeout forced |
static java.lang.String |
Get Deprecated. GET action |
static java.lang.String |
Head Deprecated. HEAD action |
static java.lang.String |
HTTP_ACCEPT_CHARSET Deprecated. |
static java.lang.String |
HTTP_ACCEPT_LANGUAGE Deprecated. |
static java.lang.String |
HTTP_ACCEPT_MIME_TYPES Deprecated. |
static java.lang.String |
HTTP_CONNECTION Deprecated. |
static java.lang.String |
HTTP_CONTENT_LENGTH Deprecated. |
static java.lang.String |
HTTP_CONTENT_TYPE Deprecated. |
static java.lang.String |
HTTP_CONTENT_TYPE_CHARSET Deprecated. |
static java.lang.String |
HTTP_EXPIRES Deprecated. |
static java.lang.String |
HTTP_LAST_MODIFIED Deprecated. |
static java.lang.String |
HTTP_POST_FORMMULTIPART Deprecated. |
static java.lang.String |
HTTP_POST_FORMURLENCODED Deprecated. |
static java.lang.String |
HTTP_REFERER Deprecated. |
static java.lang.String |
HTTP_SET_COOKIE Deprecated. |
static java.lang.String |
HTTP_USER_AGENT Deprecated. |
static int |
HTTPRESPONSENOPAGEFOUND Deprecated. |
static int |
HTTPRESPONSENOSERVICE Deprecated. |
static int |
HTTPRESPONSENOTOK Deprecated. HTTP Errors... |
static int |
HTTPRESPONSEOK Deprecated. HTTP Success |
static int |
HTTPRESPONSETIMEOUT Deprecated. |
static int |
HTTPVERSION10 Deprecated. HTTP 1.0 flag |
static int |
HTTPVERSION11 Deprecated. HTTP 1.1 flag |
protected boolean |
m_bFileDataAdded Deprecated. |
protected byte[] |
m_byUserBodyData Deprecated. |
protected java.lang.Object |
m_byUserBodyStream Deprecated. |
protected int |
m_byUserContentLength Deprecated. |
protected COM.FutureTense.Util.CookieWrapper[] |
m_Cookies Deprecated. |
protected int |
m_nLastError Deprecated. |
protected java.lang.StringBuffer |
m_sbUserTextParams Deprecated. |
protected FTValList |
m_vlHeaderInfo Deprecated. |
static java.lang.String |
Options Deprecated. PUT action |
static java.lang.String |
PATH_INFO Deprecated. |
static java.lang.String |
Post Deprecated. POST action |
static java.lang.String |
Put Deprecated. PUT action |
static java.lang.String |
REMOTE_ADDR Deprecated. |
static java.lang.String |
REMOTE_HOST Deprecated. |
static java.lang.String |
Trace Deprecated. TRACE action |
static java.lang.String |
X_CSRF_TOKEN Deprecated. |
Constructor Summary | |
---|---|
FormPoster() Deprecated. Construct a new object for post |
|
FormPoster(boolean panicOnProblem) Deprecated. |
Method Summary | |
---|---|
protected static void |
addCookieToVector(java.util.Vector vCookies, java.lang.String sName, java.lang.String sValue) Deprecated. |
boolean |
addFile(java.lang.String sParamName, java.lang.String sValue, java.lang.String sFileName) Deprecated. Add a file (upload file path spec) to data for multipart post, as in INPUT TYPE=FILE |
boolean |
addFile(java.lang.String sParamName, java.lang.String sValue, java.lang.String sFileName, java.lang.String sMIMEType) Deprecated. Add a file (upload file path spec) to data for multipart post, as in INPUT TYPE=FILE Allow specifing of mime type string. |
boolean |
addFileData(java.lang.String sParamName, java.lang.String sFileName, byte[] byData) Deprecated. Add file (upload) data via a byte array for multipart post, as in INPUT TYPE=FILE |
boolean |
addFileData(java.lang.String sParamName, java.lang.String sFileName, byte[] byData, java.lang.String sMIMEType) Deprecated. Add file (upload) data via a byte array for multipart post, as in INPUT TYPE=FILE |
boolean |
addFileData(java.lang.String sParamName, java.lang.String sFileName, java.io.InputStream is) Deprecated. Add file (upload) data via a InputStream object for multipart post, as in INPUT TYPE=FILE |
boolean |
addFileData(java.lang.String sParamName, java.lang.String sFileName, java.io.InputStream is, java.lang.String sMIMEType) Deprecated. Add file (upload) data via a InputStream object for multipart post, as in INPUT TYPE=FILE |
boolean |
addTextValue(java.lang.String sParamName, java.lang.String sValue) Deprecated. Adds a name/value pair to the MIME message we're assembling. |
boolean |
addURL(java.lang.String sParamName, java.lang.String sURL) Deprecated. Add a url ("http://" or "https://") to data for multipart post, as in INPUT TYPE=FILE |
protected void |
buildCookieArray() Deprecated. |
byte[] |
cleanRawResponse() Deprecated. Fetch the raw bytes from the output stream and remove the HTTP header. |
byte[] |
cleanRawResponse(boolean bRemoveStatus) Deprecated. Fetch the raw bytes from the output stream and remove the HTTP header. |
java.lang.String |
cleanResponse() Deprecated. Fetch the string from the output stream and remove the HTTP header. |
java.lang.String |
cleanResponse(boolean bRemoveStatus) Deprecated. Fetch the string from the output stream and remove the HTTP header. |
protected boolean |
doAuthentication() Deprecated. |
void |
dumpMsg(java.lang.String msg) Deprecated. Send a String message to stdout or a log file if one was selected via setLog. |
FTValList |
findAllCookies() Deprecated. Find the cookies in the post response |
static FTValList |
findAllCookies(java.lang.String sData) Deprecated. Find all cookie values in the HTTP response |
static COM.FutureTense.Util.CookieWrapper[] |
getCookieArray(java.lang.String sData) Deprecated. Find all cookie values in the HTTP response |
FTValList |
getCookies() Deprecated. Return FTValList containing all cookie names/values |
int |
getHTTPStatusCode() Deprecated. Fetch the HTTP status from the response |
java.lang.String |
getHTTPStatusText() Deprecated. Fetch the HTTP status text from the response |
int |
getLastError() Deprecated. Retrieve the last error code set |
java.lang.String |
getLastErrorStr() Deprecated. Retrieve any coded message from the status code object |
java.lang.String |
getLastErrorText() Deprecated. Retrieve the text represenation of the error returned by getLastError() |
java.lang.String |
getOutputFileSpec() Deprecated. Fetch the file spec where the post output has been written |
byte[] |
getRawResponse() Deprecated. Fetch the raw bytes from the output stream |
java.lang.String |
getResponse() Deprecated. Returns String response from the server after we post() our request. |
java.lang.String |
getResponseEncoding() Deprecated. Method to get the character encoding of the response if known |
javax.servlet.http.Cookie[] |
getServletCookies() Deprecated. Get HTTPServlet cookies |
protected java.lang.String |
getStatusRecordToken(int nCount) Deprecated. |
java.lang.String |
getX_CSRF_TOKEN_VALUE() Deprecated. |
protected void |
init() Deprecated. |
void |
login(boolean login, COM.FutureTense.Util.ftStatusCode status, java.lang.String user, java.lang.String pass) Deprecated. Login or logout Set the url first in the FormPoster otherwise it will attempt to default to a NAS 2.1 style URL |
boolean |
post() Deprecated. Send this record via an HTTP POST. |
protected FTValList |
postProcessMIMEHeader(java.lang.String sHeader) Deprecated. Called to post-process a mime header once the postconnector reads it |
protected static void |
processCookie(int nIndex, java.lang.String sData, java.util.Vector vCookies) Deprecated. |
protected byte[] |
readStream(java.io.InputStream is) Deprecated. |
void |
registerMIMENotifier(COM.FutureTense.Interfaces.IMIMENotifier mn) Deprecated. Register an object that supports the IMIMENotifier interface so that it will be called with MIME header information. |
void |
reset() Deprecated. Reset to reuse for a new post |
protected static java.lang.String |
sanitizeString(java.lang.String sIn) Deprecated. Clean a string by only returning a printable substring |
void |
setAction(java.lang.String sAction) Deprecated. Sets the action for this request. |
void |
setAutenticationParameters(java.lang.String sEntity, java.lang.String sIssuer) Deprecated. Set the certificate parameters to be used to authenticate the server. |
void |
setBodyData(byte[] data) Deprecated. Pass a prebuilt MIME body for posting |
void |
setBodyStream(java.lang.Object is, int length) Deprecated. Pass a prebuilt MIME body for posting |
void |
setCharacterEncoding(java.lang.String sEncoding) Deprecated. Set the character encoding for the string data contained in the MIME request message body Ignored when the transmission method is Get |
void |
setCookies(javax.servlet.http.Cookie[] c) Deprecated. Use these cookies in the future |
void |
setCookies(java.util.Map cookiesMap) Deprecated. Use these cookies in the future |
void |
setDump(boolean dumpOutput) Deprecated. Control status logging info; default is false |
boolean |
setEncodeURL(java.lang.String sURL) Deprecated. Set the URL to post to. |
void |
setHeaderInformation(FTValList vlHeaderInfo) Deprecated. Use the header information supplied |
void |
setHTTPVersion(int nVersion) Deprecated. Set the HTTP protocol version to use. |
void |
setLog(COM.FutureTense.Util.LogFile logFile) Deprecated. Supply a logging object if desired for special log types; not required, output will stream to default location based on invocation environment |
void |
setLog(java.lang.String logdir) Deprecated. Provide a standard ascii file dump location for logging in absense of LogFile object |
void |
setOutputDirectory(java.lang.String sDir) Deprecated. Set the directory where the post results output file should be written. |
void |
setOutputStream(java.io.OutputStream os) Deprecated. Set an output stream to be used for capturing the response. |
void |
setPort(int nPort) Deprecated. Set the port to be used to connect to the remote http server |
void |
setProxy(java.lang.String sHost) Deprecated. Set the proxy host if needed to post thru a fire wall |
void |
setProxyPassword(java.lang.String p) Deprecated. Specify a proxy server password if needed to push data thru a firewall |
void |
setProxyPort(int nPort) Deprecated. Specify a proxy server port if needed to push data thru a firewall |
void |
setProxyUser(java.lang.String u) Deprecated. Specify a proxy server user if needed to push data thru a firewall |
void |
setSecureProtocol(boolean bSecure) Deprecated. Communicate in secure (https) mode. |
void |
setTimeout(int milliseconds) Deprecated. Set a network socket connection timeout, in milliseconds. |
boolean |
setURL(java.lang.String sURL) Deprecated. Set the URL to post to. |
void |
setX_CSRF_TOKEN_VALUE(java.lang.String xCSRFTOKENVALUE) Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ERRORSUCCESS
public static final int ERRORNOCONSERVER
public static final int ERRORNETDISCONNECT
public static final int ERRORNOURLPARAM
public static final int ERRORTIMEOUT
public static final int ERRORBADRESPONSE
public static final int ERRORNOTAUTHENTICATED
public static final int ERROROUTOFMEMORY
public static final int ERRORGENERAL
public static final int ERRORFILEIO
public static final int ERRORILLEGALDATAFORACTION
public static final int HTTPVERSION10
public static final int HTTPVERSION11
public static final java.lang.String Post
public static final java.lang.String Get
public static final java.lang.String Connect
public static final java.lang.String Delete
public static final java.lang.String Head
public static final java.lang.String Options
public static final java.lang.String Put
public static final java.lang.String Trace
public static final int HTTPRESPONSEOK
public static final int HTTPRESPONSENOTOK
public static final int HTTPRESPONSENOPAGEFOUND
public static final int HTTPRESPONSETIMEOUT
public static final int HTTPRESPONSENOSERVICE
public static final java.lang.String HTTP_ACCEPT_LANGUAGE
public static final java.lang.String HTTP_REFERER
public static final java.lang.String REMOTE_HOST
public static final java.lang.String REMOTE_ADDR
public static final java.lang.String HTTP_CONNECTION
public static final java.lang.String PATH_INFO
public static final java.lang.String HTTP_USER_AGENT
public static final java.lang.String HTTP_ACCEPT_MIME_TYPES
public static final java.lang.String HTTP_ACCEPT_CHARSET
public static final java.lang.String X_CSRF_TOKEN
public static final java.lang.String HTTP_SET_COOKIE
public static final java.lang.String HTTP_CONTENT_TYPE_CHARSET
public static final java.lang.String HTTP_CONTENT_TYPE
public static final java.lang.String HTTP_CONTENT_LENGTH
public static final java.lang.String HTTP_EXPIRES
public static final java.lang.String HTTP_LAST_MODIFIED
public static final java.lang.String HTTP_POST_FORMMULTIPART
public static final java.lang.String HTTP_POST_FORMURLENCODED
protected int m_nLastError
protected byte[] m_byUserBodyData
protected java.lang.Object m_byUserBodyStream
protected int m_byUserContentLength
protected COM.FutureTense.Util.CookieWrapper[] m_Cookies
protected FTValList m_vlHeaderInfo
protected java.lang.StringBuffer m_sbUserTextParams
protected boolean m_bFileDataAdded
Constructor Detail |
---|
public FormPoster()
public FormPoster(boolean panicOnProblem)
Method Detail |
---|
protected void init()
public javax.servlet.http.Cookie[] getServletCookies()
public FTValList getCookies()
public void setCookies(javax.servlet.http.Cookie[] c)
c
- cookie array, null to clearpublic void setCookies(java.util.Map cookiesMap)
cookiesMap
- - Map containing cookie name/value pairspublic void setHeaderInformation(FTValList vlHeaderInfo)
vlHeaderInfo
- - vallist containing header informationpublic void setBodyData(byte[] data)
data
-public void setBodyStream(java.lang.Object is, int length)
is
- mime bodylength
- length of bodypublic void reset()
public void login(boolean login, COM.FutureTense.Util.ftStatusCode status, java.lang.String user, java.lang.String pass)
login
- - TRUE login otherwise logoutstatus
- - optional if specified return status will be setuser
- - username to use to log inpass
- - password to use to log inpublic void setDump(boolean dumpOutput)
dumpOutput
- whether to dump output msgspublic void setOutputDirectory(java.lang.String sDir)
sDir
- - directory path. If null, no output file writtenpublic void setOutputStream(java.io.OutputStream os)
os
- output stream (not closed)public void setCharacterEncoding(java.lang.String sEncoding)
sEncoding
- character encodingpublic java.lang.String getOutputFileSpec()
public java.lang.String getResponse()
String
response from the server after we post() our request.public byte[] getRawResponse()
public final java.lang.String getResponseEncoding()
public byte[] cleanRawResponse(boolean bRemoveStatus)
bRemoveStatus
- boolean flagpublic byte[] cleanRawResponse()
public int getLastError()
public java.lang.String getLastErrorText()
public java.lang.String getLastErrorStr()
protected java.lang.String getStatusRecordToken(int nCount)
public int getHTTPStatusCode()
public java.lang.String getHTTPStatusText()
public void setLog(COM.FutureTense.Util.LogFile logFile)
logFile
- an object which can construct a logging outputpublic void setLog(java.lang.String logdir)
logdir
- path to log directory and 'wwwresponse.log' will be appended to create a logfilepublic void setAction(java.lang.String sAction) throws java.lang.Exception
sAction
- actionjava.lang.Exception
- if invalid actionprotected byte[] readStream(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public boolean addURL(java.lang.String sParamName, java.lang.String sURL)
sParamName
- - the parameter namesURL
- - URL to fetchpublic boolean addFileData(java.lang.String sParamName, java.lang.String sFileName, byte[] byData)
sParamName
- - the parameter namesFileName
- - desired name of the file on the target (ie foo.txt)byData
- byte array containing file datapublic boolean addFileData(java.lang.String sParamName, java.lang.String sFileName, byte[] byData, java.lang.String sMIMEType)
sParamName
- - the parameter namesFileName
- - desired name of the file on the target (ie foo.txt)byData
- byte array containing file datasMIMEType
- MIME type of the datapublic boolean addFileData(java.lang.String sParamName, java.lang.String sFileName, java.io.InputStream is, java.lang.String sMIMEType)
sParamName
- - the parameter namesFileName
- - desired name of the file on the target (ie foo.txt)is
- - the object from where the file data will be readsMIMEType
- MIME type of the datapublic boolean addFileData(java.lang.String sParamName, java.lang.String sFileName, java.io.InputStream is)
sParamName
- - the parameter namesFileName
- - desired name of the file on the target (ie foo.txt)is
- - the object from where the file data will be readpublic boolean addFile(java.lang.String sParamName, java.lang.String sValue, java.lang.String sFileName)
sParamName
- - the parameter namesValue
- - value of the parameter (usually the file name)sFileName
- - name of the file to addpublic boolean addFile(java.lang.String sParamName, java.lang.String sValue, java.lang.String sFileName, java.lang.String sMIMEType)
sParamName
- - the parameter namesValue
- - value of the parameter (usually the file name)sFileName
- - name of the file to addsMIMEType
- - MIME type stringpublic boolean addTextValue(java.lang.String sParamName, java.lang.String sValue)
sParamName
- - name of the parametersValue
- - value string of the parameterpublic boolean setEncodeURL(java.lang.String sURL)
public boolean setURL(java.lang.String sURL)
public void setProxy(java.lang.String sHost)
sHost
- hostpublic void setProxyPort(int nPort)
nPort
- portpublic void setProxyUser(java.lang.String u)
u
- usernamepublic void setProxyPassword(java.lang.String p)
p
- passwordpublic void setTimeout(int milliseconds)
milliseconds
- timeout in millisecondspublic void setSecureProtocol(boolean bSecure)
bSecure
- If set after URL is set, will override the default which was determined from the URL protocolpublic void setPort(int nPort)
nPort
- port. If set after URL is set, will override the default which was determined from the URL protocolpublic void setHTTPVersion(int nVersion) throws java.lang.Exception
nVersion
- protocol. Input should be one of:
FormPoster.HTTPVERSION10 or FormPoster.HTTPVERSION11
java.lang.Exception
- if invalid http versionpublic boolean post()
protected boolean doAuthentication()
public void dumpMsg(java.lang.String msg)
String
message to stdout or a log file if one was selected via setLog.msg
- - the message to displayprotected static java.lang.String sanitizeString(java.lang.String sIn)
sIn
- - the string to be cleanedprotected static void addCookieToVector(java.util.Vector vCookies, java.lang.String sName, java.lang.String sValue)
protected static void processCookie(int nIndex, java.lang.String sData, java.util.Vector vCookies)
protected void buildCookieArray()
public FTValList findAllCookies()
public static COM.FutureTense.Util.CookieWrapper[] getCookieArray(java.lang.String sData)
sData
- data - HTTP response stringpublic static FTValList findAllCookies(java.lang.String sData)
sData
- data - HTTP response stringpublic java.lang.String cleanResponse(boolean bRemoveStatus)
bRemoveStatus
- - TRUE remove status, FALSE otherwisepublic java.lang.String cleanResponse()
public void setAutenticationParameters(java.lang.String sEntity, java.lang.String sIssuer)
sEntity
- String expected name of the entitysIssuer
- String expected certificate issuer name (ie verisign)protected FTValList postProcessMIMEHeader(java.lang.String sHeader)
sHeader
- String MIME headerpublic void registerMIMENotifier(COM.FutureTense.Interfaces.IMIMENotifier mn)
mn
- IMIMENotifer object which supports IMIMENotifierpublic java.lang.String getX_CSRF_TOKEN_VALUE()
public void setX_CSRF_TOKEN_VALUE(java.lang.String xCSRFTOKENVALUE)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.