Difference between revisions of "Calling On Demand Tasks"

From PresenceWiki
Jump to: navigation, search
 
Line 1: Line 1:
There are 3 ways to call OnDemand Tasks
+
There are 4 ways to call OnDemand Tasks
  
 
==1: Via a tag in the web file==
 
==1: Via a tag in the web file==
Line 9: Line 9:
 
           http://localhost/task/newtime
 
           http://localhost/task/newtime
  
==3: Through the On Demand API==
+
==3: (version 4) For Fast and unlimited file size writing to the Presence HTTP Server use the Special File Task url by referencing the http server followed by 'filetask' and then the task alias==
 +
 
 +
          http://localhost/filetask/pipefile
 +
 
 +
The task must contain the magic variables:
 +
 
 +
* PATH ${response.file.path}
 +
 
 +
* FILENAME ${response.file.name}
 +
 
 +
The following are optional:
 +
 
 +
* CONTENT TYPE ${response.file.contenttype} see [[http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html]] for more information. If this is not set the the content type will be set to "application/force-download"
 +
 
 +
* DISPOSITION ${response.file.disposition} see [[http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html]] for more information. If this is not set then it will be set to "attachment"
 +
 
 +
* SEND THE LENGTH ${response.file.sendlength} this should be populated with "true" or "1" if you want to send the file as a single stream, by setting this value you are sending the file length to the browser - not recommended for large files as the default is to chunk data.
 +
 
 +
 
 +
==4: Through the On Demand API==
  
 
This is a lightweight implementation, so that the jars you will need for this are
 
This is a lightweight implementation, so that the jars you will need for this are

Latest revision as of 15:54, 1 September 2015

There are 4 ways to call OnDemand Tasks

1: Via a tag in the web file

         <presence:remote-task presenceHost="presenceserver.com" alias="newtime" />

2: Through the url by referencing the http server followed by 'task' and then the task alias

         http://localhost/task/newtime

3: (version 4) For Fast and unlimited file size writing to the Presence HTTP Server use the Special File Task url by referencing the http server followed by 'filetask' and then the task alias

         http://localhost/filetask/pipefile

The task must contain the magic variables:

  • PATH ${response.file.path}
  • FILENAME ${response.file.name}

The following are optional:

  • CONTENT TYPE ${response.file.contenttype} see [[1]] for more information. If this is not set the the content type will be set to "application/force-download"
  • DISPOSITION ${response.file.disposition} see [[2]] for more information. If this is not set then it will be set to "attachment"
  • SEND THE LENGTH ${response.file.sendlength} this should be populated with "true" or "1" if you want to send the file as a single stream, by setting this value you are sending the file length to the browser - not recommended for large files as the default is to chunk data.


4: Through the On Demand API

This is a lightweight implementation, so that the jars you will need for this are

       presenceOnDemand.jar
       presenceCommon.jar
       pbtools57.jar
       pbembedded57.jar
       pbclient57.jar
       log4j-1.2.8.jar
       xercesImpl.jar

As well as this you will need a copy of install.inf in a res directory and a copy of presenceconfig.xml into a res\config directoy

After this you can create OnDemandRequest in your java code

       OnDemandRequest request = new OnDemandRequest();
       request.setTimeOut(3000);
       request.setHost("192.168.1.103");
       request.setPort(8221);
       request.setRequestParameters(null);
       request.setAlias("newtime");
       try
       {
            request.makeRequest();
            System.out.print (request.getResponse());	
       }
       catch (IOException e) 
       {
            e.printStackTrace();	
       }
       catch (GeneralSecurityException gse) 
       {
            gse.printStackTrace();	
       }