java - Unexpected GET values with different URLs -
the idea pass smb file url or normal website url parameter spring web mvc controller. there issues correct output:
get values:
- http://localhost:8080/docapp/document/test/42 --> value: 42
- http://localhost:8080/docapp/document/test/www.google.com --> value: www.google
- http://localhost:8080/docapp/document/test/www.google.com/ --> value: www.google.com
- http://localhost:8080/docapp/document/test/%5c%5csmbserver%5caccounts%5ctestaccount%5cwas_muessen_programme_verarbeiten.docx --> blank page, no exceptions
as can see second , fourth url examples not work, question:
- how can handle second example? correct output should www.google.com.
- what happens during fourth example?
setup information: ubuntu 14.04 lts x64 , tomcat 8 used
java
@requestmapping(value="/document/test/{url}", method=requestmethod.get) public string test(@pathvariable string url, model model) throws ioexception { model.addattribute("url", url); return "test"; }
html
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <!doctype html> <html> <head> </head> <body> <p>value: ${url}</p> </body> </html>
change request mapping below:
@requestmapping(value="/document/test/{url:.+}", method = requestmethod.get)
and 4th url not working need encode %
. please find below encoded url:
Comments
Post a Comment