annotate src/org/eclipse/jetty/server/Response.java @ 879:a3775d0c6985

remove ShutdownThread
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 04 Oct 2016 15:55:02 -0600
parents 8e9db0bbf4f9
children df84a1741687
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;
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 import java.io.PrintWriter;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 import java.util.Collection;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 import java.util.ArrayList;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 import java.util.Collections;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 import java.util.EnumSet;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 import java.util.Enumeration;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 import java.util.Locale;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 import javax.servlet.RequestDispatcher;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 import javax.servlet.ServletOutputStream;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 import javax.servlet.SessionTrackingMode;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 import javax.servlet.http.Cookie;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 import javax.servlet.http.HttpServletResponse;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35 import javax.servlet.http.HttpSession;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
37 import org.eclipse.jetty.http.HttpCookie;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38 import org.eclipse.jetty.http.HttpFields;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39 import org.eclipse.jetty.http.HttpGenerator;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
40 import org.eclipse.jetty.http.HttpHeaderValues;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
41 import org.eclipse.jetty.http.HttpHeaders;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
42 import org.eclipse.jetty.http.HttpSchemes;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
43 import org.eclipse.jetty.http.HttpStatus;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
44 import org.eclipse.jetty.http.HttpURI;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
45 import org.eclipse.jetty.http.HttpVersions;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
46 import org.eclipse.jetty.http.MimeTypes;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
47 import org.eclipse.jetty.io.BufferCache.CachedBuffer;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
48 import org.eclipse.jetty.server.handler.ContextHandler;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
49 import org.eclipse.jetty.server.handler.ErrorHandler;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
50 import org.eclipse.jetty.util.ByteArrayISO8859Writer;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
51 import org.eclipse.jetty.util.QuotedStringTokenizer;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
52 import org.eclipse.jetty.util.StringUtil;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
53 import org.eclipse.jetty.util.URIUtil;
820
8e9db0bbf4f9 remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents: 813
diff changeset
54 import org.slf4j.Logger;
8e9db0bbf4f9 remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents: 813
diff changeset
55 import org.slf4j.LoggerFactory;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
56
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
57 /** Response.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
58 * <p>
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
59 * Implements {@link javax.servlet.http.HttpServletResponse} from the <code>javax.servlet.http</code> package.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
60 * </p>
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
61 */
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
62 public class Response implements HttpServletResponse
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
63 {
820
8e9db0bbf4f9 remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents: 813
diff changeset
64 private static final Logger LOG = LoggerFactory.getLogger(Response.class);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
65
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
66
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
67 public static final int
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
68 NONE=0,
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
69 STREAM=1,
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
70 WRITER=2;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
71
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
72 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
73 * If a header name starts with this string, the header (stripped of the prefix)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
74 * can be set during include using only {@link #setHeader(String, String)} or
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
75 * {@link #addHeader(String, String)}.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
76 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
77 public final static String SET_INCLUDE_HEADER_PREFIX = "org.eclipse.jetty.server.include.";
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
78
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
79 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
80 * If this string is found within the comment of a cookie added with {@link #addCookie(Cookie)}, then the cookie
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
81 * will be set as HTTP ONLY.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
82 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
83 public final static String HTTP_ONLY_COMMENT="__HTTP_ONLY__";
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
84
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
85
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
86 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
87 public static Response getResponse(HttpServletResponse response)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
88 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
89 if (response instanceof Response)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
90 return (Response)response;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
91
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
92 return AbstractHttpConnection.getCurrentConnection().getResponse();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
93 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
94
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
95 private final AbstractHttpConnection _connection;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
96 private int _status=SC_OK;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
97 private String _reason;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
98 private Locale _locale;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
99 private String _mimeType;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
100 private CachedBuffer _cachedMimeType;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
101 private String _characterEncoding;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
102 private boolean _explicitEncoding;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
103 private String _contentType;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
104 private volatile int _outputState;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
105 private PrintWriter _writer;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
106
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
107 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
108 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
109 *
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
110 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
111 public Response(AbstractHttpConnection connection)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
112 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
113 _connection=connection;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
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
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
117 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
118 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
119 * @see javax.servlet.ServletResponse#reset()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
120 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
121 protected void recycle()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
122 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
123 _status=SC_OK;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
124 _reason=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
125 _locale=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
126 _mimeType=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
127 _cachedMimeType=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
128 _characterEncoding=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
129 _explicitEncoding=false;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
130 _contentType=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
131 _writer=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
132 _outputState=NONE;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
133 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
134
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
135 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
136 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
137 * @see javax.servlet.http.HttpServletResponse#addCookie(javax.servlet.http.Cookie)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
138 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
139 public void addCookie(HttpCookie cookie)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
140 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
141 _connection.getResponseFields().addSetCookie(cookie);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
142 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
143
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
144 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
145 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
146 * @see javax.servlet.http.HttpServletResponse#addCookie(javax.servlet.http.Cookie)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
147 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
148 public void addCookie(Cookie cookie)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
149 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
150 String comment=cookie.getComment();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
151 boolean http_only=false;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
152
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
153 if (comment!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
154 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
155 int i=comment.indexOf(HTTP_ONLY_COMMENT);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
156 if (i>=0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
157 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
158 http_only=true;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
159 comment=comment.replace(HTTP_ONLY_COMMENT,"").trim();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
160 if (comment.length()==0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
161 comment=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
162 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
163 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
164 _connection.getResponseFields().addSetCookie(cookie.getName(),
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
165 cookie.getValue(),
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
166 cookie.getDomain(),
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
167 cookie.getPath(),
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
168 cookie.getMaxAge(),
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
169 comment,
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
170 cookie.getSecure(),
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
171 http_only || cookie.isHttpOnly(),
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
172 cookie.getVersion());
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
173 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
174
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
175 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
176 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
177 * @see javax.servlet.http.HttpServletResponse#containsHeader(java.lang.String)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
178 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
179 public boolean containsHeader(String name)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
180 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
181 return _connection.getResponseFields().containsKey(name);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
182 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
183
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
184 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
185 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
186 * @see javax.servlet.http.HttpServletResponse#encodeURL(java.lang.String)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
187 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
188 public String encodeURL(String url)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
189 {
809
09d518d313b7 remove SessionManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
190 throw new UnsupportedOperationException();
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
191 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
192
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
193 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
194 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
195 * @see javax.servlet.http.HttpServletResponse#encodeRedirectURL(java.lang.String)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
196 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
197 public String encodeRedirectURL(String url)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
198 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
199 return encodeURL(url);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
200 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
201
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
202 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
203 @Deprecated
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
204 public String encodeUrl(String url)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
205 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
206 return encodeURL(url);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
207 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
208
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
209 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
210 @Deprecated
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
211 public String encodeRedirectUrl(String url)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
212 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
213 return encodeRedirectURL(url);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
214 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
215
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
216 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
217 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
218 * @see javax.servlet.http.HttpServletResponse#sendError(int, java.lang.String)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
219 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
220 public void sendError(int code, String message) throws IOException
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
221 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
222 if (_connection.isIncluding())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
223 return;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
224
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
225 if (isCommitted())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
226 LOG.warn("Committed before "+code+" "+message);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
227
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
228 resetBuffer();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
229 _characterEncoding=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
230 setHeader(HttpHeaders.EXPIRES,null);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
231 setHeader(HttpHeaders.LAST_MODIFIED,null);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
232 setHeader(HttpHeaders.CACHE_CONTROL,null);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
233 setHeader(HttpHeaders.CONTENT_TYPE,null);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
234 setHeader(HttpHeaders.CONTENT_LENGTH,null);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
235
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
236 _outputState=NONE;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
237 setStatus(code,message);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
238
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
239 if (message==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
240 message=HttpStatus.getMessage(code);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
241
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
242 // If we are allowed to have a body
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
243 if (code!=SC_NO_CONTENT &&
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
244 code!=SC_NOT_MODIFIED &&
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
245 code!=SC_PARTIAL_CONTENT &&
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
246 code>=SC_OK)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
247 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
248 Request request = _connection.getRequest();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
249
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
250 ErrorHandler error_handler = null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
251 ContextHandler.Context context = request.getContext();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
252 if (context!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
253 error_handler=context.getContextHandler().getErrorHandler();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
254 if (error_handler==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
255 error_handler = _connection.getConnector().getServer().getBean(ErrorHandler.class);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
256 if (error_handler!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
257 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
258 request.setAttribute(RequestDispatcher.ERROR_STATUS_CODE,new Integer(code));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
259 request.setAttribute(RequestDispatcher.ERROR_MESSAGE, message);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
260 request.setAttribute(RequestDispatcher.ERROR_REQUEST_URI, request.getRequestURI());
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
261 error_handler.handle(null,_connection.getRequest(),_connection.getRequest(),this );
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
262 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
263 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
264 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
265 setHeader(HttpHeaders.CACHE_CONTROL, "must-revalidate,no-cache,no-store");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
266 setContentType(MimeTypes.TEXT_HTML_8859_1);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
267 ByteArrayISO8859Writer writer= new ByteArrayISO8859Writer(2048);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
268 if (message != null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
269 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
270 message= StringUtil.replace(message, "&", "&amp;");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
271 message= StringUtil.replace(message, "<", "&lt;");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
272 message= StringUtil.replace(message, ">", "&gt;");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
273 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
274 String uri= request.getRequestURI();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
275 if (uri!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
276 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
277 uri= StringUtil.replace(uri, "&", "&amp;");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
278 uri= StringUtil.replace(uri, "<", "&lt;");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
279 uri= StringUtil.replace(uri, ">", "&gt;");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
280 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
281
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
282 writer.write("<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=ISO-8859-1\"/>\n");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
283 writer.write("<title>Error ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
284 writer.write(Integer.toString(code));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
285 writer.write(' ');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
286 if (message==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
287 message=HttpStatus.getMessage(code);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
288 writer.write(message);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
289 writer.write("</title>\n</head>\n<body>\n<h2>HTTP ERROR: ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
290 writer.write(Integer.toString(code));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
291 writer.write("</h2>\n<p>Problem accessing ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
292 writer.write(uri);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
293 writer.write(". Reason:\n<pre> ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
294 writer.write(message);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
295 writer.write("</pre>");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
296 writer.write("</p>\n<hr /><i><small>Powered by Jetty://</small></i>");
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
297
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
298 for (int i= 0; i < 20; i++)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
299 writer.write("\n ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
300 writer.write("\n</body>\n</html>\n");
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
301
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
302 writer.flush();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
303 setContentLength(writer.size());
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
304 writer.writeTo(getOutputStream());
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
305 writer.destroy();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
306 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
307 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
308 else if (code!=SC_PARTIAL_CONTENT)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
309 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
310 _connection.getRequestFields().remove(HttpHeaders.CONTENT_TYPE_BUFFER);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
311 _connection.getRequestFields().remove(HttpHeaders.CONTENT_LENGTH_BUFFER);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
312 _characterEncoding=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
313 _mimeType=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
314 _cachedMimeType=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
315 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
316
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
317 complete();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
318 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
319
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
320 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
321 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
322 * @see javax.servlet.http.HttpServletResponse#sendError(int)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
323 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
324 public void sendError(int sc) throws IOException
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
325 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
326 if (sc==102)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
327 sendProcessing();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
328 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
329 sendError(sc,null);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
330 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
331
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
332 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
333 /* Send a 102-Processing response.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
334 * If the connection is a HTTP connection, the version is 1.1 and the
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
335 * request has a Expect header starting with 102, then a 102 response is
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
336 * sent. This indicates that the request still be processed and real response
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
337 * can still be sent. This method is called by sendError if it is passed 102.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
338 * @see javax.servlet.http.HttpServletResponse#sendError(int)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
339 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
340 public void sendProcessing() throws IOException
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
341 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
342 if (_connection.isExpecting102Processing() && !isCommitted())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
343 ((HttpGenerator)_connection.getGenerator()).send1xx(HttpStatus.PROCESSING_102);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
344 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
345
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
346 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
347 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
348 * @see javax.servlet.http.HttpServletResponse#sendRedirect(java.lang.String)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
349 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
350 public void sendRedirect(String location) throws IOException
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
351 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
352 if (_connection.isIncluding())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
353 return;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
354
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
355 if (location==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
356 throw new IllegalArgumentException();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
357
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
358 if (!URIUtil.hasScheme(location))
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
359 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
360 StringBuilder buf = _connection.getRequest().getRootURL();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
361 if (location.startsWith("/"))
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
362 buf.append(location);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
363 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
364 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
365 String path=_connection.getRequest().getRequestURI();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
366 String parent=(path.endsWith("/"))?path:URIUtil.parentPath(path);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
367 location=URIUtil.addPaths(parent,location);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
368 if(location==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
369 throw new IllegalStateException("path cannot be above root");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
370 if (!location.startsWith("/"))
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
371 buf.append('/');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
372 buf.append(location);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
373 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
374
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
375 location=buf.toString();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
376 HttpURI uri = new HttpURI(location);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
377 String path=uri.getDecodedPath();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
378 String canonical=URIUtil.canonicalPath(path);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
379 if (canonical==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
380 throw new IllegalArgumentException();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
381 if (!canonical.equals(path))
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
382 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
383 buf = _connection.getRequest().getRootURL();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
384 buf.append(URIUtil.encodePath(canonical));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
385 String param=uri.getParam();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
386 if (param!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
387 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
388 buf.append(';');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
389 buf.append(param);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
390 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
391 String query=uri.getQuery();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
392 if (query!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
393 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
394 buf.append('?');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
395 buf.append(query);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
396 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
397 String fragment=uri.getFragment();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
398 if (fragment!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
399 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
400 buf.append('#');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
401 buf.append(fragment);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
402 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
403 location=buf.toString();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
404 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
405 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
406
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
407 resetBuffer();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
408 setHeader(HttpHeaders.LOCATION,location);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
409 setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
410 complete();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
411
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
412 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
413
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
414 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
415 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
416 * @see javax.servlet.http.HttpServletResponse#setDateHeader(java.lang.String, long)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
417 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
418 public void setDateHeader(String name, long date)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
419 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
420 if (!_connection.isIncluding())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
421 _connection.getResponseFields().putDateField(name, date);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
422 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
423
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
424 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
425 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
426 * @see javax.servlet.http.HttpServletResponse#addDateHeader(java.lang.String, long)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
427 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
428 public void addDateHeader(String name, long date)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
429 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
430 if (!_connection.isIncluding())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
431 _connection.getResponseFields().addDateField(name, date);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
432 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
433
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
434 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
435 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
436 * @see javax.servlet.http.HttpServletResponse#setHeader(java.lang.String, java.lang.String)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
437 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
438 public void setHeader(String name, String value)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
439 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
440 if (HttpHeaders.CONTENT_TYPE.equalsIgnoreCase(name))
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
441 setContentType(value);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
442 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
443 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
444 if (_connection.isIncluding())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
445 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
446 if (name.startsWith(SET_INCLUDE_HEADER_PREFIX))
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
447 name=name.substring(SET_INCLUDE_HEADER_PREFIX.length());
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
448 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
449 return;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
450 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
451 _connection.getResponseFields().put(name, value);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
452 if (HttpHeaders.CONTENT_LENGTH.equalsIgnoreCase(name))
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
453 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
454 if (value==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
455 _connection._generator.setContentLength(-1);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
456 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
457 _connection._generator.setContentLength(Long.parseLong(value));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
458 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
459 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
460 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
461
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
462
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
463 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
464 public Collection<String> getHeaderNames()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
465 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
466 final HttpFields fields=_connection.getResponseFields();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
467 return fields.getFieldNamesCollection();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
468 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
469
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
470 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
471 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
472 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
473 public String getHeader(String name)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
474 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
475 return _connection.getResponseFields().getStringField(name);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
476 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
477
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
478 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
479 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
480 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
481 public Collection<String> getHeaders(String name)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
482 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
483 final HttpFields fields=_connection.getResponseFields();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
484 Collection<String> i = fields.getValuesCollection(name);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
485 if (i==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
486 return Collections.EMPTY_LIST;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
487 return i;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
488 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
489
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
490 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
491 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
492 * @see javax.servlet.http.HttpServletResponse#addHeader(java.lang.String, java.lang.String)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
493 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
494 public void addHeader(String name, String value)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
495 {
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
496
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
497 if (_connection.isIncluding())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
498 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
499 if (name.startsWith(SET_INCLUDE_HEADER_PREFIX))
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
500 name=name.substring(SET_INCLUDE_HEADER_PREFIX.length());
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
501 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
502 return;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
503 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
504
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
505 if (HttpHeaders.CONTENT_TYPE.equalsIgnoreCase(name))
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
506 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
507 setContentType(value);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
508 return;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
509 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
510
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
511 _connection.getResponseFields().add(name, value);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
512 if (HttpHeaders.CONTENT_LENGTH.equalsIgnoreCase(name))
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
513 _connection._generator.setContentLength(Long.parseLong(value));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
514 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
515
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
516 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
517 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
518 * @see javax.servlet.http.HttpServletResponse#setIntHeader(java.lang.String, int)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
519 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
520 public void setIntHeader(String name, int value)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
521 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
522 if (!_connection.isIncluding())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
523 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
524 _connection.getResponseFields().putLongField(name, value);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
525 if (HttpHeaders.CONTENT_LENGTH.equalsIgnoreCase(name))
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
526 _connection._generator.setContentLength(value);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
527 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
528 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
529
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
530 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
531 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
532 * @see javax.servlet.http.HttpServletResponse#addIntHeader(java.lang.String, int)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
533 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
534 public void addIntHeader(String name, int value)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
535 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
536 if (!_connection.isIncluding())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
537 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
538 _connection.getResponseFields().addLongField(name, value);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
539 if (HttpHeaders.CONTENT_LENGTH.equalsIgnoreCase(name))
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
540 _connection._generator.setContentLength(value);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
541 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
542 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
543
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
544 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
545 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
546 * @see javax.servlet.http.HttpServletResponse#setStatus(int)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
547 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
548 public void setStatus(int sc)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
549 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
550 setStatus(sc,null);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
551 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
552
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
553 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
554 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
555 * @see javax.servlet.http.HttpServletResponse#setStatus(int, java.lang.String)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
556 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
557 public void setStatus(int sc, String sm)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
558 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
559 if (sc<=0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
560 throw new IllegalArgumentException();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
561 if (!_connection.isIncluding())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
562 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
563 _status=sc;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
564 _reason=sm;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
565 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
566 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
567
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
568 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
569 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
570 * @see javax.servlet.ServletResponse#getCharacterEncoding()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
571 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
572 public String getCharacterEncoding()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
573 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
574 if (_characterEncoding==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
575 _characterEncoding=StringUtil.__ISO_8859_1;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
576 return _characterEncoding;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
577 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
578
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
579 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
580 String getSetCharacterEncoding()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
581 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
582 return _characterEncoding;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
583 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
584
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
585 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
586 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
587 * @see javax.servlet.ServletResponse#getContentType()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
588 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
589 public String getContentType()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
590 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
591 return _contentType;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
592 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
593
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
594 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
595 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
596 * @see javax.servlet.ServletResponse#getOutputStream()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
597 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
598 public ServletOutputStream getOutputStream() throws IOException
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
599 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
600 if (_outputState!=NONE && _outputState!=STREAM)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
601 throw new IllegalStateException("WRITER");
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
602
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
603 ServletOutputStream out = _connection.getOutputStream();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
604 _outputState=STREAM;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
605 return out;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
606 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
607
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
608 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
609 public boolean isWriting()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
610 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
611 return _outputState==WRITER;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
612 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
613
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
614 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
615 public boolean isOutputing()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
616 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
617 return _outputState!=NONE;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
618 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
619
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
620 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
621 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
622 * @see javax.servlet.ServletResponse#getWriter()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
623 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
624 public PrintWriter getWriter() throws IOException
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
625 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
626 if (_outputState!=NONE && _outputState!=WRITER)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
627 throw new IllegalStateException("STREAM");
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
628
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
629 /* if there is no writer yet */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
630 if (_writer==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
631 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
632 /* get encoding from Content-Type header */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
633 String encoding = _characterEncoding;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
634
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
635 if (encoding==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
636 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
637 /* implementation of educated defaults */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
638 if(_cachedMimeType != null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
639 encoding = MimeTypes.getCharsetFromContentType(_cachedMimeType);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
640
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
641 if (encoding==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
642 encoding = StringUtil.__ISO_8859_1;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
643
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
644 setCharacterEncoding(encoding);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
645 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
646
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
647 /* construct Writer using correct encoding */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
648 _writer = _connection.getPrintWriter(encoding);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
649 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
650 _outputState=WRITER;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
651 return _writer;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
652 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
653
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
654 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
655 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
656 * @see javax.servlet.ServletResponse#setCharacterEncoding(java.lang.String)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
657 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
658 public void setCharacterEncoding(String encoding)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
659 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
660 if (_connection.isIncluding())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
661 return;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
662
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
663 if (this._outputState==0 && !isCommitted())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
664 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
665 _explicitEncoding=true;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
666
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
667 if (encoding==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
668 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
669 // Clear any encoding.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
670 if (_characterEncoding!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
671 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
672 _characterEncoding=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
673 if (_cachedMimeType!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
674 _contentType=_cachedMimeType.toString();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
675 else if (_mimeType!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
676 _contentType=_mimeType;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
677 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
678 _contentType=null;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
679
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
680 if (_contentType==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
681 _connection.getResponseFields().remove(HttpHeaders.CONTENT_TYPE_BUFFER);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
682 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
683 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
684 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
685 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
686 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
687 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
688 // No, so just add this one to the mimetype
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
689 _characterEncoding=encoding;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
690 if (_contentType!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
691 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
692 int i0=_contentType.indexOf(';');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
693 if (i0<0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
694 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
695 _contentType=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
696 if(_cachedMimeType!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
697 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
698 CachedBuffer content_type = _cachedMimeType.getAssociate(_characterEncoding);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
699 if (content_type!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
700 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
701 _contentType=content_type.toString();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
702 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,content_type);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
703 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
704 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
705
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
706 if (_contentType==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
707 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
708 _contentType = _mimeType+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
709 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
710 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
711 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
712 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
713 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
714 int i1=_contentType.indexOf("charset=",i0);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
715 if (i1<0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
716 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
717 _contentType = _contentType+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
718 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
719 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
720 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
721 int i8=i1+8;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
722 int i2=_contentType.indexOf(" ",i8);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
723 if (i2<0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
724 _contentType=_contentType.substring(0,i8)+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
725 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
726 _contentType=_contentType.substring(0,i8)+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ")+_contentType.substring(i2);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
727 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
728 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
729 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
730 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
731 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
732 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
733 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
734
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
735 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
736 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
737 * @see javax.servlet.ServletResponse#setContentLength(int)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
738 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
739 public void setContentLength(int len)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
740 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
741 // Protect from setting after committed as default handling
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
742 // of a servlet HEAD request ALWAYS sets _content length, even
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
743 // if the getHandling committed the response!
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
744 if (isCommitted() || _connection.isIncluding())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
745 return;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
746 _connection._generator.setContentLength(len);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
747 if (len>0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
748 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
749 _connection.getResponseFields().putLongField(HttpHeaders.CONTENT_LENGTH, len);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
750 if (_connection._generator.isAllContentWritten())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
751 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
752 if (_outputState==WRITER)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
753 _writer.close();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
754 else if (_outputState==STREAM)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
755 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
756 try
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
757 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
758 getOutputStream().close();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
759 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
760 catch(IOException e)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
761 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
762 throw new RuntimeException(e);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
763 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
764 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
765 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
766 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
767 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
768
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
769 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
770 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
771 * @see javax.servlet.ServletResponse#setContentLength(int)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
772 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
773 public void setLongContentLength(long len)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
774 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
775 // Protect from setting after committed as default handling
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
776 // of a servlet HEAD request ALWAYS sets _content length, even
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
777 // if the getHandling committed the response!
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
778 if (isCommitted() || _connection.isIncluding())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
779 return;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
780 _connection._generator.setContentLength(len);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
781 _connection.getResponseFields().putLongField(HttpHeaders.CONTENT_LENGTH, len);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
782 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
783
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
784 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
785 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
786 * @see javax.servlet.ServletResponse#setContentType(java.lang.String)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
787 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
788 public void setContentType(String contentType)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
789 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
790 if (isCommitted() || _connection.isIncluding())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
791 return;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
792
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
793 // Yes this method is horribly complex.... but there are lots of special cases and
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
794 // as this method is called on every request, it is worth trying to save string creation.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
795 //
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
796
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
797 if (contentType==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
798 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
799 if (_locale==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
800 _characterEncoding=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
801 _mimeType=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
802 _cachedMimeType=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
803 _contentType=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
804 _connection.getResponseFields().remove(HttpHeaders.CONTENT_TYPE_BUFFER);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
805 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
806 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
807 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
808 // Look for encoding in contentType
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
809 int i0=contentType.indexOf(';');
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
810
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
811 if (i0>0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
812 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
813 // we have content type parameters
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
814
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
815 // Extract params off mimetype
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
816 _mimeType=contentType.substring(0,i0).trim();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
817 _cachedMimeType=MimeTypes.CACHE.get(_mimeType);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
818
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
819 // Look for charset
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
820 int i1=contentType.indexOf("charset=",i0+1);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
821 if (i1>=0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
822 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
823 _explicitEncoding=true;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
824 int i8=i1+8;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
825 int i2 = contentType.indexOf(' ',i8);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
826
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
827 if (_outputState==WRITER)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
828 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
829 // strip the charset and ignore;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
830 if ((i1==i0+1 && i2<0) || (i1==i0+2 && i2<0 && contentType.charAt(i0+1)==' '))
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
831 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
832 if (_cachedMimeType!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
833 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
834 CachedBuffer content_type = _cachedMimeType.getAssociate(_characterEncoding);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
835 if (content_type!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
836 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
837 _contentType=content_type.toString();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
838 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,content_type);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
839 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
840 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
841 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
842 _contentType=_mimeType+";charset="+_characterEncoding;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
843 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
844 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
845 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
846 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
847 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
848 _contentType=_mimeType+";charset="+_characterEncoding;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
849 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
850 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
851 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
852 else if (i2<0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
853 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
854 _contentType=contentType.substring(0,i1)+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
855 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
856 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
857 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
858 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
859 _contentType=contentType.substring(0,i1)+contentType.substring(i2)+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
860 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
861 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
862 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
863 else if ((i1==i0+1 && i2<0) || (i1==i0+2 && i2<0 && contentType.charAt(i0+1)==' '))
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
864 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
865 // The params are just the char encoding
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
866 _cachedMimeType=MimeTypes.CACHE.get(_mimeType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
867 _characterEncoding = QuotedStringTokenizer.unquote(contentType.substring(i8));
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
868
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
869 if (_cachedMimeType!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
870 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
871 CachedBuffer content_type = _cachedMimeType.getAssociate(_characterEncoding);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
872 if (content_type!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
873 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
874 _contentType=content_type.toString();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
875 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,content_type);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
876 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
877 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
878 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
879 _contentType=contentType;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
880 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
881 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
882 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
883 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
884 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
885 _contentType=contentType;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
886 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
887 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
888 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
889 else if (i2>0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
890 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
891 _characterEncoding = QuotedStringTokenizer.unquote(contentType.substring(i8,i2));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
892 _contentType=contentType;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
893 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
894 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
895 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
896 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
897 _characterEncoding = QuotedStringTokenizer.unquote(contentType.substring(i8));
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
898 _contentType=contentType;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
899 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
900 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
901 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
902 else // No encoding in the params.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
903 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
904 _cachedMimeType=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
905 _contentType=_characterEncoding==null?contentType:contentType+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
906 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
907 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
908 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
909 else // No params at all
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
910 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
911 _mimeType=contentType;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
912 _cachedMimeType=MimeTypes.CACHE.get(_mimeType);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
913
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
914 if (_characterEncoding!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
915 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
916 if (_cachedMimeType!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
917 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
918 CachedBuffer content_type = _cachedMimeType.getAssociate(_characterEncoding);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
919 if (content_type!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
920 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
921 _contentType=content_type.toString();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
922 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,content_type);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
923 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
924 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
925 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
926 _contentType=_mimeType+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
927 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
928 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
929 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
930 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
931 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
932 _contentType=contentType+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
933 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
934 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
935 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
936 else if (_cachedMimeType!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
937 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
938 _contentType=_cachedMimeType.toString();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
939 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_cachedMimeType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
940 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
941 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
942 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
943 _contentType=contentType;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
944 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
945 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
946 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
947 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
948 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
949
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
950 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
951 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
952 * @see javax.servlet.ServletResponse#setBufferSize(int)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
953 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
954 public void setBufferSize(int size)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
955 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
956 if (isCommitted() || getContentCount()>0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
957 throw new IllegalStateException("Committed or content written");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
958 _connection.getGenerator().increaseContentBufferSize(size);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
959 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
960
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
961 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
962 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
963 * @see javax.servlet.ServletResponse#getBufferSize()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
964 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
965 public int getBufferSize()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
966 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
967 return _connection.getGenerator().getContentBufferSize();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
968 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
969
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
970 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
971 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
972 * @see javax.servlet.ServletResponse#flushBuffer()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
973 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
974 public void flushBuffer() throws IOException
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
975 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
976 _connection.flushResponse();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
977 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
978
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
979 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
980 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
981 * @see javax.servlet.ServletResponse#reset()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
982 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
983 public void reset()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
984 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
985 resetBuffer();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
986 fwdReset();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
987 _status=200;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
988 _reason=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
989
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
990 HttpFields response_fields=_connection.getResponseFields();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
991
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
992 response_fields.clear();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
993 String connection=_connection.getRequestFields().getStringField(HttpHeaders.CONNECTION_BUFFER);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
994 if (connection!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
995 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
996 String[] values = connection.split(",");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
997 for (int i=0;values!=null && i<values.length;i++)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
998 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
999 CachedBuffer cb = HttpHeaderValues.CACHE.get(values[0].trim());
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1000
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1001 if (cb!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1002 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1003 switch(cb.getOrdinal())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1004 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1005 case HttpHeaderValues.CLOSE_ORDINAL:
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1006 response_fields.put(HttpHeaders.CONNECTION_BUFFER,HttpHeaderValues.CLOSE_BUFFER);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1007 break;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1008
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1009 case HttpHeaderValues.KEEP_ALIVE_ORDINAL:
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1010 if (HttpVersions.HTTP_1_0.equalsIgnoreCase(_connection.getRequest().getProtocol()))
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1011 response_fields.put(HttpHeaders.CONNECTION_BUFFER,HttpHeaderValues.KEEP_ALIVE);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1012 break;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1013 case HttpHeaderValues.TE_ORDINAL:
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1014 response_fields.put(HttpHeaders.CONNECTION_BUFFER,HttpHeaderValues.TE);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1015 break;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1016 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1017 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1018 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1019 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1020 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1021
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1022
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1023 public void reset(boolean preserveCookies)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1024 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1025 if (!preserveCookies)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1026 reset();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1027 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1028 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1029 HttpFields response_fields=_connection.getResponseFields();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1030
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1031 ArrayList<String> cookieValues = new ArrayList<String>(5);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1032 Enumeration<String> vals = response_fields.getValues(HttpHeaders.SET_COOKIE);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1033 while (vals.hasMoreElements())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1034 cookieValues.add((String)vals.nextElement());
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1035
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1036 reset();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1037
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1038 for (String v:cookieValues)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1039 response_fields.add(HttpHeaders.SET_COOKIE, v);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1040 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1041 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1042
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1043
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1044
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1045 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1046 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1047 * @see javax.servlet.ServletResponse#reset()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1048 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1049 public void fwdReset()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1050 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1051 resetBuffer();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1052
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1053 _writer=null;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1054 _outputState=NONE;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1055 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1056
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1057 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1058 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1059 * @see javax.servlet.ServletResponse#resetBuffer()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1060 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1061 public void resetBuffer()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1062 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1063 if (isCommitted())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1064 throw new IllegalStateException("Committed");
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1065 _connection.getGenerator().resetBuffer();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1066 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1067
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1068 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1069 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1070 * @see javax.servlet.ServletResponse#isCommitted()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1071 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1072 public boolean isCommitted()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1073 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1074 return _connection.isResponseCommitted();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1075 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1076
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1077
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1078 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1079 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1080 * @see javax.servlet.ServletResponse#setLocale(java.util.Locale)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1081 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1082 public void setLocale(Locale locale)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1083 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1084 if (locale == null || isCommitted() ||_connection.isIncluding())
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1085 return;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1086
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1087 _locale = locale;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1088 _connection.getResponseFields().put(HttpHeaders.CONTENT_LANGUAGE_BUFFER,locale.toString().replace('_','-'));
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1089
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1090 if (_explicitEncoding || _outputState!=0 )
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1091 return;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1092
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1093 if (_connection.getRequest().getContext()==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1094 return;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1095
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1096 String charset = _connection.getRequest().getContext().getContextHandler().getLocaleEncoding(locale);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1097
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1098 if (charset!=null && charset.length()>0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1099 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1100 _characterEncoding=charset;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1101
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1102 /* get current MIME type from Content-Type header */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1103 String type=getContentType();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1104 if (type!=null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1105 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1106 _characterEncoding=charset;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1107 int semi=type.indexOf(';');
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1108 if (semi<0)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1109 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1110 _mimeType=type;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1111 _contentType= type += ";charset="+charset;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1112 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1113 else
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1114 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1115 _mimeType=type.substring(0,semi);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1116 _contentType= _mimeType += ";charset="+charset;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1117 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1118
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1119 _cachedMimeType=MimeTypes.CACHE.get(_mimeType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1120 _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1121 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1122 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1123 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1124
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1125 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1126 /*
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1127 * @see javax.servlet.ServletResponse#getLocale()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1128 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1129 public Locale getLocale()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1130 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1131 if (_locale==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1132 return Locale.getDefault();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1133 return _locale;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1134 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1135
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1136 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1137 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1138 * @return The HTTP status code that has been set for this request. This will be <code>200<code>
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1139 * ({@link HttpServletResponse#SC_OK}), unless explicitly set through one of the <code>setStatus</code> methods.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1140 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1141 public int getStatus()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1142 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1143 return _status;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1144 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1145
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1146 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1147 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1148 * @return The reason associated with the current {@link #getStatus() status}. This will be <code>null</code>,
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1149 * unless one of the <code>setStatus</code> methods have been called.
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1150 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1151 public String getReason()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1152 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1153 return _reason;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1154 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1155
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1156 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1157 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1158 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1159 public void complete()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1160 throws IOException
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1161 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1162 _connection.completeResponse();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1163 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1164
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1165 /* ------------------------------------------------------------- */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1166 /**
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1167 * @return the number of bytes actually written in response body
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1168 */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1169 public long getContentCount()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1170 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1171 if (_connection==null || _connection.getGenerator()==null)
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1172 return -1;
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1173 return _connection.getGenerator().getContentWritten();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1174 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1175
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1176 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1177 public HttpFields getHttpFields()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1178 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1179 return _connection.getResponseFields();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1180 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1181
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1182 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1183 @Override
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1184 public String toString()
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1185 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1186 return "HTTP/1.1 "+_status+" "+ (_reason==null?"":_reason) +System.getProperty("line.separator")+
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1187 _connection.getResponseFields().toString();
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1188 }
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1189
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1190 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1191 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1192 /* ------------------------------------------------------------ */
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1193 private static class NullOutput extends ServletOutputStream
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1194 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1195 @Override
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1196 public void write(int b) throws IOException
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1197 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1198 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1199
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1200 @Override
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1201 public void print(String s) throws IOException
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1202 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1203 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1204
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1205 @Override
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1206 public void println(String s) throws IOException
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1207 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1208 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1209
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1210 @Override
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1211 public void write(byte[] b, int off, int len) throws IOException
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1212 {
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1213 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1214
813
f8f7cb485c25 remove UserIdentity
Franklin Schmidt <fschmidt@gmail.com>
parents: 809
diff changeset
1215 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1216
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1217 }