On 9/1/2010 4:25 PM, Wesley Acheson wrote:


On Thu, Sep 2, 2010 at 1:16 AM, Marc Chamberlin <m...@marcchamberlin.com <mailto:m...@marcchamberlin.com>> wrote:

> Thanks Wesley!!! That did the trick, and yes, shtml does not work... But
> this should be ok for our needs, our users don't create .shtml files, and > this also worked for .jsp and .htm files as well as .html... Documentation > on the Tomcat site should be updated to discuss this, IMHO... And it might > be an interesting exercise to figure out how to make this work for all files
> if one is looking for exercises... ;-)
>>

For the record, the documentation actually does say it. You need to know what mime types are though.

*contentType* - A regex pattern that must be matched before SSI processing is applied. When crafting your own pattern, don't forget that a mime content type may be followed by an optional character set in the form "mime/type; charset=set" that you must take into account. Default is "text/x-server-parsed-html(;.*)?".

Green emphisis assuming the mailing list allows html mail is mine.
Perhaps this does say it, Wesley, but I am going to argue that, like a lot of documentation, too much is assumed about the readers level of background understanding. In this instance, as an outsider, I do not understand the model inside the Tomcat server about just how the contentType parameter is going to be used, or what "text/x-server-parsed-html(;.*)?" is, does, or will do. Internet searches resulted in nothing informative, so to me this is a black box using a magic incantation and I do not have a way to grok how to manipulate it. Same applies to your answer of using "text/html(;.*)?" for the content type. This is perhaps a very unusual form of a reg expression, if I were to interpret it, I would guess it is trying to match a string "text/html; followed by an arbitrary set of characters, but I cannot be certain, and perhaps the semi-colon is being used in a way that I am unfamiliar with... And if I am correct, I still do not understand what string is being matched against, though I might take a wild guess and guess that it is matching the content declaration in the meta tag of an html document... but then I got no clue what "test/x-server-parsed-html(;.*)?" is going to match against, and I cannot find any information about such a document type, so I remain lost...

Some mime types are more intuitive than others, but not entirely. While I can understand the need to associate simpler concepts, like a jpeg image with something to handle .jpeg files, I really cannot say I understand the mapping fully to understand just how that mapping is done. Many sites are willing to list these mime types and repeat the same sort of list that is found in the web.xml file, but they do not reveal just what is going to happen or how the mapping gets modeled/translated into an action.

So, IMHO what is needed is some additional links in the documentation, to places where concepts such as these are better defined...

Also as a side note you can have multiple mappings for one filter.So in production based on your requirements I'd do the following

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

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

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


That should fix it. In case your wondering what mime types that are used in tomcat they are all listed in the web.xml in the conf subfolder of tomcat.
Again thanks for your taking the time to help me, and I know I got a lot of learning to do yet... I will add your additional filter-mappings to my web.xml file, as it seems to be more limiting/appropriate.

As for the list of mime types, see my above comment, a simple list is not sufficient for me to understand how and why a particular mime type item should be used... An reading the official documents on mime types is pretty intimidating/overwhelming... What is needed is a link to a simple boiled down description that allows the user to quickly grasp and understand these concepts..

   Marc...

Reply via email to