1 16 package org.apache.cocoon.servlet.multipart; 17 18 import java.io.IOException ; 19 import java.io.InputStream ; 20 import java.util.Map ; 21 22 28 public class RejectedPart extends Part { 29 30 private int size; 31 public int contentLength; 32 public int maxContentLength; 33 34 public RejectedPart(Map headers, int partSize, int contentLength, int maxContentLength) { 35 super(headers); 36 this.size = partSize; 37 this.contentLength = contentLength; 38 this.maxContentLength = maxContentLength; 39 } 40 41 public String getFileName() { 42 return (String ) headers.get("filename"); 43 } 44 45 50 public int getSize() { 51 return this.size; 52 } 53 54 64 public int getMaxContentLength() { 65 return this.maxContentLength; 66 } 67 68 73 public int getContentLength() { 74 return this.contentLength; 75 } 76 79 public InputStream getInputStream() throws IOException { 80 throw new IOException ("Multipart element '" + getFileName() + "' is too large (" + 81 this.size + " bytes) and was discarded."); 82 } 83 84 87 public boolean isRejected() { 88 return true; 89 } 90 91 public void dispose() { 92 } 94 } 95 | Popular Tags |