Publishing

Publishing PageSeeder data to print, the Web or both

Task request

Allows Ant scripts to make one or more HTTP requests to PageSeeder and write the responses to a file or multiple files.

Note

If an HTTP code 202 is returned the request is treated as an Asynchronous process by polling PageSeeder until the process is finished and then returning the final thread XML as the response.

Definition

<ps:request
    path="[request path]"
    method="[method]"
    output="[output]"
    failonerror="[true|false]"
    pollinginterval="[milliseconds]"
    config="[config name]">
  <parameter name="[param name]" value="[param value]"/>
      or
  <fileset dir="[requests directory]" includes="[request.xml]" />
</ps:request>

Attributes

AttributeDescriptionRequired
pathThe path for the request after the /ps site prefix (e.g. /service/groups/mygroup)Yes, unless specified in request XML files.
outputSpecifies the path of the file to write the response to (e.g. output.xml)Yes
methodSpecifies the HTTP method for the request - default "GET".No
failonerrorIf "true" stop ANT build script on error - default "true".No
pollingintervalThe number of milliseconds between each check to see if the upload is complete - default "2000".No
configUniversal PS config name - default "default".No

Elements

Element <parameter>

If specified set the parameters for the request.

AttributeDescriptionRequired
nameThe parameter nameYes
valueThe parameter valueYes

Element <fileset>

The standard ANT fileset  element can be used to specify one or more request XML files that contain details of the requests.

Request XML files

Request XML files can be used to override any path, method, output or <parameter> defined by the <ps:request> and will perform multiple requests - one for each file.

A Request File is a UTF-8-encoded XML document that expresses the parameters for a single request in the following syntax:

<request [path="[request path]"] [method="[method]"] [output="[output]"] >
  <parameter name="x">a</parameter>
  <parameter name="y">b</parameter>
</request>

Processed in alphabetical path order, each Request that does not specify an output has a response written to the main output file as follows:

<responses>
  <response filepath="z/d.xml">
  ...
  </response>
  <response filepath="z/e.xml">
  ...
  </response>
</responses>

Environment

This task uses the following ps:config environment properties:

  • scheme – scheme for connecting to PageSeeder
  • host – host for connecting to PageSeeder
  • port – port for connecting to PageSeeder
  • site.prefix – site prefix for connecting to PageSeeder - default  /ps
  • jsessionid or username/password – jsessionid pr username/password for connecting to PageSeeder

Example Scripts

Validate all documents in a folder

This script starts a validation thread on a folder and wits until it finishes, then downloads the validation report.

<ps:request output="output.xml"
    path="/service/members/jsmith/groups/acme-specs/uris/8/foldervalidate"
    method="POST">
  <parameter name="schema" value="default"/>
</ps:request>
<ps:request output="validation.xml"
    path="/validation-report/"
    method="GET">
  <parameter name="group" value="acme-specs"/>
</ps:request>

The 8 in /uris/8 is the URI ID of the folder.

Create multiple comments

<ps:request output="output.xml"
    path="/service/members/jsmith/comments/forurl"
    method="POST">
  <fileset dir="c:\input\comments">
    <include name="*.*"/>
  </fileset>
</ps:request>

Files in c:\input\comments:

request1.xml

<?xml version="1.0" encoding="utf-8" ?>
<request>
  <parameter name="url">http://www.weborganic.com/</parameter>
  <parameter name="title">My Comment</parameter>
  <parameter name="groups">test-mygroup</parameter>
  <parameter name="content">Hello world!</parameter>
  <parameter name="authorname">John Jones</parameter>
</request>

request2.xml

<?xml version="1.0" encoding="utf-8" ?>
<request>
  <parameter name="url">http://www.mysite.com/</parameter>
  <parameter name="title">My Comment 2</parameter>
  <parameter name="groups">test-mygroup</parameter>
  <parameter name="content">Hello again world!</parameter>
  <parameter name="authorname">John Jones</parameter>
</request>

Get edit history for multiple documents

<ps:request output="output.xml">
  <fileset dir="c:\input\history">
    <include name="*.*"/>
  </fileset>
</ps:request>

Files in c:\input\history:

The 123 in /uris/123 is the URI ID of the document.

request1.xml

<?xml version="1.0" encoding="utf-8" ?>
<request path="/service/groups/test-mygroup/uris/123/history">
  <parameter name="events">edit</parameter>
</request>

request2.xml

<?xml version="1.0" encoding="utf-8" ?>
<request path="/service/groups/test-mygroup/uris/456/history">
  <parameter name="events">edit</parameter>
</request>

Created on , last edited on