Results 1 to 2 of 2
- 11-29-2011, 06:17 AM #1
Member
- Join Date
- Nov 2011
- Posts
- 1
- Rep Power
- 0
Unable to call setRedirectStrategy() method through object DefaultHttpClient Class
Hi,
I have imported following JAR files:-
1. HttpClient4.1.2
2. Httpcore4.1.2
3. HttpClient-Cache4.1.2
Also explicitly importing following file:-
1. import org.apache.http.impl.client.DefaultHttpClient;
Still I am unable to Call setRedirectStrategy() method using an Object of Class DefaultHttpClient.
Root Cause:-
setRedirectStrategy() method is defined under AbstractHttpClient Class which is extented by DefaultHttpClient class. But still unable to call the required method.
Snap Shot of the code:-
public static void main(String[] args) throws ClientProtocolException,
IOException, NoSuchAlgorithmException, KeyManagementException {
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getParams().setBooleanParameter(
"http.protocol.allow-circular-redirects", true);
httpclient.getParams().setParameter(ClientPNames.C OOKIE_POLICY,
CookiePolicy.BROWSER_COMPATIBILITY);
httpclient.getParams()
.setParameter(ClientPNames.HANDLE_REDIRECTS, true);
httpclient.setRedirectStrategy(new Redirector()); //HERE IS THE PROBLEM
Error displayed:-
The method setRedirectStrategy(Redirector) is undefined for the type DefaultHttpClient
Regards,
Ashish
- 11-29-2011, 01:30 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
Re: Unable to call setRedirectStrategy() method through object DefaultHttpClient Clas
The signature for setRedirectStrategy is:
public void setRedirectStrategy(RedirectStrategy redirectStrategy)
Unless a Redirector implements RedirectStrategy (which the error implies it doesn't) then your call is indeed wrong.
Similar Threads
-
Unable to access getter method in an object class I made
By EnSlavingBlair in forum New To JavaReplies: 6Last Post: 10-01-2011, 10:52 AM -
Eclipse Compile Error: Call validateValue(Class<T>, String, Object, Class<?>...)
By Tomshi in forum EclipseReplies: 0Last Post: 03-27-2011, 05:49 AM -
Call object methods from another class
By africanhacker in forum New To JavaReplies: 16Last Post: 03-22-2011, 01:10 AM -
How to call an object from another class?
By narty in forum New To JavaReplies: 1Last Post: 11-01-2010, 08:14 PM -
Unable to call paint() from inside method
By Y. Progammer in forum New To JavaReplies: 3Last Post: 03-01-2010, 12:47 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks