-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Yuval,
On 3/8/16 3:47 PM, Yuval Schwartz wrote: > On Tue, Mar 8, 2016 at 10:20 PM, Christopher Schultz < > ch...@christopherschultz.net> wrote: > > Yuval, > > On 3/8/16 12:38 PM, Yuval Schwartz wrote: >>>> Hello Christopher, thanks, responses below. >>>> >>>> On Tue, Mar 8, 2016 at 6:23 PM, Christopher Schultz < >>>> ch...@christopherschultz.net> wrote: >>>> >>>> Yuval, >>>> >>>> On 3/8/16 3:14 AM, Yuval Schwartz wrote: >>>>>>> Tomcat version: 8.0.22 Jdk: 1.8.0_05 Server: Amazon >>>>>>> Linux >>>>>>> >>>>>>> Hello, >>>>>>> >>>>>>> I want to map my servlet to a Hebrew url pattern. >>>> >>>> Hmm. >>>> >>>>>>> I tried placing the hebrew url pattern both in the >>>>>>> "@webservlet" annotation (urlpatterns attribute) and in >>>>>>> the the web.xml file. In both cases it doesn't work, >>>>>>> it's as if there's nothing mapped to the url >>>>>>> specified. >>>>>>> >>>>>>> I though to specify the URIEncoding parameter of the >>>>>>> connector but saw that this defaults to "utf-8" in >>>>>>> tomcat 8. >>>> >>>> Yes, it does. >>>> >>>> So you are trying to set the url-pattern for a servlet >>>> mapping? >>>> >>>> When you do it -- either using @WebServlet or >>>> <servlet-mapping> -- can you connect via JMX to observe the >>>> pattern that's been read into the configuration? First, I'd >>>> want to make sure that the Hebrew characters haven't been >>>> destroyed by the loading process of the XML file or by the >>>> compiler, or even by Tomcat. >>>> >>>> >>>>> Can you give me some direction on how I would do this? >>>>> Maybe a little more detail on jmx? There could be >>>>> encoding/decoding going on in the browser (firefox) and in >>>>> all the elements you mentioned on the server side. Any way >>>>> to see the final String that the server is using to match >>>>> the Url pattern? > > Yeah, that's why I was suggesting using JMX, since Tomcat exposes > all the configuration through it. > > Launch Tomcat, then fire-up jconsole (or VisualVM, or any other > tool that contains a JMX client... both jconsole and VisualVM > require that you go to the "plug-ins" configuration and install an > easy-to-find-and-install plug-in for JMX) on the same machine > (it's easiest this way). > > (I just checked, and VisualVM calls the plug-in > "VisualVM-MBeans".)visualvisual > > Then, connect to the Tomcat instance and go to the BMeans tab. > > You'll find your servlet under > /Catalina/Servlet/host/context/[servlet]. .. > > > Aw, crap. The mappings themselves aren't actually published via > JMX. Hmm . > >>>>> I've done a lot of guessing and checking. For example, I >>>>> used the URLEncoder to get the encoded form of my urls and >>>>> put that in the url pattern. > > Good. So you have some set of Unicode escapes like \u0fe64 or > whatever in the url-pattern string in your annotation? > > >> No, I don't have any unicode escapes. I have (for the purpose of >> testing) two strings, one is the string with the utf-8 >> characters, the other is an encoded form of the url (which is >> encoded into a series of "%" followed by two English letters). Do >> you recommend having something else here? Can you copy/paste your @WebServlet annotation into your next post? I think that will clear things up. >> Some more info: I placed a filter on pattern "/*". When my >> request with the UTF-8 url comes in, I call >> httpRequest.getServletPath() and httpRequest.getRequestURI(). As >> expected, I get the UTF-8 version of the servlet path (ie: >> decoded) and the ASCII request URI (ie: encoded) respectively. Good idea. So, does your application get what you expected in the String servlet path? >> This means that the request is reaching my server. It's the next >> step, the step where the servlet path is mapped to my specified >> url pattern, that I want to explore. But I don't know how to >> explore this. Where can I control how the url pattern is matched >> with the incoming url? You can't, other than following the rules of the servlet spec. Since you can get a Filter in the mix, try mapping the filter to "/smaller" where "smaller" is something narrower than "*" that gets you closer to what you were trying to accomplish. For instance, if you are trying to map to /עברית, then try mapping your filter to /ת* or something like that. (I have no idea what the left-to-right rules are for string-matching, etc. since Hebrew should be right-to-left, but prefix-matching is usually written in a left-to-right fashion). >> Although I can only conceive two options for how the incoming url >> is matched with the url pattern and I've tried both (either the >> UTF-8 version of the request url is matched against the pattern >> or the encoded version is matched against the pattern). Tomcat is doing a left-to-right pattern-match, character-by-character, as long as there wasn't an exact-match that was found (which would have been done roughly using String.equals, though in Tomcat it's working with character buffers and not String values). - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlbfPD0ACgkQ9CaO5/Lv0PCD7QCdE4wcSoUzCI3nUcemqUh7cNbb hMYAn3X9P5eHIiNbDxunlRwLfgLViD0t =8itk -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org