-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue #289
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# The Imixs RestClient | ||
|
||
The Imixs-RestClient is a helper class to establish connections to the Imixs Rest API. | ||
This is a simple example how to request the tasklist of a user: | ||
|
||
// create RestClient .... | ||
RestClient restClient = new RestClient(); | ||
try { | ||
restClient.setRequestProperty("Accept", MediaType.APPLICATION_XML); | ||
restClient.get("http://localhost:8080/workflow/rest-service/workflow/tasklist/owner/admin"); | ||
String xmlResult = restClient.getContent(); | ||
JAXBContext context = JAXBContext.newInstance(DocumentCollection.class); | ||
Unmarshaller u = context.createUnmarshaller(); | ||
StringReader reader = new StringReader(xmlResult); | ||
DocumentCollection xmlDocuments = (DocumentCollection) u.unmarshal(reader); | ||
List<ItemCollection> documents = XMLItemCollectionAdapter.getCollection(xmlDocuments); | ||
logger.info("Read " + documents.size() + " documents"); | ||
} catch (Exception e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
|
||
## Set Credentials | ||
|
||
The Imixs-RestClient also upports BASIC authentication. In this case the *principal* and *credentials* can be set. | ||
|
||
RestClient restClient = new RestClient(); | ||
restClient.setUser("admin"); | ||
restClient.setPassword("password"); | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters