Ok that is simple enough.
On Thu, Feb 12, 2009 at 2:21 PM, Oleg Kalnichevski <[email protected]> wrote:
> Larry Homes wrote:
>
>> I read this site:
>> http://hc.apache.org/httpclient-3.x/logging.html
>>
>> and added the lines
>> System.setProperty("org.apache.commons.logging.Log",
>> "org.apache.commons.logging.impl.SimpleLog");
>> System.setProperty("org.apache.commons.logging.simplelog.showdatetime",
>> "true");
>>
>> System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire",
>> "debug");
>>
>> System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient",
>> "debug");
>>
>> but I am not sure how to go about retreiving the logs or where they are.
>> This is in a servlet so I checked catalina.out since that is where the
>> error
>> stream leads, but there is nothing extra in there.
>>
>> Your patience is appreciated
>>
>>
> Larry,
>
> Please try to reproduce the issue using a small standalone application that
> can be run outside the servlet container. Then, pass the following settings
> to the JVM process on startup to get log entries written to the stdout:
>
> -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
> -Dorg.apache.commons.logging.simplelog.log.httpclient.wire=DEBUG
>
> -Dorg.apache.commons.logging.simplelog.log.org.apache.commons.httpclient=DEBUG
>
>
> Oleg
>
>
> On Wed, Feb 11, 2009 at 6:00 PM, Oleg Kalnichevski <[email protected]>
>> wrote:
>>
>> Larry Homes wrote:
>>>
>>> Ahh you are right. I read your previous email too quickly. However,
>>>> correcting that mistake does not solve the problem.
>>>>
>>>> From here:
>>>> http://hc.apache.org/httpclient-3.x/preference-api.html
>>>>
>>>> I saw another way to set the Params so here is the code I use currently.
>>>>
>>>> GetMethod method = new GetMethod(
>>>> http://portal.acm.org/results.cfm?coll=Portal&query=SomeCRazyString);
>>>>
>>>> method.getParams().setParameter("http.protocol.allow-circular-redirects",
>>>> true);
>>>>
>>>> and it still throws the exception
>>>>
>>>>
>>>>
>>>> Post context / wire log
>>>
>>> Oleg
>>>
>>>
>>>
>>> On Wed, Feb 11, 2009 at 5:07 PM, Oleg Kalnichevski <[email protected]>
>>>> wrote:
>>>>
>>>> Larry Homes wrote:
>>>>
>>>>> Hmm I think I did it right, but it still doesn't work correctly.
>>>>>
>>>>>> Let me provide a little more info:
>>>>>>
>>>>>> I am trying to go to the portal.acm.org website, specifcally the
>>>>>> results
>>>>>> page with the url like:
>>>>>>
>>>>>> http://portal.acm.org/results.cfm?coll=Portal&query=SomeCRazyString
>>>>>>
>>>>>> SomeCrazyString signifies a search term which results in no hits on
>>>>>> acm's
>>>>>> website. What portal.acm.org does in this case is redirect to itself
>>>>>> with
>>>>>> new parameters. I think httpclient see's this redirect to itself as a
>>>>>> circular redirect, even though it just does it once.
>>>>>>
>>>>>> Here is how I tried to disable it:
>>>>>>
>>>>>> HttpClientParams http = new HttpClientParams();
>>>>>> http.setBooleanParameter("ALLOW_CIRCULAR_REDIRECTS", true);
>>>>>>
>>>>>> ALLOW_CIRCULAR_REDIRECTS != http.protocol.allow-circular-redirects
>>>>>>
>>>>> Oleg
>>>>>
>>>>>
>>>>>
>>>>> GetMethod method = new GetMethod("
>>>>>
>>>>> http://portal.acm.org/results.cfm?coll=Portal&query=SomeCRazyString
>>>>>> ");
>>>>>> method.setParams(http);
>>>>>>
>>>>>> But I still get the CircularRedirectException.
>>>>>>
>>>>>> Any help is appreciated.
>>>>>>
>>>>>> On Wed, Feb 11, 2009 at 11:55 AM, Oleg Kalnichevski <[email protected]
>>>>>>
>>>>>> wrote:
>>>>>>>
>>>>>>> Larry Homes wrote:
>>>>>>
>>>>>> Hello,
>>>>>>>
>>>>>>> Apache Httpclient is throwing a CircularRedirectException. I know
>>>>>>>> the
>>>>>>>> redirect is in fact not a circular redirect. Setting
>>>>>>>> setFollowRedirects
>>>>>>>> to
>>>>>>>> false, solves the problem, but breaks some other sites redirect and,
>>>>>>>> in
>>>>>>>> general, I'd like to keep redirects active. So is there any way to
>>>>>>>> turn
>>>>>>>> off
>>>>>>>> just Circular Redirect detection? I read that I might be able to do
>>>>>>>> so
>>>>>>>> with
>>>>>>>> HttpParams.setParams(), but I do not know what name to set to false
>>>>>>>> to
>>>>>>>> disable catching circular redirects.
>>>>>>>>
>>>>>>>> Thanks for any help
>>>>>>>>
>>>>>>>>
>>>>>>>> Set 'http.protocol.allow-circular-redirects' parameter to true.
>>>>>>>>
>>>>>>>> Oleg
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>>
>>>>>> To unsubscribe, e-mail: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
[DEBUG] HttpClient - Java version: 1.6.0_11
[DEBUG] HttpClient - Java vendor: Sun Microsystems Inc.
[DEBUG] HttpClient - Java class path: I removed the classpath info
[DEBUG] HttpClient - Operating system name: Linux
[DEBUG] HttpClient - Operating system architecture: i386
[DEBUG] HttpClient - Operating system version: 2.6.28-ARCH
[DEBUG] HttpClient - SUN 1.6: SUN (DSA key/parameter generation; DSA signing;
SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS keystore; PKIX
CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores,
JavaPolicy Policy; JavaLoginConfig Configuration)
[DEBUG] HttpClient - SunRsaSign 1.5: Sun RSA signature provider
[DEBUG] HttpClient - SunJSSE 1.6: Sun JSSE provider(PKCS12, SunX509 key/trust
factories, SSLv3, TLSv1)
[DEBUG] HttpClient - SunJCE 1.6: SunJCE Provider (implements RSA, DES, Triple
DES, AES, Blowfish, ARCFOUR, RC2, PBE, Diffie-Hellman, HMAC)
[DEBUG] HttpClient - SunJGSS 1.0: Sun (Kerberos v5, SPNEGO)
[DEBUG] HttpClient - SunSASL 1.5: Sun SASL provider(implements client
mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL, PLAIN, CRAM-MD5; server
mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5)
[DEBUG] HttpClient - XMLDSig 1.0: XMLDSig (DOM XMLSignatureFactory; DOM
KeyInfoFactory)
[DEBUG] HttpClient - SunPCSC 1.6: Sun PC/SC provider
[DEBUG] DefaultHttpParams - Set parameter http.useragent = Jakarta
Commons-HttpClient/3.1
[DEBUG] DefaultHttpParams - Set parameter http.protocol.version = HTTP/1.1
[DEBUG] DefaultHttpParams - Set parameter http.connection-manager.class = class
org.apache.commons.httpclient.SimpleHttpConnectionManager
[DEBUG] DefaultHttpParams - Set parameter http.protocol.cookie-policy = default
[DEBUG] DefaultHttpParams - Set parameter http.protocol.element-charset =
US-ASCII
[DEBUG] DefaultHttpParams - Set parameter http.protocol.content-charset =
ISO-8859-1
[DEBUG] DefaultHttpParams - Set parameter http.method.retry-handler =
org.apache.commons.httpclient.defaulthttpmethodretryhand...@1617189
[DEBUG] DefaultHttpParams - Set parameter http.dateparser.patterns = [EEE, dd
MMM yyyy HH:mm:ss zzz, EEEE, dd-MMM-yy HH:mm:ss zzz, EEE MMM d HH:mm:ss yyyy,
EEE, dd-MMM-yyyy HH:mm:ss z, EEE, dd-MMM-yyyy HH-mm-ss z, EEE, dd MMM yy
HH:mm:ss z, EEE dd-MMM-yyyy HH:mm:ss z, EEE dd MMM yyyy HH:mm:ss z, EEE
dd-MMM-yyyy HH-mm-ss z, EEE dd-MMM-yy HH:mm:ss z, EEE dd MMM yy HH:mm:ss z,
EEE,dd-MMM-yy HH:mm:ss z, EEE,dd-MMM-yyyy HH:mm:ss z, EEE, dd-MM-yyyy HH:mm:ss
z]
[DEBUG] DefaultHttpParams - Set parameter
http.protocol.allow-circular-redirects = true
[DEBUG] HttpConnection - Open connection to portal.acm.org:80
[DEBUG] header - >> "GET /results.cfm?coll=Portal&query=SomeCRazyString
HTTP/1.1[\r][\n]"
[DEBUG] HttpMethodBase - Adding Host request header
[DEBUG] header - >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
[DEBUG] header - >> "Host: portal.acm.org[\r][\n]"
[DEBUG] header - >> "[\r][\n]"
[DEBUG] header - << "HTTP/1.1 302 Moved Temporarily[\r][\n]"
[DEBUG] header - << "HTTP/1.1 302 Moved Temporarily[\r][\n]"
[DEBUG] header - << "Connection: close[\r][\n]"
[DEBUG] header - << "Date: Thu, 12 Feb 2009 22:42:12 GMT[\r][\n]"
[DEBUG] header - << "Server: Microsoft-IIS/6.0[\r][\n]"
[DEBUG] header - << "location:
results.cfm?nquery=SomeCRazyString&CFID=22155380&CFTOKEN=88998067[\r][\n]"
[DEBUG] header - << "Content-Type: text/html; charset=UTF-8[\r][\n]"
[DEBUG] header - << "[\r][\n]"
[DEBUG] HttpMethodDirector - Redirect required
[DEBUG] HttpMethodDirector - Redirect requested to location
'results.cfm?nquery=SomeCRazyString&CFID=22155380&CFTOKEN=88998067'
[DEBUG] HttpMethodDirector - Redirect URI is not absolute - parsing as relative
Exception in thread "main"
org.apache.commons.httpclient.CircularRedirectException: Circular redirect to
'http://portal.acm.org:80/results.cfm'
at
org.apache.commons.httpclient.HttpMethodDirector.processRedirectResponse(HttpMethodDirector.java:638)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:179)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at Main.main(Main.java:14)
import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.GetMethod;
public class Main
{
public static void main(String[] args) throws HttpException, IOException
{
HttpClient http = new HttpClient();
GetMethod method = new GetMethod("http://portal.acm.org/results.cfm?coll=Portal&query=SomeCRazyString");
method.getParams().setParameter("http.protocol.allow-circular-redirects", true);
http.executeMethod(method);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]