You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rick Smith <ri...@mindspring.com> on 2001/02/26 05:00:18 UTC

:80 in URL of Links generated in example app

I've been going over the example application and can't for the life of
me find where the :80 is appended to the URL when going through Apache.
When the starting URL is http://localhost/struts-example the page comes
up with :80 added after localhost. When I click on a link with :80 in it
I end up back at the logon page. If I remove the :80 the link takes me
to the correct page. I've spent some time looking through the code and
config files and haven't found anything to explain either how to get rid
of the :80 or how to make the app work with :80. If someone could point
me in the direction of the doc or code that is related to this or
enlighten me in some way I would appreciate it. Thanks. 

Rick

Re: :80 in URL of Links generated in example app

Posted by Rick Smith <ri...@mindspring.com>.
The :80 may be working but for whatever reason when it's there I'm taken
back to the logon page and when it isn't there I go to the page
specified in the link. It seems to be related to authorization not so
much that the :80 doesn't work. 

Rick

Re: :80 in URL of Links generated in example app

Posted by Thierry Cools <th...@s1.com>.
Sorry, I did'nt know you it was possible to servletexec with Apache, we're learning every day ;-) 
But is the 80 port, not the default port for Apache ? 
So the address Localhost:80 should work, am I wrong ?

Thierry Cools
 
Senior Java Developer 
S1 Brussels 
Kleine Kloosterstraat, 23 
1932 st. Stevens-Woluwe 
Belgium 
Tel : +32 2 200 43 82 
Email : thierry.cools@s1.com 

  ----- Original Message ----- 
  From: Robert Taylor 
  To: struts-user@jakarta.apache.org ; Thierry Cools 
  Sent: Monday, February 26, 2001 12:08 PM
  Subject: RE: :80 in URL of Links generated in example app


  Hmmm. I'm using Struts with ServletExec3.1 and Apache on Win98 without any problems so far. 
    -----Original Message-----
    From: Thierry Cools [mailto:thierry.cools@s1.com]
    Sent: Monday, February 26, 2001 5:54 AM
    To: struts-user@jakarta.apache.org
    Subject: Re: :80 in URL of Links generated in example app


    I don't really understand you question, are trying to use struts with apache ?
    You have to know that struts will not work on the Apache server, you'll have to use Tomcat instead.

    The default port for Tomcat is 8080, so that you will have to type  e.g. : http://localhost:8080/struts-example
    if you want to make it work on the 80 port you will have to change the server.xml file and change the value of the "port" parameter.

    Hope it helps.
    Thierry


    Thierry Cools
     
    Senior Java Developer 
    S1 Brussels 
    Kleine Kloosterstraat, 23 
    1932 st. Stevens-Woluwe 
    Belgium 
    Tel : +32 2 200 43 82 
    Email : thierry.cools@s1.com 

      ----- Original Message ----- 
      From: Rick Smith 
      To: struts-user@jakarta.apacheorg 
      Sent: Monday, February 26, 2001 5:00 AM
      Subject: :80 in URL of Links generated in example app


      I've been going over the example application and can't for the life of
      me find where the :80 is appended to the URL when going through Apache.
      When the starting URL is http://localhost/struts-example the page comes
      up with :80 added after localhost. When I click on a link with :80 in it
      I end up back at the logon page. If I remove the :80 the link takes me
      to the correct page. I've spent some time looking through the code and
      config files and haven't found anything to explain either how to get rid
      of the :80 or how to make the app work with :80. If someone could point
      me in the direction of the doc or code that is related to this or
      enlighten me in some way I would appreciate it. Thanks. 

      Rick


RE: :80 in URL of Links generated in example app

Posted by Robert Taylor <rt...@mulework.com>.
Hmmm. I'm using Struts with ServletExec3.1 and Apache on Win98 without any
problems so far.
  -----Original Message-----
  From: Thierry Cools [mailto:thierry.cools@s1.com]
  Sent: Monday, February 26, 2001 5:54 AM
  To: struts-user@jakarta.apache.org
  Subject: Re: :80 in URL of Links generated in example app


  I don't really understand you question, are trying to use struts with
apache ?
  You have to know that struts will not work on the Apache server, you'll
have to use Tomcat instead.

  The default port for Tomcat is 8080, so that you will have to type  e.g. :
http://localhost:8080/struts-example
  if you want to make it work on the 80 port you will have to change the
server.xml file and change the value of the "port" parameter.

  Hope it helps.
  Thierry


  Thierry Cools

  Senior Java Developer
  S1 Brussels
  Kleine Kloosterstraat, 23
  1932 st. Stevens-Woluwe
  Belgium
  Tel : +32 2 200 43 82
  Email : thierry.cools@s1.com

    ----- Original Message -----
    From: Rick Smith
    To: struts-user@jakarta.apacheorg
    Sent: Monday, February 26, 2001 5:00 AM
    Subject: :80 in URL of Links generated in example app


    I've been going over the example application and can't for the life of
    me find where the :80 is appended to the URL when going through Apache.
    When the starting URL is http://localhost/struts-example the page comes
    up with :80 added after localhost. When I click on a link with :80 in it
    I end up back at the logon page. If I remove the :80 the link takes me
    to the correct page. I've spent some time looking through the code and
    config files and haven't found anything to explain either how to get rid
    of the :80 or how to make the app work with :80. If someone could point
    me in the direction of the doc or code that is related to this or
    enlighten me in some way I would appreciate it. Thanks.

    Rick


Re: :80 in URL of Links generated in example app

Posted by Thierry Cools <th...@s1.com>.
I don't really understand you question, are trying to use struts with apache ?
You have to know that struts will not work on the Apache server, you'll have to use Tomcat instead.

The default port for Tomcat is 8080, so that you will have to type  e.g. : http://localhost:8080/struts-example
if you want to make it work on the 80 port you will have to change the server.xml file and change the value of the "port" parameter.

Hope it helps.
Thierry


Thierry Cools
 
Senior Java Developer 
S1 Brussels 
Kleine Kloosterstraat, 23 
1932 st. Stevens-Woluwe 
Belgium 
Tel : +32 2 200 43 82 
Email : thierry.cools@s1.com 

  ----- Original Message ----- 
  From: Rick Smith 
  To: struts-user@jakarta.apache.org 
  Sent: Monday, February 26, 2001 5:00 AM
  Subject: :80 in URL of Links generated in example app


  I've been going over the example application and can't for the life of
  me find where the :80 is appended to the URL when going through Apache.
  When the starting URL is http://localhost/struts-example the page comes
  up with :80 added after localhost. When I click on a link with :80 in it
  I end up back at the logon page. If I remove the :80 the link takes me
  to the correct page. I've spent some time looking through the code and
  config files and haven't found anything to explain either how to get rid
  of the :80 or how to make the app work with :80. If someone could point
  me in the direction of the doc or code that is related to this or
  enlighten me in some way I would appreciate it. Thanks. 

  Rick


Re: :80 in URL of Links generated in example app

Posted by Incze Lajos <in...@mail.matav.hu>.
> The Tomcat 3.2.3 beta is out now. If memory serves some similar error
                ^^^ 2 of course 
> was corrected, give it a try. (3.2.2 is a bugfix release, so it seems
> to be reasonably safe to change to it even if it is "beta".)     incze
                                                                   incze

Re: :80 in URL of Links generated in example app

Posted by Matthias Bauer <Ma...@livinglogic.de>.
Hi there,

the problem described, looks exactly like the one Gordon Maclean addressed the
first time. I also ran into it and sent out the mail I attached below, which
proposes a bugfix with the request to incorporate it as soon as possible.
Gordon's previous mail describes the problem very very good and he also proposed
a bugfix, which is essentially the same as mine (I didn't know he already did).
Unfortunately both requests were silently ignored. Probably due to the fact that
the active developers did not run into the problem, maybe because they are using
some other configuration. The problem only seems to show up, when using Apache
together with mod_jk and Tomcat 3.2.1 and when using Netscape 4.7x. 

The fix really isn't a big deal. And obviously quite a few people are running
into it. The issue at hand really seems to be a bug, because it comes in due to
the fact that in some places the port number :80 is suppressed and in some it is
not. 

Here it is (BaseTag.java):

>   public int doStartTag() throws JspException {
>     HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
>     StringBuffer buf = new StringBuffer("<base href=\""); 
>     buf.append(request.getScheme());
>     buf.append("://");
>     buf.append(request.getServerName());
>     if ("http".equals(request.getScheme()) &&
>         (80 == request.getServerPort())) {
>         ;
>     } else if ("https".equals(request.getScheme()) &&
>                (443 == request.getServerPort())) {
>         ;
>     } else {
>         buf.append(":");
>         buf.append(request.getServerPort());
>     }
>     buf.append(request.getRequestURI());
>     buf.append("\">");
>     JspWriter out = pageContext.getOut();
>     try {
>         out.write(buf.toString());
>     }
>     catch (IOException e) {
>         pageContext.setAttribute(Action.EXCEPTION_KEY, e,
>                                  PageContext.REQUEST_SCOPE);
>         throw new JspException(messages.getMessage("common.io", e.toString()));
>     }
>     return EVAL_BODY_INCLUDE;
>   }

In RequestUtils.java it is not:

>     public static String absoluteURL(HttpServletRequest request, String path) {
> 
>         try {
>             URL url = new URL(request.getScheme(),
>                               request.getServerName(),
>                               request.getServerPort(),
>                               request.getContextPath() + path);
>             return (url.toString());
>         } catch (MalformedURLException e) {
>             return (null);
>         }


So I would like to request the minor code modification again before Struts 1.0
is finally released. I did it in my setup and everything worked fine from then
on. So why hesitate? I think the configuration in which it shows up, is quite
common. Obviously quite some people will be running into it.

Thanks,

--- Matthias


Matthias Bauer +++ mba@livinglogic.de +++ LivingLogic AG +++ www.livinglogic.de




> To all active developers.
> 
> I would like to see a minor change (bugfix) in struts, which fixes the problem
> outlined in a previous mail from Gordon Maclean, subjected "netscape 4.7x,
> session ids and struts". I attached it to the end of this mail because it
> describes the problem very good. 
> 
> I ran into the same problem this morning and finally found a workaround. I would
> like to see this change in struts before it is released as official version 1.0.
> It simply prevents the function RequestUtil.absoluteURL() from including the
> port number into the URL, when the port number is equal to 80.
> 
> Unfortunately I do not have a (and don't want to open one now) Bugzilla account.
> Nevertheless I would like to ask an active developer to implement this change. I
> am quite sure, that considerably many developers have already stumbled over this
> problem outlined int Gordon's mail.
> 
> Here is the little change in the code (RequestUtils.java):
> 
> Former code:
> 
> >     public static String absoluteURL(HttpServletRequest request, String path) {
> > 
> >         try {
> >             URL url = new URL(request.getScheme(),
> >                               request.getServerName(),
> >                               request.getServerPort(),
> >                               request.getContextPath() + path);
> >             return (url.toString());
> >         } catch (MalformedURLException e) {
> >             return (null);
> >         }
> > 
> >     }
> 
> New code:
> 
> >     public static String absoluteURL(HttpServletRequest request, String path) {
> > 
> >         try {
> >                       int port = request.getServerPort();
> >                       URL url;
> >                       if (80 == port)
> >                       {
> >                               url = new URL(request.getScheme(),
> >                                                         request.getServerName(),
> >                                                         request.getContextPath() + path);
> >                       }
> >                       else
> >                       {
> >                               url = new URL(request.getScheme(),
> >                                                         request.getServerName(),
> >                                                         port,
> >                                                         request.getContextPath() + path);
> >                       }
> >             return (url.toString());
> >         } catch (MalformedURLException e) {
> >             return (null);
> >         }
> > 
> >     }
> 
> Thanks,
> 
> --- Matthias
> 
> 
> 
> Matthias Bauer +++ mba@livinglogic.de +++ LivingLogic AG +++ www.livinglogic.de
> 
> 
> 
> Gordon's Previous Mail with the bug description:
> ================================================
> 
> >        Using netscape 4.7x on either solaris, linux or windows, the
> >        struts-example fails, because I am bounced between two different
> >        sessions.
> > 
> >        The symptom indicates to me that netscape keeps separate lists
> >        of cookies for the following URLs:
> > 
> >                http://myhost
> >                http://myhost:80
> > 
> >        As one goes through the struts example, the URL is
> >        sometimes displayed as myhost, and sometimes as myhost:80,
> >        and I am never allowed past the login because the user
> >        information is kept in a session associated with myhost,
> >        and can't be found in a session associated with myhost:80.
> > 
> >        Environment: struts nightly download as of Feb 12, 2001.
> >                Tomcat 3.2.1, mod_jk, apache 1.3.12 on RH7.
> > 
> >        I have all cookies enabled in netscape preferences, with
> >        "Warn before accepting a cookie" also turned on for debugging.
> > 
> >        1. When I try the struts-example with the following URL:
> > 
> >                http://myhost/struts-example
> > 
> >        Netscape asks if I want to send the cookie JSESSIONID=f78s0eymd1,
> >        and I click OK.
> > 
> >        2. I select the "Log on ..." link.  Then the logon form is displayed at
> >        a
> >           URL of
> >                http://myhost:80/struts-example/logon.jsp;jsessionid=f78s0eymd1
> > 
> >        Note the cookie in the URL because struts doesn't yet know if my browser 
> >        accepts cookies.  Also note the port number 80 in the URL.
> > 
> >        3. I enter user:pass and Submit.  
> > 
> >        LogonAction logs the following message:
> > 
> >        2001-02-15 01:59:47 - path="/struts-example" :action: LogonAction: 
> >                User 'user' logged on in session f78s0eymd1
> > 
> > 
> >        The mainMenu.jsp page is displayed, with a URL: 
> > 
> >                http://myhost/struts-example/logon.do;jsessionid=f78s0eymd1
> > 
> >        (note no port number is in the URL)
> > 
> >        4. Then, when I select "Edit your" the netscape question box pops up
> >        asking if I want to send a cookie JSESSIONID=ynsmafyqr1.
> >        The URL is shown as
> >        http://myhost:80/struts-example/editRegistration.do?action=Edit
> >         
> >        This shouldn't happen, it should use the first session id!
> > 
> >        5. When I click on OK, then, EditRegistrationAction logs the following
> >        error:
> > 
> >        2001-02-15 02:00:55 - path="/struts-example" :action:  User is not
> >          logged on in session ynsmafyqr1
> > 
> > 
> >        The logon.jsp form is again displayed.  If I enter user:pass, then
> >        LogonAction reports a successfull login in session f78s0eymd1
> >        (the first session id again!)
> > 
> >        When I select "Edit ..." I get the same error from
> >        EditRegistrationAction about "User is not logged on in session
> >        ynsmafyqr1".
> >        And so on, ad-infinitum.
> > 
> >        If I disable cookies in netscape preferences, then things
> >        work with URL rewriting, and EditRegistrationAction forwards me to
> >        registration.jsp.
> > 
> >        The problem also does not show up with IE 5.
> > 
> >        Also, at step 4, if I manually enter a URL of:
> >                http://myhost/struts-example/editRegistration.do?action=Edit
> >        then EditRegistrationAction succeeds and forwards to registration.jsp. 
> >                
> > 
> >        If I am right about netscape keeping separate cookie lists, then perhaps
> >        a workaround is for struts (specifically the html taglib) not to add
> >        the port number when generating URLs?
> > 
> >        I haven't tested this solution.  
> > 
> >        Someone must have run into it also?
> > 
> >        Gordon Maclean
> > 
> >        -- 
> >        *****************************************************
> >        Gordon Maclean, Software Engineer, 303 497-8794
> >        Nat'l Center for Atmospheric Research, Boulder CO USA
> >        *****************************************************

Re: :80 in URL of Links generated in example app

Posted by Rick Smith <ri...@mindspring.com>.
As stated in another thread, the culprit seems to be Netscape 4.7x. I've
tried several browsers including Lynx and IE5 and all work but not
Netscape 4.72. 


Rick 

Incze Lajos wrote:
> 
> On Mon, Feb 26, 2001 at 05:34:46PM -0800, Craig R. McClanahan wrote:
> > Rick Smith wrote:
> >
> > > Well, I take that back, too. They are just coded differently but both
> > > append the :80. Maybe I have a problem with mod_jk.
> >
> > That seems much more likely.
> >
> > A way to prove it (one way or the other) would be to try Tomcat 3.2.1
> > stand alone
> > in an environment where you can open port 80 (either on a Windows 98
> > box, or
> > temporarily on a Unix box running as root).  I would bet you that mod_jk
> > is the
> > culprit here -- in which case, you should report an error to
> >
> >     http://nagoya.apache.org/bugzilla/
> >
> > under product category "Tomcat 3".
> >
> > Craig
> 
> The Tomcat 3.2.3 beta is out now. If memory serves some similar error
> was corrected, give it a try. (3.2.2 is a bugfix release, so it seems
> to be reasonably safe to change to it even if it is "beta".)     incze

Re: :80 in URL of Links generated in example app

Posted by Incze Lajos <in...@mail.matav.hu>.
On Mon, Feb 26, 2001 at 05:34:46PM -0800, Craig R. McClanahan wrote:
> Rick Smith wrote:
> 
> > Well, I take that back, too. They are just coded differently but both
> > append the :80. Maybe I have a problem with mod_jk.
> 
> That seems much more likely.
> 
> A way to prove it (one way or the other) would be to try Tomcat 3.2.1
> stand alone
> in an environment where you can open port 80 (either on a Windows 98
> box, or
> temporarily on a Unix box running as root).  I would bet you that mod_jk
> is the
> culprit here -- in which case, you should report an error to
> 
>     http://nagoya.apache.org/bugzilla/
> 
> under product category "Tomcat 3".
> 
> Craig

The Tomcat 3.2.3 beta is out now. If memory serves some similar error
was corrected, give it a try. (3.2.2 is a bugfix release, so it seems
to be reasonably safe to change to it even if it is "beta".)     incze

Re: :80 in URL of Links generated in example app

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Rick Smith wrote:

> Well, I take that back, too. They are just coded differently but both
> append the :80. Maybe I have a problem with mod_jk.

That seems much more likely.

A way to prove it (one way or the other) would be to try Tomcat 3.2.1
stand alone
in an environment where you can open port 80 (either on a Windows 98
box, or
temporarily on a Unix box running as root).  I would bet you that mod_jk
is the
culprit here -- in which case, you should report an error to

    http://nagoya.apache.org/bugzilla/

under product category "Tomcat 3".

Craig

Re: :80 in URL of Links generated in example app

Posted by Rick Smith <ri...@mindspring.com>.
Well, I take that back, too. They are just coded differently but both
append the :80. Maybe I have a problem with mod_jk.

 Rick Smith wrote:
> 
> I see where the difference is. There is a BaseTag.java in
> /src/share/org/apache/struts/taglib and one in
> /src/share/org/apache/struts/taglib/html. The one in the html directory
> has the :80 appended to the base url and the one under taglib doesn't.
> 
> Rick
> 
> Robert Leland wrote:
> >
> > Rick Smith wrote:
> > > I'm using the just released beta binary version. I took a look at the
> > > source for BaseTag from the binary release and the source release and
> > > they are different.
> >
> > I downloaded both the binary and source version of the struts beta
> >  the org.apache.struts.taglib.html.BaseTag  is the same in both.
> >
> > The same goes for the Feburary 24 version of struts, and the CVS version.
> >
> > So there is no inconsistency between these versions.
> >
> > -Rob

Re: :80 in URL of Links generated in example app

Posted by Rick Smith <ri...@mindspring.com>.
I see where the difference is. There is a BaseTag.java in
/src/share/org/apache/struts/taglib and one in
/src/share/org/apache/struts/taglib/html. The one in the html directory
has the :80 appended to the base url and the one under taglib doesn't. 

Rick 

Robert Leland wrote:
> 
> Rick Smith wrote:
> > I'm using the just released beta binary version. I took a look at the
> > source for BaseTag from the binary release and the source release and
> > they are different.
> 
> I downloaded both the binary and source version of the struts beta
>  the org.apache.struts.taglib.html.BaseTag  is the same in both.
> 
> The same goes for the Feburary 24 version of struts, and the CVS version.
> 
> So there is no inconsistency between these versions.
> 
> -Rob

Re: :80 in URL of Links generated in example app

Posted by Robert Leland <Ro...@free2create.org>.

Rick Smith wrote:
> I'm using the just released beta binary version. I took a look at the
> source for BaseTag from the binary release and the source release and
> they are different. 

I downloaded both the binary and source version of the struts beta
 the org.apache.struts.taglib.html.BaseTag  is the same in both.

The same goes for the Feburary 24 version of struts, and the CVS version.

So there is no inconsistency between these versions.

-Rob

Re: :80 in URL of Links generated in example app

Posted by Rick Smith <ri...@mindspring.com>.
I'm running with Tomcat 3.2.1 and using mod_jk to work with Apache.
Sorry for not making that clear before. I added .do to the JkMount for
struts-example so the .do files are working but I'm finding I get thrown
back to the logon screen whenever the link has the :80 appended to the
base url.

I'm using the just released beta binary version. I took a look at the
source for BaseTag from the binary release and the source release and
they are different. The source release doesn't append the :80 to the
base URL but the binary source does. So, it looks like the two aren't in
sync with each other. In a situation like this who would be contacted to
get the newer version of BaseTag into the binary version? I've been
meaning to compile from source so this will be my incentive to do that
but I would think the source code should match. Agree?

Rick


Robert Leland wrote:
> 
> Which version of struts are you using ? Back on Feb 02 a change was made
> to BaseTag dealing with port 80.
> 
> -Rob
> 
> Rick Smith wrote:
> >
> > I've been going over the example application and can't for the life of
> > me find where the :80 is appended to the URL when going through Apache.
> > When the starting URL is http://localhost/struts-example the page comes
> > up with :80 added after localhost. When I click on a link with :80 in it
> > I end up back at the logon page. If I remove the :80 the link takes me
> > to the correct page. I've spent some time looking through the code and
> > config files and haven't found anything to explain either how to get rid
> > of the :80 or how to make the app work with :80. If someone could point
> > me in the direction of the doc or code that is related to this or
> > enlighten me in some way I would appreciate it. Thanks.
> >
> > Rick

Re: :80 in URL of Links generated in example app

Posted by Robert Leland <Ro...@free2create.org>.
Which version of struts are you using ? Back on Feb 02 a change was made
to BaseTag dealing with port 80.

-Rob

Rick Smith wrote:
> 
> I've been going over the example application and can't for the life of
> me find where the :80 is appended to the URL when going through Apache.
> When the starting URL is http://localhost/struts-example the page comes
> up with :80 added after localhost. When I click on a link with :80 in it
> I end up back at the logon page. If I remove the :80 the link takes me
> to the correct page. I've spent some time looking through the code and
> config files and haven't found anything to explain either how to get rid
> of the :80 or how to make the app work with :80. If someone could point
> me in the direction of the doc or code that is related to this or
> enlighten me in some way I would appreciate it. Thanks.
> 
> Rick