Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to extract window origin in spring

Posted on 2016-08-12
2
Medium Priority
?
103 Views
Last Modified: 2016-08-14
hi,
i basically want to capture what window.location.origin does in javascript from inside the controller in spring.

thanks
0
Comment
Question by:Rohit Bajaj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:Rohit Bajaj
ID: 41753638
so if url hitting my app is http://domain/sjdjkkrkrkjr/....
i need to get http://domain part only inside my controller or handler
0
 
LVL 36

Accepted Solution

by:
mccarl earned 2000 total points
ID: 41755849
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

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question