Re: mod rewrite, RequestDispatcher and intercepting requests to the server

2001-03-06 Thread Mel Martinez


--- Michael Tickle [EMAIL PROTECTED]
wrote:
 I am attempting to intercept all requests to a
 server so I can extract
 information from the header.  I would then like to
 pass the request on to
 the server for it to display the user the requested
 page.

Sounds straightforward.

 
 I am led to believe that TomCat can not direct all
 requests to it on to a
 servlet - is this correct?  

Uh? What exactly are you trying to say here?  If you
are saying that tomcat can not be configured to send
every single request all to the same servlet, then I'm
not sure that's true.

Couldn't you setup servlet pattern-mapping like so:

servlet-mapping
servlet-name
DelagatorServlet
/servlet-name
url-pattern
/
/url-pattern
/servlet-mapping
servlet-mapping
servlet-name
DelagatorServlet
/servlet-name
url-pattern
*
/url-pattern
/servlet-mapping

You may need a couple of other patterns like "/*.*" or
"/*/*" as I'm not sure of the exact behavior of the
wild-card algorithm used in TC.

You may also want to define your own context for
"webapps/" to intercept activity there from going to
webapps/ROOT instead of to your application context.

I won't claim that this is simpler or better than just
using Apache's rewrite module.  It is recommended you
use apache anyway for serving static content, so it
may be simplest to just settup some RewriteRules to do
this (funnel all requests to a single servlet).

 I have installed apache and using mod rewrite all
 requests are forwarded on
 to my servlet.  The servlet the extracts the header
 information.  The
 problem then is showing the user the requested page.
  Ideally I would just
 like to return the request to the server and let it
 deal with it. I am told
 the closest to this is RequestDispatcher.  However
 RequestDispatcher seems
 only to be able to use relative linking - this will
 not work for me as I
 want to go from
 http://win2k:9090/servlet/myservlet?To=/index.html
 to
 http://win2k/index.htm
 
 Firstly is there a better way of doing what I am
 trying to do?

You want to use the HttpServletResponse.sendRedirect()
method instead of RequestDispatcher.forward().  The
forward() method only accesses urls reachable in the
current servlet engine thus they must be relative URLs
or 'absolute' relative to the current servlet context
path.  The sendRedirect() method is an actual HTTP
redirect that tells the browser to go somewhere else.

Keep in mind that neither a forward() or a
sendRedirect() will work once the response has been
committed, which can happen if you modify request
headers or write more output to the response than the
buffer size (8k I believe).

 
 Secondly is there a similar feature to
 RequestDispatcher that can use full
 URLs not relative URIs?
 

HttpServletResponse.sendRedirect()


 Thirdly has TomCat got any rewrite functionality (CF
 mod rewrite) since if I
 can not pass the request back to the apache domain I
 will have to somehow
 rewrite all the URLs in the tomcat domain.
 

TOmcat has pretty minimal rewrite capability
(basically the servlet-naming tag above).  This sounds
like a prime candidate for an Interceptor for a future
version (ideally it work consistently with apache
mod_rewrite rules in effect) but is not trivial and
probably won't happen real soon.

However, as indicated above, you should be able to
solve your problem by using sendRedirect() to send the
requests back to apache (or wherever).

Cheers,

Mel


__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: mod rewrite, RequestDispatcher and intercepting requests...

2001-03-06 Thread Mel Martinez


--- Michael Tickle [EMAIL PROTECTED]
wrote:
 I am currently using apache to sent all requests to
 my servlet with
 
 RewriteRule ^(.*)/(.*)
 http://win2k:9090/servlet/redirect?To=/$2 [R,L]
 
 so my servlet gets the parameter To and knows what
 page the user requested.

That needs to have some more 'smarts' added to it.

 
 I just tried
 response.sendRedirect("http://win2k/index.html");
 but that does not work with my rewrite rule as the
 page is redirected back
 to the servlet.  

Of course it won't!  Your rewrite rule is immediately
forwarding it 'back' to the servlet! :-)

1) request comes to apache
2) your rewrite rule sends it to tomcat servlet
3) tomcat servlet redirects it to apache
4) repeat at (2) !!!

You need to put some clue to the Rewrite Engine to
tell it that you don't want a URL to be rewritten
further.

I would suggest that you preprocess the url in your
servlet before you do the sendRedirect to embed some
clue such as rewriting it as:

http://win2k/index.html -
http://win2k/index.html?DELEGATED=true

or whatever.  Next, modify your rewrite rule to have a
conditional:

RewriteCond  $0  !.*/DELEGATED.*
RewriteRule ^(.*)/(.*)
http://win2k:9090/servlet/redirect?To=/$2 [R,L]

This will make your rule skip any URL with the 'clue'
you've embedded.
Next, apply a rule to remove the 'clue'

RewriteCond $0 .*/DELEGATED.*
RewriteRule (.*)/DELEGATED(.*) $1$2

don't redirect this time or you'll just jump back into
the cycle.

Alternatively, you might just add a query string param
or set some other request info to act as your 'clue'.

Still another alternative is to simply run another
Apache server instance or virtual host that does NOT
apply your rewrite rule.  There are lots of
strategies.  Use your imagination.  :-)

I was informed that this would not
 happen with
 RequestDispatcher.


??? RequestDispatcher will only forward or include
requests to be serviced in the same servlet engine. 
It can not redirect back to apache.
 
 The other option I can think of is to turn all the
 HTML pages in to JSP and
 have the JSP collect the information (request page,
 referring page, date,
 time, user agent and session id) and send it to a
 servlet - would that be a
 better way of doing it?
 

It depends on your application.  I don't really have a
clear idea on what your high-level goal is here.

Good luck,

mel


__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: help: no stack trace in standard out

2001-02-25 Thread Mel Martinez

--- Jon Crater [EMAIL PROTECTED] wrote:
 
 but i can't get a stack trace printed to the
 standard out to save my
 life.
 any ideas?
 

Whether or not a stack trace gets printed is not a
function  of the logging level.  A stack trace will be
printed under the following conditions:

If an uncaught exception makes it through to the VM
runtime, a trace will printed by the runtime to
standard err (System.err).

If a catch() block in your code (or someone else's
code higher up the call chain) catches an exception
and proceeds to  explicitely print the stack trace.
Note - if you are throwing an exception that you
expect to show a trace at the runtime level, it is
possible that "someone else's code" is catching it and
ignoring it (a very bad practice but all too common).

Finally, you can always just create a Throwable object
and print the stack trace yourself.

To display the stack trace of a Throwable object to
System.err, you can just use the
Throwable.printStackTrace() method.  Thus, in your
code you might put:

try{
  // do something that throws a FooException
}catch(FooException e){
  e.printStackTrace();
}

Or, for debug purposes to find out how you got to your
code without relying on some Exception being thrown,
just do the following:

   //...do stuff...
   (new Throwable()).printStackTrace();
   //... continue doing other stuff...

The only problem with the above technique is that
there is no control over formatting or where the
message goes.  It always goes straight to stderr.  To
change that, you can capture the stack trace in a
String using a simple method like so:

/**
  utility function for retrieving the stacktrace of
  a Throwable object as a String for easy
manipulation.
  Useful for debugging.  Returns "" if it/i==null.
  @param bt/b a Throwable object.
  @return a String representation of the stack trace
  for it/i.
*/
public static String getStackTrace(Throwable t){
  if(t==null){
return "";
  }
  StringWriter sw = new StringWriter();
  t.printStackTrace(new PrintWriter(sw));
  return sw.toString(); 
}

Put the above method into a utility class (i.e.
'MyUtils' and then you can always grab the trace for a
throwable anywhere in your code with:

  String trace=MyUtils.getStackTrace(new Throwable());

That way, you can display the trace in an html page,
or search it or make it part of the message nested
inside another exception, or whatever.

Using stack traces like this is a very useful tool for
developing and debugging code, or for simply trying to
understand other folk's code.  Visual Debuggers are
useful too, but less reliable and not ubiquitous.

One tip:  You refer to wanting to print the trace to
'standard out'.  Just a bit of developer's philosophy,
but:

 Standard out - for program _output_ (i.e., the actual
  product of the application).  Example: 'more'
  displays text from files to stdout.
 Standard err - for program _debug_ and _error_
  messages.  Example, if 'more' can't find the file
  indicated, it prints an error message to stderr.

The distinction is important because conceptually,
these are two different io streams.  By default,
System.err prints to the same OutputStream as
System.out, but that is not necessarily always so. 
You can easily redirect one or the other using
System.setErr() or System.setOut().  By always sending
your debug and error messages to System.err, you
should not have to worry about forgetting to remove
all your debug statements and accidentally corrupting
your program's output.

Just my $.02.  Take it for what it's worth.  :-)

I hope this is helpful.

Mel
  



__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Macintosh and Java

2001-02-25 Thread Mel Martinez


--- S Lafredo [EMAIL PROTECTED] wrote:
 1. I am running MacOS 9.x, MRJ 2.2.4 and downloaded
 jakarta-tomcat-3.2.1
 I clicked on the Tomcat Start and a Java console
 opens and displays
 
 2001-02-25 12:40:09 - PoolTcpConnector: Starting
 HttpConnectionHandler
 on 8080

 So it looks like it is running correctly?
 
 I then run IE 5 (Netscape does not support MRJ?) and
 type localhost.
 Nada?

By default, standalone Tomcat listens to port 8080. 
Try:  http://localhost:8080/ instead.  Alternatively,
edit the ..:tomcat:conf:server.xml file to change the
port.

Tomcat ishould/i be able to run fine with MacOS 9
and MRJ 2.2.4, but may occasionally encounter a glitch
with file separator.  I've spotted more than one case
in the code already where folks have improperly
assumed they can use "/" as the file separator.  So
watch out for possible problems in that area (mac OS 9
uses ':', mac OS X can use either ':' or '/').

Rule of thumb:  When building file paths, be sure to
either use either the system property
System.getProperty("file.separator") or the public
field java.io.File.separator as the separator. 
Alternatively, you should just let the File object
build paths for you:

String base = "/some/path"; // arbitrary '/' here
String dname = "mydir";
String fname = "myFile.txt";
File f = new File(base);
f = new File(f,dname);
f = new File(f,fname);

The above would build "/some/path/mydir/myFile.txt" on
unix.  On a mac (assuming base=":some:path", the
result would be ":some:path:mydir:myFile.txt"

 
 2. Download Darwin, Apache for Darwin and Tomcat.sit
 or Tomcat.sit.hqx?
 While waiting for MacOS X.
 

If you want to run Apache, you will need to use Darwin
or Mac OS X public beta while waiting for Mac Os X. 
If you don't need Apache, then tomcat itself should
run fine on Mac OS 9.  MRJ 2.2.4 has many 'Java 2'
apis added on top of the offic 1.1.8 spec.

 3. Purchase SuSE 7.0 for PPC?
 

Drastic, but should work great.

 4. Something else?
 

If you have at least a 500MHz G3 box, running Apache
on Linux or WinNT inside Virtual PC v4 should be
actually viable unless you expect a lot of traffic
(i.e. it should be fine for development).

Cheers,

Mel

__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: TC3.2.1 - response commit on included JSPs

2001-02-21 Thread Mel Martinez


--- Incze Lajos [EMAIL PROTECTED] wrote:
 Maybe it's not correct in general but the JSP 1.1
 syntax
 contains the flush="true" attribute - obligatory in
 case
 of jsp:include. So, it's inconvenient but tomcat3 is
 an
 jsp 1.1 implementation. Am I missing something?
incze

The JSP 1.1 spec says that the current response buffer
should be flushed _prior_ to the inclusion.  In other
words, the flush="true" requirement is talking about
what should happen at level of the calling page.  In
normal java servlet code this is saying :

if(buffered  flush==true){ //JSP1.1 flush always
true
  out.flush();
}
requestDispatcher.include(...);
//continue...

All this is saying is that, at least for JSP 1.1, we
are required to write everything we've put in the
buffer now before we add more to the buffer from the
included resource.  This requirement is supposed to
happen on the CALLING page, not in the INCLUDED page. 
I will note that TC3.2.1 does not actually do this
correctly and if it tried, it would break because of
the same root cause to the problem I am talking about
here.

The problem I am talking about is independent of the
_calling_ page.  

The problem is caused by the nature of the JSP servlet
that is generated by TC3.2.1.  It cannot properly be
included (dynamically) from either a JSP *OR* a
servlet because when it exits, it always sets the
isCommitted() flag of the response.  It should not do
that if the page is processing a request as an
'include' action because only the parent, calling
servlet or jsp should Commit the response.

As explained, the reason it always sets the
isCommitted() state is due to the sequence:

1) Every JSP page generated by TC3.2.1 has a finally{}
block that invokes out.flush() and...
2) For some reason the TC 3.2.1 JspWriterImpl
implementation of out.flush() commits the response
even BEFORE it calls response.flushBuffer()!
3) Also, out.flush() ALWAYS calls
response.flushBuffer() even if processing an included
request.

IMHO out.flush() should not commit the response.  Only
response.flushBuffer() should commit the response. 
And response.flushBuffer() should not be called from
an inside an 'include' request.

What probably SHOULD happen is the following:

1) Response.flushBuffer() alone should be used to set
the commit state.  But it should NEVER be called from
within an include action which can be checked with:

Obj incl = request.getAttribute(
 "javax.servlet.include.servlet_path");
if(incl==null){
  response.flushBuffer();
}

2) It is probably fine for out.flush() to be called at
the end of every JSP page.  Optionally, a check like
in
(1) could be used to call response.flushBuffer().

3) MOST IMPORTANTLY - JspWriterImpl needs to be
rewritten so as to flush the output stream, but NOT to
commit the response and NOT to call
response.flushBuffer()!

I'd say that I consider this a serious bug because it
makes it impossible for a JSP page to be included in
any other JSP or even a Java Servlet except as the
last committment to the response - which means that it
is essentially only a 'forward' action.

Also, the fact that out.flush() (incorrectly) commits
the response actually means that technically TC3.2.1
can not be made compliant with the very spec you cite
because if it DID enforce the flush="true" attribute
and then tried to include a resource (or do ANY output
or forward or redirect), an error would occur becuase
(as I've stated) the response would already be
committed as soon as out.flush() got called.

"Fortunately", tc3.2.1 is currently broken in this
regard and is NOT actually flushing the output before
the include.  If the above problem in out.flush() is
fixed, then this should be fixed as well.

This bug has thrown a HUGE wrench into my current
project and I'm not sure how I'm going to address it
in the short term. 

Hasn't someone noticed this before?  Is this problem
fixed in either of the later versions (3.3 or 4.0)?

If so, I may need to upgrade and I really hate having
to upgrade to non-release versions of software since
that entails a whole lot of risk/justification I have
to explain to my clients.

Sigh... if it ain't one thing, it's another...

Mel


__
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: TC3.2.1 - response commit on included JSPs

2001-02-21 Thread Mel Martinez


--- Larry Isaacs [EMAIL PROTECTED] wrote:
 to the spec.  Your discussion below about the
 JspWriterImpl
 seems to be something different.
 
 So rather than quess, let me ask exactly what are
 you
 referring to when you say, "dynamic include of a JSP
 page"?
 
 Is this jsp:include..., PageContext.include(),
 RequestDispatcher.include(), or am I off track here?
 

Yes, by 'dynamic' include (the above) I was making the
distinction from a 'static' include, which would be
done with the syntax %@ include file="blah.txt" %.

The problem with the TC3.2.1 behavior is that after
performing a dynamic include (using any of the above
three methods), of a _JSP_ resource (served by
TC3.2.1), the response will be committed.  Note that
if you do a dynamic include of some other resource
(such as a servlet) the response would not necessarily
be committed (and generally shouldn't be unless a
forward or redirect occurs).

Mel

__
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: POST Method

2001-02-20 Thread Mel Martinez

I'm encountering a slightly different problem with
POST.

I'm using tc3.2.1 and apache 1.3.17 on win32 for dev
purposes (we haven't yet setup the linux boxes that
will be used for production).

When send a request from a form method=POST... to
tomcat via Apache, it gets invoked okay, but the
parameters of the form don't get there!  That is, when
I print out the results of request.getParameters() it
is empty.

If I send the request directly to tomcat, it works
fine.  If I send the request using GET instead of
POST, via either Apache or Tomcat, then it works fine.

I am wondering if the problem I'm having is due to the
use of a RewriteRule that uses [R] to redirect the
request?  Does a Rewrite/[R] cause a problem for a
POST request?

In your example below that 'worked', did you try
printing out the result of the request.getParameters()
call?

Mel

--- Jiri Trnka [EMAIL PROTECTED] wrote:
   Hello
 
   I have an interesting problem. I have Tomcat 3.2.1
 working with Apache 1.3 on
 RedHat 6.22. I am invoking servlet with POST method.
 
   public void doPost(HttpServletRequest request,
 HttpServletResponse response)
   throws IOException, ServletException  {
 
 response.setContentType("text/html");
 PrintWriter out = response.getWriter();
 
 out.println("htmlSome html/html");
   }
 
   This simple example will work with Tomcat but not
 with Tomcat-Apache
   If I add a simple line
 
  public void doPost(HttpServletRequest request,
 HttpServletResponse response)
   throws IOException, ServletException  {
 
 response.setContentType("text/html");
 Enumeration e = request.getParameterNames();
 PrintWriter out = response.getWriter();
 
 out.println("htmlSome html/html");
   }
 
   example would work.
 
   Can someone explain me this? I think maybe there
 is problem with mod_jk.so.
 
Thanks.
 
Jiri Trnka
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, email:
 [EMAIL PROTECTED]
 


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Aliases/Rewrites (was: ajp12 vs ajp13 mod_jk.conf-auto

2001-02-16 Thread Mel Martinez


--- Jan Labanowski [EMAIL PROTECTED] wrote:
 It is my (and others) experience that mod_jk has to
 be loaded BEFORE
 mod_rewrite for it to act responsibly. In your case
 the mod_rewrite is 
 linked statically, i.e., loaded before mod_jk. I
 would suggest to
 make both mod_jk and mod_rewrite DSO, and load/add
 module mod_jk before
 mod_rewrite. Remember to comment out the 
   # LoadModule jk_module libexec/mod_jk.so  
 in mod_jk.conf
 

Ya know, I'm almost 100% positive I tried this before
to no affect, but being in a mad dash to fix things, I
may spoiled that test by simultaneously changing
something else.  At any rate, with mod_jk loaded
before mod_rewrite (in my case, I am able to simply
perform the include of mod_jk.conf-auto before I do
any rewrites) it seems to work.  I also had a stupid
syntax error in my rewrite expression so maybe that
was it.

Amazin' how much time one can spend fixin' somethin'
that ain't broke...

Mel


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




mod_vhost_alias.c

2001-02-15 Thread Mel Martinez

I realize this is an apache question, but...

could someone give me a link to a download site for
mod_vhost_alias.c ?  I can compile src if necessary
for solaris and linux, but I need a precompiled binary
for NT.

Everytime I try to search the internet for
mod_vhost_alias I get a zillion links to the apache
documentation page for this module (because every guy
and his dog using apache has left the 'manuals'
directory exposed to the world) but no link to the
actual module!

Thanks in advance.

Mel


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Aliases/Rewrites (was: ajp12 vs ajp13 mod_jk.conf-auto

2001-02-15 Thread Mel Martinez

Filip,

--- Filip Hanik [EMAIL PROTECTED] wrote:
  Now, if I could just get someone to tell me why
 apache
  Alias and Rewrites are not working with tomcat...
 
 tell us what you are trying to do and send us some
 sample config files and
 how your environment is setup. is becomes much
 easier than to answer the
 question above, because alias works very well for me
 :)
 

Well, actually, I've twice posted detailed
descriptions of what I'm trying to accomplish on this
topic and gotten zero replies, but here goes another
attempt...

I'm using Apache 1.3.14 and tomcat 3.2.1 with
mod_jk.c.  I don't know if the latter is the 'latest'
version of mod_jk.c - I grabbed it from the tomcat
download site two weeks ago.  I am running this on
WinNT using downloaded binary versions of the relevant
software.

I have setup my application ("myapp") as a directory
inside the webapps/ directory, complete with WEB-INF
subdirectory and such.

I have apache configured to apply an alias or a
rewrite rule to a reqest:
#--
IfModule !mod_rewrite.c
LoadModule rewrite_module
n:/opt/local/apache/modules/ApacheModuleRewrite.dll
/IfModule

RewriteEngine On
RewriteLog log/apache_logs/rewrites.log
RewriteLogLevel 9
RewriteOptions inherit
RewriteRule ^/myapp/(.*)/common/(.*) /myapp/common/$2
#-


I can tell from the rewrites.log that it is indeed
getting applied:

 (2) init rewrite engine with requested uri
/myapp/folder1/common/mypage.jsp
 (3) applying pattern '^/myapp/(.*)/common/(.*)' to
uri '/myapp/folder1/common/mypage.jsp'
 (2) rewrite /myapp/folder1/common/mypage.jsp -
/myapp/common/mypage.jsp
 (2) local path result: /myapp/common/mypage.jsp
 (1) go-ahead with /myapp/common/mypage.jsp [OK]

The idea here is simple: the request

/myapp/folder1/common/mypage.jsp

should result in a request for

/myapp/common/mypage.jsp

The rewrite rule works great.  This works great for
static stuff (i.e. html) served up by Apache. 

The *problem* is that Tomcat is not getting the
translated request, it is getting the original one:

/myapp/folder1/common/mypage.jsp
 
Since no file in that path actually exists, naturally
it returns a file not found error.  Tomcat DOES
happily find, compile and execute requests for
servlets and jsp pages that are in paths that do exist
such as

/myapp/folder1/myother.jsp

I have apache configured to send requests to tomcat
via ajp13 by including mod_jk.conf-auto just after the
above rewrite rule:

# include configuration for tomcat servlet engine:
#
Include n:/opt/demo/conf/mod_jk.conf-auto
#

I've configured server.xml very minimally, no custom
contexts or anything.  About the only thing changed
here is I've enabled ajp13 and then setup
workers.properties to map requests to it.  I doubt any
of this is relevant because I see the exact same
behavior even with 'raw' server.xml and
worker.properties files.

Note that I get the same behavior if I use an Alias
instead of a rewrite:

#--
Alias (.*)/myapp/(.*)/common/(.*) $1/myapp/common/$3
#--

This rewrites static requests served by Apache, but
just like with rewrites, gets ignored by tomcat.

That's pretty much it.

Any suggestions as to what is (or is not) going on?

Basically, what I want to happen is that, after a
rewrite rule has been applied, that Tomcat should be
processing the modified URL, not the original.

Thanks in advance for any help!

Mel


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: mod_vhost_alias.c

2001-02-15 Thread Mel Martinez

Steve Ruby wrote:

 no.. really it's been in the standard distribution
 since 1.3.7
 any version 1.3.7 or newer should have it, I know
 the unix
 distributions to I assume it's in the win one too.


Then it seems the unix and Win distributions differ in
this respect. I just installed the Win NT version
(1.3.14) that I downloaded at most 2 1/2 weaks ago and
this is what is listed in the modules directory:

ApacheModuleAuthAnon.dll
ApacheModuleAuthDBM.dll
ApacheModuleAuthDigest.dll
ApacheModuleCERNMeta.dll
ApacheModuleDigest.dll
ApacheModuleExpires.dll
ApacheModuleHeaders.dll
ApacheModuleInfo.dll
ApacheModuleProxy.dll
ApacheModuleRewrite.dll
ApacheModuleSpeling.dll
ApacheModuleStatus.dll
ApacheModuleUserTrack.dll

The httpd.conf file only lists the following modules
for either static or dynamic load:

#ClearModuleList
#AddModule mod_so.c mod_mime.c mod_access.c mod_auth.c
mod_negotiation.c
#AddModule mod_include.c mod_autoindex.c mod_dir.c
mod_cgi.c mod_userdir.c
#AddModule mod_alias.c mod_env.c mod_log_config.c
mod_asis.c mod_imap.c
AddModule mod_actions.c mod_setenvif.c mod_isapi.c

#LoadModule anon_auth_module
modules/ApacheModuleAuthAnon.dll
#LoadModule dbm_auth_module
modules/ApacheModuleAuthDBM.dll
#LoadModule digest_auth_module
modules/ApacheModuleAuthDigest.dll
#LoadModule cern_meta_module
modules/ApacheModuleCERNMeta.dll
#LoadModule digest_module
modules/ApacheModuleDigest.dll
#LoadModule expires_module
modules/ApacheModuleExpires.dll
#LoadModule headers_module
modules/ApacheModuleHeaders.dll
#LoadModule proxy_module modules/ApacheModuleProxy.dll
#LoadModule rewrite_module
modules/ApacheModuleRewrite.dll
#LoadModule speling_module
modules/ApacheModuleSpeling.dll
#LoadModule info_module modules/ApacheModuleInfo.dll
#LoadModule status_module
modules/ApacheModuleStatus.dll
#LoadModule usertrack_module
modules/ApacheModuleUserTrack.dll

I don't see mod_vhost_alias.c anywhere in this.  Do
you?

Mel

--- Steve Ruby [EMAIL PROTECTED] wrote:
 Mel Martinez wrote:
  
  I realize this is an apache question, but...
  
  could someone give me a link to a download site
 for
  mod_vhost_alias.c ?  I can compile src if
 necessary
  for solaris and linux, but I need a precompiled
 binary
  for NT.
  
  Everytime I try to search the internet for
  mod_vhost_alias I get a zillion links to the
 apache
  documentation page for this module (because every
 guy
  and his dog using apache has left the 'manuals'
  directory exposed to the world) but no link to the
  actual module!
  
  Thanks in advance.
  
  Mel
  
 
 
 httpd.apache.org
 
 
 no.. really it's been in the standard distribution
 since 1.3.7
 any version 1.3.7 or newer should have it, I know
 the unix
 distributions to I assume it's in the win one too.
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, email:
 [EMAIL PROTECTED]
 


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: mod_vhost_alias.c

2001-02-15 Thread Mel Martinez


--- Steve Ruby [EMAIL PROTECTED] wrote:
 
 Hmmm... Try searching the web for ApacheModuleVhost
 or something since that is probably what the DLL if
 it exists
 would be called..

good suggestion.


 I thought they were making an effort to at least
 keep 
 parallel functionality in the win version.. 
 

I just downloaded the newest Apache v1.3.17 to see if
it is included with that version.

Unfortunately, Apache for win32 is from now on packed
in .msi format, and I have to download a new version
of the MSI Installer from microsoft.  I have been
trying to do that for the last 2 hours with little
success.  Is somebody blasting microsoft's site with
an attack or something?  Or is microsoft.com always
this g*d*mn slow and flaky?

Sigh... dealing with crap like this is NOT making my
life any easier.  What was wrong with distributing
software in good ol' .zip archives?  :-(

mel


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: mod_vhost_alias.c

2001-02-15 Thread Mel Martinez


After downloading Apache 1.3.17, and wasting most of
the last few g*d*mn hours trying to get an update of
the Windows MSI installer tool just so I could install
the new apache, I must unfortunately report that for
all I can tell, mod_vhost_alias is still NOT included
with the standard Win32 binary distribution.

The new version does change the name of the modules in
the modules/ folder from the form:
ApacheModule.dll to the mod_xxx.so form more
consistent with unix distributions.  Strangely, no one
bothered to update the httpd.conf file that comes with
the distribution to reflect this change.  I also was
left more than a little annoyed by the fact that the
1.3.17 installer automatically installs apache as an
NT service and starts it - without an option for me to
avoid this 'feature'.Basically, this release could
use some polish.

At any rate, I guess I am left with assumption that
there is no version of mod_vhost_alias available for
the win32 version of apache.  Hopefully someone will
pop-up with a correction to that.


Mel


--- Mel Martinez [EMAIL PROTECTED] wrote:
 
 --- Steve Ruby [EMAIL PROTECTED] wrote:
  
  Hmmm... Try searching the web for
 ApacheModuleVhost
  or something since that is probably what the DLL
 if
  it exists
  would be called..
 
 good suggestion.
 
 
  I thought they were making an effort to at least
  keep 
  parallel functionality in the win version.. 
  
 
 I just downloaded the newest Apache v1.3.17 to see
 if
 it is included with that version.
 
 Unfortunately, Apache for win32 is from now on
 packed
 in .msi format, and I have to download a new version
 of the MSI Installer from microsoft.  I have been
 trying to do that for the last 2 hours with little
 success.  Is somebody blasting microsoft's site with
 an attack or something?  Or is microsoft.com always
 this g*d*mn slow and flaky?
 
 Sigh... dealing with crap like this is NOT making my
 life any easier.  What was wrong with distributing
 software in good ol' .zip archives?  :-(
 
 mel
 
 
 __
 Do You Yahoo!?
 Get personalized email addresses from Yahoo! Mail -
 only $35 
 a year!  http://personal.mail.yahoo.com/
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, email:
 [EMAIL PROTECTED]
 


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




ajp12 vs ajp13 mod_jk.conf-auto

2001-02-13 Thread Mel Martinez

Question:

what determines whether ajp12 or ajp13 will be
specified for a jkmount statement in the
auto-generated mod_jk.conf-auto file?

I.E., it always generates statements like:

JkMount /myapp/servlet/* ajp12
JkMount /myapp/*.jsp ajp12

I've even tried disabling all reference to ajp12 from
server.xml and workers.properties but that had no
effect.

Is the only way to force the use of Ajp13 to manually
edit the mod_jk.conf file?

Should I even be worrying about this?

Thanks,

mel

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: ajp12 vs ajp13 mod_jk.conf-auto

2001-02-13 Thread Mel Martinez

Thanks, Filip.

I'll try the changes you suggested.

Now, if I could just get someone to tell me why apache
Alias and Rewrites are not working with tomcat...


Mel



--- Filip Hanik [EMAIL PROTECTED] wrote:
 yes,
 the JkMount command looks like this
 
 JkMount context workername
 
 so the autogenerated ajp12 is just the worker name
 "ajp12"
 
 in the workers.properties file you can change the
 protocol that the worker
 is using.
 the property file has the following format
 
 worker.workername.propertyname=value
 worker.ajp12.port=8007
 worker.ajp12.host=localhost
 worker.ajp12.type=ajp13
 
 so just change the last line to use ajp13. now you
 have to modify server.xml
 to start a ajp13 connector on the port 8007 and
 change the port for ajp12.
 
 the nice thing with the autogenerated file is that
 your webapps can be
 dynamic.
 but if you need to do a lot of fancy stuff, you
 should create your own file
 for the mod_jk configuration.
 
 try playing around with it, and if you have a
 specific problem let me know
 and I can help you out.
 
 Filip
 
 ~
 Namaste - I bow to the divine in you
 ~
 Filip Hanik
 Software Architect
 [EMAIL PROTECTED]
 www.filip.net
 - Original Message -
 From: "Mel Martinez" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, February 13, 2001 2:32 PM
 Subject: ajp12 vs ajp13  mod_jk.conf-auto
 
 
  Question:
 
  what determines whether ajp12 or ajp13 will be
  specified for a jkmount statement in the
  auto-generated mod_jk.conf-auto file?
 
  I.E., it always generates statements like:
 
  JkMount /myapp/servlet/* ajp12
  JkMount /myapp/*.jsp ajp12
 
  I've even tried disabling all reference to ajp12
 from
  server.xml and workers.properties but that had no
  effect.
 
  Is the only way to force the use of Ajp13 to
 manually
  edit the mod_jk.conf file?
 
  Should I even be worrying about this?
 
  Thanks,
 
  mel
 
  __
  Do You Yahoo!?
  Get personalized email addresses from Yahoo! Mail
 - only $35
  a year!  http://personal.mail.yahoo.com/
 
 

-
  To unsubscribe, e-mail:
 [EMAIL PROTECTED]
  For additional commands, email:
 [EMAIL PROTECTED]
 
 
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, email:
 [EMAIL PROTECTED]
 


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




apache AliasRewrites vs tomcat?

2001-02-13 Thread Mel Martinez

I'm trying to assertain just how Apache and Tomcat
interact regarding aliases and rewrites.

I'm using Apache 1.3.14 and tomcat 3.2.1 with
mod_jk.c.  I don't know if the latter is the 'latest'
version.

If I have apache configured to apply an alias or a
rewrite rule to a reqest, I can tell from the logs
that it is indeed getting applied:

 (2) init rewrite engine with requested uri
/myapp/folder1/common/mypage.jsp
 (3) applying pattern '^/myapp/(.*)/common/(.*)' to
uri '/myapp/folder1/common/mypage.jsp'
 (2) rewrite /myapp/folder1/common/mypage.jsp -
/myapp/common/mypage.jsp
 (2) local path result: /myapp/common/mypage.jsp
 (1) go-ahead with /myapp/common/mypage.jsp [OK]

The idea here is simple: the request

/myapp/folder1/common/mypage.jsp

should result in a request for

/myapp/common/mypage.jsp

The rewrite rule works great.  This works great for
static stuff served up by Apache.

The problem is that Tomcat is not getting the
translated request, it is getting the original one. 
Since no file in that path actually exists, naturally
it returns a file not found error.

Could someone please tell me if this behavior is
correct or if this is a bug in mod_jk?  Should I be
using apj13? (I just noticed that the mod_jk.conf-auto
has the contexts mounted to apj12 so I'll try changing
that).

I seem to recall that JServ obeyed the results of
rewrites.  Should I try using tomcat with mod_jserv? 
'Would seem like walking backwards...

Please help clear this up so I don't spend too much
more time banging my head against this.

Thanks,

Mel


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Apache + tomcat: help w/mod_alias

2001-02-12 Thread Mel Martinez

Hi,

First off, I'm using Apache 1.3.14 (win NT and linux)
and tomcat 3.2.1.  If I need to upgrade I will, if I
know that it will fix this.

I'm trying to setup tomcat with an existing apache web
server.  I'm having trouble figuring out the best way
to handle an otherwise simple Alias mapping.

The apache httpd.conf has the following:

Alias .*/foo/(.*)   /abs/path/to/foo/$1

which basically says:  treat all paths with '/foo/' in
them to be a link to the one great and powerful foo
directory.  So both of the following:

.../somepath/foo/splash.html
.../someotherpath/foo/splash.html

would both map to the same file,
/abs/path/to/foo/splash.html

This is very useful for having links to a common
directory of reusable resources from a variety of
locations.  In addition, this works on both Unix and
NT versions of Apache so you don't have to depend on
symbolic links.

On top of Apache, I've added the use of Tomcat to the
mix so as to (naturally) support servlets and *.jsp
applications.  I have done this through the use of
mod_jk.  So far, Tomcat works just fine for running
servlets and compiling JSP files. With the following
exception.

Problem:

Urls forwarded to tomcat seem to bypass the Alias
mechanism.  So a request for:

.../somepath/foo/myapp.jsp

gets sent to tomcat as the above, instead of as the
desired:

/abs/path/to/foo/myapp.jsp

Since there is no 'foo' directory inside /somepath/,
tomcat complains about not finding the file. 
Naturally, if I turn off mod_jk, so that Apache simply
returns the file, apache finds the myapp.jsp file just
fine.

Could someone offer me some helpful suggestions on the
best way to fix this?  Would this be fixed if I
replaced the alias with a mod_rewrite directive?  Does
Tomcat have a comparable 'alias' or 'rewrite'
mechanism?

Is this a matter of setting up things with the proper
precedence so that the Alias gets applied to the URL
before it gets sent to the mod_jk worker?  If so, how?

Thanks in advance for your help.

Mel


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]