Re: New option: BASEHREF

2002-03-28 23:59:16
On March 28, 2002 at 10:05, Jym Dyer wrote:

is about to print <a href="somefile.html">, it prints
<a href="/this/directory/somefile.html"> instead.
For cases excluding the mimefilters, you can do this
by customizing the page layout resources.
I'm not sure what you mean by this?

=v= I think it means page layout would contain something like
this up near the top:

<base href="";>

Nope, but a nice idea for some who may want to insure that if
someone copies some of the pages, clients know where the data
is based from.

Hmmm, it could also be used for dynamic sites that map a base URL
to a CGI, or Servlet.  For example, the URL:


may actually map to a servlet in a Java servlet-enable web server.
Therefore, I could have the following:

    <base href="/mymail/archive">

Therefore, the following URL would invoke the servlet:


The servlet can then use the path information to see what file it
should load since it appears to the client/user to be a URL to a
regular file.  This is a more elegant solution than using query string
parameters to specify the main filename to load.  The servlet can then
have the following logic (pseudo code):

  include header
  open and print contents of specified file
  include footer

The Java Servlet API has mechanisms for including the contents of
other servlets to the output stream.  This includes including JSP
content since they are compiled to servlets.

The only minor challenge is dealing with attachment files generated
by mhonarc.  These files can be detected by checking the filename
to see if they are a mhonarc HTML page or an attachment.  If an
attachment, you bypass the inclusion of the header and the footer
and the servlet serves the data directly.  I leave it as an
exercise to the reader on how to do this (hint: look at the
getResource() method of the ServletContext).

Which would work in the case mentioned, there, but I suspect
this would not work:

<base href="";>

Correct, it will not work.

See my other response on what I meant, with an actual example,


<Prev in Thread] Current Thread [Next in Thread>