httpsupload:single

Full name:

com.addicticks.oss.maven:httpsupload-maven-plugin:1.1.7:single

Description:

Uploads a single file to a remote server using HTTP or HTTPS.

File is sent using POST method and using multipart/form-data encoding (RFC2388).

Attributes:

Required Parameters

Name Type Since Description
file File - File to upload.
targetURL URL - The URL to upload the file(s) to. Must be either HTTP or HTTPS protocol.

The plugin derives which protocol to use from this value.

Examples:

  https://solar.mycompany.com/upload
  http://pluto.vanilla.org/acceptfiles

Optional Parameters

Name Type Since Description
additionalHeaders Map - Sets additional overall HTTP headers to add to the upload POST request. There's rarely a need to use this parameter.

The following header fields are automatically set:

   "Connection"
   "Cache-Control"
   "Content-Type"
   "Content-Length"
   "Authorization"
and you must never set these here. (if you do they will be ignored).

However you might want to use this parameter to explicitly set e.g. User-Agent or non-standard header fields that are required for your particular endpoint. For example by overriding User-Agent you can make the upload operation look to the endpoint as if it comes from a browser.

Example:

    <additionalHeaders>
        <!-- impersonate Safari browser on iPad  -->
        <User-Agent>Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405</User-Agent>
        <!--  just an example of a really weird header field  -->
        <From>joe@mycorp.com</From>
    </additionalHeaders>

connectTimeoutMs int - Connect timeout (in milliseconds) to use when connecting to the endpoint.

If the URL is specified with a hostname as opposed to an IP address then a name lookup needs to be performed. This is not included in the connect timeout. The connect timeout is the time it takes to establish the tcp connection, nothing else. The timeout for name resolution (DNS lookup) is platform dependent.


Default value is: 10000.
extraFields Map - Extra fields to send along with the file upload. The keys of the map are the field names and the value their (String) content.

Example

   <extraFields>
       <field1>value1</field1>
       <field2>value2</field2>
       ...
   </extraFields>

Typical use cases: Extra fields are often used to provide information about the uploader such as a name or an e-mail address. Or they can convey additional information about where the server should put the files, such as a destination folder or similar.

NB: Don't set the filename field here. Posting content for filename is handled automatically.


formFieldName String - The form field name to POST the file to. This value depends entirely on the server. Typically such a field is named "file".
Default value is: file.
hintFilename String - Hint given to the server as to what the server should name the file. If this value is not set explicitly it will be derived from the filename of the file argument.
indicateProgress boolean - Can be used to turn off upload progress logging (if parameter value is false). By default upload progress logging is enabled. Progress logging can be a bit 'chatty'.

Files larger than 100 MBytes will see a log entry for every one percent uploaded. For files less this size there will be proportionally less log entries.

This parameter will only turn off the actual progress logging not the logging at the beginning and end of the file upload operation.


Default value is: true.
mimeType String - Mime type.

This is the http Content-Type used when the file is uploaded. If not given explicitly here it will be derived from the file name extension using Java's URLConnection.guessContentTypeFromName() method and if this fails then application/octet-stream will be used.


readTimeoutMs int - Read timeout (in milliseconds) to use when reading from the endpoint. This is the time from the upload has completed until the server responds.

You may have to increase this parameter if the endpoint takes a long time to process the uploaded data.


Default value is: 10000.
useAuthentication boolean - (no description)
Default value is: false.
validateCertificate boolean - Specifies if the certificate at the endpoint should be validated or not. Only relevant for HTTPS protocol, otherwise ignored.

If the value is false then the server's certificate is not validated in any way. This may be useful when working with endpoints that use a self-signed certificate.


Default value is: true.

Parameter Details

additionalHeaders:

Sets additional overall HTTP headers to add to the upload POST request. There's rarely a need to use this parameter.

The following header fields are automatically set:

   "Connection"
   "Cache-Control"
   "Content-Type"
   "Content-Length"
   "Authorization"
and you must never set these here. (if you do they will be ignored).

However you might want to use this parameter to explicitly set e.g. User-Agent or non-standard header fields that are required for your particular endpoint. For example by overriding User-Agent you can make the upload operation look to the endpoint as if it comes from a browser.

Example:

    <additionalHeaders>
        <!-- impersonate Safari browser on iPad  -->
        <User-Agent>Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405</User-Agent>
        <!--  just an example of a really weird header field  -->
        <From>joe@mycorp.com</From>
    </additionalHeaders>
  • Type: java.util.Map
  • Required: No

connectTimeoutMs:

Connect timeout (in milliseconds) to use when connecting to the endpoint.

If the URL is specified with a hostname as opposed to an IP address then a name lookup needs to be performed. This is not included in the connect timeout. The connect timeout is the time it takes to establish the tcp connection, nothing else. The timeout for name resolution (DNS lookup) is platform dependent.

  • Type: int
  • Required: No
  • Default: 10000

extraFields:

Extra fields to send along with the file upload. The keys of the map are the field names and the value their (String) content.

Example

   <extraFields>
       <field1>value1</field1>
       <field2>value2</field2>
       ...
   </extraFields>

Typical use cases: Extra fields are often used to provide information about the uploader such as a name or an e-mail address. Or they can convey additional information about where the server should put the files, such as a destination folder or similar.

NB: Don't set the filename field here. Posting content for filename is handled automatically.

  • Type: java.util.Map
  • Required: No

file:

File to upload.
  • Type: java.io.File
  • Required: Yes

formFieldName:

The form field name to POST the file to. This value depends entirely on the server. Typically such a field is named "file".
  • Type: java.lang.String
  • Required: No
  • Default: file

hintFilename:

Hint given to the server as to what the server should name the file. If this value is not set explicitly it will be derived from the filename of the file argument.
  • Type: java.lang.String
  • Required: No

indicateProgress:

Can be used to turn off upload progress logging (if parameter value is false). By default upload progress logging is enabled. Progress logging can be a bit 'chatty'.

Files larger than 100 MBytes will see a log entry for every one percent uploaded. For files less this size there will be proportionally less log entries.

This parameter will only turn off the actual progress logging not the logging at the beginning and end of the file upload operation.

  • Type: boolean
  • Required: No
  • Default: true

mimeType:

Mime type.

This is the http Content-Type used when the file is uploaded. If not given explicitly here it will be derived from the file name extension using Java's URLConnection.guessContentTypeFromName() method and if this fails then application/octet-stream will be used.

  • Type: java.lang.String
  • Required: No

readTimeoutMs:

Read timeout (in milliseconds) to use when reading from the endpoint. This is the time from the upload has completed until the server responds.

You may have to increase this parameter if the endpoint takes a long time to process the uploaded data.

  • Type: int
  • Required: No
  • Default: 10000

targetURL:

The URL to upload the file(s) to. Must be either HTTP or HTTPS protocol.

The plugin derives which protocol to use from this value.

Examples:

  https://solar.mycompany.com/upload
  http://pluto.vanilla.org/acceptfiles
  • Type: java.net.URL
  • Required: Yes

useAuthentication:

(no description)
  • Type: boolean
  • Required: No
  • Default: false

validateCertificate:

Specifies if the certificate at the endpoint should be validated or not. Only relevant for HTTPS protocol, otherwise ignored.

If the value is false then the server's certificate is not validated in any way. This may be useful when working with endpoints that use a self-signed certificate.

  • Type: boolean
  • Required: No
  • Default: true