Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 0586134af330ac7e1b7518d2740f98ea13b5b220 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

<!-- =============================================================== -->
<!-- Configure the Jetty Server                                      -->
<!--                                                                 -->
<!-- Documentation of this file format can be found at:              -->
<!-- http://docs.codehaus.org/display/JETTY/jetty.xml                -->
<!--                                                                 -->
<!-- =============================================================== -->


<Configure id="Server" class="org.eclipse.jetty.server.Server">

    <!-- =========================================================== -->
    <!-- Server Thread Pool                                          -->
    <!-- =========================================================== -->
    <Set name="ThreadPool">
      <!-- Default queued blocking threadpool -->
      <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
        <Set name="minThreads">10</Set>
        <Set name="maxThreads">50</Set>
        <Set name="lowThreads">5</Set>
        <Set name="SpawnOrShrinkAt">2</Set>
      </New>
    </Set>



    <!-- =========================================================== -->
    <!-- Set connectors                                              -->
    <!-- =========================================================== -->
    <!-- One of each type!                                           -->
    <!-- =========================================================== -->

    <!-- Use this connector for many frequently idle connections
         and for threadless continuations.
    -->
    <Call name="addConnector">
      <Arg>
          <New class="org.eclipse.jetty.server.ServerConnector">
            <Set name="host"><SystemProperty name="jetty.host" /></Set>
            <Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>
            <Set name="idleTimeout">30000</Set>
            <Set name="Acceptors">2</Set>
            <Set name="statsOn">false</Set>
            <Set name="confidentialPort">8443</Set>
          </New>
      </Arg>
    </Call>

    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!-- To add a HTTPS SSL listener                                     -->
    <!-- see jetty-ssl.xml to add an ssl connector. use                  -->
    <!-- java -jar start.jar etc/jetty-ssl.xml                           -->
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <!-- =========================================================== -->
    <!-- Set up global session ID manager                            -->
    <!-- =========================================================== -->
    <!--
    <Set name="sessionIdManager">
      <New class="org.eclipse.jetty.servlet.HashSessionIdManager">
        <Set name="workerName">node1</Set>
      </New>
    </Set>
    -->

    <!-- =========================================================== -->
    <!-- Set handler Collection Structure                            -->
    <!-- =========================================================== -->
    <Set name="handler">

      <!-- ==========================================================  -->
      <!-- RewriteHandler Sample Configuration                         -->
      <!-- ==========================================================  -->
      <New id="Handlers" class="org.eclipse.jetty.rewrite.handler.RewriteHandler">

        <Set name="originalPathAttribute">requestedPath</Set>
        <Set name="rewriteRequestURI">true</Set>

        <Set name="rules">
          <Array type="org.eclipse.jetty.rewrite.handler.Rule">

            <Item>
              <New id="rewrite" class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
                <Set name="pattern">/*</Set>
                <Set name="replacement">/test</Set>
              </New>
            </Item>

            <Item>
              <New id="response" class="org.eclipse.jetty.rewrite.handler.ResponsePatternRule">
                <Set name="pattern">/session/</Set>
                <Set name="code">401</Set>
                <Set name="reason">Setting error code 401</Set>
              </New>
            </Item>

            <Item>
              <New id="header" class="org.eclipse.jetty.rewrite.handler.HeaderPatternRule">
                <Set name="pattern">*.jsp</Set>
                <Set name="name">Server</Set>
                <Set name="value">dexter webserver</Set>
              </New>
            </Item>

            <Item>
              <New id="header" class="org.eclipse.jetty.rewrite.handler.HeaderPatternRule">
                <Set name="pattern">*.jsp</Set>
                <Set name="name">title</Set>
                <Set name="value">driven header purpose</Set>
              </New>
            </Item>

            <Item>
              <New id="redirect" class="org.eclipse.jetty.rewrite.handler.RedirectPatternRule">
                <Set name="pattern">/test/dispatch</Set>
                <Set name="location">http://jetty.eclipse.org</Set>
              </New>
            </Item>

            <Item>
              <New id="regexRewrite" class="org.eclipse.jetty.rewrite.handler.RewriteRegexRule">
                <Set name="regex">/test-jaas/$</Set>
                <Set name="replacement">/demo</Set>
              </New>
            </Item>

            <Item>
              <New id="forwardedHttps" class="org.eclipse.jetty.rewrite.handler.ForwardedSchemeHeaderRule">
                <Set name="header">X-Forwarded-Scheme</Set>
                <Set name="headerValue">https</Set>
                <Set name="scheme">https</Set>
              </New>
            </Item>

            <Item>
              <New id="virtualHost" class="org.eclipse.jetty.rewrite.handler.VirtualHostRuleContainer">

                <Set name="virtualHosts">
                  <Array type="java.lang.String">
                    <Item>eclipse.com</Item>
                    <Item>www.eclipse.com</Item>
                    <Item>eclipse.org</Item>
                    <Item>www.eclipse.org</Item>
                  </Array>
                </Set>

                <Call name="addRule">
                  <Arg>
                    <New class="org.eclipse.jetty.rewrite.handler.CookiePatternRule">
                      <Set name="pattern">/*</Set>
                      <Set name="name">CookiePatternRule</Set>
                      <Set name="value">1</Set>
                    </New>
                  </Arg>
                </Call>

             </New>
           </Item>

          </Array>
        </Set>

        <Set name="handler">
          <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
            <Set name="handlers">
             <Array type="org.eclipse.jetty.server.Handler">
               <Item>
                 <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
               </Item>
               <Item>
                 <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
               </Item>
               <Item>
                 <New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
               </Item>
             </Array>
            </Set>
          </New>
        </Set>
      </New>
    </Set>

    <!-- =========================================================== -->
    <!-- Configure the context deployer                              -->
    <!-- A context deployer will deploy contexts described in        -->
    <!-- configuration files discovered in a directory.              -->
    <!-- The configuration directory can be scanned for hot          -->
    <!-- deployments at the configured scanInterval.                 -->
    <!--                                                             -->
    <!-- This deployer is configured to deploy contexts configured   -->
    <!-- in the $JETTY_HOME/contexts directory                       -->
    <!--                                                             -->
    <!-- =========================================================== -->
    <Call name="addBean">
      <Arg>
        <New class="org.eclipse.jetty.server.deployer.ContextDeployer">
          <Set name="contexts"><Ref id="Contexts"/></Set>
          <Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/contexts</Set>
          <Set name="scanInterval">1</Set>
        </New>
      </Arg>
    </Call>

    <!-- =========================================================== -->
    <!-- Configure the webapp deployer.                              -->
    <!-- A webapp  deployer will deploy standard webapps discovered  -->
    <!-- in a directory at startup, without the need for additional  -->
    <!-- configuration files.    It does not support hot deploy or   -->
    <!-- non standard contexts (see ContextDeployer above).          -->
    <!--                                                             -->
    <!-- This deployer is configured to deploy webapps from the      -->
    <!-- $JETTY_HOME/webapps directory                               -->
    <!--                                                             -->
    <!-- Normally only one type of deployer need be used.            -->
    <!--                                                             -->
    <!-- =========================================================== -->
    <Call name="addBean">
      <Arg>
        <New class="org.eclipse.jetty.server.deployer.WebAppDeployer">
          <Set name="contexts"><Ref id="Contexts"/></Set>
          <Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps</Set>
    <Set name="parentLoaderPriority">false</Set>
    <Set name="extract">true</Set>
    <Set name="allowDuplicates">false</Set>
          <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
        </New>
      </Arg>
    </Call>

    <!-- =========================================================== -->
    <!-- Configure Authentication Realms                             -->
    <!-- Realms may be configured for the entire server here, or     -->
    <!-- they can be configured for a specific web app in a context  -->
    <!-- configuration (see $(jetty.home)/contexts/test.xml for an   -->
    <!-- example).                                                   -->
    <!-- =========================================================== -->
    <Set name="LoginServices">
      <Array type="org.eclipse.jetty.security.LoginService">
        <Item>
          <New class="org.eclipse.jetty.security.jaspi.modules.HashLoginService">
            <Set name="name">Test Realm</Set>
            <Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
            <Set name="refreshInterval">0</Set>
          </New>
        </Item>
      </Array>
    </Set>

    <!-- =========================================================== -->
    <!-- Configure Request Log                                       -->
    <!-- Request logs  may be configured for the entire server here, -->
    <!-- or they can be configured for a specific web app in a       -->
    <!-- contexts configuration (see $(jetty.home)/contexts/test.xml -->
    <!-- for an example).                                            -->
    <!-- =========================================================== -->
    <Ref id="RequestLog">
      <Set name="requestLog">
        <New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
          <Set name="filename"><SystemProperty name="jetty.logs" default="./logs"/>/yyyy_mm_dd.request.log</Set>
          <Set name="filenameDateFormat">yyyy_MM_dd</Set>
          <Set name="retainDays">90</Set>
          <Set name="append">true</Set>
          <Set name="extended">true</Set>
          <Set name="logCookies">false</Set>
          <Set name="LogTimeZone">GMT</Set>
        </New>
      </Set>
    </Ref>

    <!-- =========================================================== -->
    <!-- extra options                                               -->
    <!-- =========================================================== -->
    <Set name="stopAtShutdown">true</Set>
    <Set name="sendServerVersion">true</Set>
    <Set name="sendDateHeader">true</Set>
    <Set name="stopTimeout">1000</Set>

</Configure>

Back to the top