Mercurial Hosting > luan
comparison src/org/eclipse/jetty/http/AbstractGenerator.java @ 1031:921c25a05eaa
remove Buffer.asReadOnlyBuffer()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 03 Nov 2016 02:04:40 -0600 |
parents | 8c13b9224cff |
children | 563458c4dc93 |
comparison
equal
deleted
inserted
replaced
1030:80cad9086593 | 1031:921c25a05eaa |
---|---|
23 import org.eclipse.jetty.io.Buffer; | 23 import org.eclipse.jetty.io.Buffer; |
24 import org.eclipse.jetty.io.Buffers; | 24 import org.eclipse.jetty.io.Buffers; |
25 import org.eclipse.jetty.io.ByteArrayBuffer; | 25 import org.eclipse.jetty.io.ByteArrayBuffer; |
26 import org.eclipse.jetty.io.EndPoint; | 26 import org.eclipse.jetty.io.EndPoint; |
27 import org.eclipse.jetty.io.EofException; | 27 import org.eclipse.jetty.io.EofException; |
28 import org.eclipse.jetty.io.View; | |
29 import org.slf4j.Logger; | 28 import org.slf4j.Logger; |
30 import org.slf4j.LoggerFactory; | 29 import org.slf4j.LoggerFactory; |
31 | 30 |
32 /* ------------------------------------------------------------ */ | 31 /* ------------------------------------------------------------ */ |
33 /** | 32 /** |
243 int len=reason.length(); | 242 int len=reason.length(); |
244 | 243 |
245 // TODO don't hard code | 244 // TODO don't hard code |
246 if (len>1024) | 245 if (len>1024) |
247 len=1024; | 246 len=1024; |
248 _reason=new ByteArrayBuffer(len); | 247 _reason = new ByteArrayBuffer(len); |
249 for (int i=0;i<len;i++) | 248 for (int i=0;i<len;i++) |
250 { | 249 { |
251 char ch = reason.charAt(i); | 250 char ch = reason.charAt(i); |
252 if (ch!='\r'&&ch!='\n') | 251 if (ch!='\r'&&ch!='\n') |
253 _reason.put((byte)ch); | 252 _reason.put((byte)ch); |
363 LOG.debug("sendError: {} {}",code,reason); | 362 LOG.debug("sendError: {} {}",code,reason); |
364 setResponse(code, reason); | 363 setResponse(code, reason); |
365 if (content != null) | 364 if (content != null) |
366 { | 365 { |
367 completeHeader(null, false); | 366 completeHeader(null, false); |
368 addContent(new View(new ByteArrayBuffer(content)), LAST); | 367 addContent(new ByteArrayBuffer(content), LAST); |
369 } | 368 } |
370 else if (code>=400) | 369 else if (code>=400) |
371 { | 370 { |
372 completeHeader(null, false); | 371 completeHeader(null, false); |
373 addContent(new View(new ByteArrayBuffer("Error: "+(reason==null?(""+code):reason))), LAST); | 372 addContent(new ByteArrayBuffer("Error: "+(reason==null?(""+code):reason)), LAST); |
374 } | 373 } |
375 else | 374 else |
376 { | 375 { |
377 completeHeader(null, true); | 376 completeHeader(null, true); |
378 } | 377 } |