Thanks Mark, follow up questions below: On Wed, Mar 9, 2016 at 1:26 AM, Mark Eggers <its_toas...@yahoo.com.invalid> wrote:
> Yuval, > > On 3/8/2016 2:35 PM, Yuval Schwartz wrote: > > On Tue, Mar 8, 2016 at 10:53 PM, Mark Thomas <ma...@apache.org> wrote: > > > >> On 08/03/2016 20:20, Christopher Schultz 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 > >> > >> Yes they are. > >> > >> You need to look at the operations. findMappings() will list them. > >> > > > > I did this and it worked: > > The english patterns show up fine, as expected. > > The hebrew pattern shows up as a bunch of question marks (eg: > > ????-?????-????) > > The URLEncoded pattern shows up as wierd symbols (eg: diamond shape, tm > > symbol). > > > > Could this be something in my IDE (Netbeans) settings? The logs for > > example, display hebrew characters as question marks. Although my project > > encoding is set as UTF-8. > > > > Thanks. > > > > > > > >> > >> Mark > > Are you developing on Windows? (ah, you are) > > If so, could you check how you launch NetBeans? My netbeans.conf file > contains this on the netbeans_default_options line: > > -J-Dfile.encoding=UTF-8 > I tried this, still doesn't fix the issue (Although a change is noticed: going to help-->about under "system" text changes from "cp1252" to "UTF-8"). > > Also, if you're using Maven with NetBeans, UTF-8 has to be set there as > well. My projects contain the following in pom.xml: > > <properties> > <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> > <!-- more stuff --> > </properties> > I don't think I use Maven for this. I use the default build process (for my development environment) ie: I right click the project and click "run". For my production I build with "gulp". > > If you have cygwin installed on Windows, you can use the following: > > file -bi [filename] > Which file am I supposed to do this for? > > will tell you the encoding and mime-type. > > iconv will help you convert from us-ascii to UTF-8. The syntax is: > > iconv -f [from-encoding] -t [to-encoding] [input-file] > output-file > Are you suggesting I convert all of my source files to UTF-8? Will all new files that are created now be in UTF-8 at least? Because I just created a new servlet for testing purposes (after the -J-Dfile.encoding property was added) and hebrew urls still aren't found. > > I suspect there are native Windows tools to do this, but I'd have to > wander about and find them. > > Notepad will tell you when you open a file what encoding the file is. > You could then do a "save as" and select the correct encoding. > > Sadly, NetBeans does not have a plugin to do this. > > . . . just my two cents > Thanks. > /mde/ > >