public class HttpProcessor extends Object implements IoProcessor, SplitReceiver, AcceptsPayload
Modifier and Type | Class and Description |
---|---|
static class |
HttpProcessor.HTTP_AUTH
HTTP auth.
|
static class |
HttpProcessor.HTTP_METHOD
HTTP methods.
|
class |
HttpProcessor.HttpDeleteWithEntity
The Class HttpDeleteWithEntity.
|
class |
HttpProcessor.HttpGetWithEntity
The Class HttpGetWithEntity.
|
Modifier and Type | Field and Description |
---|---|
static String |
ACCESS_TOKEN_PROP
The access token property.
|
static String |
ADD_RESPONSE_TO_EXCEPTION_PROP
The ADD REPONSE TO EXCEPTION PROPERTY.
|
static String |
ADD_URL_TO_DEBUG_LOG_PROP
The ADD_URL_TO_DEBUG_LOG PROPERTY.
|
static String |
ASYNC_PROP
The ASYNC PROPERTY.
|
static String |
AUTH_CONTENT_TYPE_PROP
The AUTH_CONTENT_TYPE property.
|
static String |
AUTH_HEADER_PREFIX
The Constant AUTH_HEADER_PREFIX.
|
static String |
AUTH_HEADER_PROP
The auth header property.
|
static String |
AUTH_METHOD_PROP
The refresh token property.
|
static String |
AUTH_PAYLOAD_PROP
The AUTH_PAYLOAD property.
|
static String |
AUTH_PROP
The Constant AUTH_PROP.
|
static String |
AUTH_TOKEN_NAME
The Constant OAUTH2_NAME.
|
static String |
AUTH_URL_PROP
The auth URL property.
|
static String |
AUTHENTICATION_HEADER_NAME_PROP
The AUTHENTICATION_HEADER_NAME.
|
static String |
AWS_NAME
The Constant AWS_NAME.
|
static String |
BASIC_AUTH_NAME
The BASIC_AUTH_NAME.
|
static String |
BASIC_PREEMPTIVE_NAME
The BASIC_PREEMPTIVE_AUTH_NAME.
|
static String |
BODY_ENCODING_PROP
The BODY ENCODING PROPERTY.
|
static String |
CONNECTION_PREPROCESSOR_PROP
The CONNECTION_PREPROCESSOR PROPERTY.
|
static String |
CONTENT_TYPE_PROP
The CONTENT_TYPE property.
|
static String |
DELAY_BETWEEN_RETRIES_PROP
The DELAY BETWEEN RETRIES PROPERTY.
|
static String |
DELETE_METHOD
HTTP DELETE.
|
static String |
DUMP_RESPONSE_PROP
The DUMP RESPONSE property.
|
static String |
ENCODING_PROP
The ENCODING PROPERTY.
|
static String |
ETLWORKS_ACCESS_TOKEN_ATTR_NAME
The default etlworks access token name.
|
static String |
EXCEPTIONS_PROP
The EXCEPTIONS property.
|
static String |
FILE_NAME_PROP
The FILE NAME property.
|
static String |
FILE_PROP
The IS FILE property.
|
static String |
GET_METHOD
HTTP GET.
|
static String |
HEAD_METHOD
HTTP HEADER.
|
static String |
HEADER_NAME
The Constant HEADER_NAME.
|
static String |
HEADER_PREFIX
this prefix used to get a headers from the properties for the
corresponding http methods.
|
static String |
HTTP
HTTP.
|
static String |
LAST_HTTP_CODE
The Constant LAST_HTTP_CODE.
|
static String |
LAST_RESPONSE_HEADERS_CODE
The Constant LAST_RESPONSE_HEADERS_CODE.
|
static String |
METHOD_PROP
The HTTP method properties.
|
static String |
NAME
NAME.
|
static String |
NONE_NAME
The NONE_NAME.
|
static String |
NUMBER_OF_RETRIES_PROP
The NUMBER OF RETRIES PROPERTY.
|
static String |
OAUTH1_NAME
The Constant OAUTH1_NAME.
|
static String |
OAUTH2_NAME
The Constant OAUTH2_NAME.
|
static String |
PARAM_PREFIX
this prefix used to get parameters from the properties for the
corresponding http methods.
|
static String |
PATCH_METHOD
HTTP PATCH.
|
static String |
POST_METHOD
HTTP POST.
|
static String |
PUT_METHOD
HTTP PUT.
|
static String |
REFRESH_TOKEN_PROP
The refresh token property.
|
static String |
REGION_PROP
The region property.
|
static String |
REGUEST_TIMEOUT_PROP
The REQUEST_TIMEOUT_PROP PROPERTY.
|
static String |
SAVE_HTTP_CODE_PROP
The SAVE HTTP CODE PROPERTY.
|
static String |
SAVE_RESPONSE_HEADERS_PROP
The SAVE RESPONSE HEADERS PROPERTY.
|
static String |
SAVE_RESPONSE_ON_ERROR_PROP
The SAVE_RESPONSE_ON_ERROR PROPERTY.
|
static String |
SERVICE_NAME_PROP
The service name property.
|
static String |
SLEEP_AFTER_PROP
The SLEEP AFTER PROPERTY.
|
static String |
SLEEP_ENDPOINT_PROP
The ENDPOINT PROPERTY.
|
static String |
SLEEP_PROP
The SLEEP PROPERTY.
|
static String |
STREAM_WHEN_POSTING_PROP
The STREAM_WHEN_POSTING PROPERTY.
|
static String |
SUCCESS_PROP
The SUCCESS property.
|
static String |
TLS_VERSION_PROP
The TLS_VERSION PROPERTY.
|
static String |
TOKEN_PREFIX_PROP
The access token prefix property.
|
static String |
USER_DEFINED_ACCESS_SECRET_PROP
The USER_DEFINED_ACCESS_SECRET_PROP.
|
static String |
USER_DEFINED_ACCESS_TOKEN_PROP
The USER_DEFINED_ACCESS_TOKEN_PROP.
|
ALPHA_ALG, BACK_ALPHA_ALG, LARGETS_ALG, NEWEST_ALG, OLDEST_ALG, SMALLEST_ALG
Constructor and Description |
---|
HttpProcessor()
Instantiates a new HttpProcessor.
|
HttpProcessor(String proxyHost,
int proxyPort)
Instantiates a new HttpProcessor with a http proxy.
|
Modifier and Type | Method and Description |
---|---|
String |
appendPrefix()
Append this prefix at the beginning of the URL if not present.
|
boolean |
batchDelete(String folder,
String filename,
boolean forceDelete)
Batch delete.
|
void |
connect(String url,
String user,
String password,
boolean passiveMode,
String parameters,
Object request)
Connects to the remote resource.
|
IoStatus |
copy(IoProcessor processor,
String fromFolder,
String toFolder,
String filename,
String toFilename)
Copies fromFolder + filename file to the toFolder + toFilename using
provided destination processor.
|
boolean |
delete(String folder,
String filename)
Deletes a file folder + filename.
|
void |
disconnect()
Disconnects from the remore resource.
|
boolean |
done()
Executed when IO command is finished.
|
InputStream |
doPost(String payload)
Execute POST HTTP request with a given payload and return InputStream.
|
void |
dumpGetRequest(org.apache.http.HttpResponse response,
String filename,
String toFile)
Dump get response.
|
void |
dumpOutput(OutputStream outputStream,
String name)
Dumps output stream to the designated destination.
|
boolean |
forceFileExtension()
If true force adding file extension to the name.
|
IoStatus |
get(IoProcessor processor,
String fromFolder,
String toFolder,
String filename)
Copies a file fromFolder + filename to the toFolder + filename using
client as a source IoProcessor.
|
InputStream |
get(Object cData)
Gets the InputStream from the cData.
|
InputStream |
get(String fromFolder,
String filename)
Copies file fromFolder + filename to the InputStream.
|
boolean |
get(String fromFolder,
String toFolder,
String filename)
Copies file fromFolder + filename to the toFolder + filename using itself
as a source IoProcessor.
|
String |
getActualName(String name)
Gets the actual file name from the passed name.
|
oauth.signpost.OAuthConsumer |
getConsumer()
Gets the OAuth consumer.
|
List<FileResource> |
getList(String folder,
String filename,
boolean includeFolders,
int maxFiles)
Gets the list of FileResource objects from the folder + filename.
|
String |
getName()
Get processor name.
|
OutputStream |
getOutputStream(String fileName)
Gets the output stream through which data can be written to store a file.
|
String |
getPropsWizardResource()
Gets the name of the xml file used to create a wizard for editing
properties.
|
IoProcessor |
getProxyIoProcessor(String proxyUrl,
int proxyPort)
Gets the proxy version of the give io processor.
|
static String |
getToken(String attr,
String payload)
Gets the token.
|
String |
getWildcardAlgorithm()
Gets the wildcard algorithm.
|
boolean |
isApi()
Checks if processor is associated with api.
|
boolean |
isDirect()
Checks if processor gets and saves data directly to the alias.
|
boolean |
isFileSystem()
Checks if IoProcessor operates on a local file system.
|
boolean |
isStreamingProcessor()
Checks if this is a streaming processor.
|
boolean |
isTruncateUrl()
Checks if url needs to be truncated (separated from the file name).
|
int |
maxObjectsInBatch()
Maximum number of objects that can be processed in a single call.
|
boolean |
mkDir(String folder)
Creates a folder.
|
boolean |
move(IoProcessor processor,
String fromFolder,
String toFolder,
String filename,
String toFilename)
Moves a file fromFolder + filename to the toFolder + filename using
processor as a destination IoProcessor.
|
boolean |
preserveUrl()
If true - do not modify the URL when connecting to the resource.
|
boolean |
put(IoProcessor processor,
String fromFolder,
String toFolder,
String filename)
Copies file fromFolder + filename to the toFolder + filename using client
as a designation IoProcessor.
|
IoStatus |
put(String toFolder,
String filename,
InputStream in)
Creates a file toFolder + filename from the InputStream in.
|
boolean |
put(String fromFolder,
String toFolder,
String filename)
Copies a file fromFolder + filename to the toFolder + toFolder using
itself as a destination IoProcessor.
|
int |
rank()
Gets the sorting rank.
|
boolean |
rename(String fromFolder,
String toFolder,
String filename,
String toFilename)
Renames a file fromFolder + filename to toFolder + toFilename.
|
boolean |
requestHasBody()
Checks if request has body.
|
org.apache.http.client.methods.HttpRequestBase |
signRequest(org.apache.http.client.methods.HttpRequestBase request)
Sign http request.
|
boolean |
supportsCdata()
Checks if IoProcessor supports cdata.
|
boolean |
supportsFiles()
Checks if IoProcessor supports files.
|
public static final String LAST_HTTP_CODE
public static final String LAST_RESPONSE_HEADERS_CODE
public static final String HEADER_PREFIX
public static final String AUTH_HEADER_PREFIX
public static final String PARAM_PREFIX
public static final String EXCEPTIONS_PROP
public static final String CONTENT_TYPE_PROP
public static final String AUTHENTICATION_HEADER_NAME_PROP
public static final String AUTH_URL_PROP
public static final String SERVICE_NAME_PROP
public static final String REGION_PROP
public static final String AUTH_HEADER_PROP
public static final String REFRESH_TOKEN_PROP
public static final String USER_DEFINED_ACCESS_TOKEN_PROP
public static final String USER_DEFINED_ACCESS_SECRET_PROP
public static final String ACCESS_TOKEN_PROP
public static final String ETLWORKS_ACCESS_TOKEN_ATTR_NAME
public static final String TOKEN_PREFIX_PROP
public static final String AUTH_METHOD_PROP
public static final String AUTH_PAYLOAD_PROP
public static final String AUTH_CONTENT_TYPE_PROP
public static final String DUMP_RESPONSE_PROP
public static final String ENCODING_PROP
public static final String BODY_ENCODING_PROP
public static final String SUCCESS_PROP
public static final String METHOD_PROP
public static final String AUTH_PROP
public static final String FILE_NAME_PROP
public static final String FILE_PROP
public static final String NUMBER_OF_RETRIES_PROP
public static final String DELAY_BETWEEN_RETRIES_PROP
public static final String SLEEP_PROP
public static final String SLEEP_AFTER_PROP
public static final String SLEEP_ENDPOINT_PROP
public static final String REGUEST_TIMEOUT_PROP
public static final String SAVE_RESPONSE_ON_ERROR_PROP
public static final String ADD_RESPONSE_TO_EXCEPTION_PROP
public static final String ADD_URL_TO_DEBUG_LOG_PROP
public static final String STREAM_WHEN_POSTING_PROP
public static final String TLS_VERSION_PROP
public static final String ASYNC_PROP
public static final String SAVE_HTTP_CODE_PROP
public static final String SAVE_RESPONSE_HEADERS_PROP
public static final String CONNECTION_PREPROCESSOR_PROP
public static final String GET_METHOD
public static final String PUT_METHOD
public static final String POST_METHOD
public static final String PATCH_METHOD
public static final String DELETE_METHOD
public static final String HEAD_METHOD
public static final String NONE_NAME
public static final String BASIC_AUTH_NAME
public static final String BASIC_PREEMPTIVE_NAME
public static final String OAUTH2_NAME
public static final String AUTH_TOKEN_NAME
public static final String HEADER_NAME
public static final String OAUTH1_NAME
public static final String AWS_NAME
public static final String HTTP
public static final String NAME
public HttpProcessor()
public HttpProcessor(String proxyHost, int proxyPort)
proxyHost
- the http proxy hostproxyPort
- the http proxy portpublic boolean requestHasBody()
public void connect(String url, String user, String password, boolean passiveMode, String parameters, Object request) throws Exception
IoProcessor
connect
in interface IoProcessor
url
- the urluser
- the userpassword
- the passwordpassiveMode
- the passive mode flagparameters
- the parametersrequest
- the requestException
- in case of any errorpublic IoStatus copy(IoProcessor processor, String fromFolder, String toFolder, String filename, String toFilename) throws Exception
IoProcessor
copy
in interface IoProcessor
processor
- the destination IoProcessorfromFolder
- the from foldertoFolder
- the to folderfilename
- the filenametoFilename
- the to filenameException
- in case of any errorpublic oauth.signpost.OAuthConsumer getConsumer()
public org.apache.http.client.methods.HttpRequestBase signRequest(org.apache.http.client.methods.HttpRequestBase request) throws Exception
request
- the requestException
- the exceptionpublic boolean delete(String folder, String filename) throws Exception
IoProcessor
delete
in interface IoProcessor
folder
- the folderfilename
- the filenameException
- in case of any errorpublic void disconnect()
IoProcessor
disconnect
in interface IoProcessor
public boolean done() throws Exception
IoProcessor
done
in interface IoProcessor
Exception
- in case of any errorpublic void dumpGetRequest(org.apache.http.HttpResponse response, String filename, String toFile) throws Exception
response
- the responsefilename
- the filenametoFile
- the to fileException
- in case of any errorpublic void dumpOutput(OutputStream outputStream, String name) throws Exception
IoProcessor
dumpOutput
in interface IoProcessor
outputStream
- the output streamname
- the dataset nameException
- the exceptionpublic InputStream doPost(String payload) throws Exception
payload
- the payloadException
- in case of any exceptionpublic IoStatus put(String toFolder, String filename, InputStream in) throws Exception
IoProcessor
put
in interface IoProcessor
toFolder
- the to folderfilename
- the filenamein
- the InputStreamException
- in case of any errorpublic IoStatus get(IoProcessor processor, String fromFolder, String toFolder, String filename) throws Exception
IoProcessor
get
in interface IoProcessor
processor
- the source IoProcessorfromFolder
- the from foldertoFolder
- the to folderfilename
- the filenameException
- in case of any errorpublic InputStream get(String fromFolder, String filename) throws Exception
IoProcessor
get
in interface IoProcessor
fromFolder
- the from folderfilename
- the filenameException
- in case of any errorpublic boolean get(String fromFolder, String toFolder, String filename) throws Exception
IoProcessor
get
in interface IoProcessor
fromFolder
- the from foldertoFolder
- the to folderfilename
- the filenameException
- in case of any errorpublic List<FileResource> getList(String folder, String filename, boolean includeFolders, int maxFiles) throws Exception
IoProcessor
getList
in interface IoProcessor
folder
- the folderfilename
- the filenameincludeFolders
- the include folders flag. If equals to true recursively
includes sub-foldersmaxFiles
- the maximum number of filesException
- in case of any errorFileResource
public String getName()
IoProcessor
getName
in interface IoProcessor
public OutputStream getOutputStream(String fileName) throws Exception
IoProcessor
getOutputStream
in interface IoProcessor
fileName
- the file nameException
- the exceptionpublic String getPropsWizardResource()
IoProcessor
getPropsWizardResource
in interface IoProcessor
public IoProcessor getProxyIoProcessor(String proxyUrl, int proxyPort)
IoProcessor
getProxyIoProcessor
in interface IoProcessor
proxyUrl
- the proxy urlproxyPort
- the proxy portpublic boolean isFileSystem()
IoProcessor
isFileSystem
in interface IoProcessor
public boolean isTruncateUrl()
IoProcessor
isTruncateUrl
in interface IoProcessor
public boolean mkDir(String folder) throws Exception
IoProcessor
mkDir
in interface IoProcessor
folder
- the folder to createException
- in case of any errorpublic boolean move(IoProcessor processor, String fromFolder, String toFolder, String filename, String toFilename) throws Exception
IoProcessor
move
in interface IoProcessor
processor
- the destination IoProcessorfromFolder
- the from foldertoFolder
- the to folderfilename
- the filenametoFilename
- the to filenameException
- in case of any errorpublic boolean put(IoProcessor processor, String fromFolder, String toFolder, String filename) throws Exception
IoProcessor
put
in interface IoProcessor
processor
- the designation IoProcessorfromFolder
- the from foldertoFolder
- the to folderfilename
- the filenameException
- in case of any errorpublic boolean put(String fromFolder, String toFolder, String filename) throws Exception
IoProcessor
put
in interface IoProcessor
fromFolder
- the from foldertoFolder
- the to folderfilename
- the filenameException
- in case of any errorpublic int rank()
IoProcessor
rank
in interface IoProcessor
public boolean rename(String fromFolder, String toFolder, String filename, String toFilename) throws Exception
IoProcessor
rename
in interface IoProcessor
fromFolder
- the from foldertoFolder
- the to folderfilename
- the filenametoFilename
- the to filenameException
- in case of any errorpublic boolean supportsCdata()
IoProcessor
supportsCdata
in interface IoProcessor
public boolean supportsFiles()
IoProcessor
supportsFiles
in interface IoProcessor
public String getWildcardAlgorithm()
IoProcessor
getWildcardAlgorithm
in interface IoProcessor
public boolean isDirect()
IoProcessor
isDirect
in interface IoProcessor
public InputStream get(Object cData)
IoProcessor
get
in interface IoProcessor
cData
- the cdatapublic boolean forceFileExtension()
IoProcessor
forceFileExtension
in interface IoProcessor
public String getActualName(String name)
IoProcessor
getActualName
in interface IoProcessor
name
- Stringpublic boolean isApi()
IoProcessor
isApi
in interface IoProcessor
public int maxObjectsInBatch()
IoProcessor
maxObjectsInBatch
in interface IoProcessor
public boolean batchDelete(String folder, String filename, boolean forceDelete) throws Exception
IoProcessor
batchDelete
in interface IoProcessor
folder
- the folderfilename
- the filenameforceDelete
- if true force the deleteException
- in case of any errorpublic boolean isStreamingProcessor()
IoProcessor
isStreamingProcessor
in interface IoProcessor
public static String getToken(String attr, String payload) throws Exception
attr
- the attrpayload
- the payloadException
- the exceptionpublic String appendPrefix()
IoProcessor
appendPrefix
in interface IoProcessor
public boolean preserveUrl()
IoProcessor
preserveUrl
in interface IoProcessor
Copyright © 2010-2020 Toolsverse. All Rights Reserved.