tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wesley Acheson <wesley.ache...@gmail.com>
Subject Re: Question on SSI
Date Wed, 01 Sep 2010 20:46:18 GMT
On Wed, Sep 1, 2010 at 10:13 PM, Marc Chamberlin
<marc@marcchamberlin.com> wrote:
>  Hello -  I am running a Tomcat6.0 server both stand-alone and with Eclipse,
> and am in the process of developing a webapp that I will want to make
> available to all our users via a server side include statement. I have this
> working in a limited sense, in that I got it working using the filter
> version but was unsuccessful getting the servlet version working, which is
> acceptable. (I am not clear on what the real difference between the two
> approaches is, documentation is non-existent as far as I could find).
>
> Anywise, what I have working, works so long as the <!--#include
> virtual="somefile.html" --> is in a .shtml file, but this will be
> unacceptable. I need this feature to also work from inside normal .html and
> .htm as well as .jsp files as that is what our users will expect. I have
> fooled around with the filter-mapping segment in the server's web.xml file
> but so far no joy in finding a solution.

Have you tried modifying this section?

    <filter-mapping>
        <filter-name>ssi</filter-name>
        <url-pattern>*.shtml</url-pattern>
    </filter-mapping>


To look more like this

    <filter-mapping>
        <filter-name>ssi</filter-name>
        <url-pattern>*</url-pattern>
    </filter-mapping>

Also change the section
        <init-param>
          <param-name>contentType</param-name>
          <param-value>text/x-server-parsed-html(;.*)?</param-value>
        </init-param>

The param-value must be a regular expression that will meet the
following mime types
text/x-server-parsed-html or text/html. My regular expressions aren't
great so I'll leave that for an exercise.

I think this should work with html and htm. I'm not so sure about JSP,
hopefully someone else can clear this up.

Note there is an overhead with scanning all your files for SSI
comments but I don't think it should be too bad. Again someone more
experienced should be able to answer.
>
> Searches (lots of em!) on the internet have not provided me with an answer,
> though I have gotten hints that it is doable.  Could some kind guru help me
> grok this and guide me to the light?  Many thanks in advance....
>
>    Marc Chamberlin
>
>
Note I got this info from reading the web.xml that came with tomcat 6
it may be different depending on your version.

Regards,

Wes

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message