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

  • SEARCH
  • Home
  • 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 655889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:39:16+00:00 2026-05-13T22:39:16+00:00

Is there an easy way to map a directory in the web.xml or other

  • 0

Is there an easy way to map a directory in the web.xml or other deployment descriptor (jetty.xml, etc) files?

For example, if I have a directory /opt/files/ is there a way that I can access its files and sub-directories by visiting http://localhost/some-mapping/? It strikes me that there should be some simple way of doing this, but I haven’t been able to find out how (via google, stackoverflow, etc). All I’ve found are servlets that mimic fileservers, which is not what I would like.

For reference I am using jetty on an AIX box.

  • 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. Editorial Team
    Editorial Team
    2026-05-13T22:39:16+00:00Added an answer on May 13, 2026 at 10:39 pm

    No idea how to do it with Jetty, but in Tomcat you can just add a new <Context> to server.xml:

    <Context docBase="/opt/files" path="/files" />
    

    This way it’s accessible by http://example.com/files/.... See if something similar exist for Jetty.

    Update: after Googling, the “normal Java code” equivalent would be something like:

    WebAppContext files = new WebAppContext("/opt/files", "/files");
    Server server  = new Server(8080);
    server.setHandler(files);
    server.start(); 
    

    Now yet to translate that into jetty.xml flavor. I am a bit guessing based on the documentation and examples found on the web, so don’t pin me on it:

    <Configure class="org.mortbay.jetty.webapp.WebAppContext">
        <Set name="webApp">/opt/files</Set>
        <Set name="contextPath">/files</Set>
    </Configure>
    

    Another possibility may be this:

    <Configure class="org.mortbay.jetty.Server">
        <Call name="addHandler">
            <Arg>
                <New class="org.mortbay.jetty.webapp.WebAppContext">
                    <Arg name="webApp">/opt/files</Arg>
                    <Arg name="contextPath">/files</Arg>
                </New>
            </Arg>
        </Call>
    </Configure>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't beleive there's no easy way to do such a basic thing like
I have a table in my database formatted like this: customer old_code new_code C1
I'm showing a Google Map based on a street address supplied from an outside
Sorry in advance for the lengthy explanation! I have a C++ application that uses
Summary: I have a struct that is read/written to file. This struct changes frequently,
What approaches can be used to embed additional meta data in HTML markup, where
I'm using a GSP for sending out emails based on the MailService plug-in. The
Perhaps this is a stupid question, but I'm trying to use BGL's dijkstra_shortest_paths ,
Trying a mental reset here: I tried to create a reliable, persistent stack with
My question is best illustrated with a code sample, so let's just start off

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.