File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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


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

Joined: Jan 10, 2002
Posts: 62749

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
jQuery in Action, 2nd edition
subject: get domain url