tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark B. Indictor" <>
Subject REPOST: Please HELP!: URL Mapping Problems in servlet
Date Wed, 27 Feb 2002 17:24:09 GMT
OK -- I'm having a related problem:

I can hit my servlet with the following httpd.conf and web.xml file setup
with these two URLs:




>From within the servlet, I am trying to reconstruct the URL. I am using the
following code:

private String buildURL( HttpServletRequest req ) {
	// Build a new absolute URL
	StringBuffer url = new StringBuffer();
	url.append( req.getScheme() );	// http
	url.append( "://" ); 			// http://
	url.append( req.getServerName() ); 	// http://hostname
	url.append( ":" );			// http://hostname:
	url.append( req.getServerPort() );	// http://hostname:80
	url.append( req.getServletPath() );	//
	return url.toString();

Unfortunately, the URL this produces is either:

http://hostname:8080/sb or http://hostname/sb, 

	and not

http://hostname:8080/s2/sb or http://hostname/SiteBlocks/sb

as expected.

Am I doing something wrong? If so, how can I get the desired result?

Thanks for any assistance!

Here's an excerpt from my httpd.conf file:

<IfModule od_webapp.c>
	WebAppConnection warpconnection warp localhost:8008
	WebAppDeploy examples warpConnection /examples/
	WebAppDeploy SiteBlocks warpConnection /SiteBlocks/

Here's my entire web.xml file:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"



    - Mark
Mark Indictor -- V.P. Engineering
Phone:(310)451-3472 FAX:(240)220-6341

-----Original Message-----
From: Dave Ferguson [] 
Sent: Tuesday, February 26, 2002 12:11 PM
To: Tomcat Users List
Subject: Re: servlet-mapping problem

This is basic stuff.  It should work.  What URL are you using to invoke the
servlet?  With no mapping the URL would be http://server/servlet/warservlet.
If your mapping is


then the URL would be http://server/blah.  Restart Tomcat to be sure your
changes take effect.

- df

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message