user1491927 user1491927 - 7 months ago 98
Java Question

How to set Default page in embedded jetty server

I am having embedded jetty server up & running on port 3309.

When I Query url localhost:3309 , it points to the directory structure of it.

What i am trying to do is , when I Query localhost:3309 it should point to default webpage of my application.

i.e "localhost:3309/Index.html"

How to achieve this.

I am only using jetty server with Java code without servlet , JSP.

Answer

The WebAppContext class has a method setWelcomeFiles(String[]); which can be used to set the welcome file.

Hope this helps!

Thanks