Menu

HttpClient issues

Help
Professr
2006-11-23
2013-04-08
  • Professr

    Professr - 2006-11-23

    I've gotten some test code to compile, etc, but when I call refreshInbox(), I get "Entity enclosing requests cannot be redirected without user intervention".  Am I missing a step, has GMail changed and broken jGmail, or what?  Any suggestions would be appreciated.

     
    • Todd Lindner

      Todd Lindner - 2006-11-24

      I haven't worked on this in a while.  If you want to debug and submit a path that would be great.

       
    • Michael Young

      Michael Young - 2009-02-10

      Hi
      I see this thread is old, but im hoping you could help me anyway.
      Same problem as above:

      java.lang.IllegalArgumentException: Entity enclosing requests cannot be redirected without user intervention
          at org.apache.commons.httpclient.methods.EntityEnclosingMethod.setFollowRedirects(EntityEnclosingMethod.java:221)
          at net.sf.jgmail.GmailAdapter.makeWebRequest(GmailAdapter.java:312)
          at net.sf.jgmail.GmailAdapter.login(GmailAdapter.java:145)
          at net.sf.jgmail.GmailAdapter.refresh(GmailAdapter.java:113)
          at net.sf.jgmail.GmailSession.refreshInbox(GmailSession.java:132)
          at axon.gmail_client.Test_Access.main(Test_Access.java:22)

      <terminated, exit value: 0>/opt/jdk1.6.0_10/bin/java (10 Feb 2009 2:31:10 PM)   

      Thanks

       
      • Niall Mulhare

        Niall Mulhare - 2009-02-23

        Hey Folks,

        Also having the same issue.

        Debugged it as far as GMailAdapter.makeWebRequest() around
        method.setFollowRedirects(true);

        I'll carry on the digging tomorrow, but if there is any ideas afloat feel free to post them.

        Cheers,
        N.

         
        • Niall Mulhare

          Niall Mulhare - 2009-02-23

          Per default HttpClient automatically handles redirects for all non entity enclosing methods. Just do not PostMethod#setFollowRedirects() to true in your code and everything should be fine. i.e.

          GMailAdapter.makeWebRequest()
          method.setFollowRedirects(false);

          See the HttpClient redirect handling guide for details:

          http://jakarta.apache.org/commons/httpclient/redirects.html

           
  • isar

    isar - 2009-09-23

    Hi there,

    Even though I set setFollowRedirects to false, I cannot connect to gmail successfully. Has something changed in gmail and jgmail is not in sync?

    The exception I get &amp; response is:

        net.sf.jgmail.LoginException: Unable to find _sgh value in rawResponse &lt;html&gt;&lt;head&gt;&lt;title&gt;Google Accounts&lt;/title&gt;
    &lt;style type=&quot;text/css&quot;&gt;
          body {font-family: arial,sans-serif;}
          .body {margin: 0 15px; }

          div.errorbox-good {}

          div.errorbox-bad {}

          div.errormsg { color: red; font-size: smaller; font-family: arial,sans-serif;}
          font.errormsg { color: red; font-size: smaller; font-family: arial,sans-serif;}
        &lt;/style&gt;
    &lt;/head&gt;
    &lt;body dir=&quot;ltr&quot; bgcolor=&quot;#ffffff&quot; text=&quot;#000000&quot; link=&quot;#0000cc&quot; vlink=&quot;#551a8b&quot; alink=&quot;#ff0000&quot;&gt;&lt;style type=&quot;text/css&quot;&gt;
      .aligns {
        text-align: right;
      }
      .margins {
        margin-left: 13px;
      }
      .floats-normal {
        float: left;
      }
      .floats-reverse {
        float: right;
        margin-top: 17px;
      }
    &lt;/style&gt;
    &lt;div class=&quot;topbar aligns&quot; style=&quot;font-size:smaller; margin-bottom:0 15px 1px 15px; white-space:nowrap;&quot;&gt;
    &lt;a href=&quot;http://www.google.com&quot;&gt;Google Home&lt;/a&gt;
    |

    &lt;a href=&quot;https://www.google.com/accounts/Login&quot;&gt;Sign In&lt;/a&gt;&lt;/div&gt;
    &lt;div class=&quot;header margins&quot; style=&quot;height: 40px; margin: 13px 15px 9px 15px;&quot;&gt;&lt;a href=&quot;https://www.google.com/accounts/&quot;&gt;&lt;img src=&quot;googleaccountslogo/en.gif&quot; border=&quot;0&quot; class=&quot;floats-normal&quot; alt=&quot;Google&quot;&gt;&lt;/a&gt;
    &lt;/div&gt;
    &lt;div style=&quot;clear:both;&quot;&gt;&lt;/div&gt;
    &lt;div class=&quot;body&quot;&gt;&lt;p&gt;Invalid request.
    &lt;/p&gt;&lt;/div&gt;
    &lt;div class=&quot;footer&quot; style=&quot;color: #666;          font-size: smaller;          margin: 50px 15px 0 15px;          text-align: center;&quot;&gt;&amp;copy;2009 Google
    -
    &lt;a href=&quot;http://www.google.com&quot;&gt;Google Home&lt;/a&gt;
    -
    &lt;a href=&quot;https://www.google.com/accounts/TOS?hl=en&quot;&gt;Terms of Service&lt;/a&gt;
    -
    &lt;a href=&quot;http://www.google.com/intl/en/privacy.html&quot;&gt;Privacy Policy&lt;/a&gt;
    -
    &lt;a href=&quot;http://www.google.com/support/accounts?hl=en&quot;&gt;Help&lt;/a&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;
    at net.sf.jgmail.GmailAdapter.login(GmailAdapter.java:156)
    at net.sf.jgmail.GmailAdapter.refresh(GmailAdapter.java:113)
    at net.sf.jgmail.GmailSession.refreshInbox(GmailSession.java:132)
    .
    .
    .

    Any ideas?

    Thanks.

     

Log in to post a comment.