java - Forwarding request to a new controller -


i have 2 controller 2 separate projects lets name them:

  • project1.controller1
  • project2.controller1

obviously these 2 spring controllers different projects.what want make project1.controller1 gateway request sent here. , process request if go project2.controller1 or new controller.

some pseudocode:

@controller public class someclassfromproject1{     @requestmapping(value="/controller1", method=requestmethod.post)    public string smscatcher(string target, httpservletrequest request,         httpservletresponse response){            //some processing, converting request string, etc            if("somestringthatispartoftherequest".equals("somestring"))             //carry request , forward project2.controller1            else             //go external controller          }      } 

and in project2.controller 1 this:

@controller public class someclassfromproject2{     @requestmapping(value="/controller1", method=requestmethod.post)    public string smscatcher(string target, httpservletrequest request,         httpservletresponse response){           //processing    }   } 

i've tried return "forward:/someurl"; , return "redirect:someurl";. didn't work , didn't reach project2.controller1. ideas on one?

edit: forgot add one, different project means different war deployed on same sever. , request should carried on project1.controller1 project2.controller1 because i'm gonna process request there.

thanks!

you need use redirect instead of forward.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -