The main resource set specified is not valid
Hello - I am encountering a problem, on OpenSuSE15.0 and on OpenSuSE15.2, which suddenly appeared, possibly via an update or possibly from me working on Tomcat and doing something that I can't find a way to resolve. I am now getting a rather obtuse set of error messages for all my webapps, which is coming from a series of stack walk-back traces (shown without the actual program trace messages) from the Tomcat/Catalina logfile - 9-Dec-2020 13:47:22.732 SEVERE [main] org.apache.catalina.startup.HostConfig.beforeStart Unable to create directory for deployment: [/usr/share/tomcat/webapps] 19-Dec-2020 13:47:22.734 SEVERE [main] org.apache.catalina.core.ContainerBase.startInternal A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@704921a5] Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@704921a5] Caused by: java.lang.IllegalArgumentException: The main resource set specified [/usr/share/tomcat/webapps] is not valid The last error message - java.lang.IllegalArgumentException seems to the the pertinent one telling me the path /usr/share/tomcat/webapps is not valid. Doesn't tell me why it is invalid, sigh, when will programmers write decent user friendly error messages which can actually help? Anywise, on my system I am guessing that the problem is that this app path is actually a double soft link i.e. quasar:/usr/share/tomcat # ll -d /usr/share/tomcat/webapps lrwxrwxrwx 1 root tomcat 19 Jul 12 2019 /usr/share/tomcat/webapps -> /srv/tomcat/webapps quasar:/usr/share/tomcat # ll -d /srv/tomcat/webapps lrwxrwxrwx 1 root tomcat 38 Nov 23 14:58 /srv/tomcat/webapps -> /websites/home/marc/domain.com quasar:/usr/share/tomcat # ll -d /websites/home/marc/domain.com/ drwxrwxr-x 39 marc users 4096 Aug 13 23:52 /websites/home/marc/domain.com/ I did try shortening this to a single soft link but that didn't change anything. The only other possibility I can think of is that Tomcat may have troubles reaching a file system on a different mount point??? /webapps/... is on a different disk drive and is a mount point. These two environment variables are defined in tomcat.conf - CATALINA_HOME="/usr/share/tomcat" CATALINA_BASE="/usr/share/tomcat" The host declaration for this application, in server.xml, is - The context.xml file is - WEB-INF/web.xml WEB-INF/tomcat-web.xml ${catalina.base}/conf/web.xml Sure would appreciate any help offered and thanks in advance. I been spending lots of hours trying to noodle this problem out and just not getting anywhere! A puzzler is that I had Tomcat working on OpenSuSE 15.0 at one time and this error message surfaced when I was trying to port Tomcat to OpenSuSE 15.2. I may have done something bad that broke Tomcat on OpenSuSE 15.0 but can't remember what I might had done that might have broken Tomcat. A couple other tidbits of information that might prove helpful - # tomcat version Server version: Apache Tomcat/9.0.21 Server built: Jul 4 2019 12:00:00 UTC Server number: 9.0.21.0 OS Name: Linux OS Version: 4.12.14-lp150.12.82-default Architecture: amd64 JVM Version: 1.8.0_222-b10 JVM Vendor: IcedTea java -version openjdk version "1.8.0_222" OpenJDK Runtime Environment (IcedTea 3.13.0) (build 1.8.0_222-b10 suse-lp150.2.19.1-x86_64) OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode) Thanks, Marc -- --... ...-- .. ...-.. ..-- .- --... .--. -..- .-- -- .- .-. -.-. Computers: the final frontier. These are the voyages of the user Marc. His mission: to explore strange new hardware. To seek out new software and new applications. To boldly go where no Marc has gone before!
Re: Apache mod_jk connector question about alias
On 10/20/2016 3:19 AM, André Warnier (tomcat) wrote: On 20.10.2016 01:58, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Marc, On 10/18/16 7:59 PM, Marc Chamberlin wrote: On 10/17/2016 10:36 AM, Rainer Jung wrote: Alias maps URIs to local file system directories. JkMount maps URIs to remote back end requests. You can not change JkMount forwarding using Alias (except that if you have a comflict between Alias and JkMount only one of them wins). As far as I understand you are not really trying to map requests to the local web server file system, but instead want to forward to a Tomcat back end but change the URI path which is used when accessing Apache to something else being used to acces Tomcat. E.g. the URI /jsp-examples/something gets used when accessing Apache and mod_jk should send this request as /examples/jsp/something to the Tomcat back end. If you really need to change URIs, then often mod_proxy is much easier to set up, because it has specific directives for this (ProxyPass etc.). With mod_jk you would first need to use mod_rewrite RewriteRules to change the URI, and then JkMount to forward them. More details can be found at http://tomcat.apache.org/connectors-doc/common_howto/proxy.html#URL%2 0Rewriting The rest of this docs page might be useful as well. Regards, Rainer Thanks a million Rainer, you got me over that hump! I have it working now but have another question - When the response is generated for a request, that used the alias in the URL, is there a way to keep the client browser from displaying what the alias got mapped to? So for example, if I use the alias in the URL - http://www.mydomain.com/jsp-examples that I send to the Apache server, and it in turn forwards that request to Tomcat as http://www.mydomain.com/examples/jsp, I would prefer that the response, sent back to the user, contains the original, aliased or unaliased, version of the URL that he/she typed, and not just the resolved version. As it stands I am always getting the response URL of http://www.mydomain.com/examples/jsp displayed in the client browser. What follows is my current version of the config file that I am using for the jsp-examples. Seems to be working mostly OK, so hopefully I am on the right track. FYI - I intend to include these config files in various virtual hosts configurations each of which have their own document root, hence the reason for the Alias commands at the beginning of this config file. Thanks again in advance for any and all offers of help, thoughts, and replies... Your best bet is to name the context in Tomcat to be whatever you really want the URL path to be. This will remove all kinds of problems you are likely to see in the future because of your decision to try to rewrite URLs. I never understand why people would rather spend a great deal of time configuring around the fact that this simple command will get everything working without any other issues: $ mv webapps/name-you-have webapps/name-you-want +10 Because once you start playing with Aliases and RewriteRules, you are setting yourself up for a lot of future additional complications in terms of Redirects, Authentication, etc.. most of which you cannot even imagine right now. Thanks Christopher, Andre for your comments and I will certainly take them under consideration. If I were working in a simple environment where all I had to do was to focus on Tomcat and Apache I would certainly agree with you. Your simplistic solution of renaming directories would indeed be the correct choice. The problem is, is that the real world is not quite so accommodating. I am trying to support a team of users who are using other third party applications and also using cross-sectional tools that require multiple resources/directories in the Tomcat/Apache web directories, that all need to be coordinated. Some of this can be solved with directory renaming or links, but in some cases it becomes a question of whether the dog is wagging the tail or the tail is wagging the dog in terms of the amount of work involved to solve a problem; such as a simple Tomcat/Apache alone related answer (directory renaming) implies. So I am exploring the choices I have within the Tomcat/Apache tool space in order to determine what choice is best. If indeed the tools available within Tomcat and Apache are so odious to use, then yes I will also have to explore the option of changing other tools, software, and configurations in order to accommodate Tomcat and Apache. My understanding of Tomcat and Apache is that they are supposedly robust enterprise grade tools, designed to work in complex environments. So my hope is that issues like this have been already addressed with elegant solutions. ;-) FYI I am using the jsp and servlet examples here as just a simple model of what I want to accomplish. I could really care less about those particular web applications. Marc
Re: Apache mod_jk connector question about alias
On 10/17/2016 10:36 AM, Rainer Jung wrote: Alias maps URIs to local file system directories. JkMount maps URIs to remote back end requests. You can not change JkMount forwarding using Alias (except that if you have a comflict between Alias and JkMount only one of them wins). As far as I understand you are not really trying to map requests to the local web server file system, but instead want to forward to a Tomcat back end but change the URI path which is used when accessing Apache to something else being used to acces Tomcat. E.g. the URI /jsp-examples/something gets used when accessing Apache and mod_jk should send this request as /examples/jsp/something to the Tomcat back end. If you really need to change URIs, then often mod_proxy is much easier to set up, because it has specific directives for this (ProxyPass etc.). With mod_jk you would first need to use mod_rewrite RewriteRules to change the URI, and then JkMount to forward them. More details can be found at http://tomcat.apache.org/connectors-doc/common_howto/proxy.html#URL%20Rewriting The rest of this docs page might be useful as well. Regards, Rainer Thanks a million Rainer, you got me over that hump! I have it working now but have another question - When the response is generated for a request, that used the alias in the URL, is there a way to keep the client browser from displaying what the alias got mapped to? So for example, if I use the alias in the URL - http://www.mydomain.com/jsp-examples that I send to the Apache server, and it in turn forwards that request to Tomcat as http://www.mydomain.com/examples/jsp, I would prefer that the response, sent back to the user, contains the original, aliased or unaliased, version of the URL that he/she typed, and not just the resolved version. As it stands I am always getting the response URL of http://www.mydomain.com/examples/jsp displayed in the client browser. What follows is my current version of the config file that I am using for the jsp-examples. Seems to be working mostly OK, so hopefully I am on the right track. FYI - I intend to include these config files in various virtual hosts configurations each of which have their own document root, hence the reason for the Alias commands at the beginning of this config file. Thanks again in advance for any and all offers of help, thoughts, and replies... Marc.. # The following line makes apache aware of the location of # the /jsp-examples context Alias /examples/jsp "/srv/tomcat/webapps/examples/jsp" Alias /jsp-examples "/srv/tomcat/webapps/examples/jsp" Options Indexes FollowSymLinks AllowOverride None # Controls who can get stuff from this server. Require all granted Order allow,deny Allow from all # AllowOverride None Require all denied deny from all RewriteEngine On RewriteRule "^/jsp-examples" "/examples/jsp" [PT] # Mounted stuff goes via tomcat (ajp13) # JkMount /jsp-examples tomcatWorker1 # JkMount /jsp-examples/* tomcatWorker1 JkMount /examples/jsp tomcatWorker1 JkMount /examples/jsp/* tomcatWorker1 # Serve html, css, js, jpg, png and gif using Apache JkUnMount /*.html tomcatWorker1 JkUnMount /*.css tomcatWorker1 JkUnMount /*.js tomcatWorker1 JkUnMount /*.jpg tomcatWorker1 JkUnMount /*.png tomcatWorker1 JkUnMount /*.gif tomcatWorker1 -- "The Truth is out there" - Spooky - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Apache mod_jk connector question about alias
Hello - My apologies if this has already been asked or the wrong mail list, but Google is not coming up with an answer for me, so here goes... I am trying to set up the mod_jk connector between an Apache HTTPD server and Tomcat with the intent of supporting virtual hosts, and serving static content from the Apache server and forwarding jsp and servlet requests to Tomcat. Typical scenario I know... Most of this I have working but the trouble I am having is with the use an Alias directive for the Apache server. Following instructions for the JSP examples that came with my distribution for Tomcat 8, I created a configuration for # The following line makes apache aware of the location of # the /jsp-examples context Alias /jsp-examples "/srv/tomcat/webapps/examples/jsp" Options Indexes FollowSymLinks AllowOverride None # Controls who can get stuff from this server. Require all granted Order allow,deny Allow from all # Mounted stuff goes via tomcat (ajp13) JkMount /jsp-examples tomcatWorker1 JkMount /jsp-examples/* tomcatWorker1 # Serve html, css, js, jpg, png and gif using Apache JkUnMount /*.html tomcatWorker1 JkUnMount /*.css tomcatWorker1 JkUnMount /*.js tomcatWorker1 JkUnMount /*.jpg tomcatWorker1 JkUnMount /*.png tomcatWorker1 JkUnMount /*.gif tomcatWorker1 I am actually defining this in the context of a virtual host and if necessary I can post its configuration as well. Using the JK debug level and monitoring the mod_jk.log file I can see what is going wrong, I just don't know how to rectify it - [Mon Oct 17 09:28:01.145 2016] [30237:139868423546816] [debug] ajp_connection_tcp_send_message::jk_ajp_common.c (1208): sending to ajp13 pos=4 len=469 max=8192 [Mon Oct 17 09:28:01.145 2016] [30237:139868423546816] [debug] ajp_connection_tcp_send_message::jk_ajp_common.c (1208): 12 34 01 D1 02 02 00 08 48 54 54 50 2F 31 2E 31 - .4..HTTP/1.1 [Mon Oct 17 09:28:01.145 2016] [30237:139868423546816] [debug] ajp_connection_tcp_send_message::jk_ajp_common.c (1208): 0010 00 00 0E 2F 6A 73 70 2D 65 78 61 6D 70 6C 65 73 - .../jsp-examples [Mon Oct 17 09:28:01.145 2016] [30237:139868423546816] [debug] ajp_connection_tcp_send_message::jk_ajp_common.c (1208): 0020 2F 00 00 0D 31 39 32 2E 31 36 38 2E 31 30 2E 31 - /...192.168.10.1 This excerpt shows that the Apache server is sending a message to the Tomcat worker telling it to find a resource "/jsp-examples" which of course doesn't really exist and so Tomcat reports a "Not Found" failure. What I want is for the Apache server to send the actual location that this alias is mapped to i.e. "/examples/jsp", which is what actually exists in the Tomcat context. I can fool Tomcat into handling this alias request by creating a link named jsp-examples -> examples/jsp within the Tomcat webapps directory but that seems like a hack and not something I want to have to do/maintain for all the other resources I will want to handle via alias commands. Is there a magic incantation that I am missing? Thanks in advance for suggestions/help Marc... - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Question on SSI
On 9/1/2010 7:01 PM, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Marc, On 9/1/2010 6:52 PM, Marc Chamberlin wrote: On 9/1/2010 1:49 PM, Christopher Schultz wrote: 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. 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 Technically speaking, the filter wraps the call to the actual servlet (or, even, other filters that get called before the servlet). They can act either before or after the servlet, or both. The SSI filter wraps the request handed-off to the filter chain (which ultimately ends by calling a servlet) and buffers the response. After the rest of the filter chain has run (and presumably produced output), the SSI filter completes its task by actually running that buffered-output through the SSI processor to actually *do* all of the SSI stuff. The result is then sent to the client. Honestly, I'm not sure why the SSI Servlet is even included: the DefaultServlet handles files on the disk, etc. quite nicely and the SSI Filter can be used to filter them, too. See my related post on the SSI Filter implementation if you're interested. Aww THANKS for the explanation Christopher! That helps a lot... And I think I follow you on the SSI Servlet, I was unsuccessful in getting SSI to work with it, and have not gone back and retried... The Filter approach seems more intuitive to me.. 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. Thefilter-mapping itself should definitely only be included in your webapp's META-INF/web.xml file. 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. Gotcha. Feel free to enable this site-wide, then (using conf/web.xml). Evidently, you'll also have to make all contexts that want to use SSI privileged. I'm not entirely sure that's true if you enable it at the top-level as you are doing. Please let us know. I changed to Context tag declaration in the Context.xml file to Context privileged=true and that enables SSI for all my webapps (so far as I have tested it) Again thanks for your time and help! A little bit of the fog has lifted for me! ;-) Marc... - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Question on SSI
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. 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 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Question on SSI
On 9/1/2010 1:46 PM, Wesley Acheson wrote: On Wed, Sep 1, 2010 at 10:13 PM, Marc Chamberlin m...@marcchamberlin.com wrote: Have you tried modifying this section? filter-mapping filter-namessi/filter-name url-pattern*.shtml/url-pattern /filter-mapping To look more like this filter-mapping filter-namessi/filter-name url-pattern*/url-pattern /filter-mapping Thanks Wesley for taking the time to answer, much appreciated! Yes, I have tried this filter mapping / url-pattern with no joy. Also have tried a url-pattern of *.html and no joy either Also change the section init-param param-namecontentType/param-name param-valuetext/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. Yeah, neither are mine ;-) ... The trouble with reg expressions is that there are a lot of variants and documentation does not clarify just whose reg expr parser is being used. I usually assume GNU, but been bit so many times by that assumption that I can never be sure. So I don't know how to modify this either 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. Yeah I read, but did not grok... Marc.. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Question on SSI
On 9/1/2010 1:49 PM, Christopher Schultz wrote: -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. 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.) 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? 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 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. 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 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 yourfilter and filter-mapping for the aforementioned filter? It should be as simple as setting up multipleurl-patterns for the URL patterns that you want to have run through the SSI 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. filter filter-namessi/filter-name filter-class org.apache.catalina.ssi.SSIFilter /filter-class init-param param-namecontentType/param-name param-valuetext/x-server-parsed-html(;.*)?/param-value /init-param init-param param-namedebug/param-name param-value0/param-value /init-param init-param param-nameexpires/param-name param-value666/param-value /init-param init-param param-nameisVirtualWebappRelative/param-name param-value0/param-value /init-param /filter !-- Built In Filter Mappings == -- !-- The mapping for the SSI Filter -- filter-mapping filter-namessi/filter-name url-pattern*/url-pattern /filter-mapping !-- filter-mapping filter-namessi/filter-name url-pattern*.shtml/url-pattern /filter-mapping -- !-- filter-mapping filter-namessi/filter-name url-pattern*.html/url-pattern /filter-mapping -- !-- filter-mapping filter-namessi/filter-name url-pattern*.shtml/url-pattern url-pattern*.html/url-pattern /filter-mapping -- !-- filter-mapping filter-namessi/filter-name url-pattern/*/url-pattern /filter-mapping -- 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. Thefilter-mapping itself should definitely only be included in your webapp's META-INF/web.xml file. 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
Re: Question on SSI
On 9/1/2010 3:35 PM, Wesley Acheson wrote: On Thu, Sep 2, 2010 at 12:24 AM, Marc Chamberlin m...@marcchamberlin.com wrote: On 9/1/2010 1:46 PM, Wesley Acheson wrote: On Wed, Sep 1, 2010 at 10:13 PM, Marc Chamberlin m...@marcchamberlin.comwrote: Have you tried modifying this section? filter-mapping filter-namessi/filter-name url-pattern*.shtml/url-pattern /filter-mapping To look more like this filter-mapping filter-namessi/filter-name url-pattern*/url-pattern /filter-mapping Thanks Wesley for taking the time to answer, much appreciated! Yes, I have tried this filter mapping / url-pattern with no joy. Also have tried a url-pattern of *.html and no joy either Also change the section init-param param-namecontentType/param-name param-valuetext/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. Hi Marc, Okay the suggestion was to do these two changes in conjunction with one another as I understand it the mapping says what URLS this is applied on and the init-param says what the mime type has to be. To test simply, just to see if we are on the right track try chaning the filter-mapping as above, but change init-param param-namecontentType/param-name param-valuetext/x-server-parsed-html(;.*)?/param-value /init-param to init-param param-namecontentType/param-name param-valuetext/html(;.*)?/param-value /init-param And test it on a html page. If I'm right it will work but shtml won't. Really need a regularexpression writer. 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... ;-) - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Question on SSI
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-namessi/filter-name url-pattern*.html/url- pattern /filter-mapping filter-mapping filter-namessi/filter-name url-pattern*.htm/url- pattern /filter-mapping filter-mapping filter-namessi/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...