Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how to extract window origin in spring

Posted on 2016-08-12
2
Medium Priority
?
110 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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.
Suggested Courses

824 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