• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 118
  • Last Modified:

how to extract window origin in spring

hi,
i basically want to capture what window.location.origin does in javascript from inside the controller in spring.

thanks
0
Rohit Bajaj
Asked:
Rohit Bajaj
1 Solution
 
Rohit BajajAuthor Commented:
so if url hitting my app is http://domain/sjdjkkrkrkjr/....
i need to get http://domain part only inside my controller or handler
0
 
mccarlIT Business Systems Analyst / Software DeveloperCommented:
You need to pull a few parts and assemble it, but something like this...

public void myController(HttpServletRequest req) {
    String url = req.getScheme() + "://" + req.getServerName();
}

Open in new window


And if you care about other stuff that could be there, such as port, etc, you can pull more things from the request object.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now