jQuery in Action, 3rd edition
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
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 http://www.mydomain.com


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

Joined: Jan 10, 2002
Posts: 63343

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: http://aspose.com/file-tools
subject: get domain url
It's not a secret anymore!