You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Gus Heck <sp...@telocity.com> on 2002/06/04 02:29:23 UTC

Does Tomcat want to stand alone?

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

Re: Does Tomcat want to stand alone?

Posted by Phillip Morelock <su...@phillipmorelock.com>.
On 6/4/02 8:37 PM, "Gus Heck" <sp...@telocity.com> wrote:

> I don't think it is so hard to do the java part, and I suspect that the
> tomcat part isn't that hard either, but I am really criticising the
> documentation more than anything else. I am not opposed to extra keystrokes
> for benefits of java, but I do really dislike reading page after irrelevant
> page hoping to stumble on the nugget I need. I feel that the documentation
> focuses on the neat cool things that tomcat does that non java servers
> don't, and omits the routine basic stuff. Even if it takes a few more
> keystrokes or some extra thought in Tomcat, I shouldn't have trouble finding
> out how to turn of directory indexing. (for example).
> 
> Gus

Yeah that one is particularly nasty.  I agree with you on all your points, I
guess I'm just one of those people who's invested so much of this time on
"irrelevant keystrokes" that I can't turn back :)

The benefits continue -- I've actually found that because I've had to find
out so much about the guts of Tomcat, my knowledge and skills are very
portable because I know all these dirty tricks, irrelevant keystrokes, and
hidden corners -- that perhaps some implementations document better than
others. 

The other funny little paradox is:
Tomcat 4 has 10 times as much official documentation as Tomcat 3, but Tomcat
4 is 50 times more complex to use than Tomcat 3.  Well, not really...but
there is a sneaky ratio like this at play.

fillup


> 
> ----- Original Message -----
> From: "Eric Hollander" <hh...@mobile.mp>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> Sent: Tuesday, June 04, 2002 10:51 PM
> Subject: Re: Does Tomcat want to stand alone?
> 
> 
>> On Monday 03 June 2002 18:24, you wrote:
>>> My impression of Tomcat is that one winds up having to learn ALL of it's
>>> features at once. It is also very hard to find out answers to simple
> things
>>> on their web site... like how do you turn off directory indexing in
> Tomcat?
>>> I can find stuff on security managers, jndi and class loaders, but
> whenever
>>> I have a simple question I get stuck.
>> 
>> One of the common criticisms about Java is that it's great for big-scale
>> stuff but it's harder to use for small stuff.  This really is true, and
> it's
>> also true for Tomcat.  You can learn perl very quickly and you can write a
>> basic cgi and install it in apache very quickly.  Just learning how to
>> install and get Tomcat started is a challenge.  Just writing "hello world"
> is
>> vastly more complicated.  You can write a hello-world cgi in two lines.
> In
>> Java you need to install everything, and then subclass Servlet, and set up
>> web.xml, etc, etc.  So you are right, you need to learn a lot more to do
>> simple stuff, but it works a lot better when you need to do big stuff.
>> 
>> But if you are already familiar with java and tomcat it because very quick
>> and easy to set up simple applications.
>> 
>> --
>> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>> 
>> 
>> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Does Tomcat want to stand alone?

Posted by Gus Heck <sp...@telocity.com>.
I don't think it is so hard to do the java part, and I suspect that the
tomcat part isn't that hard either, but I am really criticising the
documentation more than anything else. I am not opposed to extra keystrokes
for benefits of java, but I do really dislike reading page after irrelevant
page hoping to stumble on the nugget I need. I feel that the documentation
focuses on the neat cool things that tomcat does that non java servers
don't, and omits the routine basic stuff. Even if it takes a few more
keystrokes or some extra thought in Tomcat, I shouldn't have trouble finding
out how to turn of directory indexing. (for example).

Gus

----- Original Message -----
From: "Eric Hollander" <hh...@mobile.mp>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Tuesday, June 04, 2002 10:51 PM
Subject: Re: Does Tomcat want to stand alone?


> On Monday 03 June 2002 18:24, you wrote:
> > My impression of Tomcat is that one winds up having to learn ALL of it's
> > features at once. It is also very hard to find out answers to simple
things
> > on their web site... like how do you turn off directory indexing in
Tomcat?
> > I can find stuff on security managers, jndi and class loaders, but
whenever
> > I have a simple question I get stuck.
>
> One of the common criticisms about Java is that it's great for big-scale
> stuff but it's harder to use for small stuff.  This really is true, and
it's
> also true for Tomcat.  You can learn perl very quickly and you can write a
> basic cgi and install it in apache very quickly.  Just learning how to
> install and get Tomcat started is a challenge.  Just writing "hello world"
is
> vastly more complicated.  You can write a hello-world cgi in two lines.
In
> Java you need to install everything, and then subclass Servlet, and set up
> web.xml, etc, etc.  So you are right, you need to learn a lot more to do
> simple stuff, but it works a lot better when you need to do big stuff.
>
> But if you are already familiar with java and tomcat it because very quick
> and easy to set up simple applications.
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Does Tomcat want to stand alone?

Posted by Phillip Morelock <su...@phillipmorelock.com>.
On 6/4/02 7:51 PM, "Eric Hollander" <hh...@mobile.mp> wrote:

> On Monday 03 June 2002 18:24, you wrote:
>> My impression of Tomcat is that one winds up having to learn ALL of it's
>> features at once. It is also very hard to find out answers to simple things
>> on their web site... like how do you turn off directory indexing in Tomcat?
>> I can find stuff on security managers, jndi and class loaders, but whenever
>> I have a simple question I get stuck.
> 
> One of the common criticisms about Java is that it's great for big-scale
> stuff but it's harder to use for small stuff.  This really is true, and it's
> also true for Tomcat.  You can learn perl very quickly and you can write a
> basic cgi and install it in apache very quickly.  Just learning how to
> install and get Tomcat started is a challenge.  Just writing "hello world" is
> vastly more complicated.  You can write a hello-world cgi in two lines.  In
> Java you need to install everything, and then subclass Servlet, and set up
> web.xml, etc, etc.  So you are right, you need to learn a lot more to do
> simple stuff, but it works a lot better when you need to do big stuff.

Very succinct statement.

> But if you are already familiar with java and tomcat it because very quick
> and easy to set up simple applications.

I find this is especially true after you've done a project or two with it,
and you have all sorts of framework code lying around.

fillup


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Does Tomcat want to stand alone?

Posted by Eric Hollander <hh...@mobile.mp>.
On Monday 03 June 2002 18:24, you wrote:
> My impression of Tomcat is that one winds up having to learn ALL of it's
> features at once. It is also very hard to find out answers to simple things
> on their web site... like how do you turn off directory indexing in Tomcat?
> I can find stuff on security managers, jndi and class loaders, but whenever
> I have a simple question I get stuck.

One of the common criticisms about Java is that it's great for big-scale 
stuff but it's harder to use for small stuff.  This really is true, and it's 
also true for Tomcat.  You can learn perl very quickly and you can write a 
basic cgi and install it in apache very quickly.  Just learning how to 
install and get Tomcat started is a challenge.  Just writing "hello world" is 
vastly more complicated.  You can write a hello-world cgi in two lines.  In 
Java you need to install everything, and then subclass Servlet, and set up 
web.xml, etc, etc.  So you are right, you need to learn a lot more to do 
simple stuff, but it works a lot better when you need to do big stuff.

But if you are already familiar with java and tomcat it because very quick 
and easy to set up simple applications.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Does Tomcat want to stand alone?

Posted by Phillip Morelock <su...@phillipmorelock.com>.
On 6/3/02 9:24 PM, "Gus Heck" <sp...@telocity.com> wrote:

> Your response is helpful, though I can't tell if it will help until I check
> out struts, and attempt to create a dispacher like you describe. At least
> now I have some more leads... still it seems that there should be a simple
> option that provides the simple functionality. Flexability and power is
> great, but sometimes one only wants part of the power... and just wants the
> rest to work like it does elsewhere.
> 
> I am not yet at the point where I am writing full scale web apps. I hope to
> do that sort of thing eventually, but for the moment I just want the ability
> to do some dynamic content,

Understandable.  I still use PHP for this purpose.

> and respond to forms taking advantage of the
> relatively safe, and secure Java platform to keep people from doing nasty
> things to my home server when I don't quite check cgi input right or screw
> up the permissions on a script.

Security is definitely one of the best reasons to use Java.  I do think
security stuff has improved considerably since the "olden days" of cgi --
and I think that less-powerful-but-more-specialized solutions (like PHP) are
also considerably more secure than they used to be.

> My impression of Tomcat is that one winds up having to learn ALL of it's
> features at once. It is also very hard to find out answers to simple things
> on their web site... like how do you turn off directory indexing in Tomcat?
> I can find stuff on security managers, jndi and class loaders, but whenever
> I have a simple question I get stuck.

I don't know that you have to learn *all* of the features.  But I will
definitely grant you that working with Servlet/JSP stuff is much more
application programming than simple scripting.  People looking to use JSP as
an easy scripting platform are in for some hard times.

Again, nothing to feel bad about -- there are a thousand other things that
someone like me hasn't learned -- I just happened to like tomcat when I
first used it, and I stuck with it for application development, but
certainly not for the sort of quick cgi type of stuff, as I find it
cumbersome for that.

> 
> Thanks,
> Gus

Cheers,
Phillip

> 
> ----- Original Message -----
> From: "Phillip Morelock" <su...@phillipmorelock.com>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> Sent: Monday, June 03, 2002 9:16 PM
> Subject: Re: Does Tomcat want to stand alone?
> 
> 
>>> 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" <sp...@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" <su...@phillipmorelock.com>
>>> To: "Tomcat Users List" <to...@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" <sp...@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:
>>> <ma...@jakarta.apache.org>
>>>> For additional commands, e-mail:
>>> <ma...@jakarta.apache.org>
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> --
>>> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
>>> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>>> 
>> 
>> 
>> --
>> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>> 
>> 
>> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Does Tomcat want to stand alone?

Posted by Gus Heck <sp...@telocity.com>.
Your response is helpful, though I can't tell if it will help until I check
out struts, and attempt to create a dispacher like you describe. At least
now I have some more leads... still it seems that there should be a simple
option that provides the simple functionality. Flexability and power is
great, but sometimes one only wants part of the power... and just wants the
rest to work like it does elsewhere.

I am not yet at the point where I am writing full scale web apps. I hope to
do that sort of thing eventually, but for the moment I just want the ability
to do some dynamic content, and respond to forms taking advantage of the
relatively safe, and secure Java platform to keep people from doing nasty
things to my home server when I don't quite check cgi input right or screw
up the permissions on a script.

My impression of Tomcat is that one winds up having to learn ALL of it's
features at once. It is also very hard to find out answers to simple things
on their web site... like how do you turn off directory indexing in Tomcat?
I can find stuff on security managers, jndi and class loaders, but whenever
I have a simple question I get stuck.

Thanks,
Gus

----- Original Message -----
From: "Phillip Morelock" <su...@phillipmorelock.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Monday, June 03, 2002 9:16 PM
Subject: Re: Does Tomcat want to stand alone?


> > 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" <sp...@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" <su...@phillipmorelock.com>
> > To: "Tomcat Users List" <to...@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" <sp...@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:
> > <ma...@jakarta.apache.org>
> >> For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >>
> >>
> >>
> >
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Does Tomcat want to stand alone?

Posted by Phillip Morelock <su...@phillipmorelock.com>.
> 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" <sp...@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" <su...@phillipmorelock.com>
> To: "Tomcat Users List" <to...@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" <sp...@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:
> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>> 
>> 
>> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Does Tomcat want to stand alone?

Posted by Gus Heck <sp...@telocity.com>.
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" <su...@phillipmorelock.com>
To: "Tomcat Users List" <to...@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" <sp...@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:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Does Tomcat want to stand alone?

Posted by Phillip Morelock <su...@phillipmorelock.com>.
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" <sp...@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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>