Home > Contents > Index >
Expanded TOC | Accordion TOC | Annotated TOC | Index
FormPoster.setLog
Supplies a logging object for special log types.
Use of this method is not required. If you do not use setLog, output streams to a default location based on the environment in which you invoke the method.
This method has two variants:
- setLog (Variant 1) accepts a logfile object.
- setLog (Variant 2) accepts a string.
FormPoster.setLog
Supplies a logging object for special log types.
Syntax
public void setLog(LogFile logFile)Parameters
logFile
- An object which can construct a logging output.
Description
The
setLog
method supplies a logging object for special log types. Use of this method is not required. If you do not usesetLog
, output streams to a default location based on the environment in which you invoke the method.Example
FormPoster fp = new FormPoster(); // Turn on logging fp.setDump(true); fp.setLog("/export/home/mydir/"); FTValList vlCookies; fp.setURL("http://myserver/servlet/CatalogManager"); // Add a new row to MyTable FTStatusCode ftStatus = new FTStatusCode(); status = fp.login(true, ftStatus, "myusername", "mypassword"); vlCookies = fp.findAllCookies(); Status = fp.addFile("url", "test.html", "/export/home/temp/test.html", "text/html"); Status = fp.addTextValue("tblname", "MyTable"); Status = fp.addURL("myparameter", "http://server/main.html"); Status = fp.addTextValue("id", "1323"); Status = fp.addTextValue("ftcmd", "addrow"); fp.setCookies(vlCookies); Status = fp.post(); int nLastErrorCode = fp.getLastError(); String sLastError = fp.getLastErrorStr(); // Fetch the response byte[] byResponse = fp.getRawResponse(); fp.reset(); Status = fp.addFile("url", "body.html", "/export/home/temp/body.html", "text/html"); Status = fp.addTextValue("tblname", "MyTable"); Status = fp.addURL("myparameter", "http://server/index.html"); Status = fp.addTextValue("id", "4567"); Status = fp.addTextValue("ftcmd", "addrow"); Status = fp.post(); fp.login(false, ftStatus, null, null);See Also
FormPoster.setLog
Supplies a logging object for special log types.
Syntax
public void setLog(String logdir)Parameters
logdir
- Path to log directory and
'wwwresponse.log
' will be appended to create a logfile.
Description
The
setLog
method supplies a logging object for special log types. Use of this method is not required. If you do not usesetLog
, output streams to a default location based on the environment in which you invoke the method.Example
FormPoster fp = new FormPoster(); // Turn on logging fp.setDump(true); fp.setLog("/export/home/mydir/"); FTValList vlCookies; fp.setURL("http://myserver/servlet/CatalogManager"); // Add a new row to MyTable FTStatusCode ftStatus = new FTStatusCode(); status = fp.login(true, ftStatus, "myusername", "mypassword"); vlCookies = fp.findAllCookies(); Status = fp.addFile("url", "test.html", "/export/home/temp/test.html", "text/html"); Status = fp.addTextValue("tblname", "MyTable"); Status = fp.addURL("myparameter", "http://server/main.html"); Status = fp.addTextValue("id", "1323"); Status = fp.addTextValue("ftcmd", "addrow"); fp.setCookies(vlCookies); Status = fp.post(); int nLastErrorCode = fp.getLastError(); String sLastError = fp.getLastErrorStr(); // Fetch the response byte[] byResponse = fp.getRawResponse(); fp.reset(); Status = fp.addFile("url", "body.html", "/export/home/temp/body.html", "text/html"); Status = fp.addTextValue("tblname", "MyTable"); Status = fp.addURL("myparameter", "http://server/index.html"); Status = fp.addTextValue("id", "4567"); Status = fp.addTextValue("ftcmd", "addrow"); Status = fp.post(); fp.login(false, ftStatus, null, null);See Also
Home > Contents > Index > ![]()
Oracle JAVA Reference
Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.