Created
September 25, 2013 17:11
-
-
Save ngandriau/6702830 to your computer and use it in GitHub Desktop.
activiti secure rest call attempt
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
package com.hybris.activity | |
import groovyx.net.http.ContentType | |
import groovyx.net.http.RESTClient | |
/** | |
* Created by User: ngandriau - Date: 9/25/13 - Time: 12:07 PM | |
* | |
* this works: curl --basic --user kermit:kermit http://localhost:8080/activiti-rest/service/process-engine | |
*/ | |
class ActivitiMonitor { | |
public static void main(String[] args) { | |
def activitiRestClient = new RESTClient("http://localhost:8080") | |
activitiRestClient.auth.basic "kermit", "kermit" | |
def response = activitiRestClient.post( | |
path: "/activiti-rest/service/login", | |
body: """{ | |
"userId": "kermit", | |
"password": "kermit" | |
} | |
""", | |
contentType: ContentType.JSON, | |
requestContentType: ContentType.JSON) | |
println response.data | |
response = activitiRestClient.get( | |
path: "/activiti-rest/service/process-engine", | |
contentType: ContentType.JSON, | |
requestContentType: ContentType.JSON) | |
println response.data | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment