Class BuiltinRPC
- All Implemented Interfaces:
com.isomorphic.base.IAutoConfigurable
- Direct Known Subclasses:
BuiltinRPC
You can control which methods are enabled by listing the enabled methods under the server.properties attribute RPCManager.enabledBuiltinMethods
.
-
Method Summary
Modifier and TypeMethodDescriptionstatic RPCResponse
appendToFile
(String path, String data) Appends the supplied contents to a file under webroot.static RPCResponse
deleteFile
(String path) Deletes an arbitrary file under webRoot.static void
downloadClientContent
(String fileContents, String fileName, String mimeType, RPCManager rpc, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Accepts string content and streams it back as a file to the requester via content-disposition: attachment.static void
downloadClientExport
(List<? extends Map<String, Object>> records, String exportAs, String fileName, String exportDisplay, Map<String, Object> settings, jakarta.servlet.http.HttpServletResponse response, RPCManager rpc, RPCRequest request) Accepts a List of formatted Record-data, exports it to the specified format and streams it back as a file with the specified fileName to the requester via content-disposition: attachment.static void
downloadWSDL
(String url, String format, String fileName, RPCManager rpc, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Loads a WSDL file from the specified URL, optionally translates it to SmartClient-compatible JS format and streams the file back to the requester via content-disposition: attachment.static void
downloadZip
(Map<String, Object> settings, RPCManager rpc, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) This method is used by the Export Project feature in Reify.static RPCResponse
evalJava
(String javaCode, RequestContext context) This method is used by the "Evaluate Java" section of the Developer Console (in the Results tab).static Collection
getLogEntries
(String logName) Returns the contents of the specified log4j log.static List
Returns the list of available log4j log names.static RPCResponse
Returns the contents of any file under webRoot as a String.static RPCResponse
loadSharedXML
(String type, String ID) Load a DS, UI, or APP file from the standard search path.static RPCResponse
ping()
Convenience method for pinging the server to check whether it's alive.static RPCResponse
Saves a file under webRoot with the supplied contents.static RPCResponse
saveSharedXML
(String type, String ID, String contents) Writes or overwrites a UI, DS or APP file with the provided contents.static RPCResponse
uploadProgressCheck
(jakarta.servlet.http.HttpSession session, String formID) Used by the FileUpload control to periodically check the progress of a file upload.static RPCResponse
xmlToJS
(String xmlString, RPCRequest req) Translates XML to JS in exactly the same fashion as done by the <isomorphicXML> JSP tag.
-
Method Details
-
downloadWSDL
public static void downloadWSDL(String url, String format, String fileName, RPCManager rpc, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws Exception Loads a WSDL file from the specified URL, optionally translates it to SmartClient-compatible JS format and streams the file back to the requester via content-disposition: attachment.This method is used by the Download feature of the WSDL tab in the Developer Console.
- Parameters:
url
- The URL from which to load the WSDL file. Can be relative or absolute.format
- Set to 'xml' to stream the file without translation to JS or 'js' to get translated output.fileName
- This method returns a stream with content-disposition: attachment. This argument specifies the default filename that will be shown to the user in the "save as" dialog that comes up in the browser.- Throws:
Exception
-
downloadClientContent
public static void downloadClientContent(String fileContents, String fileName, String mimeType, RPCManager rpc, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws Exception Accepts string content and streams it back as a file to the requester via content-disposition: attachment.This method is used by the Download feature of the DataSourceList in Reify.
- Parameters:
fileContents
- The string data to return in a file for saving.fileName
- This method returns a stream with content-disposition: attachment. This argument specifies the default filename that will be shown to the user in the "save as" dialog that comes up in the browser.mimeType
- The MIME type with which to save the fileContents- Throws:
Exception
-
downloadZip
public static void downloadZip(Map<String, Object> settings, RPCManager rpc, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws ExceptionThis method is used by the Export Project feature in Reify.- Parameters:
settings
- data to export- Throws:
Exception
-
xmlToJS
Translates XML to JS in exactly the same fashion as done by the <isomorphicXML> JSP tag.This method is enabled by default in smartclientRuntime
- Parameters:
xmlString
- String of XML to be translated to JS.- Returns:
- The 'data' payload of the RPCResponse is a String containing the translated result. If an error occurs, status is set to STATUS_FAILURE and 'data' contains the error string.
- Throws:
Exception
-
ping
Convenience method for pinging the server to check whether it's alive.- Returns:
- RPCResponse containing the number 1 as data
- Throws:
Exception
-
uploadProgressCheck
public static RPCResponse uploadProgressCheck(jakarta.servlet.http.HttpSession session, String formID) throws Exception Used by the FileUpload control to periodically check the progress of a file upload.This method is enabled by default in smartclientRuntime
- Parameters:
formID
- The ID of the form uploading the file.- Returns:
- The 'data' payload of the RPCResponse is a Map that contains two attributes: bytesSoFar and totalBytes. If an error occurs, status is set to STATUS_FAILURE and 'data' contains the error string.
- Throws:
Exception
-
deleteFile
Deletes an arbitrary file under webRoot.This method is used by the Reify tool.
- Parameters:
path
- file to delete, must be relative to webRoot.- Returns:
- an RPCResponse with STATUS_SUCCESS if successful, STATUS_FAILURE with 'data' set to the error string otherwise.
- Throws:
Exception
-
saveFile
Saves a file under webRoot with the supplied contents.This method is used by the Reify tool.
You can use SKUploadSaveFile datasource for the purpose of saving files. This datasource uses saveFile method so be sure it is enabled in RPCManager.enabledBuiltinMethods property. You can upload files using the datasource with the help of add operation.
- Parameters:
path
- location of new file, must be relative to webRootdata
- contents of new file- Returns:
- an RPCResponse with STATUS_SUCCESS if successful, STATUS_FAILURE with 'data' set to the error string otherwise.
- Throws:
Exception
-
appendToFile
Appends the supplied contents to a file under webroot. If the file does not exist, this method is the same as saveFile.- Parameters:
path
- location of file, must be relative to webRootdata
- text to append to file- Returns:
- an RPCResponse with STATUS_SUCCESS if successful, STATUS_FAILURE with 'data' set to the error string otherwise.
- Throws:
Exception
-
loadFile
Returns the contents of any file under webRoot as a String.This method is used by the Reify tool.
- Parameters:
path
- location of file to load- Returns:
- 'data' payload of RPCResponse contains the contents of the file. If an error occurs, status is set to STATUS_FAILURE and 'data' contains the error string.
- Throws:
Exception
-
evalJava
This method is used by the "Evaluate Java" section of the Developer Console (in the Results tab). It takes java code and writes it to a temporary JSP, sandwiched by the contents of /shared/jsp/evalJavaHeader.jsp and /shared/jsp/evalJavaFooter.jsp. Then the resulting JSP is loaded via an internal container request. The output of that request is sent back to the browser in the 'data' payload of the RPCResponse.- Parameters:
javaCode
- Arbitrary JSP content, java sections must be enclosed in standard Java escape tags (<% %>).- Returns:
- 'data' payload of RPCResponse contains the result of executing the specified code via the JSP parser. If an error occurs, status is set to STATUS_FAILURE and 'data' contains the error string.
- Throws:
Exception
-
getLogNames
Returns the list of available log4j log names.This method is used by the Server Logs tab of the Developer Console.
- Returns:
- The list of available log names.
- Throws:
Exception
-
getLogEntries
Returns the contents of the specified log4j log.This method is used by the Server Logs tab of the Developer Console.
- Parameters:
logName
- The name of the log.- Returns:
- The contenst of the specified log4j.log.
- Throws:
Exception
-
downloadClientExport
public static void downloadClientExport(List<? extends Map<String, Object>> records, String exportAs, String fileName, String exportDisplay, Map<String, throws ExceptionObject> settings, jakarta.servlet.http.HttpServletResponse response, RPCManager rpc, RPCRequest request) Accepts a List of formatted Record-data, exports it to the specified format and streams it back as a file with the specified fileName to the requester via content-disposition: attachment.- Parameters:
records
- The records to return in a file for saving.exportAs
- The export-format to convert the passed records intofileName
- If parameter exportDisplay is "download", this method returns a stream with content-disposition: attachment. This argument specifies the default filename that will be shown to the user in the "save as" dialog that comes up in the browser.exportDisplay
- Should the content be exported to a file or a browser windowsettings
- Settings for the export. SeeDataBoundComponent.exportClientData
in the client-side documentation for details- Throws:
Exception
-