Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 181395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:45:22+00:00 2026-05-11T14:45:22+00:00

I have an application running under Jetty, and I want the application to return

  • 0

I have an application running under Jetty, and I want the application to return self referencing absolute URLs (when generating an RSS feed, so a client must be able to work without a ‘current URL’ context).

The problem is that I don’t know ahead of time under which host name the application will be deployed, and it is quite likely that it will be deployed in a virtual hosting environment where several host names are mapped to the same IP address. I’ve tried using HttpServletRequest.getLocalName(), but that returns the resolved host name[1] for IP address on which the request was received (usually what is set in the local hosts file) and not the host name from the URL that the client specified in the HTTP request.

Basically I want to get what under CGI would be the environment variable SERVER_NAME but it doesn’t look like the Java API provides this. Any help will be appreciated.

[1] only if I’m lucky – on some setups it only returns the IP address.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T14:45:22+00:00Added an answer on May 11, 2026 at 2:45 pm

    Use ServletRequest.getServerName() to get the virtual host name from the ‘Host’ header. This is equivalent to CGI’s SERVER_NAME variable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application running under apache that I want to keep in the
I have a Swing Application running under Linux, that has problems to display accented
We have an issue related to a Java application running under a (rather old)
I have a web application that's currently running under Tomcat 5.5.25. I'm attempting to
I have an application running under WebLogic that is using standard forms authentication. The
I have a server application running under Cent OS. The server answers many requests
I have a web application running under Tomcat. Logging for various features is implemented
I have a simple ASP.NET 3.5 application running under IIS7 under a virtual directory.
I have an application running in tomcat that has a bunch of configuration files
I have an application running only on Windows and a batch file that launches

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.