MCPcopy Create free account
hub / github.com/apache/tomcat / getReader

Method getReader

java/org/apache/catalina/connector/Request.java:1191–1223  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1189
1190
1191 @Override
1192 public BufferedReader getReader() throws IOException {
1193
1194 if (usingInputStream) {
1195 throw new IllegalStateException(sm.getString("coyoteRequest.getReader.ise"));
1196 }
1197
1198 // InputBuffer has no easily accessible reference chain to the Context
1199 // to check for a default request character encoding at the Context.
1200 // Therefore, if a Context default should be used, it is set explicitly
1201 // here. Need to do this before setting usingReader.
1202 if (coyoteRequest.getCharsetHolder().getName() == null) {
1203 // Nothing currently set explicitly.
1204 // Check the context
1205 Context context = getContext();
1206 if (context != null) {
1207 String enc = context.getRequestCharacterEncoding();
1208 if (enc != null) {
1209 // Explicitly set the context default so it is visible to
1210 // InputBuffer when creating the Reader.
1211 setCharacterEncoding(enc);
1212 }
1213 }
1214 }
1215
1216 usingReader = true;
1217
1218 inputBuffer.checkConverter();
1219 if (reader == null) {
1220 reader = new CoyoteReader(inputBuffer);
1221 }
1222 return reader;
1223 }
1224
1225
1226 @Override

Callers

nothing calls this directly

Calls 7

getContextMethod · 0.95
setCharacterEncodingMethod · 0.95
getStringMethod · 0.65
getNameMethod · 0.65
getCharsetHolderMethod · 0.45
checkConverterMethod · 0.45

Tested by

no test coverage detected