public class LightweightHttpWagon extends StreamWagon
HttpURLConnection
Modifier and Type | Field and Description |
---|---|
private LightweightHttpWagonAuthenticator |
authenticator |
private java.util.Properties |
httpHeaders |
static int |
MAX_REDIRECTS |
private boolean |
preemptiveAuthentication |
private java.net.Proxy |
proxy |
private java.net.HttpURLConnection |
putConnection |
private boolean |
useCache
Whether to use any proxy cache or not.
|
authenticationInfo, DEFAULT_BUFFER_SIZE, interactive, proxyInfo, repository, sessionEventSupport, transferEventSupport
DEFAULT_CONNECTION_TIMEOUT, DEFAULT_READ_TIMEOUT, ROLE
Constructor and Description |
---|
LightweightHttpWagon() |
Modifier and Type | Method and Description |
---|---|
private void |
addHeaders(java.net.HttpURLConnection urlConnection) |
private java.lang.String |
buildUrl(Resource resource)
Builds a complete URL string from the repository URL and the relative path of the resource passed.
|
void |
closeConnection() |
void |
fillInputData(InputData inputData) |
void |
fillOutputData(OutputData outputData) |
protected void |
finishPutTransfer(Resource resource,
java.io.InputStream input,
java.io.OutputStream output) |
LightweightHttpWagonAuthenticator |
getAuthenticator() |
java.util.List<java.lang.String> |
getFileList(java.lang.String destinationDirectory)
Returns a
List of strings naming the files and directories in the directory denoted by
this abstract pathname. |
java.util.Properties |
getHttpHeaders() |
private java.net.Proxy |
getProxy(ProxyInfo proxyInfo) |
private java.net.Proxy.Type |
getProxyType(ProxyInfo proxyInfo) |
java.net.SocketAddress |
getSocketAddress(ProxyInfo proxyInfo) |
boolean |
isUseCache() |
protected void |
openConnectionInternal() |
java.net.PasswordAuthentication |
requestProxyAuthentication() |
java.net.PasswordAuthentication |
requestServerAuthentication() |
boolean |
resourceExists(java.lang.String resourceName)
Check if a remote resource exists
|
void |
setAuthenticator(LightweightHttpWagonAuthenticator authenticator) |
private void |
setAuthorization(java.net.HttpURLConnection urlConnection) |
void |
setHttpHeaders(java.util.Properties httpHeaders) |
void |
setPreemptiveAuthentication(boolean preemptiveAuthentication) |
(package private) void |
setSystemProperty(java.lang.String key,
java.lang.String value) |
void |
setUseCache(boolean useCache) |
checkInputStream, checkOutputStream, get, getIfNewer, getIfNewerToStream, getInputStream, getOutputStream, getToStream, put, putFromStream, putFromStream, putFromStream
addSessionListener, addTransferListener, cleanupGetTransfer, cleanupPutTransfer, connect, connect, connect, connect, connect, connect, createParentDirectories, disconnect, finishGetTransfer, fireGetCompleted, fireGetInitiated, fireGetStarted, firePutCompleted, firePutInitiated, firePutStarted, fireSessionConnectionRefused, fireSessionDebug, fireSessionDisconnected, fireSessionDisconnecting, fireSessionError, fireSessionLoggedIn, fireSessionLoggedOff, fireSessionOpened, fireSessionOpening, fireTransferDebug, fireTransferError, fireTransferProgress, getAuthenticationInfo, getPath, getPermissionsOverride, getProxyInfo, getProxyInfo, getReadTimeout, getRepository, getSessionEventSupport, getTimeout, getTransfer, getTransfer, getTransfer, getTransfer, getTransfer, getTransfer, getTransferEventSupport, hasSessionListener, hasTransferListener, isInteractive, openConnection, postProcessListeners, putDirectory, putTransfer, putTransfer, removeSessionListener, removeTransferListener, setInteractive, setPermissionsOverride, setReadTimeout, setSessionEventSupport, setTimeout, setTransferEventSupport, supportsDirectoryCopy, transfer, transfer, transfer, transfer
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addSessionListener, addTransferListener, connect, connect, connect, connect, connect, connect, disconnect, getReadTimeout, getRepository, getTimeout, hasSessionListener, hasTransferListener, isInteractive, openConnection, putDirectory, removeSessionListener, removeTransferListener, setInteractive, setReadTimeout, setTimeout, supportsDirectoryCopy
private boolean preemptiveAuthentication
private java.net.HttpURLConnection putConnection
private java.net.Proxy proxy
public static final int MAX_REDIRECTS
private boolean useCache
private java.util.Properties httpHeaders
private volatile LightweightHttpWagonAuthenticator authenticator
private java.lang.String buildUrl(Resource resource)
resource
- the resource to extract the relative path from.public void fillInputData(InputData inputData) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
fillInputData
in class StreamWagon
TransferFailedException
ResourceDoesNotExistException
AuthorizationException
private void addHeaders(java.net.HttpURLConnection urlConnection)
private void setAuthorization(java.net.HttpURLConnection urlConnection)
public void fillOutputData(OutputData outputData) throws TransferFailedException
fillOutputData
in class StreamWagon
TransferFailedException
protected void finishPutTransfer(Resource resource, java.io.InputStream input, java.io.OutputStream output) throws TransferFailedException, AuthorizationException, ResourceDoesNotExistException
finishPutTransfer
in class AbstractWagon
TransferFailedException
AuthorizationException
ResourceDoesNotExistException
protected void openConnectionInternal() throws ConnectionException, AuthenticationException
openConnectionInternal
in class AbstractWagon
ConnectionException
AuthenticationException
public java.net.PasswordAuthentication requestProxyAuthentication()
public java.net.PasswordAuthentication requestServerAuthentication()
private java.net.Proxy getProxy(ProxyInfo proxyInfo)
private java.net.Proxy.Type getProxyType(ProxyInfo proxyInfo)
public java.net.SocketAddress getSocketAddress(ProxyInfo proxyInfo)
public void closeConnection() throws ConnectionException
closeConnection
in class StreamWagon
ConnectionException
public java.util.List<java.lang.String> getFileList(java.lang.String destinationDirectory) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
Wagon
List
of strings naming the files and directories in the directory denoted by
this abstract pathname.
If this abstract pathname does not denote a directory, or does not exist, then this method throws
ResourceDoesNotExistException
.
Otherwise a List
of strings is returned, one for each file or directory in the directory.
Names denoting the directory itself and the directory's parent directory are not included in
the result. Each string is a file name rather than a complete path.
There is no guarantee that the name strings in the resulting list will appear in any specific
order; they are not, in particular, guaranteed to appear in alphabetical order.
getFileList
in interface Wagon
getFileList
in class AbstractWagon
destinationDirectory
- directory to list contents ofList
of strings naming the files and directories in the directory denoted by
this abstract pathname. The List
will be empty if the directory is empty.TransferFailedException
- if there's an error trying to access the remote sideResourceDoesNotExistException
- if destinationDirectory does not exist or is not a directoryAuthorizationException
- if not authorized to list the contents of the directorypublic boolean resourceExists(java.lang.String resourceName) throws TransferFailedException, AuthorizationException
Wagon
resourceExists
in interface Wagon
resourceExists
in class AbstractWagon
TransferFailedException
- if there's an error trying to access the remote sideAuthorizationException
- if not authorized to verify the existence of the resourcepublic boolean isUseCache()
public void setUseCache(boolean useCache)
public java.util.Properties getHttpHeaders()
public void setHttpHeaders(java.util.Properties httpHeaders)
void setSystemProperty(java.lang.String key, java.lang.String value)
public void setPreemptiveAuthentication(boolean preemptiveAuthentication)
public LightweightHttpWagonAuthenticator getAuthenticator()
public void setAuthenticator(LightweightHttpWagonAuthenticator authenticator)