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 8068009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:31:08+00:00 2026-06-05T12:31:08+00:00

If I enter http://example.com/index.html in my browser, jetty should look in a specified dir

  • 0

If I enter http://example.com/index.html in my browser, jetty should look in a specified dir for the file index.html.

How can I achieve this with embedded jetty?

This is my code to start jetty:

InetSocketAddress socketAddress =InetSocketAddress.createUnresolved("0.0.0.0", 80);
Server server = new Server(socketAddress);
server.start();
server.join();
  • 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-06-05T12:31:10+00:00Added an answer on June 5, 2026 at 12:31 pm

    Found a good description at http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty

    public class FileServer{
    
        public static void main(String[] args) throws Exception{
    
            Server server = new Server();
            SelectChannelConnector connector = new SelectChannelConnector();
            connector.setPort(8080);
            server.addConnector(connector);
    
            ResourceHandler resource_handler = new ResourceHandler();
            resource_handler.setDirectoriesListed(true);
            resource_handler.setWelcomeFiles(new String[]{ "index.html" });
    
            resource_handler.setResourceBase(".");
    
            HandlerList handlers = new HandlerList();
            handlers.setHandlers(new Handler[] { resource_handler, new DefaultHandler() });
            server.setHandler(handlers);
    
            server.start();
            server.join();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the URL (single line): http://test.example.com/dir/subdir/file.html How can I extract the following parts using
I want to create a single page such as this: http://www.mywebsite.com/special/index.html But anything in
Here's an example: http://jsfiddle.net/7g8GD/1/ Once you have entered an invalid input and hit enter
in this page http://api.jquery.com/category/effects/ when you put 'up'(keyboard) and 'down',then put 'enter',it will go
In this example http://jsbin.com/inoka4 no width is defined for parent element if i want
I'm trying to modify this example: http://jqueryui.com/demos/autocomplete/#combobox to parse a similar select list, in
Edited: To better explain what i want. We want to move our frontpage http://www.example.com
basically i have a website i.e www.example.com when i enter www.example.com it deosnt work
So here's what I'd like to do: access to http://example.com/ * would require the
I've got a url type:- http://www.example.com/products.php?cat=1 which I am able to rewrite to:- http://www.example.com/myproduct1

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.