tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phillip Morelock <subscripti...@phillipmorelock.com>
Subject Re: Does Tomcat want to stand alone?
Date Tue, 04 Jun 2002 01:16:44 GMT
> But this is within the servlet/jsp page, not the config file. unless I
> misunderstand you. there is no response until a page has been settled on for
> processing right? This means to redirect a request I would have to have a
> phantom page that tomcat decided to serv that then redirected to the real
> page. One of the top features of redirection is to have the user ask for one
> thing, and not need it to exist physically on the file system.
> 
> Of course I may be entirely missing something here :)

You are  :)

First, look into frameworks like struts.  They do exactly what you're
talking about.  (Struts is another jakarta project).  Second, get creative
with your servlet mappings:  check out the servlet specification for what's
allowed in a servlet mapping.  The thing about the servlet / jsp
specifications, they are really supposed to be broad bases that are highly
portable and highly flexible, at the expense of some of the "convenience"
features of an environment like ASP or PHP.

Struts uses this paradigm:
*.do

or *.action or whatever file extension.  Struts catches all requests for
*.do and dynamically instantiates appropriate developer-defined handlers for
these actions.  It's very cool.

Second, even with struts or without it, I've written very simple servlets
(like 50 lines) that essentially are "mini-dispatchers" -- they
load-on-startup and read a flat file of forwarding dispatches.  That way you
can forward any request like:
fandango/*
to a particular servlet and from that servlet you can check out the url and
see where you want to dispatch it (this is very easy -- but again, struts
does this all "automagically" and securely for you).  I don't remember the
exact details of every servlet-mapping rule, but the spec is usually very
helpful in that.

I also have some friends at a very high-profile entertainment company who
use WebLogic (off topic...) and they use the Struts framework in that
environment for an extremely high-traffic, high-security, yadda yadda
deployment that has exactly the kinds of flexibility requirements you're
asking for.  Struts is written to the servlet spec, so it's almost
invariably portable.

You might not know about the request dispatcher object too.
javax.servlet.http.RequestDispatcher -- or maybe it's
javax.servlet.RequestDispatcher.  This has a "forward" method that allows
you to internally forward a request on the server to another servlet or jsp.
In fact this is how my apps work -- servlets take all user input, and do all
the processing / database work / error-intensive / security-conscious tasks,
etc. -- and then forward the request to a simple display-only jsp (after
putting items into the request scope hashtable).  This is kind of the
"right" way to do things, although there are obviously a million shades of
gray.  I can forward to A.jsp if condition A is satisfied, or B.jsp
otherwise, etc.

Does this help?

cheers
fillup


On 6/3/02 6:17 PM, "Gus Heck" <sparverius@telocity.com> wrote:

> But this is within the servlet/jsp page, not the config file. unless I
> misunderstand you. there is no response until a page has been settled on for
> processing right? This means to redirect a request I would have to have a
> phantom page that tomcat decided to serv that then redirected to the real
> page. One of the top features of redirection is to have the user ask for one
> thing, and not need it to exist physically on the file system.
> 
> Of course I may be entirely missing something here :)
> 
> Actually I expect that I am missing something which is why I have asked
> tomcat users :)
> 
> Gus
> 
> ----- Original Message -----
> From: "Phillip Morelock" <subscriptions@phillipmorelock.com>
> To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> Sent: Monday, June 03, 2002 8:35 PM
> Subject: Re: Does Tomcat want to stand alone?
> 
> 
>> response.encodeUrl  for url rewriting methinks....
>> 
>> I almost invariably use Tomcat as a standalone server, for your average
>> website where you might use something like php or whatever, but you want a
>> more "robust" application design, it's fine.
>> 
>> Content negotiation is a pit I have not stepped into, maybe someone else
> can
>> speak more to that.
>> 
>> fillup
>> 
>> 
>> On 6/3/02 5:29 PM, "Gus Heck" <sparverius@telocity.com> wrote:
>> 
>>> Hi,
>>> 
>>> I've been playing with tomcat a little bit, I like JSP, and it does that
> well,
>>> but when it comes to operating on it's own as a web server, I have been
> a bit
>>> frustrated. I don't seem to be able to find mechanisms in Tomcat that
> support
>>> things like URL rewriting or content negotiation. Granted that content
>>> negotiation can be acheived with java code, and I suspect one could also
> write
>>> java to do something that aproximated rewriting, but these are standard
>>> features of most web servers, and I am wondering if this functionality
> exists
>>> and I am not finding it within tomcat, or if there are implementations
> of this
>>> functionality available somewhere. It seems silly to have to write this
> sort
>>> of thing that is standard on other servers.
>>> 
>>> If not, is this something Tomcat is working towards?
>>> 
>>> I'm fond of metaphors, so let me ask it another way:
>>> 
>>> Is Tomcat destined to be as independant as it's namesake, or is it
> really a
>>> housecat that will always be found sitting in the window at 1 httpd way?
>>> 
>>> Gus
>>> 
>> 
>> 
>> --
>> To unsubscribe, e-mail:
> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>> For additional commands, e-mail:
> <mailto:tomcat-user-help@jakarta.apache.org>
>> 
>> 
>> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message