Menu

Errorneous 404 error in WebLink.click()?

Help
2003-04-16
2003-04-18
  • rich cariens

    rich cariens - 2003-04-16

    Hello,

    I'm using HttpUnit to unit-test a J2EE application (Servlet + EJB).  We have a Struts-like servlet layer that routes HTTP requests through a dispatcher, so all the links in the pages I'm testing look something like:

    http://host:port/dispatch?formName=foo&ref=bar&parm1=val1&par2=val2&SomeEvent

    HttpUnit is throwing an Exception if I invoke click() on a WebLink related to this sort of link:

    Error on HTTP request: 404 Not Found [http://host:port/dispatch?formName=foo&ref=bar&parm1=val1&par2=val2&SomeEvent]

    Has anyone seen this before?

    Thanks,
    Rich

     
    • rich cariens

      rich cariens - 2003-04-16

      Oops - I should have been more specific.  The link that's causing HttpUnit problems seems to work fine in any generic browser.

       
    • David D. Kilzer

      David D. Kilzer - 2003-04-18

      Is the query string (the text after "?" in the URL) properly encoded?

      For example, and spaces in a "variable" or "value" in the string should be encoded as "+" or "%20".  Other characters (such as "&", "=", "/" and more) should be encoded with their %HH equivalents.

      If your code is building the query string itself, be sure to pass all variables and values that appear in the query string through the encode() method of java.net.URLEncoder before the query string is assembled by joining variables and values with "=" and variable/value pairs with "&".

      Hope that helps.

      Dave

       

Log in to post a comment.

MongoDB Logo MongoDB