java - How to change "pathInfo" of HttpServletRequest -


i afraid ask strange question want change "pathinfo" of httpservletrequest @ handler method of controller. please take @ below.

i know can "pathinfo" using getpathinfo(). however. don't know how set pathinfo. possible ? appreciated

@requestmapping(value = "show1" method = requestmethod.get) public string show1(model model, httpservletrequest request) {      // want set "pathinfo" kind of methods not provided      //request.setpathinfo("/show2");      // thought beanutils.copy may available.. no ideas.      // have call show2() same request object     return show2(model, request); }  // not allowed edit method private string show2(model model, httpservletrequest request) {      // hope display "http://localhost:8080/contextroot/show2"     system.out.println(request.getrequesturl());      return "complete"; } 

you can't set these values.

the option create wrapper request, this:

return show2(model, new httpservletrequestwrapper(request) {     public stringbuffer getrequesturl() {         return new stringbuffer(             super.getrequesturl().tostring().replacefirst("/show1$", "/show2"));     } }); 

Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -