Search code examples
mavenjettystatic-resource

Maven Jetty 7 & static resources


I would like to change our infrastructure to take benefits of Jetty and rapid application development.

Shortly I would like to serve static content. I found such an explanation at Jetty documentation.

<Configure class="org.mortbay.jetty.handler.ContextHandler">
    <Set name="contextPath">/static</Set>
    <Set name="resourceBase">D:/LocalProjects/myproject/html/static/
    </Set>
    <Call name="addHandler">
        <Arg>
            <New class="org.mortbay.jetty.handler.ResourceHandler"/>
        </Arg>
    </Call>
</Configure>                        

What is the maven equivalent of the the configuration above?

Thanks


Solution

  •   <contextHandlers>
           <contextHandler implementation="org.eclipse.jetty.server.handler.ContextHandler">
               <contextPath>/static</contextPath>
               <resourceBase>D:/LocalProjects/myproject/html/static/</resourceBase>
               <handler implementation="org.eclipse.jetty.server.handler.ResourceHandler"/>
            </contextHandler>
      </contextHandlers>