java - Tomcat 8 converts hyphens to %2D in the URL -


how prevent tomcat encoding hyphens (-) %2d in urls. behaviour causes session related issues when requests made safari browser.

deployed war file: my-app.war

generated url: /my%2dapp

desired url: /my-app

if referring links generated tomcat manger: issue experience rooted not in context configuration in htmlmanagerservlet. servlet includes following line:

 "<a href=\"" + url_encoder.encode(contextpath + "/") 

which custom encoder: org.apache.catalina.util.urlencoder. static instance employed in code not use default singleton marks following chars safe:

public static final urlencoder default = new urlencoder(); static {     default.addsafecharacter('~');     default.addsafecharacter('-');     default.addsafecharacter('_');     default.addsafecharacter('.');     default.addsafecharacter('*');     default.addsafecharacter('/'); } 

but rather this:

static {     url_encoder = new urlencoder();     // '/' should not encoded in context paths     url_encoder.addsafecharacter('/'); } 

so outcome every single char except / url-encoded utf-8.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -