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
Post a Comment