0

Is it possible to serve files in a given directory using jetty by just providing the directory URL ?

I have a directory called "dist" and it contains five jar files. Is it possible to serve all five jar files by just providing the dist folder in the URL like http://localhost:8000/dist ?

Kirupa
  • 73
  • 1
  • 1
  • 7
  • Please read [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – P.J.Meisch May 22 '17 at 03:53
  • Hi Meisch, I don't have code yet. Before writing the code, I want to make sure my requirement is feasible hence my question. – Kirupa May 22 '17 at 07:38

1 Answers1

0

Probably, the feature you said is "Directory Listing". It can be enabled/disabled by:

webAppContext.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "true");

or

${JETTY_HOME}/etc/webdefault.xml

<servlet>
    <servlet-name>default</servlet-name>
    <servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
    <init-param>
        <param-name>dirAllowed</param-name>
        <param-value>true</param-value>
    </init-param>
</servlet>

See also: How to disable directory listing for Jetty's WebAppContext?

Jetty documentation: http://www.eclipse.org/jetty/documentation/9.4.x/advanced-extras.html

Kohei TAMURA
  • 4,970
  • 7
  • 25
  • 49