« "blog entry" vs.... | Main | MozBlog success! »

Unsightly Tomcat port number issue.

I've been trying to figure out why Mozblog will not work with Roller's Blogger API implementation. I haven't had much luck, but I have again come across an irritating little issue with the Servlet API request.getRequestURL() method. I'm calling on the blog support line for advice.

Tomcat/Servlet experts, what do you make of this comment from Roller's RollerContext.getContextUrl() method?

 // If you are running Roller behind a foreground server, 
 // then your Servlet engine may be operating on a different
 // port than your forground server. For example, I run Roller 
 // on a Tomcat background server that operates behind an 
 // Apache foreground server. My Apache server is on port 80, 
 // but my Tomcat server is on port 1003.
 //
 // If this is the case, then request.getRequestURL() may 
 // return a URL that is valid but that includes an unsightly
 // and unnecessary port number that you would rather not 
 // include in weblog permalink. In other cases (e.g. you are 
 // running a standalone Tomcat instance on port 8080) the port 
 // number is essential.
 //
 // To deal with this the Roller getContextUrl() method uses 
 // a configuration parameter to determine if it should include 
 // a port number. It calls request.getRequestURL(), parses apart 
 // the result, and builds a context URL suitable for use in a 
 // permalink with or without a port number.
Is that clear? Is there an easier way to deal with this issue?
Comments:

I run Tomcat behind apache, and using the ajp connector, the port number is a non-issue. I don't think this is so much of a webserver/appserver issue as it is a firewall/gateway issue. Do you have a need for this feature? I don't ;-)

Posted by Matt Raible on December 30, 2002 at 04:16 AM EST #

This has to deal with running Tomcat as a standalone vs using Tomcat and Apache (or any other type of webserver). Please take a look http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/connectors.html; in particular, the last section entitled "Why a Tomcat connector with a native Web Server?". You need the port number only if your requests are going directly to the tomcat instance; otherwise, you can just use the url without the port number and have apache forward the request to the tomcat instance (which IMHO, is the better choice). -John

Posted by John W. Mendes on December 30, 2002 at 05:32 PM EST #

Shouldn't request.getHeader("HOST") provide the original Apache request header? I think so, but try it out and see what happens.

Posted by Rickard Öberg on December 31, 2002 at 06:44 AM EST #

In Roller 0.9.7.2 and later, the base URL for Roller is configurable.

Posted by Dave Johnson on May 07, 2003 at 12:36 AM EDT #

Post a Comment:
  • HTML Syntax: NOT allowed

« "blog entry" vs.... | Main | MozBlog success! »

Welcome

This is just one entry in the weblog Blogging Roller. You may want to visit the main page of the weblog

Related entries

Below are the most recent entries in the category Java, some may be related to this entry.