4

I tried below configuration:

<plugin>
            <groupId>org.mortbay.jetty</groupId>  
            <artifactId>jetty-maven-plugin</artifactId>
            <version>7.6.14.v20131031</version>
            <!--  
            <version>7.6.14.v20131031</version>
            <version>8.1.10.v20130312</version>
            -->     
            <configuration>
                <reload>manual</reload>
                <webApp>
                    <contextPath>/myapp</contextPath>
                    <defaultsDescriptor>${basedir}/src/test/resources/jetty/webdefault.xml</defaultsDescriptor>
                    <jettyEnvXml>${basedir}/src/test/resources/jetty/jetty-env.xml</jettyEnvXml>
                    <descriptor>${basedir}/src/test/resources/jetty/web.xml</descriptor>
                </webApp>
                <webAppSourceDirectory>${basedir}/WebContent</webAppSourceDirectory>
            </configuration>
    </plugin>

But the response is always having a wrong MIME type, as text/html, not the expected text/css:

Server: Jetty(7.6.14.v20131031)
Last-Modified:  Thu, 16 Jan 2014 08:09:48 GMT
Content-Type:   text/html;charset=UTF-8
Content-Length: 28095
Content-Language:   en-US
Accept-Ranges:  bytes

I have extracted the webdefault.xml out and added below MIME type mapping:

<mime-mapping>
  <extension>css</extension>
  <mime-type>text/css</mime-type>
</mime-mapping>

And I also tried to add above code snippet into my web.xml too but still no luck.

What should I do then? Please advise, thanks.

Bright
  • 646
  • 5
  • 9
  • possible duplicate of [Why is Jetty serving css with text/html content type](http://stackoverflow.com/questions/15852443/why-is-jetty-serving-css-with-text-html-content-type) – Paul Sweatte Nov 04 '14 at 15:50

0 Answers0