This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes get domain url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "get domain url" Watch "get domain url" New topic

get domain url

Joseph Sweet
Ranch Hand

Joined: Jan 29, 2005
Posts: 327
Does anyone know how I can get the domain url by somthing like the ServletContext.

Somthing like


We must know, we will know. -- David Hilbert
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60794

Did you check the API for HttpServletRequest?

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Joseph Sweet
Ranch Hand

Joined: Jan 29, 2005
Posts: 327
Are there any methods to get only the protocol + domain part from the string returned by HttpServletRequest.getRequestURL()

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: get domain url
Similar Threads
mapping default page to domain name in tomcat without port Ubuntu
response.sendRedirect expecting the wrong file
I am not sure how to change the view of url for struts 2
get file path from url ?
Apache virtual hosting