Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Need some help to write a jetty.xml file

more information here : https://jira.codehaus.org/browse/JETTY-1503


2013/8/15 Hugo Lassiège <hlassiege@xxxxxxxxx>
Because this attribute is not supported in Jetty

(I've posted on the bugtracker of jetty last year and this workaround was proposed by them)


2013/8/15 Joakim Erdfelt <joakim@xxxxxxxxxxx>
If you are using Servlet 3.0, why not just set your web.xml's metadata-complete="true" instead?
That should disable annotation scanning as well.



--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts


On Thu, Aug 15, 2013 at 9:55 AM, Hugo Lassiège <hlassiege@xxxxxxxxx> wrote:
Hi,

I currently have two jetty.xml file, one for prod, one for dev. 

The jetty.xml file for prod is quite simple. It configure a WebAppContext like this : 

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<Set name="war"><SystemProperty name="jetty.home" default="."/>/workable-web/target/workable.war</Set>
    <Call name="setAttribute">
        <Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
        <Arg>.*/.*langur[^/]*\.jar$</Arg>
    </Call>
</Configure>

This configuration allows to avoid scanning the whole classpath for JEE annotations.

In dev, I have a basic configuration file to enable https but I am unable to backport the previous configuration. So I scan the whole classpath and startup is very time consuming. 

The dev file : 

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">

<Configure id="jetty" class="org.eclipse.jetty.server.Server">
    <New id="httpsConfig" class="org.eclipse.jetty.server.HttpConfiguration">
        <Set name="secureScheme">https</Set>
        <Set name="securePort">8443</Set>
        <Set name="outputBufferSize">32768</Set>
        <Call name="addCustomizer">
            <Arg><New class="org.eclipse.jetty.server.SecureRequestCustomizer"/></Arg>
        </Call>
    </New>

    <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
        <Set name="secureScheme">https</Set>
        <Set name="securePort">8443</Set>
        <Set name="outputBufferSize">32768</Set>
        <!-- Uncomment to enable handling of X-Forwarded- style headers-->
          <Call name="addCustomizer">
            <Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg>
          </Call>

    </New>

    <New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
        <Set name="KeyStorePath">./workable-web/ssl/keystore</Set>
        <Set name="KeyStorePassword">hopwork1234</Set>
        <Set name="KeyManagerPassword">hopwork1234</Set>
    </New>

    <New id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
        <Arg name="server"><Ref refid="jetty" /></Arg>
        <Arg name="factories">
            <Array type="org.eclipse.jetty.server.ConnectionFactory">
                <Item><New class="org.eclipse.jetty.server.SslConnectionFactory">
                    <Arg name="sslContextFactory"><Ref refid="sslContextFactory" /></Arg>
                    <Arg name="next">http/1.1</Arg>
                </New></Item>
                <Item>
                    <New class="org.eclipse.jetty.server.HttpConnectionFactory">
                        <Arg name="config"><Ref refid="httpsConfig" /></Arg>
                    </New>
                </Item>
            </Array>
        </Arg>
        <Set name="port">8443</Set>
        <Set name="idleTimeout">30000</Set>
    </New>

    <Call name="addConnector">
        <Arg><Ref refid="sslConnector" /></Arg>
    </Call>

    <Call name="addConnector">
        <Arg>
            <New class="org.eclipse.jetty.server.ServerConnector">
                <Arg name="server"><Ref refid="jetty" /></Arg>
                <Arg name="factories">
                    <Array type="org.eclipse.jetty.server.ConnectionFactory">
                        <Item>
                            <New class="org.eclipse.jetty.server.HttpConnectionFactory">
                                <Arg name="config"><Ref refid="httpConfig" /></Arg>
                            </New>
                        </Item>
                    </Array>
                </Arg>
                <Set name="port"><Property name="jetty.port" default="8088" /></Set>
                <Set name="idleTimeout"><Property name="http.timeout" default="30000"/></Set>
            </New>
        </Arg>
    </Call>

</Configure>


I don't understand in the documentation how to combine the configuration of a webapp context and the configuration of a server

Any idea ?

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users




Back to the top