public class HttpClient
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
java.lang.String |
command |
java.lang.String |
servletLocation |
| Constructor and Description |
|---|
HttpClient(java.lang.String host,
int port,
java.lang.String servletLocation,
LogUtils log) |
HttpClient(java.lang.String Host,
java.lang.String Cgihost,
LogUtils log) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Send Abort command
|
void |
allo(long size) |
java.io.BufferedWriter |
appendAscii(java.lang.String filename)
APPEND (with create) to a file to the FTP server in Ascii mode
|
java.io.BufferedOutputStream |
appendBinary(java.lang.String filename)
APPEND (with create) to a file to the FTP server in Binary mode
|
boolean |
ascii()
Set transfer type to 'A'
|
boolean |
binary()
Set transfer type to 'I'
|
void |
cd(java.lang.String remoteDirectory)
CD to a specific directory on a remote FTP server
|
void |
cdup() |
void |
closeServer()
issue the QUIT command to the FTP server and close the connection.
|
java.io.BufferedOutputStream |
concatenate(java.lang.String filename,
int numOfParts)
CONCAT a bunch of files on the FTP server
|
protected void |
configureSSLIfNeeded(java.lang.String Cgihost) |
boolean |
connected() |
java.net.URL |
constructURL(java.lang.String cmd,
java.lang.String newDir,
java.lang.String file,
java.lang.String site) |
java.net.URL |
constructURL(java.lang.String cmd,
java.lang.String newDir,
java.lang.String file,
java.lang.String site,
boolean reinitIfInvalid) |
void |
delete(java.lang.String s,
boolean stripPath) |
void |
deleteTempFiles() |
void |
doesFTPServerSupportResume(boolean usingFC3_8) |
void |
email(java.lang.String emailAddress,
int statusCode,
java.lang.String note) |
void |
forceCloseServer() |
boolean |
ftpResumeSupported() |
void |
fxp(java.lang.String fxpsid,
java.lang.String filename,
java.lang.String fxpFilename,
boolean triangle) |
java.io.BufferedReader |
getAscii(java.lang.String filename)
GET a file from the FTP server in Ascii mode
|
java.lang.String |
getBaseURL(java.lang.String concatenatedString) |
java.io.BufferedInputStream |
getBinary(java.lang.String filename)
GET a file from the FTP server in Binary mode
|
java.io.BufferedInputStream |
getBinary(java.lang.String filename,
long offset)
GET a file from the FTP server in Binary mode and starting at the given
offset
|
java.io.BufferedInputStream |
getBinary(java.lang.String filename,
long offset,
long segment)
GET a file segment from the FTP server in Binary mode and starting at the
given offset
|
protected java.io.BufferedReader |
getBufferedReader(java.net.URLConnection urlc)
This method will try multiple times to open the data connection to the web server if
it gets IO exceptions.
|
java.lang.String |
getCertificateInfo()
Go up one directory on remots system
|
java.lang.String |
getCommand() |
int |
getLastReplyCode() |
protected int |
getMovePercentage(java.lang.String remoteFile)
returns true/false if the move is completed
|
java.lang.String |
getRemoteHost() |
int |
getRemotePort() |
java.lang.String |
getResponseString()
Returns all server response strings.
|
java.lang.String |
getResponseStringNoReset() |
protected void |
getServletVersion() |
java.lang.String |
getSid() |
int |
getSoConnectTimeout() |
int |
getSoLinger() |
int |
getSoTimeout() |
java.net.URL |
getURL() |
java.lang.String |
getWelcomeMessage() |
boolean |
isEnableResume() |
boolean |
isForceResume() |
boolean |
isMac() |
boolean |
isNetscapeFour()
Deprecated.
|
boolean |
isPrintSolution() |
boolean |
isUseGZip() |
java.io.BufferedInputStream |
list() |
java.io.BufferedInputStream |
list(java.lang.String args) |
void |
login(java.lang.String username,
java.lang.String password)
login user to a host with username user and password
password
|
void |
login(java.util.function.Supplier<ClientCredentials> creds)
login user to a host with username user and password
password
|
void |
mkdir(java.lang.String s)
Create a directory on the remote system
|
void |
moveFilesToServer(java.lang.String remoteFile) |
java.io.BufferedInputStream |
nlist()
NLIST files on a remote FTP server
|
java.io.BufferedInputStream |
nlist(java.lang.String args)
NLIST files on a remote FTP server
|
void |
noop() |
void |
openServer(java.lang.String host)
open a FTP connection to host host.
|
void |
openServer(java.lang.String host,
int port)
open a FTP connection to host host on port port.
|
java.io.BufferedWriter |
putAscii(java.lang.String filename)
PUT a file to the FTP server in Ascii mode
|
java.io.BufferedOutputStream |
putBinary(java.lang.String filename)
PUT a file to the FTP server in Binary mode
|
java.io.BufferedOutputStream |
putSegmentBinary(java.lang.String filename,
long segmentOffset,
long segmentSize)
PUT a file to the FTP server in Binary mode
|
void |
pwd()
Get the name of the present working directory on the ftp file system
|
void |
quote(java.lang.String s) |
int |
readServerResponse() |
void |
reinitSessionIfNeeded() |
void |
rename(java.lang.String oldFile,
java.lang.String newFile)
Rename a file on the remote server
|
void |
rmdir(java.lang.String s) |
void |
saveFilesToWebServer() |
void |
sendServer(java.lang.String cmd)
Sends command cmd to the server.
|
void |
sendWeblink(WeblinkDataContainer linkDO)
Streams Our File Listing To The Server
|
boolean |
serverIsOpen() |
void |
setClientCredentials(java.util.function.Supplier<ClientCredentials> creds) |
void |
setDebug(boolean debug) |
void |
setEnableResume(boolean enableResume) |
void |
setForceResume(boolean forceResume) |
void |
setMac(boolean mac) |
protected void |
setMD5HashedLocalIP() |
void |
setNetscapeFour(boolean netscapeFour)
Deprecated.
|
void |
setPassive(boolean mode)
Set Passive mode Trasfers
|
void |
setPrintSolution(boolean printSolution) |
void |
setSid(java.lang.String sid) |
void |
setSoConnectTimeout(int i) |
void |
setSoLinger(int i) |
void |
setSoTimeout(int i) |
void |
setupURLConnection(java.net.URLConnection urlc) |
void |
setUseGZip(boolean useGZip) |
void |
setWelcomeMessage(java.lang.String welcomeMessage) |
void |
site(java.lang.String params)
Site Command
|
protected void |
startMOVE(java.lang.String remoteFile) |
java.lang.String |
toString() |
protected void |
writeLog(java.lang.String line) |
void |
zip(java.lang.String zipFilename,
java.lang.String filenames,
int compLevel,
long limit) |
public java.lang.String servletLocation
public java.lang.String command
public HttpClient(java.lang.String Host,
java.lang.String Cgihost,
LogUtils log)
throws java.io.IOException
java.io.IOExceptionpublic HttpClient(java.lang.String host,
int port,
java.lang.String servletLocation,
LogUtils log)
throws java.io.IOException
java.io.IOExceptionprotected void setMD5HashedLocalIP()
protected void configureSSLIfNeeded(java.lang.String Cgihost)
protected void getServletVersion()
throws java.io.IOException,
java.net.MalformedURLException
java.io.IOExceptionjava.net.MalformedURLExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic void setupURLConnection(java.net.URLConnection urlc)
throws java.io.IOException
java.io.IOExceptionpublic java.net.URL getURL()
@Deprecated public void setNetscapeFour(boolean netscapeFour)
@Deprecated public boolean isNetscapeFour()
public void setPassive(boolean mode)
public boolean serverIsOpen()
public int readServerResponse()
throws java.io.IOException
java.io.IOExceptionpublic void sendServer(java.lang.String cmd)
public boolean connected()
public java.lang.String getCommand()
public java.lang.String getResponseString()
public int getLastReplyCode()
public java.lang.String getResponseStringNoReset()
public void closeServer()
throws java.io.IOException
java.io.IOExceptionpublic void fxp(java.lang.String fxpsid,
java.lang.String filename,
java.lang.String fxpFilename,
boolean triangle)
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic void forceCloseServer()
throws java.io.IOException
java.io.IOExceptionpublic void openServer(java.lang.String host)
throws java.io.IOException,
java.net.UnknownHostException
java.io.IOExceptionjava.net.UnknownHostExceptionpublic void openServer(java.lang.String host,
int port)
throws java.io.IOException,
java.net.UnknownHostException
java.io.IOExceptionjava.net.UnknownHostExceptionpublic void login(java.lang.String username,
java.lang.String password)
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic void login(java.util.function.Supplier<ClientCredentials> creds) throws java.io.IOException, FCException
java.io.IOExceptionFCExceptionpublic void doesFTPServerSupportResume(boolean usingFC3_8)
throws java.io.IOException
java.io.IOExceptionpublic java.io.BufferedReader getAscii(java.lang.String filename)
throws java.io.IOException
java.io.IOExceptionpublic java.io.BufferedInputStream getBinary(java.lang.String filename)
throws java.io.IOException
java.io.IOExceptionpublic java.io.BufferedInputStream getBinary(java.lang.String filename,
long offset)
throws java.io.IOException
java.io.IOExceptionpublic java.io.BufferedInputStream getBinary(java.lang.String filename,
long offset,
long segment)
throws java.io.IOException
java.io.IOExceptionpublic java.io.BufferedWriter putAscii(java.lang.String filename)
throws java.io.IOException
java.io.IOExceptionpublic void moveFilesToServer(java.lang.String remoteFile)
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionprotected void writeLog(java.lang.String line)
protected void startMOVE(java.lang.String remoteFile)
throws java.net.MalformedURLException,
java.io.IOException
java.net.MalformedURLExceptionjava.io.IOExceptionprotected int getMovePercentage(java.lang.String remoteFile)
throws java.net.MalformedURLException,
java.io.IOException
java.net.MalformedURLExceptionjava.io.IOException - if a 500 Error occurred, i.e. HTTP request failedpublic void delete(java.lang.String s,
boolean stripPath)
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic void deleteTempFiles()
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic void saveFilesToWebServer()
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic boolean ftpResumeSupported()
public java.io.BufferedOutputStream concatenate(java.lang.String filename,
int numOfParts)
throws java.io.IOException
java.io.IOExceptionpublic java.io.BufferedOutputStream putBinary(java.lang.String filename)
throws java.io.IOException
java.io.IOExceptionpublic java.io.BufferedOutputStream putSegmentBinary(java.lang.String filename,
long segmentOffset,
long segmentSize)
throws java.io.IOException
java.io.IOExceptionpublic java.io.BufferedWriter appendAscii(java.lang.String filename)
throws java.io.IOException
java.io.IOExceptionpublic java.io.BufferedOutputStream appendBinary(java.lang.String filename)
throws java.io.IOException
java.io.IOExceptionpublic java.io.BufferedInputStream nlist()
throws java.io.IOException
java.io.IOExceptionpublic java.io.BufferedInputStream nlist(java.lang.String args)
throws java.io.IOException
java.io.IOExceptionpublic java.io.BufferedInputStream list()
throws java.io.IOException
java.io.IOExceptionpublic java.io.BufferedInputStream list(java.lang.String args)
throws java.io.IOException
java.io.IOExceptionpublic void cd(java.lang.String remoteDirectory)
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic void rename(java.lang.String oldFile,
java.lang.String newFile)
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic void site(java.lang.String params)
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic void allo(long size)
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic boolean binary()
throws java.io.IOException
java.io.IOExceptionpublic boolean ascii()
throws java.io.IOException
java.io.IOExceptionpublic void abort()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getCertificateInfo()
throws java.io.IOException
java.io.IOExceptionpublic void pwd()
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic void noop()
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic void quote(java.lang.String s)
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic void cdup()
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic void zip(java.lang.String zipFilename,
java.lang.String filenames,
int compLevel,
long limit)
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic void email(java.lang.String emailAddress,
int statusCode,
java.lang.String note)
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic void mkdir(java.lang.String s)
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic void rmdir(java.lang.String s)
throws java.io.IOException,
FCException
java.io.IOExceptionFCExceptionpublic void sendWeblink(WeblinkDataContainer linkDO) throws java.io.IOException, FCException
files - java.io.IOExceptionFCExceptionprotected java.io.BufferedReader getBufferedReader(java.net.URLConnection urlc)
throws java.io.IOException
urlc - java.io.IOExceptionpublic java.net.URL constructURL(java.lang.String cmd,
java.lang.String newDir,
java.lang.String file,
java.lang.String site)
throws java.net.MalformedURLException,
java.io.UnsupportedEncodingException,
java.io.IOException
java.net.MalformedURLExceptionjava.io.UnsupportedEncodingExceptionjava.io.IOExceptionpublic java.net.URL constructURL(java.lang.String cmd,
java.lang.String newDir,
java.lang.String file,
java.lang.String site,
boolean reinitIfInvalid)
throws java.net.MalformedURLException,
java.io.UnsupportedEncodingException,
java.io.IOException
java.net.MalformedURLExceptionjava.io.UnsupportedEncodingExceptionjava.io.IOExceptionpublic java.lang.String getBaseURL(java.lang.String concatenatedString)
throws FCException,
java.io.IOException
FCExceptionjava.io.IOExceptionpublic void setSoConnectTimeout(int i)
public void setSoTimeout(int i)
public void setSoLinger(int i)
public int getSoConnectTimeout()
public int getSoTimeout()
public int getSoLinger()
public boolean isPrintSolution()
public void setPrintSolution(boolean printSolution)
public boolean isUseGZip()
public void setUseGZip(boolean useGZip)
public void setEnableResume(boolean enableResume)
public boolean isEnableResume()
public void setDebug(boolean debug)
public void setMac(boolean mac)
public boolean isMac()
public java.lang.String getSid()
public void setSid(java.lang.String sid)
public boolean isForceResume()
public void setForceResume(boolean forceResume)
public java.lang.String getWelcomeMessage()
public void setWelcomeMessage(java.lang.String welcomeMessage)
welcomeMessage - the welcomeMessage to setpublic void setClientCredentials(java.util.function.Supplier<ClientCredentials> creds) throws FCException
FCExceptionpublic java.lang.String getRemoteHost()
public int getRemotePort()
public void reinitSessionIfNeeded()
throws FCException,
java.io.IOException
FCExceptionjava.io.IOException