Marc Chamberlin
Wed, 01 Sep 2010 15:53:02 -0700
On 9/1/2010 1:49 PM, Christopher Schultz wrote:
Thanks Christopher for your taking the time to reply, again much appreciated! What I am trying to accomplish is to provide users with some services that can be included on their web pages, simply by including a server side include statement, which I will define for them, in their web pages. (I run a Tomcat server for a number of users and host their websites for them.)-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Marc, On 9/1/2010 4:13 PM, Marc Chamberlin 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.Uhh... you want the webapp to be available via SSI? I'm pretty sure that's the problem of whoever wants to use your service. You can't configure SSI on someone else's site. Maybe I'm misunderstanding you.
Yes, I read both of these documents, as well as a bunch of others! ;-) The documentation was not detailed enough for me to grok and solve this problem on my own....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).Do http://tomcat.apache.org/tomcat-6.0-doc/ssi-howto.html and http://httpd.apache.org/docs/current/howto/ssi.html#basic count as non-existent? Or were you thinking of more involved documentation?
OK, I kinda gathered that a filter is applied to everything served up by the server, before servlets are invoked... So it makes sense that a filter has to be used (if I am understanding this correctly) for JSP Servlets....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.You will have to use filter mapping in order to post-process your .jsp and other dynamic pages: a servlet can't be wrapped around another servlet (such as the JSPServlet, which you don't have to map yourself) for this kind of thing. So, stick with the filter.
Umm, well let me include that part of the web.xml file, as it stands at the moment, here.. Note: Commented out pieces are from my attempts to get this working, so you can see some of the things that I have tried.....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....What is the complete configuration for your<filter> and <filter-mapping> for the aforementioned filter? It should be as simple as setting up multiple<url-pattern>s for the URL patterns that you want to have run through the SSI filter.
<filter>
<filter-name>ssi</filter-name>
<filter-class>
org.apache.catalina.ssi.SSIFilter
</filter-class>
<init-param>
<param-name>contentType</param-name>
<param-value>text/x-server-parsed-html(;.*)?</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>expires</param-name>
<param-value>666</param-value>
</init-param>
<init-param>
<param-name>isVirtualWebappRelative</param-name>
<param-value>0</param-value>
</init-param>
</filter>
<!-- ==================== Built In Filter Mappings
====================== -->
<!-- The mapping for the SSI Filter --> <filter-mapping> <filter-name>ssi</filter-name> <url-pattern>*</url-pattern> </filter-mapping> <!-- <filter-mapping> <filter-name>ssi</filter-name> <url-pattern>*.shtml</url-pattern> </filter-mapping> --> <!-- <filter-mapping> <filter-name>ssi</filter-name> <url-pattern>*.html</url-pattern> </filter-mapping> --> <!-- <filter-mapping> <filter-name>ssi</filter-name> <url-pattern>*.shtml</url-pattern> <url-pattern>*.html</url-pattern> </filter-mapping> --> <!-- <filter-mapping> <filter-name>ssi</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> -->
Not sure I fully understand you here, so please forgive my lack of understanding... I do want this SSI feature to be available across all the webapps deployed on our server. As I mentioned previously, we want to provide some services that users can access, by simply including a server side include statement that will effectively include these features on their web pages. And like I mentioned, I have gotten this working in one sense, but the include statement only works for me from within .shtml files and I need it to work from within .html, .htm, and .jsp files.Note that you should be able to set up SSI in a single webapp instead of modifying the conf/web.xml file as described in the SSI documentation. I find this cleaner, as you will only end up making SSI available in a specific webapp instead of across all webapps deployed onto the server. The<filter-mapping> itself should definitely only be included in your webapp's META-INF/web.xml file.
Marc... --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org