Mercurial Hosting > luan
comparison src/org/eclipse/jetty/server/AbstractHttpConnection.java @ 1034:563458c4dc93
remove HttpGenerator.reset()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 03 Nov 2016 21:02:59 -0600 |
parents | 4ada7a8c128a |
children | 898774c2cd87 |
comparison
equal
deleted
inserted
replaced
1033:4ada7a8c128a | 1034:563458c4dc93 |
---|---|
96 protected volatile HttpParser _parser; | 96 protected volatile HttpParser _parser; |
97 protected final HttpFields _requestFields = new HttpFields(); | 97 protected final HttpFields _requestFields = new HttpFields(); |
98 public volatile Request _request; | 98 public volatile Request _request; |
99 private volatile ServletInputStream _in; | 99 private volatile ServletInputStream _in; |
100 | 100 |
101 protected final HttpGenerator _generator; | 101 protected volatile HttpGenerator _generator; |
102 final HttpFields _responseFields = new HttpFields(); | 102 final HttpFields _responseFields = new HttpFields(); |
103 protected volatile Response _response; | 103 protected volatile Response _response; |
104 private volatile Output _out; | 104 private volatile Output _out; |
105 private volatile HttpWriter _writer; | 105 private volatile HttpWriter _writer; |
106 private volatile PrintWriter _printWriter; | 106 private volatile PrintWriter _printWriter; |
117 | 117 |
118 protected AbstractHttpConnection(Connector connector, EndPoint endpoint) | 118 protected AbstractHttpConnection(Connector connector, EndPoint endpoint) |
119 { | 119 { |
120 super(endpoint); | 120 super(endpoint); |
121 _connector = connector; | 121 _connector = connector; |
122 _generator = new HttpGenerator(_connector.getResponseBuffers(), endpoint); | |
123 _server = connector.server; | 122 _server = connector.server; |
124 init(); | 123 init(); |
125 } | 124 } |
126 | 125 |
127 void initParser() { | 126 void initParser() { |
128 Buffers buffers = _connector.getRequestBuffers(); | 127 Buffers buffers = _connector.getRequestBuffers(); |
129 _parser = new HttpParser(buffers.getHeader(), buffers.getBuffer(), _endp, new RequestHandler()); | 128 _parser = new HttpParser(buffers.getHeader(), buffers.getBuffer(), _endp, new RequestHandler()); |
130 } | 129 } |
131 | 130 |
131 void initGenerator() { | |
132 if( _generator != null ) | |
133 _generator.shutdown(); | |
134 _generator = new HttpGenerator(_connector.getResponseBuffers(), _endp); | |
135 } | |
136 | |
132 private void init() { | 137 private void init() { |
133 initParser(); | 138 initParser(); |
139 initGenerator(); | |
134 _request = new Request(this); | 140 _request = new Request(this); |
135 _response = new Response(this); | 141 _response = new Response(this); |
136 } | 142 } |
137 | 143 |
138 public final Connector getConnector() | 144 public final Connector getConnector() |
229 } | 235 } |
230 | 236 |
231 protected void reset() | 237 protected void reset() |
232 { | 238 { |
233 _requestFields.clear(); | 239 _requestFields.clear(); |
234 _generator.reset(); | |
235 _generator.returnBuffers();// TODO maybe only on unhandle | 240 _generator.returnBuffers();// TODO maybe only on unhandle |
236 _responseFields.clear(); | 241 _responseFields.clear(); |
237 _uri.clear(); | 242 _uri.clear(); |
238 _writer = null; | 243 _writer = null; |
239 _earlyEOF = false; | 244 _earlyEOF = false; |
378 catch(RuntimeException e) | 383 catch(RuntimeException e) |
379 { | 384 { |
380 LOG.warn("header full: " + e); | 385 LOG.warn("header full: " + e); |
381 | 386 |
382 _response.reset(); | 387 _response.reset(); |
383 _generator.reset(); | 388 initGenerator(); |
384 _generator.setResponse(HttpStatus.INTERNAL_SERVER_ERROR_500,null); | 389 _generator.setResponse(HttpStatus.INTERNAL_SERVER_ERROR_500,null); |
385 _generator.completeHeader(_responseFields,HttpGenerator.LAST); | 390 _generator.completeHeader(_responseFields,HttpGenerator.LAST); |
386 _generator.complete(); | 391 _generator.complete(); |
387 throw new HttpException(HttpStatus.INTERNAL_SERVER_ERROR_500); | 392 throw new HttpException(HttpStatus.INTERNAL_SERVER_ERROR_500); |
388 } | 393 } |
405 { | 410 { |
406 LOG.warn("header full: "+e); | 411 LOG.warn("header full: "+e); |
407 LOG.debug("",e); | 412 LOG.debug("",e); |
408 | 413 |
409 _response.reset(); | 414 _response.reset(); |
410 _generator.reset(); | 415 initGenerator(); |
411 _generator.setResponse(HttpStatus.INTERNAL_SERVER_ERROR_500,null); | 416 _generator.setResponse(HttpStatus.INTERNAL_SERVER_ERROR_500,null); |
412 _generator.completeHeader(_responseFields,HttpGenerator.LAST); | 417 _generator.completeHeader(_responseFields,HttpGenerator.LAST); |
413 _generator.complete(); | 418 _generator.complete(); |
414 throw new HttpException(HttpStatus.INTERNAL_SERVER_ERROR_500); | 419 throw new HttpException(HttpStatus.INTERNAL_SERVER_ERROR_500); |
415 } | 420 } |