Home > Contents > Index >
FormPoster.login
Logs a user in or out.
Syntax
public void login(boolean login, ftStatusCode status, String user, String pass)Parameters
login
- Specify
true
to log in,false
to log out.
status
- Optional if specified return status will be set.
username
- Username to log in.
password
- Password associated with
username
.
Description
The
login
method logs in or logs out a user. Prior to callinglogin
, you must first set the URL by callingsetURL
.Error Numbers
The possible values of
errno
include:
Value Description -3500 If theFormPoster
can not communicate with the target server during login.Example
FormPoster fp = new FormPoster(); 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.login(false, ftStatus, null, null);
Home > Contents > Index > Oracle JAVA Reference
Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.