This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | I18N - JSP parser does not handle encoding by context-root path as url-pattern in web.xml | ||
---|---|---|---|
Product: | javaee | Reporter: | mtsuruta <mtsuruta> |
Component: | Code | Assignee: | Petr Pisl <ppisl> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | CC: | ckutler, jf4jbug, pkeegan |
Priority: | P2 | Keywords: | I18N, RELNOTE, TOMCAT |
Version: | 3.x | ||
Hardware: | Sun | ||
OS: | Solaris | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: |
jasper-compiler.jar extracted from jakarta-tomcat-5-src-20040320.zip
jasper-runtime.jar of jakarta-tomcat-5-src-20040320.zip |
Description
mtsuruta
2004-03-05 09:04:57 UTC
This is problem in tomcat's parser, which has been already fixed. See http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26432 . But the fix is not in the version, which we used in the IDE. If user replaces the jasper-compiler-5.0.19.jar and jasper-runtime-5.0.19.jar with appropriate jars from nightly tomcat's build, then it works. Now we are in hight resistance mode, so I'm not going to replace bad jars with this bug in the 3.6. But we will replace them in promo-D. Could we put this issue into release notes? marking as P2 since encoding issue which is important to customers. ken.frank@sun.com 03/05/2004 I agree it's important. But this is bug in tomcat parser, I think we can write down this topic in release note. Ken, would you give me your any thoghts? Petr, the Tomcat bug you are referring to was fixed on January 27. Tomcat 5.0.19 release date is Feb 14. Do you know why 5.0.19 does not contain this fix? Thanks. No I don't know it. But the bug is still in the tomcat 5.0.19 version. I wrote to Kin-Man, who fixed the bug, and here is her answer: "I have no idea why the fix is not in 5.0.19. It is possible that Remy may have tagged the release before the fix was committed." Chris, could you construct a brief release note for this issue? Here's my best guess. I have some unanswered questions, such as does "/jsp_dir/*.jsp" work?. Can someone verify that what is written below is true? I don't have my system set up so that I can try it myself. Tomcat JSP Encoding Bug: Due to a bug in the Tomcat servlet container, a property group entry in the deployment descriptor (web.xml) for specifying the page-encoding must use a URL pattern that includes the .jsp extension. If you just specify all files in a directory, such as "/jsp_dir/*", the server does not load the JSP using the specified encoding. Here is an example of how to specify the URL pattern so that Tomcat loads the JSPs using the correct encoding. <jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <page-encoding> UTF-8 </page-encoding> </jsp-property-group> </jsp-config> Alternatively, download the latest versions of the following JARs and replace the JAR files in <ide-install-dir>\jakarta-tomcat-5.0.19\common\lib jasper-compiler-5.0.19.jar jasper-runtime-5.0.19.jar oops, I should have written Alternatively, download the latest versions of the following JARs from http://jakarta.apache.org/tomcat/index.html ... Hm, I assume this bug prevents the editor from using the correct encoding also? So it might be worth mentioning that it affects the editor also, and isn't just about the servlet container. If so, we need to recommend that people who need to input non-ascii characters into a JSP file do not use NB for this purpose if they need to make a declaration of that type (which will work on other servers). BTW, we were assured that a number of things were fixed in time for 5. 19 - might there be other things we've missed also, because of this tagging? Have we verified the other issues? Do we use the Tomcat parser for opening the JSP in the editor? Can someone verify that this type of URL pattern for page-encoding causes problems with the Source Editor? If so, we can write: Tomcat JSP Encoding Bug: Due to a bug in the Tomcat servlet container, a property group entry in the deployment descriptor (web.xml) for specifying the page-encoding must use a URL pattern that includes the .jsp extension. If you just specify all files in a directory, such as "/jsp_dir/*", the IDE's Source Editor and the Tomcat server do not load the JSP using the specified encoding. Here is an example of how to specify the URL pattern so that Tomcat loads the JSPs using the correct encoding. <jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <page-encoding> UTF-8 </page-encoding> </jsp-property-group> </jsp-config> Alternatively, download the latest version of the following JARs from http://jakarta.apache.org/tomcat/index.html and replace the JAR files in <ide-install-dir>\jakarta-tomcat-5.0.19\common\lib jasper-compiler-5.0.19.jar jasper-runtime-5.0.19.jar I have verified this issue on nb-trunk build 0403081900 as following. Tested with: - no page directive in jsp - specified the URL pattern and page encoding for jsp in web.xml - multibyte chars in jsp which has been saved in Shift_JIS and EUC-JP OK = Opened and saved properly in ide editor and executed on browser failed = Not able to open and save in ide editor properly using page-encoding atttibute of web.xml and failed to execute on browser - CASE1 in web.xml <url-pattern>/dir/*</url-pattern> <page-encoding>XXX</page-encoding> XXX = Shift_JIS on Sol9 XXX = EUC-JP on W2K result Platform : W2K Sol9 RedHat8 ide Editor: OK OK OK - CASE2 in web.xml <url-pattern>/dir/*.jsp</url-pattern> <page-encoding>XXX</page-encoding> XXX = Shift_JIS on Sol9 XXX = EUC-JP on W2K result Platform : W2K Sol9 RedHat8 ide Editor: faild* failed* failed* * org.apache.catalina.startup.ContextConfig applicationConfig SEVERE: Parse error in application web.xml java.lang.IllegalArgumentException: Invalid <url-pattern> /test/*.jsp in servlet mapping Excuse me, the CASE1's url-pattern was wrong. Here is correct url pattern that I tested as CASE1. - CASE1 in web.xml <url-pattern>*.jsp</url-pattern> Thank you for performing the test. To be clear, do the tests indicate we need the following reworded entry See >> << for rewording ? P.S. Will the Source Editor work correctly if they follow the alternative of dowloading new jars? Tomcat JSP Encoding Bug: Due to a bug in the Tomcat servlet container, a property group entry in the deployment descriptor (web.xml) for specifying the page-encoding >>must use a URL pattern that does not include a directory and does include the .jsp extension.<< If you just specify a directory, such as >>"/jsp_dir/*" or "/jsp_dir/*.jsp", the IDE's Source Editor and the Tomcat server do not load the JSP using the specified encoding.<< Here is an example of how to specify the URL pattern so that Tomcat loads the JSPs using the correct encoding. <jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <page-encoding> UTF-8 </page-encoding> </jsp-property-group> </jsp-config> Alternatively, download the latest version of the following JARs from http://jakarta.apache.org/tomcat/index.html and replace the JAR files in <ide-install-dir>\jakarta-tomcat-5.0.19\common\lib jasper-compiler-5.0.19.jar jasper-runtime-5.0.19.jar Hi Chris, yes we use encodiing from the Tomcat parser for opening / saving the JSP in the editor. I think the last version is OK. Petr, would you give me a specific URL to download the nighytly build to verify those jars? I have downloaded nightly build(zip) from following URL and extracted, but there is no jasper-compiler and jasper-runtime jars under /jakarta-tomcat-5/build/common/lib and other extracted dir. I think I am checking wrong zip. http://cvs.apache.org/builds/jakarta-tomcat-5/nightly/ Extracted: jakarta-tomcat-5-src-20040315.zip jakarta-jsp-api-5-bin-20040315.zip Downloaded following zip from nightly-build page and replaced two jars in ide-install directory, but "/jsp_dir/*" and "/jsp_dir/*.jsp" are not possible to specify jsp page encoding with no page directive. JSP file is not able to open and save in ide editor using the encoding type of jsp-config property with the latest jars, and executing jsp with no page directive also displayed garbaged multibyte chars as page encoding is not specified in web.xml. Only the URL pattern of *.jsp works fine after replacing jars, also. There might be a regression in tomcat nightly build. (new user dir, tested on Sol9 only) downloaded: http://cvs.apache.org/builds/jakarta-tomcat-5/nightly/jakarta-tomcat-5-src-20040320.zip replased: jasper-compiler.jar jasper-runtime.jar in: <ide-install-dir>/jakarta-tomcat-5.0.19/common/lib/ Created attachment 14069 [details]
jasper-compiler.jar extracted from jakarta-tomcat-5-src-20040320.zip
Created attachment 14070 [details]
jasper-runtime.jar of jakarta-tomcat-5-src-20040320.zip
Could not confirm the fix in tomcat nightly build again. on sol9, with j2sdk1.4.2 jakarta-tomcat-5-src-20040322.zip jakarta-tomcat-5-src-20040324.zip I think there is no stability to get this fix in tomcat latest build recently. I'd propose to add some words as "after this issue was fixed" or anything in release note if this comment is not too late for it. Some words are needed to avoid users misunderstanding that they can absolutely use the context root if they download the latest build. I think other part is fine. Excuse me for being late to verify this. New version of tomcat jsp parser was added into build in trunk. This bug is fixed in this version of parser. Fix is verified on Sol9, XP, and RedHat8 with build 200405171800. |