aspose file tools*
The moose likes Tomcat and the fly likes Stubborn SSI Filter In Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Stubborn SSI Filter In Tomcat" Watch "Stubborn SSI Filter In Tomcat" New topic
Author

Stubborn SSI Filter In Tomcat

Guy Yafe
Greenhorn

Joined: Sep 30, 2011
Posts: 21
Hi All,
Tomcat 7, Java 7, JSP, Windows XP
Up until now I worked with SSIServlet and everything worked fine. The problem started when I switched to SSIFilter.
It seems that everything is configured properly: The filter is loaded, the Context has the correct privileges, but instead of processing the requests and replace SSI directives with the right file, it just ignores the directives, and in the final output (On the browser) I only get the original directive strings embedded in the HTML code.
Because of an unknown reason, the filter doesn't do its job and doesn't fetch the code from the SSI file.
I believe this is related to the following parameter in the filter's configuration which I left as is (In the web.xml file): (Taken from the documentation)
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(;.*)?".

Or in pure English:
We have concluded that Tomcat isn't complicated enough so we decided to make your life even more miserable.

It would be great if someone could guide me to the solution. I couldn't understand what this parameter stands for and what value should it get.
I don't even know which code to attach:
web.xml?
HTML file?
I haven't changed anything in it when transferred from SSIServlet which worked fine.

Thanks,
Guy
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19761
    
  20

Most of this should be configured in the web.xml file, so please post that. Don't forget to UseCodeTags for them, selecting XML as the code type.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Guy Yafe
Greenhorn

Joined: Sep 30, 2011
Posts: 21
This is the web.xml file content. This is the content of the application's file.
The general tomcat's web.xml content is empty. (Left as is)
I removed the comments and unrelated server mappings.
I tried finding a log file that tells if Tomcat encountered any problem but couldn't find any.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19761
    
  20

Check line 10; it's missing the type (text); it only has the / and sub type.
Guy Yafe
Greenhorn

Joined: Sep 30, 2011
Posts: 21
Can you please elaborate?
Do you mean writing something like:

Do I need to write it in addition to line 10 or instead of it?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19761
    
  20

Instead of. That will basically fix the incorrect mime type value.
Guy Yafe
Greenhorn

Joined: Sep 30, 2011
Posts: 21
Thanks, I'll change this line.
Is the above line I wrote, the one I should insert?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19761
    
  20

That seems right, given the quote in your opening post.
Guy Yafe
Greenhorn

Joined: Sep 30, 2011
Posts: 21
Thanks, that worked but partially:
When I set the value to text/x-server-parsed-html(;.*)? or to text/* it didn't work.
The only way I could get the SSIFilter to parse the files is when I set the above value to text/html.
This is good but not enough because by this way I can't get the filter to process JSP files.
I verified that the filter-mappings of the SSIFilter do include the *.jsp pattern.

Guy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stubborn SSI Filter In Tomcat