As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
<br>DefaultHttpClient client = new DefaultHttpClient();<br>client.getCredentialsProvider().setCredentials(new AuthScope("localhost", 8080), <br> new UsernamePasswordCredentials("kermit", "kermit"));<br> <br>// Create AuthCache instance<br>AuthCache authCache = new BasicAuthCache();<br>// Generate BASIC scheme object and add it to the local auth cache<br>BasicScheme basicAuth = new BasicScheme();<br>authCache.put(new HttpHost("localhost", 8080, "http"), basicAuth);<br><br>// Add AuthCache to the execution context<br>BasicHttpContext localcontext = new BasicHttpContext();<br>localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);<br>HttpPost postMethod = new HttpPost(REST_URI + "/deployment");<br>HttpResponse response = client.execute(postMethod, localcontext);<br>
<br> DefaultHttpClient client = new DefaultHttpClient();<br> client.getCredentialsProvider().setCredentials(new AuthScope("localhost", 8080),<br> new UsernamePasswordCredentials("kermit", "kermit"));<br> <br> // Create AuthCache instance<br> AuthCache authCache = new BasicAuthCache();<br> // Generate BASIC scheme object and add it to the local auth cache<br> BasicScheme basicAuth = new BasicScheme();<br> authCache.put(new HttpHost("localhost", 8080, "http"), basicAuth);<br><br> // Add AuthCache to the execution context<br> BasicHttpContext localcontext = new BasicHttpContext();<br> localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);<br> HttpPost postMethod = new HttpPost("<a href="http://localhost:8080/activiti-rest/service/process-instance" rel="nofollow noopener noreferrer">http://localhost:8080/activiti-rest/service/process-instance</a>");<br> try {<br> postMethod.setEntity(new StringEntity("{\"processDefinitionId\":\"MyProcess:1:4448\"}", "UTF-8"));<br> HttpResponse response = client.execute(postMethod, localcontext);<br> System.out.println(IOUtils.toString(response.getEntity().getContent()));<br> client.getConnectionManager().shutdown();<br> } catch (Exception e) {<br> // TODO Auto-generated catch block<br> e.printStackTrace();<br> }<br>
<br>…<br>Client client = Client.create();<br>client.addFilter(new HTTPBasicAuthFilter("kermit", "kermit"));<br>WebResource webResource = client.resource(getServiceUrl("/user/kermit"));<br>…<br>