-
Language:
English
-
Language:
English
Red Hat Training
A Red Hat training course is available for Red Hat JBoss Data Virtualization
17.28. Publish a File Using the REST Client API
// Setup POJOs Server server = new Server("http://localhost:8080", "username", "password"); Repository repository = new Repository("repositoryName", server); Workspace workspace = new Workspace("workspaceName", repository); // Publish File file = new File("/path/to/file"); IRestClient restClient = new JsonRestClient(); Status status = restClient.publish(workspace, "/workspace/path/", file); if (status.isError() { // Handle error here }
Successfully executing the above code results in the creation of a JCR folder node (
nt:folder
) for each segment of the workspace path (if the folder didn't already exist). Also, a JCR file node (a node with primary type nt:file
) is created or updated under the last folder node and the file contents are encoded and uploaded into a child node of that file node.
Refer to the quickstart example in the
SOA_ROOT/jboss-as/samples/quickstarts/modeshape_helloworld_publish/
directory.