comparison src/goodjava/webserver/RequestParser.java @ 1766:8df0b80e715e

fix scheduled tasks
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 06 Jun 2023 14:33:24 -0600
parents a02a75e3daa8
children b914a726061f
comparison
equal deleted inserted replaced
1765:1ffe1e06ea55 1766:8df0b80e715e
19 this.request = request; 19 this.request = request;
20 } 20 }
21 21
22 void parseUrlencoded(String charset) throws ParseException, UnsupportedEncodingException { 22 void parseUrlencoded(String charset) throws ParseException, UnsupportedEncodingException {
23 if( request.body == null ) { 23 if( request.body == null ) {
24 logger.warn("body is null\n"+request.rawHead); 24 logger.info("body is null\n"+request.rawHead);
25 return; 25 return;
26 } 26 }
27 this.parser = new Parser(Util.toString(request.body,charset)); 27 this.parser = new Parser(Util.toString(request.body,charset));
28 parseQuery(); 28 parseQuery();
29 require( parser.endOfInput() ); 29 require( parser.endOfInput() );
192 192
193 private static final String contentTypeStart = "multipart/form-data; boundary="; 193 private static final String contentTypeStart = "multipart/form-data; boundary=";
194 194
195 void parseMultipart() throws ParseException, UnsupportedEncodingException { 195 void parseMultipart() throws ParseException, UnsupportedEncodingException {
196 if( request.body == null ) { 196 if( request.body == null ) {
197 logger.warn("body is null\n"+request.rawHead); 197 logger.info("body is null\n"+request.rawHead);
198 return; 198 return;
199 } 199 }
200 String contentType = (String)request.headers.get("content-type"); 200 String contentType = (String)request.headers.get("content-type");
201 if( !contentType.startsWith(contentTypeStart) ) 201 if( !contentType.startsWith(contentTypeStart) )
202 throw new RuntimeException(contentType); 202 throw new RuntimeException(contentType);
272 } 272 }
273 273
274 // improve later 274 // improve later
275 void parseJson(String charset) throws UnsupportedEncodingException { 275 void parseJson(String charset) throws UnsupportedEncodingException {
276 if( request.body == null ) { 276 if( request.body == null ) {
277 logger.warn("body is null\n"+request.rawHead); 277 logger.info("body is null\n"+request.rawHead);
278 return; 278 return;
279 } 279 }
280 String value = Util.toString(request.body,charset); 280 String value = Util.toString(request.body,charset);
281 Util.add(request.parameters,"json",value); 281 Util.add(request.parameters,"json",value);
282 } 282 }