static { int offset = PartImpl.totalSlots(); Slot_superTypes += offset; Slot_structuredFields += offset; Slot_constructors += offset; Slot_functions += offset; Slot_operations += offset; Slot_initializerStatements += offset; }
Multipart(ServletRequest request, String boundary, ServletAccessDescr sad) { try { String scl = ((HttpServletRequest) request).getHeader("content-length"); long contentLength = -1; if (scl != null) try { contentLength = Long.parseLong(scl); } catch (NumberFormatException nfe) { } if (contentLength > 0 && sad.multipartMaxRequest > 0 && sad.multipartMaxRequest < contentLength) throw new IOException( String.format( "Request size %d is bigger than limited by %d", contentLength, sad.multipartMaxRequest)); String encoding = request.getCharacterEncoding(); // TODO request.getLocale(); and calculate encoding if (encoding == null) encoding = Serve.UTF8; ServletInputStream sis = request.getInputStream(); parts = new LinkedList<PartImpl>(); long bytesRead = 0; parts_loop: do { // read part PartImpl pi = new PartImpl(); long partSize = pi.readPart(encoding, boundary, sis, sad); // System.err.printf("Loaded part %s of %d%n", pi, partSize); if (partSize < 0) bytesRead -= partSize; else bytesRead += partSize; if ((sad.multipartMaxFile > 0 && pi.fileSize > sad.multipartMaxFile) || (sad.multipartMaxRequest > 0 && sad.multipartMaxRequest < bytesRead)) tooLarge = true; else parts.add(pi); // System.err.printf("Loaded part too large %b - %d%n", tooLarge, bytesRead); if (partSize < 0) break; } while (tooLarge == false && (contentLength < 0 || contentLength > 0 && bytesRead < contentLength)); } catch (IOException ioe) { ioException = ioe; } }
public static int totalSlots() { return totalSlots + PartImpl.totalSlots(); }