Predefined Friendly URLs
Fabasoft Folio provides some predefined friendly URLs that can be used right away.
download
Allows downloading a content. The Content-Disposition header is set to attachment to enforce the presentation the content as downloadable file.
Friendly URL |
---|
http://<web server>/<vdir>/download/<objectid>/ <contentpath (optional)>/<downloadname (optional)> |
Parameters:
- objectid
The COO address of the object, which contains the content that should be downloaded. - contentpath
The property path defining the content. The default value is: content(0)contcontent(0) - downloadname
The name that should be used as file name. The default value is the object name.
Example |
---|
http://server.mycomp.com/fsc/download/COO.1.3285.3.9 http://server.mycomp.com/fsc/download/COO.1.3285.3.9/contentfinalform%280%29contcontent%280%29/test.pdf |
downloadzip
Allows downloading several contents as ZIP file.
Friendly URL |
---|
http://<web server>/<vdir>/downloadzip/<objects> |
Parameters:
- objects
A list of COO addresses separated by a semicolon. If only one object is provided, the object itself will be downloaded and no ZIP file is generated.
Example |
---|
http://server.mycomp.com/fsc/downloadzip/COO.1.3285.3.9 http://server.mycomp.com/fsc/downloadzip/COO.1.3285.3.9;COO.1.3285.3.12 |
read
Allows retrieving a content. Document properties (if present) are evaluated.
Friendly URL |
---|
http://<web server>/<vdir>/read/<objectid>/ <contentpath (optional)>/<maxageseconds (optional)> |
Parameters:
- objectid
The COO address of the object, which contains the content that should be read. - contentpath
The property path defining the content. The default value is: content(0)contcontent(0) - maxageseconds
Sets the HTTP response header field Cache-Control to the defined value max-age=<maxageseconds>.
Example |
---|
http://server.mycomp.com/fsc/read/COO.1.3285.3.9 http://server.mycomp.com/fsc/read/COO.1.3285.3.9/content%280%29contcontent%280%29/50000 |
readraw
Allows retrieving a content. Document properties are not evaluated.
Friendly URL |
---|
http://<web server>/<vdir>/readraw/<objectid>/ <contentpath (optional)>/<maxageseconds (optional)> |
Parameters:
- objectid
The COO address of the object, which contains the content that should be downloaded. - contentpath
The property path defining the content. The default value is: content(0)contcontent(0) - maxageseconds
Sets the HTTP response header field Cache-Control to the defined value max-age=<maxageseconds>.
Example |
---|
http://server.mycomp.com/fsc/readraw/COO.1.3285.3.9 http://server.mycomp.com/fsc/readraw/COO.1.3285.3.9/content%280%29contcontent%280%29/50000 |
image
Allows retrieving an image of an object. Available image types are configured in the Conversion Configuration in the Image Type Configuration field.
Friendly URL |
---|
http://<web server>/<vdir>/image/<objaddr>/<name>/<page (optional)> |
Parameters:
- objaddr
The COO address of the object, which contains the content that should be retrieved as image. - name
Defines the kind of image. Possible values are defined in the Conversion Configuration, on the “Conversion Configuration” tab, in the Image Type Configuration field (e.g. tn or pv). - page
In the Image Type Configuration it can be defined that more than one page is generated as image. The page parameter can be used to get the desired page (e.g. 2).
Example |
---|
http://server.mycomp.com/fsc/image/COO.1.3285.3.9 http://server.mycomp.com/fsc/image/COO.1.3285.3.9/pv/1 |
convert
Allows converting a content into another format (HTTP POST request).
Friendly URL |
---|
http://<web server>/<vdir>/convert/<sourcefmt>/<destfmt> |
Parameters:
- sourcecont (content input parameter)
The source content with content type application/octet-stream. - destcont (content output parameter)
The target content. The content type is defined by destfmt. - sourcefmt
Typically a file extension (e.g. doc). - destfmt
Typically a file extension (e.g. pdf).
The parameters sourcefmt and destfmt are evaluated based on the Conversion Configuration.
Example (Java) |
---|
// Fabasoft Folio Friendly URL scheme is used for the end point URL URL endPoint = new URL(FolioWebSvcSample.WEBSERVER + "/convert/" + sourceFormat + "/" + destFormat); HttpURLConnection connection = (HttpURLConnection) endPoint.openConnection(); // set authentication if required if (FolioWebSvcSample.AUTHENTICATION == "BASIC") { Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(FolioWebSvcSample.USERNAME, FolioWebSvcSample.PASSWORD.toCharArray()); } }); } // set request properties connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/octet-stream"); connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); // connect to web server connection.connect(); byte[] buf = new byte[2048]; int received = 0; // read from the source file and write to the connection output stream (upload) FileInputStream sourceFileStream = new FileInputStream(sourceFile); OutputStream uploadStream = connection.getOutputStream(); while ((received = sourceFileStream.read(buf, 0, buf.length)) > 0) { uploadStream.write(buf, 0, received); } uploadStream.flush(); uploadStream.close(); sourceFileStream.close(); // read from the connection input stream and write to destination file (download) FileOutputStream destFileStream = new FileOutputStream(destFile); InputStream downloadStream = connection.getInputStream(); while ((received = downloadStream.read(buf, 0, buf.length)) > 0) { destFileStream.write(buf, 0, received); } destFileStream.flush(); destFileStream.close(); |
thumbnail
Allows generating a thumbnail of a content (HTTP POST request).
Friendly URL |
---|
http://<web server>/<vdir>/thumbnail/<srctype>/<bbwidth>/<bbheight>/ <pageindex>/<thumbtype> |
Parameters:
- srccont (content input parameter)
The source content with content type application/octet-stream. - thumbnail (content output parameter)
The generated thumbnail. The content type is defined by thumbtype. - srctype
Typically a file extension (e.g. doc). - bbwidth
Width of the thumbnail. - bbheight
Height of the thumbnail. - pageindex
The page inside a document. - thumbtype
Typically a file extension (e.g. jpg).
Example (C#) |
---|
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using System.IO;
namespace HttpRequest { class Program { static void Main(string[] args) { string target = "http://localhost/fsc/thumbnail/cr2/250/250/1/jpg"; string requestfile = @"C:\friendlyurltester\RAW_CANON_1DSM3.CR2"; string httpmethod = "POST"; Uri targetUri = new Uri(target); HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(targetUri); request.Method = httpmethod; // BASIC authentication string user = "Username"; string pass = "Password"; string authStr = user + ":" + pass; request.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(authStr))); // read http body from file byte[] buf = null; try { FileStream fs = new FileStream(requestfile, FileMode.Open); buf = new byte[fs.Length]; fs.Read(buf, 0, (int)fs.Length); } catch (Exception) { } if (buf == null || buf.Length == 0) { request.ContentLength = 0; } else { request.ContentLength = buf.Length; } // send request if (buf != null && buf.Length > 0) { Stream instream = request.GetRequestStream(); instream.Write(buf, 0, buf.Length); } // download response WebResponse response = request.GetResponse(); Stream outstream = response.GetResponseStream(); FileStream outfs = new FileStream(@"c:\friendlyurltester\thumbnail.jpg", FileMode.CreateNew); byte[] outbuf = new byte[1024]; int bytesread = 0; while ((bytesread = outstream.Read(outbuf, 0, outbuf.Length)) > 0) { outfs.Write(outbuf, 0, bytesread); } outfs.Close(); } } } |