Skip to main content
Administrator Guide
Last Updated: 2023-06-23
Reference: Util Helper Object

Reference: Util Helper Object

Useful Functions

Name
Arguments
Return Value Type
Notes
cleanString
String value
String
Used to escape any input characters that must be escaped in XML documents.
Example:
<Value>@{util.cleanString(parts[0].xpath(‘/root/row/a_value’))}</Value>
getExtForContentType
String mimetype
String
Enables an integration to obtain a file extension such as .txt or .xml, based on the specified MIME type.
getFilenameFromContentDisposition
String content-disposition
String
Extracts a filename from a content-disposition string. Some assembly components such as the document iterator strategy populate the content-disposition message header with filename information.
Example: this code returns the value
testfile.pdf
:
util.getFilenameFromContentDisposition( ‘attachment; filename=testfile.pdf’)
readFileToVar
String var_name, String filename
Enables nontext files to be read into a variable. This is the only delivered means by which nontext documents can be loaded. Note that the
write
step's static-file attribute can only load text documents into a message or variable. The file is specified relative to the WSAR-INF directory.
Example: this code reads the image file icon-32.png from the WSAR-INF directory into the context variable v1:
util.readFileToVar(‘v1’, ‘icon-32.png’)
readFileToVar
String var_name, String filename,String mimetype
Enables nontext files to be read into a variable whose MIME type you specify. This is the only delivered means by which nontext documents can be loaded. Note that the
write
step's static-file attribute can only load text documents into a message or variable. The file is specified relative to the WSAR-INF directory.
Example: this code reads the image file icon-32.png from the WSAR-INF directory into the context variable v1 with the MIME type image/png:
util.readFileToVar(‘v1’, ‘icon-32.png’, ‘image/png’)