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
Rohit BajajAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
mccarlConnect With a Mentor IT 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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.