IDependOn-Set: 1
IDependOn-Set: 2
IDependOn-Set: 41
IDependOn-Set: 46
IDependOn-Set: 47
IDependOn-Set: 7
LastModifiedSecs: 936751058
Parent: 7
SequenceNumber: 11
Title: How do I make hits on 'http://www.myserver.com/' go to a servlet?  or  Aliasing / to a servlet
Part: 0
Author-Set: jon@working-dogs.com
HideAttributions: 1
LastModifiedSecs: 921178320
Type: monospaced
Lines: 76

----------
From: "Umesh R. Patil" <upatil@bigfoot.com>
To: "'java-apache-users@list.working-dogs.com'" <java-apache-users@list.working-dogs.com>
Subject: / alias
Date: Thu, Mar 11, 1999, 10:48 AM


URL rewriting may be a solution for you:

At the end of httpd.conf add:
-----------------------------

</IfModule>

LoadModule rewrite_module modules/ApacheModuleRewrite.dll

<IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule ^/(.*)  /myZone/slash?data=$1 [PT]
</IfModule>

What this does is rewrite urls so that your servlet gets invoked
with anything following the first slash in the URI.

I haven't tested this but it could get you going...

Umesh.

On Thursday, March 11, 1999 9:05 AM, John Frailey [SMTP:john@ecstreet.com] 
wrote:
> This may sound like a simple request... but I am having all kinds of trouble
> figuring
> out a way to do this:
>
> we host many sites. we build the same servlets that are used among many
> sites.
> depending on the site, we may write to different database tables, or perfom
> different reads from files or db.
>
> my problem is this... I am trying to make a url that looks clean. that is
> just our
> domain, and then the hosted customer name like so:
>     http://ourdomain.com/abc
>     http://ourdomain.com/xyz
>
>     I want to make my servlet aliased to /
>     this would allow me to parse the abc and xyz appropriately. I realize
> that all
> request at that domain will go through that servlet. thats ok. I have set up
> a domain
> just for that reason.
>
> I have set up a zone called slash with a mounting point of / but it seams
> that the
> alias name starts after the slash. I use several different servlet engines,
> (all with
> apache) and can accomplish this with what they call a mapping. (Jrun term)
> Set up
> a map for my servlet name ie ( store.class -> /) to slash.
>
> Is there any idea's on how to get this same functionality with jserv.
> Everything else
> works so good... I they really did a great job of cleaning up the install...
> went
> perfect first time through...
>
> Thanks for any ideas...
>
> p.s. we also offer another option to our cust. that let them get a dns
> entry. this would
> then look like :
>     abc.<ourdomain>.com/store (servlet here is store)
>     but this requires a new dns entry, and a KILHUP on dns. we would like to
> have     a  realtime, non disruptive way like above for an alternative...

EndPart: 0
Part: 1
Author-Set: nnordrum@isd.net
HideAttributions: 1
LastModifiedSecs: 935558760
Type: monospaced
Lines: 15
If all you want to do is "forward" any requests to 
http://www.xxx.com/
to a servlet you can create an index.html file with the following:
<HTML>
<HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="1; URL=/servlets/Store">
<TITLE>[INSERT TITLE HERE]</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
</BODY>
</HTML>

====================================================================
Just replace "/servlets/Store" with the servlet you want to "forward" to.
Clean, simple solution. Works greate. KISS.
EndPart: 1
Part: 2
Author-Set: jon@working-dogs.com
HideAttributions: 1
LastModifiedSecs: 936750897
Type: monospaced
Lines: 53


----------
From: Bernie Bernstein <bernard@corp.talkcity.com>
To: "Java Apache Users" <java-apache-users@list.working-dogs.com>
Subject: Re: Way to make all urls go through one servlet?
Date: Tue, Aug 31, 1999, 9:29 PM

>Say I have a domain http://www.mydomain.com and I want to have all the
>urls that start with /thisdir call a specific servlet as a handler.
>This servlet can then look at the path requested and take the
>appropriate action.
>
>So http://www.mydomain.com/thisdir/status/ would call the servlet as
>would http://www.mydomain.com/thisdir/update/ etc.
>
>I want the one servlet to handle requests for all those paths.
>


... in httpd.conf ...

<IfModule mod_rewrite.c>
RewriteEngine On
# anything else gets appended to /tc/meta
RewriteRule ^(.*) /myzone/myservlet$1 [PT]
</IfModule>



Set up the zone "myzone" which includes servlet "myservlet" and then all
requests will get passed through that servlet.

eg.

http://www.mydomain.com/thisdir/status/

will expand to:

http://www.mydomain.com/myzone/myservlet/thisdir/status/

and

http://www.mydomain.com/

expands to:

http://www.mydomain.com/myzone/myservlet



IMPORTANT: Be sure that mod_jserv is loaded before mod_rewrite.

EndPart: 2
Part: 3
Author-Set: jon@working-dogs.com
HideAttributions: 1
LastModifiedSecs: 936751058
Type: monospaced
Lines: 22
----------
From: Jonathan Tew <jtew@bpsinfo.com>
To: Java Apache Users <java-apache-users@list.working-dogs.com>
Subject: Re: Way to make all urls go through one servlet?
Date: Wed, Sep 1, 1999, 7:21 AM


To whoever else might be trying to accomplish this...

Finally got it working without a core dump.  Your examples below were
correct, but there was some additional changes I had to make.  Since I
statically compiled in the modules I had to make sure that mod_jserv
appearred *ABOVE* (<-- very important) mod_rewrite in modules.c  This
wasn't the default from how Configure created modules.c  Then I had to
make sure that the JServ stuff appearred before the rewrite stuff in the
configuration file.

I'm still of the opinion that mod_rewrite is voodoo magic... I've got to
get a book on regular expression and really learn them.  That one class
back in college just doesn't make ya an expert!

Jonathan Tew
EndPart: 3
