Skip to main content

 Version 5

Legacy documentation for PageSeeder v5

Task ps-download

This task has been removed as of PageSeeder v6. Use Task export instead.

This simple task allows the Ant Script to download one or more files or the contents of a folder to a designated location.

Definition

<ps:ps-download
      destination="[destination]"
      uriHost="[uriHost]"
      uriPort="[uriPort]"
      path="[path]" or
      paths="[path1|path2|path3]"
      jsessionid="[jsessionid]"
      port="[port]"
      host="[host]"
      siteprefix="[siteprefix]"
      servletprefix="[servletprefix]"
      output="[output]"
      includes="[pattern]"
      excludes="[pattern]">
   <parameter name="[param name]"
              value="[param value]"/>
</ps:ps-download>

Attributes

AttributeDescriptionRequired
jsessionidThe @jsessionid attribute (optional) is used for authentication. It is not required but it will always be used if specified.Yes, unless username/password or propertiesfile are specified
usernameIf jsessionid is not specified this can be used for authentication.Yes, unless jsessionid or propertiesfile are specified
passwordIf jsessionid is not specified this can be used for authentication.Yes, unless jsessionid or propertiesfile are specified
propertiesfileThe @propertiesfile attribute (optional) describes the location of the properties file to use to connect to the PageSeeder Server.
The value of the attribute can be the full path of the file, the relative path (the base directory is the location of the Ant script) or simply its name, in which case it MUST be located on the classpath.
Yes, unless (jsessionid or username/password) and host are specified
portThe port address of the PageSeeder Server - default: 80
(used when no properties file is specified)
No
hostThe host name of the PageSeeder Server
(used when no properties file is specified)
Yes, unless propertiesfile is specified
siteprefixThe PageSeeder site prefix defined - default: /ps
(used when no properties file is specified)
No
servletprefixThe PageSeeder servlet prefix defined - default: /servlet
(used when no properties file is specified)
No
destinationThe @destination attribute is the full path of the folder where the file(s) will be downloaded, if it does not exist, it will be created. If creation fails, an error will be raised.Yes
pathThe @path attribute is the full path of the file or folder to download (not URL encoded). The full path includes  any prefix used for the PageSeeder server and the group name (i.e.: /ps/gen/jbtest/file.xml). The full path can be seen in PageSeeder in the Document/Folder Properties. If a folder should be downloaded, the path attribute MUST end with "/". If the file or folder is not found, a 404 error will be raised.Yes, unless paths is specified
pathsA list of full paths pointing to documents on the PageSeeder server (no folders are allowed). The paths are separated by the vertical bar character: |. e.g.:
/ps/project/group1/file1.xml|/ps/project/group2/folder/file2.xml
Yes, unless path is specified
uriHostRequired when the host of the uri to download is different from webSiteAddress in WEB-INF/config/template.properties.No
uriPortRequired when the port of the uri to download is different from webSitePort in WEB-INF/config/template.properties.No
outputLocation of the output file. This is meaningful only when the path to download points to a folder (ends with "/"). The output file will contain the list of URIs downloaded.No
includesA comma-separated list of patterns matching documents/folders to include. When not specified, all documents/folders are included.
The format is similar to other Ant tasks file pattern selection. Here are some examples:
*.doc,archive,folder1/*.xml
*.jpg,**/*.jpg
No
excludesA comma-separated list of patterns matching documents/folders to exclude. When not specified, no documents/folders are excluded.
The format is similar to other Ant tasks file pattern selection. Here are some examples:
*.doc,archive,folder1/*.xml
*.jpg,**/*.jpg
No

Note about destination:
If the path points to a single file or folder, the downloaded content is saved using a relative path, otherwise, the full path is used. Here are some examples:

  • With destination="C:/download" and path="/ps/project/group/file.xml", the file saved has the path "C:/download/file.xml".
  • With destination="C:/download" and path="/ps/project/group/folder/" which points to a folder containing two files "file1.xml" and "subfolder/file2.xml", the two files downloaded are "C:/download/file1.xml" and "C:/download/subfolder/file2.xml".
  • With destination="C:/download" and paths="/ps/project/group/file1.xml|/ps/project/group/file2.xml", the two files downloaded are saved as "C:/download/ps/project/group/file1.xml" and "C:/download/ps/project/group/file2.xml".

Parameters

Zero or more <parameter> elements may be nested inside the <ps-download> element. They add modifying parameters to the PageSeeder download URL used to request the files. The following parameters are supported:

Parameter NameDescription
ps-releasedecimal number or non-number version used to download a version equal to (or if a number less than) this version
ps-releaseStatusstatus string used to download the latest version with this status
ps-comparedecimal number or non-number version used to compare a version equal to (or if a number less than) this version  with the downloaded version (must be used with ps-fragmentinfo=true)
ps-compareStatusstatus string used to compare a version with the latest version that has this status (must be used with ps-fragmentinfo=true)
xsl-documentInfoif "true" includes <ps:documentInfo> metadata in document. Deprecated: Use ps-documentinfo instead.
xsl-discussionif "true" includes comments in document under <ps:discussion> (must be used with ps-documentinfo=true or ps-fragmentinfo=true or xsl-documentInfo=true)
ps-documentinfoif "true" includes <ps:documentinfo> metadata in document, see Document Metadata Schema 1.3
ps-fragmentinfoif "true" includes <ps:fragmentinfo> metadata in document
ps-reversexrefsif "true" includes <ps:reversexrefs> metadata in document (must be used with ps-documentinfo=true or ps-fragmentinfo=true)

For example <parameter name="ps-release" value="4.1"/> would download the latest versions of the documents with version less than or equal to 4.1

Examples

Stand alone script examples:

<ps:ps-download
  destination="c:\download"
  path="/ps/acme/demo/"
  host="mycompany.com"
  username="jsmith"
  password="xyz" />
<ps:ps-download
  destination="c:\download"
  paths="/ps/acme/demo/file1.xml|/ps/acme/demo/folder/file2.xml"
  host="mycompany.com"
  username="jsmith"
  password="xyz" />

 Publish script example:

<ps:ps-download
  destination="${ps-working}"
  path="${ps-uriPath}" uriHost="${ps-uriHost}" uriPort="${ps-uriPort}"
  jsessionid="${ps-jsessionid}"  host="${ps-host}" port="${ps-port}"
  servletPrefix="${ps-servletPrefix}" sitePrefix="${ps-sitePrefix}" />
Created on , last edited on