annotate src/org/eclipse/jetty/server/handler/HandlerWrapper.java @ 1040:3e4949834f3e

remove Buffer.asArray()
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 03 Nov 2016 23:04:11 -0600
parents 32d4b569567c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 // ========================================================================
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 // ------------------------------------------------------------------------
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 // All rights reserved. This program and the accompanying materials
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 // are made available under the terms of the Eclipse Public License v1.0
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 // and Apache License v2.0 which accompanies this distribution.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 // The Eclipse Public License is available at
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 // http://www.eclipse.org/legal/epl-v10.html
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 // The Apache License v2.0 is available at
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 // http://www.opensource.org/licenses/apache2.0.php
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 // You may elect to redistribute this code under either of these licenses.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 // ========================================================================
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 package org.eclipse.jetty.server.handler;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 import java.io.IOException;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 import javax.servlet.ServletException;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 import javax.servlet.http.HttpServletResponse;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 import org.eclipse.jetty.server.Handler;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 import org.eclipse.jetty.server.Request;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 import org.eclipse.jetty.server.Server;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 import org.eclipse.jetty.util.component.LifeCycle;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 /* ------------------------------------------------------------ */
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 /** A <code>HandlerWrapper</code> acts as a {@link Handler} but delegates the {@link Handler#handle handle} method and
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 * {@link LifeCycle life cycle} events to a delegate. This is primarily used to implement the <i>Decorator</i> pattern.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 *
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35 */
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 public class HandlerWrapper extends AbstractHandlerContainer
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
37 {
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
38 protected Handler _handler;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
40 /* ------------------------------------------------------------ */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
41 /**
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
42 *
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
43 */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
44 public HandlerWrapper()
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
45 {
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
46 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
47
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
48 /* ------------------------------------------------------------ */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
49 /**
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
50 * @return Returns the handlers.
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
51 */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
52 public Handler getHandler()
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
53 {
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
54 return _handler;
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
55 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
56
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
57 /* ------------------------------------------------------------ */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
58 /**
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
59 * @return Returns the handlers.
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
60 */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
61 public Handler[] getHandlers()
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
62 {
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
63 if (_handler==null)
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
64 return new Handler[0];
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
65 return new Handler[] {_handler};
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
66 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
67
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
68 /* ------------------------------------------------------------ */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
69 /**
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
70 * @param handler Set the {@link Handler} which should be wrapped.
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
71 */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
72 public void setHandler(Handler handler)
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
73 {
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
74 if (isStarted())
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
75 throw new IllegalStateException(STARTED);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
76
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
77 Handler old_handler = _handler;
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
78 _handler = handler;
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
79 if (handler!=null)
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
80 handler.setServer(getServer());
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
81 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
82
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
83 /* ------------------------------------------------------------ */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
84 /*
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
85 * @see org.eclipse.thread.AbstractLifeCycle#doStart()
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
86 */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
87 @Override
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
88 protected void doStart() throws Exception
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
89 {
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
90 if (_handler!=null)
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
91 _handler.start();
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
92 super.doStart();
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
93 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
94
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
95 /* ------------------------------------------------------------ */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
96 /*
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
97 * @see org.eclipse.thread.AbstractLifeCycle#doStop()
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
98 */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
99 @Override
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
100 protected void doStop() throws Exception
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
101 {
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
102 if (_handler!=null)
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
103 _handler.stop();
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
104 super.doStop();
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
105 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
106
1000
32d4b569567c simplify handle()
Franklin Schmidt <fschmidt@gmail.com>
parents: 993
diff changeset
107 @Override
32d4b569567c simplify handle()
Franklin Schmidt <fschmidt@gmail.com>
parents: 993
diff changeset
108 public void handle(String target, Request request, HttpServletResponse response) throws IOException, ServletException
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
109 {
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
110 if (_handler!=null && isStarted())
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
111 {
1000
32d4b569567c simplify handle()
Franklin Schmidt <fschmidt@gmail.com>
parents: 993
diff changeset
112 _handler.handle(target, request, response);
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
113 }
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
114 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
115
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
116
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
117 /* ------------------------------------------------------------ */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
118 @Override
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
119 public void setServer(Server server)
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
120 {
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
121 Server old_server=getServer();
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
122 if (server==old_server)
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
123 return;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
124
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
125 if (isStarted())
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
126 throw new IllegalStateException(STARTED);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
127
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
128 super.setServer(server);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
129
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
130 Handler h=getHandler();
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
131 if (h!=null)
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
132 h.setServer(server);
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
133 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
134
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
135
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
136 /* ------------------------------------------------------------ */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
137 @Override
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
138 protected Object expandChildren(Object list, Class byClass)
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
139 {
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
140 return expandHandler(_handler,list,byClass);
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
141 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
142
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
143 /* ------------------------------------------------------------ */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
144 public <H extends Handler> H getNestedHandlerByClass(Class<H> byclass)
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
145 {
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
146 HandlerWrapper h=this;
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
147 while (h!=null)
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
148 {
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
149 if (byclass.isInstance(h))
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
150 return (H)h;
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
151 Handler w = h.getHandler();
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
152 if (w instanceof HandlerWrapper)
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
153 h=(HandlerWrapper)w;
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
154 else break;
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
155 }
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
156 return null;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
157
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
158 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
159
993
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
160 /* ------------------------------------------------------------ */
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
161 @Override
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
162 public void destroy()
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
163 {
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
164 if (!isStopped())
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
165 throw new IllegalStateException("!STOPPED");
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
166 Handler child=getHandler();
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
167 if (child!=null)
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
168 {
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
169 setHandler(null);
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
170 child.destroy();
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
171 }
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
172 super.destroy();
d9d95acded81 remove ScopedHandler
Franklin Schmidt <fschmidt@gmail.com>
parents: 848
diff changeset
173 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
174
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
175 }