Java Code Examples for org.apache.http.impl.client.DefaultHttpClient#setRedirectStrategy()
The following examples show how to use
org.apache.http.impl.client.DefaultHttpClient#setRedirectStrategy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpServiceImpl.java From container with Apache License 2.0 | 6 votes |
@Override public HttpResponse Get(final String uri, final List<Cookie> cookies) throws IOException { DefaultHttpClient client = new DefaultHttpClient(); client.setRedirectStrategy(new LaxRedirectStrategy()); final HttpGet get = new HttpGet(uri); if (cookies != null) { for (final Cookie c : cookies) { client.getCookieStore().addCookie(c); } } final HttpResponse response = client.execute(get); return response; // TODO Return something useful maybe... like an InputStream }
Example 2
Source File: HttpServiceImpl.java From container with Apache License 2.0 | 5 votes |
@Override public HttpResponse Get(final String uri, final Map<String, String> headers) throws IOException { DefaultHttpClient client = new DefaultHttpClient(); client.setRedirectStrategy(new LaxRedirectStrategy()); final HttpGet get = new HttpGet(uri); for (final String header : headers.keySet()) { get.addHeader(header, headers.get(header)); } final HttpResponse response = client.execute(get); return response; // TODO Return something useful maybe... like an InputStream }
Example 3
Source File: HttpServiceImpl.java From container with Apache License 2.0 | 5 votes |
@Override public HttpResponse Get(final String uri) throws IOException { DefaultHttpClient client = new DefaultHttpClient(); client.setRedirectStrategy(new LaxRedirectStrategy()); final HttpGet get = new HttpGet(uri); final HttpResponse response = client.execute(get); return response; // TODO Return something useful maybe... like an InputStream }
Example 4
Source File: HttpServiceImpl.java From container with Apache License 2.0 | 5 votes |
@Override public HttpResponse Get(final String uri, final String username, final String password) throws IOException { DefaultHttpClient client = new DefaultHttpClient(); client.getCredentialsProvider().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password)); client.setRedirectStrategy(new LaxRedirectStrategy()); final HttpGet get = new HttpGet(uri); final HttpResponse response = client.execute(get); return response; // TODO Return something useful maybe... like an InputStream }
Example 5
Source File: HttpServiceImpl.java From container with Apache License 2.0 | 5 votes |
@Override public HttpResponse Head(final String uri) throws IOException { DefaultHttpClient client = new DefaultHttpClient(); client.setRedirectStrategy(new LaxRedirectStrategy()); final HttpHead head = new HttpHead(uri); final HttpResponse response = client.execute(head); return response; }
Example 6
Source File: HttpServiceImpl.java From container with Apache License 2.0 | 5 votes |
@Override public HttpResponse Post(final String uri, final HttpEntity httpEntity) throws IOException { DefaultHttpClient client = new DefaultHttpClient(); client.setRedirectStrategy(new LaxRedirectStrategy()); final HttpPost post = new HttpPost(uri); post.setEntity(httpEntity); final HttpResponse response = client.execute(post); return response; }
Example 7
Source File: HttpServiceImpl.java From container with Apache License 2.0 | 5 votes |
@Override public HttpResponse Post(final String uri, final HttpEntity httpEntity, final Header... header) throws IOException { DefaultHttpClient client = new DefaultHttpClient(); client.setRedirectStrategy(new LaxRedirectStrategy()); final HttpPost post = new HttpPost(uri); post.setEntity(httpEntity); post.setHeaders(header); final HttpResponse response = client.execute(post); return response; }
Example 8
Source File: HttpServiceImpl.java From container with Apache License 2.0 | 5 votes |
@Override public HttpResponse Post(final String uri, final HttpEntity httpEntity, final List<Cookie> cookies) throws IOException { DefaultHttpClient client = new DefaultHttpClient(); client.setRedirectStrategy(new LaxRedirectStrategy()); final HttpPost post = new HttpPost(uri); post.setEntity(httpEntity); if (cookies != null) { for (final Cookie c : cookies) { client.getCookieStore().addCookie(c); } } final HttpResponse response = client.execute(post); return response; }
Example 9
Source File: HttpServiceImpl.java From container with Apache License 2.0 | 5 votes |
@Override public List<Cookie> PostCookies(final String uri, final HttpEntity httpEntity) throws IOException { DefaultHttpClient client = new DefaultHttpClient(); client.setRedirectStrategy(new LaxRedirectStrategy()); final HttpPost post = new HttpPost(uri); post.setEntity(httpEntity); client.execute(post); final List<Cookie> cookies = client.getCookieStore().getCookies(); // client.getConnectionManager().shutdown(); return cookies; }
Example 10
Source File: HttpServiceImpl.java From container with Apache License 2.0 | 5 votes |
@Override public HttpResponse Put(final String uri, final HttpEntity httpEntity) throws IOException { DefaultHttpClient client = new DefaultHttpClient(); client.setRedirectStrategy(new LaxRedirectStrategy()); final HttpPut put = new HttpPut(uri); put.setEntity(httpEntity); final HttpResponse response = client.execute(put); return response; }
Example 11
Source File: HttpServiceImpl.java From container with Apache License 2.0 | 5 votes |
@Override public HttpResponse Put(final String uri, final HttpEntity httpEntity, final String username, final String password) throws IOException { DefaultHttpClient client = new DefaultHttpClient(); client.setRedirectStrategy(new LaxRedirectStrategy()); client.getCredentialsProvider().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password)); final HttpPut put = new HttpPut(uri); put.setEntity(httpEntity); final HttpResponse response = client.execute(put); return response; }
Example 12
Source File: HttpServiceImpl.java From container with Apache License 2.0 | 5 votes |
@Override public HttpResponse Delete(final String uri) throws IOException { DefaultHttpClient client = new DefaultHttpClient(); client.setRedirectStrategy(new LaxRedirectStrategy()); final HttpDelete del = new HttpDelete(uri); final HttpResponse response = client.execute(del); return response; }
Example 13
Source File: HttpServiceImpl.java From container with Apache License 2.0 | 5 votes |
@Override public HttpResponse Trace(final String uri) throws IOException { DefaultHttpClient client = new DefaultHttpClient(); client.setRedirectStrategy(new LaxRedirectStrategy()); final HttpTrace trace = new HttpTrace(uri); final HttpResponse response = client.execute(trace); return response; }
Example 14
Source File: HttpServiceImpl.java From container with Apache License 2.0 | 5 votes |
@Override public HttpResponse Options(final String uri) throws IOException { DefaultHttpClient client = new DefaultHttpClient(); client.setRedirectStrategy(new LaxRedirectStrategy()); final HttpOptions options = new HttpOptions(uri); final HttpResponse response = client.execute(options); return response; }