04-25-2009 11:04 AM
HttpClient client = new HttpClient();
GetMethod method = new GetMethod(contenturl.toString());
Credentials defaultcreds = new UsernamePasswordCredentials("tomcat",
"tomcat");
client.getState().setCredentials(
new AuthScope("localhost", 8080, AuthScope.ANY_REALM),
defaultcreds);
client.getParams().setAuthenticationPreemptive(true);
// client = new URL(contenturl.toString());
[b]in try block[/b]
int responseCode = client.executeMethod(method);
InputStream resultdoc = method.getResponseBodyAsStream();
04-25-2009 11:05 AM
HttpClient client = new HttpClient();
GetMethod method = new GetMethod(contenturl.toString());
Credentials defaultcreds = new UsernamePasswordCredentials("tomcat",
"tomcat");
client.getState().setCredentials(
new AuthScope("localhost", 8080, AuthScope.ANY_REALM),
defaultcreds);
client.getParams().setAuthenticationPreemptive(true);
// client = new URL(contenturl.toString());
[b]in try block[/b]
int responseCode = client.executeMethod(method);
InputStream resultdoc = method.getResponseBodyAsStream();
04-26-2009 11:21 AM
HttpClient httpClientAuth = new HttpClient();
httpClientAuth.getParams().setAuthenticationPreemptive(true);
HostConfiguration host = httpClientAuth.getHostConfiguration();
AuthScope authScope = new AuthScope(host.getHost(), host.getPort());
HttpState state = httpClientAuth.getState();
Credentials defaultcreds = new UsernamePasswordCredentials(usernameValue, passwordValue);
state.setCredentials(authScope, defaultcreds);
PostMethod post = new PostMethod(authUrl);
post.setDoAuthentication(true);
post.addParameter(usernameParameter, usernameValue);
post.addParameter(passwordParameter, passwordValue);
….
Hope this helps.
05-01-2012 05:37 AM
String url = yoururl+"?alf_ticket="+ticket
HttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet(url);
HttpResponse response = client.execute(get);
HttpEntity myEntity = response.getEntity();
String responseString = EntityUtils.toString(myEntity);
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.