Fix some inspector warnings
This commit is contained in:
parent
651c7b056a
commit
a5f33f4020
@ -132,7 +132,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* if the default charset was wrong when decoding or other
|
||||
* errors
|
||||
*/
|
||||
public HttpPostMultipartRequestDecoder(HttpRequest request) throws ErrorDataDecoderException {
|
||||
public HttpPostMultipartRequestDecoder(HttpRequest request) {
|
||||
this(new DefaultHttpDataFactory(DefaultHttpDataFactory.MINSIZE), request, HttpConstants.DEFAULT_CHARSET);
|
||||
}
|
||||
|
||||
@ -148,8 +148,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* if the default charset was wrong when decoding or other
|
||||
* errors
|
||||
*/
|
||||
public HttpPostMultipartRequestDecoder(HttpDataFactory factory, HttpRequest request)
|
||||
throws ErrorDataDecoderException {
|
||||
public HttpPostMultipartRequestDecoder(HttpDataFactory factory, HttpRequest request) {
|
||||
this(factory, request, HttpConstants.DEFAULT_CHARSET);
|
||||
}
|
||||
|
||||
@ -167,8 +166,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* if the default charset was wrong when decoding or other
|
||||
* errors
|
||||
*/
|
||||
public HttpPostMultipartRequestDecoder(HttpDataFactory factory, HttpRequest request, Charset charset)
|
||||
throws ErrorDataDecoderException {
|
||||
public HttpPostMultipartRequestDecoder(HttpDataFactory factory, HttpRequest request, Charset charset) {
|
||||
if (factory == null) {
|
||||
throw new NullPointerException("factory");
|
||||
}
|
||||
@ -196,11 +194,8 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
|
||||
/**
|
||||
* Set from the request ContentType the multipartDataBoundary.
|
||||
* @param contentType
|
||||
* @throws ErrorDataDecoderException
|
||||
* @throws ErrorDataDecoderException
|
||||
*/
|
||||
private void setMultipart(String contentType) throws ErrorDataDecoderException {
|
||||
private void setMultipart(String contentType) {
|
||||
multipartDataBoundary = HttpPostRequestDecoder.getMultipartDataBoundary(contentType);
|
||||
currentStatus = MultiPartStatus.HEADERDELIMITER;
|
||||
}
|
||||
@ -217,6 +212,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
*
|
||||
* @return True if this request is a Multipart request
|
||||
*/
|
||||
@Override
|
||||
public boolean isMultipart() {
|
||||
checkDestroyed();
|
||||
return true;
|
||||
@ -227,6 +223,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* Setting this lower gives lower memory usage but with the overhead of more memory copies.
|
||||
* Use {@code 0} to disable it.
|
||||
*/
|
||||
@Override
|
||||
public void setDiscardThreshold(int discardThreshold) {
|
||||
if (discardThreshold < 0) {
|
||||
throw new IllegalArgumentException("discardThreshold must be >= 0");
|
||||
@ -237,6 +234,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
/**
|
||||
* Return the threshold in bytes after which read data in the buffer should be discarded.
|
||||
*/
|
||||
@Override
|
||||
public int getDiscardThreshold() {
|
||||
return discardThreshold;
|
||||
}
|
||||
@ -251,7 +249,8 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* @throws NotEnoughDataDecoderException
|
||||
* Need more chunks
|
||||
*/
|
||||
public List<InterfaceHttpData> getBodyHttpDatas() throws NotEnoughDataDecoderException {
|
||||
@Override
|
||||
public List<InterfaceHttpData> getBodyHttpDatas() {
|
||||
checkDestroyed();
|
||||
|
||||
if (!isLastChunk) {
|
||||
@ -271,7 +270,8 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* @throws NotEnoughDataDecoderException
|
||||
* need more chunks
|
||||
*/
|
||||
public List<InterfaceHttpData> getBodyHttpDatas(String name) throws NotEnoughDataDecoderException {
|
||||
@Override
|
||||
public List<InterfaceHttpData> getBodyHttpDatas(String name) {
|
||||
checkDestroyed();
|
||||
|
||||
if (!isLastChunk) {
|
||||
@ -292,7 +292,8 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* @throws NotEnoughDataDecoderException
|
||||
* need more chunks
|
||||
*/
|
||||
public InterfaceHttpData getBodyHttpData(String name) throws NotEnoughDataDecoderException {
|
||||
@Override
|
||||
public InterfaceHttpData getBodyHttpData(String name) {
|
||||
checkDestroyed();
|
||||
|
||||
if (!isLastChunk) {
|
||||
@ -314,7 +315,8 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* if there is a problem with the charset decoding or other
|
||||
* errors
|
||||
*/
|
||||
public HttpPostMultipartRequestDecoder offer(HttpContent content) throws ErrorDataDecoderException {
|
||||
@Override
|
||||
public HttpPostMultipartRequestDecoder offer(HttpContent content) {
|
||||
checkDestroyed();
|
||||
|
||||
// Maybe we should better not copy here for performance reasons but this will need
|
||||
@ -346,7 +348,8 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* @throws EndOfDataDecoderException
|
||||
* No more data will be available
|
||||
*/
|
||||
public boolean hasNext() throws EndOfDataDecoderException {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
checkDestroyed();
|
||||
|
||||
if (currentStatus == MultiPartStatus.EPILOGUE) {
|
||||
@ -370,7 +373,8 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* @throws EndOfDataDecoderException
|
||||
* No more data will be available
|
||||
*/
|
||||
public InterfaceHttpData next() throws EndOfDataDecoderException {
|
||||
@Override
|
||||
public InterfaceHttpData next() {
|
||||
checkDestroyed();
|
||||
|
||||
if (hasNext()) {
|
||||
@ -386,7 +390,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* if there is a problem with the charset decoding or other
|
||||
* errors
|
||||
*/
|
||||
private void parseBody() throws ErrorDataDecoderException {
|
||||
private void parseBody() {
|
||||
if (currentStatus == MultiPartStatus.PREEPILOGUE || currentStatus == MultiPartStatus.EPILOGUE) {
|
||||
if (isLastChunk) {
|
||||
currentStatus = MultiPartStatus.EPILOGUE;
|
||||
@ -419,7 +423,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* if there is a problem with the charset decoding or other
|
||||
* errors
|
||||
*/
|
||||
private void parseBodyMultipart() throws ErrorDataDecoderException {
|
||||
private void parseBodyMultipart() {
|
||||
if (undecodedChunk == null || undecodedChunk.readableBytes() == 0) {
|
||||
// nothing to decode
|
||||
return;
|
||||
@ -450,7 +454,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* @throws ErrorDataDecoderException
|
||||
* if an error occurs
|
||||
*/
|
||||
private InterfaceHttpData decodeMultipart(MultiPartStatus state) throws ErrorDataDecoderException {
|
||||
private InterfaceHttpData decodeMultipart(MultiPartStatus state) {
|
||||
switch (state) {
|
||||
case NOTSTARTED:
|
||||
throw new ErrorDataDecoderException("Should not be called with the current getStatus");
|
||||
@ -545,7 +549,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
*
|
||||
* @throws NotEnoughDataDecoderException
|
||||
*/
|
||||
void skipControlCharacters() throws NotEnoughDataDecoderException {
|
||||
void skipControlCharacters() {
|
||||
SeekAheadOptimize sao;
|
||||
try {
|
||||
sao = new SeekAheadOptimize(undecodedChunk);
|
||||
@ -591,7 +595,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* @throws ErrorDataDecoderException
|
||||
*/
|
||||
private InterfaceHttpData findMultipartDelimiter(String delimiter, MultiPartStatus dispositionStatus,
|
||||
MultiPartStatus closeDelimiterStatus) throws ErrorDataDecoderException {
|
||||
MultiPartStatus closeDelimiterStatus) {
|
||||
// --AaB03x or --AaB03x--
|
||||
int readerIndex = undecodedChunk.readerIndex();
|
||||
try {
|
||||
@ -633,7 +637,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* @return the next InterfaceHttpData if any
|
||||
* @throws ErrorDataDecoderException
|
||||
*/
|
||||
private InterfaceHttpData findMultipartDisposition() throws ErrorDataDecoderException {
|
||||
private InterfaceHttpData findMultipartDisposition() {
|
||||
int readerIndex = undecodedChunk.readerIndex();
|
||||
if (currentStatus == MultiPartStatus.DISPOSITION) {
|
||||
currentFieldAttributes = new TreeMap<String, Attribute>(CaseIgnoringComparator.INSTANCE);
|
||||
@ -783,7 +787,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* @return the InterfaceHttpData if any
|
||||
* @throws ErrorDataDecoderException
|
||||
*/
|
||||
protected InterfaceHttpData getFileUpload(String delimiter) throws ErrorDataDecoderException {
|
||||
protected InterfaceHttpData getFileUpload(String delimiter) {
|
||||
// eventually restart from existing FileUpload
|
||||
// Now get value according to Content-Type and Charset
|
||||
Attribute encoding = currentFieldAttributes.get(HttpHeaders.Names.CONTENT_TRANSFER_ENCODING);
|
||||
@ -878,6 +882,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* Destroy the {@link HttpPostMultipartRequestDecoder} and release all it resources. After this method
|
||||
* was called it is not possible to operate on it anymore.
|
||||
*/
|
||||
@Override
|
||||
public void destroy() {
|
||||
checkDestroyed();
|
||||
cleanFiles();
|
||||
@ -897,6 +902,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
/**
|
||||
* Clean all HttpDatas (on Disk) for the current request.
|
||||
*/
|
||||
@Override
|
||||
public void cleanFiles() {
|
||||
checkDestroyed();
|
||||
|
||||
@ -906,6 +912,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
/**
|
||||
* Remove the given FileUpload from the list of FileUploads to clean
|
||||
*/
|
||||
@Override
|
||||
public void removeHttpDataFromClean(InterfaceHttpData data) {
|
||||
checkDestroyed();
|
||||
|
||||
@ -932,7 +939,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* Need more chunks and reset the readerInder to the previous
|
||||
* value
|
||||
*/
|
||||
private String readLineStandard() throws NotEnoughDataDecoderException {
|
||||
private String readLineStandard() {
|
||||
int readerIndex = undecodedChunk.readerIndex();
|
||||
try {
|
||||
ByteBuf line = buffer(64);
|
||||
@ -966,7 +973,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* Need more chunks and reset the readerInder to the previous
|
||||
* value
|
||||
*/
|
||||
private String readLine() throws NotEnoughDataDecoderException {
|
||||
private String readLine() {
|
||||
SeekAheadOptimize sao;
|
||||
try {
|
||||
sao = new SeekAheadOptimize(undecodedChunk);
|
||||
@ -1019,7 +1026,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* Need more chunks and reset the readerInder to the previous
|
||||
* value
|
||||
*/
|
||||
private String readDelimiterStandard(String delimiter) throws NotEnoughDataDecoderException {
|
||||
private String readDelimiterStandard(String delimiter) {
|
||||
int readerIndex = undecodedChunk.readerIndex();
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder(64);
|
||||
@ -1113,7 +1120,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* Need more chunks and reset the readerInder to the previous
|
||||
* value
|
||||
*/
|
||||
private String readDelimiter(String delimiter) throws NotEnoughDataDecoderException {
|
||||
private String readDelimiter(String delimiter) {
|
||||
SeekAheadOptimize sao;
|
||||
try {
|
||||
sao = new SeekAheadOptimize(undecodedChunk);
|
||||
@ -1225,8 +1232,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* @throws ErrorDataDecoderException
|
||||
* write IO error occurs with the FileUpload
|
||||
*/
|
||||
private void readFileUploadByteMultipartStandard(String delimiter) throws NotEnoughDataDecoderException,
|
||||
ErrorDataDecoderException {
|
||||
private void readFileUploadByteMultipartStandard(String delimiter) {
|
||||
int readerIndex = undecodedChunk.readerIndex();
|
||||
// found the decoder limit
|
||||
boolean newLine = true;
|
||||
@ -1333,8 +1339,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* @throws ErrorDataDecoderException
|
||||
* write IO error occurs with the FileUpload
|
||||
*/
|
||||
private void readFileUploadByteMultipart(String delimiter) throws NotEnoughDataDecoderException,
|
||||
ErrorDataDecoderException {
|
||||
private void readFileUploadByteMultipart(String delimiter) {
|
||||
SeekAheadOptimize sao;
|
||||
try {
|
||||
sao = new SeekAheadOptimize(undecodedChunk);
|
||||
@ -1448,8 +1453,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* Need more chunks
|
||||
* @throws ErrorDataDecoderException
|
||||
*/
|
||||
private void loadFieldMultipartStandard(String delimiter) throws NotEnoughDataDecoderException,
|
||||
ErrorDataDecoderException {
|
||||
private void loadFieldMultipartStandard(String delimiter) {
|
||||
int readerIndex = undecodedChunk.readerIndex();
|
||||
try {
|
||||
// found the decoder limit
|
||||
@ -1544,7 +1548,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest
|
||||
* Need more chunks
|
||||
* @throws ErrorDataDecoderException
|
||||
*/
|
||||
private void loadFieldMultipart(String delimiter) throws NotEnoughDataDecoderException, ErrorDataDecoderException {
|
||||
private void loadFieldMultipart(String delimiter) {
|
||||
SeekAheadOptimize sao;
|
||||
try {
|
||||
sao = new SeekAheadOptimize(undecodedChunk);
|
||||
|
@ -45,7 +45,7 @@ public class HttpPostRequestDecoder implements InterfaceHttpPostRequestDecoder {
|
||||
* if the default charset was wrong when decoding or other
|
||||
* errors
|
||||
*/
|
||||
public HttpPostRequestDecoder(HttpRequest request) throws ErrorDataDecoderException {
|
||||
public HttpPostRequestDecoder(HttpRequest request) {
|
||||
this(new DefaultHttpDataFactory(DefaultHttpDataFactory.MINSIZE), request, HttpConstants.DEFAULT_CHARSET);
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ public class HttpPostRequestDecoder implements InterfaceHttpPostRequestDecoder {
|
||||
* if the default charset was wrong when decoding or other
|
||||
* errors
|
||||
*/
|
||||
public HttpPostRequestDecoder(HttpDataFactory factory, HttpRequest request) throws ErrorDataDecoderException {
|
||||
public HttpPostRequestDecoder(HttpDataFactory factory, HttpRequest request) {
|
||||
this(factory, request, HttpConstants.DEFAULT_CHARSET);
|
||||
}
|
||||
|
||||
@ -79,8 +79,7 @@ public class HttpPostRequestDecoder implements InterfaceHttpPostRequestDecoder {
|
||||
* if the default charset was wrong when decoding or other
|
||||
* errors
|
||||
*/
|
||||
public HttpPostRequestDecoder(HttpDataFactory factory, HttpRequest request, Charset charset)
|
||||
throws ErrorDataDecoderException {
|
||||
public HttpPostRequestDecoder(HttpDataFactory factory, HttpRequest request, Charset charset) {
|
||||
if (factory == null) {
|
||||
throw new NullPointerException("factory");
|
||||
}
|
||||
@ -135,11 +134,9 @@ public class HttpPostRequestDecoder implements InterfaceHttpPostRequestDecoder {
|
||||
|
||||
/**
|
||||
* Check if the given request is a multipart request
|
||||
* @param request
|
||||
* @return True if the request is a Multipart request
|
||||
* @throws ErrorDataDecoderException
|
||||
*/
|
||||
public static boolean isMultipart(HttpRequest request) throws ErrorDataDecoderException {
|
||||
public static boolean isMultipart(HttpRequest request) {
|
||||
if (request.headers().contains(HttpHeaders.Names.CONTENT_TYPE)) {
|
||||
return getMultipartDataBoundary(request.headers().get(HttpHeaders.Names.CONTENT_TYPE)) != null;
|
||||
} else {
|
||||
@ -151,8 +148,7 @@ public class HttpPostRequestDecoder implements InterfaceHttpPostRequestDecoder {
|
||||
* Check from the request ContentType if this request is a Multipart request.
|
||||
* @return the multipartDataBoundary if it exists, else null
|
||||
*/
|
||||
protected static String getMultipartDataBoundary(String contentType)
|
||||
throws ErrorDataDecoderException {
|
||||
protected static String getMultipartDataBoundary(String contentType) {
|
||||
// Check if Post using "multipart/form-data; boundary=--89421926422648"
|
||||
String[] headerContentType = splitHeaderContentType(contentType);
|
||||
if (headerContentType[0].toLowerCase().startsWith(
|
||||
@ -169,50 +165,62 @@ public class HttpPostRequestDecoder implements InterfaceHttpPostRequestDecoder {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultipart() {
|
||||
return decoder.isMultipart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDiscardThreshold(int discardThreshold) {
|
||||
decoder.setDiscardThreshold(discardThreshold);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDiscardThreshold() {
|
||||
return decoder.getDiscardThreshold();
|
||||
}
|
||||
|
||||
public List<InterfaceHttpData> getBodyHttpDatas() throws NotEnoughDataDecoderException {
|
||||
@Override
|
||||
public List<InterfaceHttpData> getBodyHttpDatas() {
|
||||
return decoder.getBodyHttpDatas();
|
||||
}
|
||||
|
||||
public List<InterfaceHttpData> getBodyHttpDatas(String name) throws NotEnoughDataDecoderException {
|
||||
@Override
|
||||
public List<InterfaceHttpData> getBodyHttpDatas(String name) {
|
||||
return decoder.getBodyHttpDatas(name);
|
||||
}
|
||||
|
||||
public InterfaceHttpData getBodyHttpData(String name) throws NotEnoughDataDecoderException {
|
||||
@Override
|
||||
public InterfaceHttpData getBodyHttpData(String name) {
|
||||
return decoder.getBodyHttpData(name);
|
||||
}
|
||||
|
||||
public InterfaceHttpPostRequestDecoder offer(HttpContent content) throws ErrorDataDecoderException {
|
||||
@Override
|
||||
public InterfaceHttpPostRequestDecoder offer(HttpContent content) {
|
||||
return decoder.offer(content);
|
||||
}
|
||||
|
||||
public boolean hasNext() throws EndOfDataDecoderException {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return decoder.hasNext();
|
||||
}
|
||||
|
||||
public InterfaceHttpData next() throws EndOfDataDecoderException {
|
||||
@Override
|
||||
public InterfaceHttpData next() {
|
||||
return decoder.next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
decoder.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanFiles() {
|
||||
decoder.cleanFiles();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeHttpDataFromClean(InterfaceHttpData data) {
|
||||
decoder.removeHttpDataFromClean(data);
|
||||
}
|
||||
|
@ -110,8 +110,7 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
* if the default charset was wrong when decoding or other
|
||||
* errors
|
||||
*/
|
||||
public HttpPostStandardRequestDecoder(HttpRequest request)
|
||||
throws ErrorDataDecoderException {
|
||||
public HttpPostStandardRequestDecoder(HttpRequest request) {
|
||||
this(new DefaultHttpDataFactory(DefaultHttpDataFactory.MINSIZE), request, HttpConstants.DEFAULT_CHARSET);
|
||||
}
|
||||
|
||||
@ -127,8 +126,7 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
* if the default charset was wrong when decoding or other
|
||||
* errors
|
||||
*/
|
||||
public HttpPostStandardRequestDecoder(HttpDataFactory factory, HttpRequest request)
|
||||
throws ErrorDataDecoderException {
|
||||
public HttpPostStandardRequestDecoder(HttpDataFactory factory, HttpRequest request) {
|
||||
this(factory, request, HttpConstants.DEFAULT_CHARSET);
|
||||
}
|
||||
|
||||
@ -146,8 +144,7 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
* if the default charset was wrong when decoding or other
|
||||
* errors
|
||||
*/
|
||||
public HttpPostStandardRequestDecoder(HttpDataFactory factory, HttpRequest request, Charset charset)
|
||||
throws ErrorDataDecoderException {
|
||||
public HttpPostStandardRequestDecoder(HttpDataFactory factory, HttpRequest request, Charset charset) {
|
||||
if (factory == null) {
|
||||
throw new NullPointerException("factory");
|
||||
}
|
||||
@ -182,6 +179,7 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
*
|
||||
* @return True if this request is a Multipart request
|
||||
*/
|
||||
@Override
|
||||
public boolean isMultipart() {
|
||||
checkDestroyed();
|
||||
return false;
|
||||
@ -192,6 +190,7 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
* Setting this lower gives lower memory usage but with the overhead of more memory copies.
|
||||
* Use {@code 0} to disable it.
|
||||
*/
|
||||
@Override
|
||||
public void setDiscardThreshold(int discardThreshold) {
|
||||
if (discardThreshold < 0) {
|
||||
throw new IllegalArgumentException("discardThreshold must be >= 0");
|
||||
@ -202,6 +201,7 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
/**
|
||||
* Return the threshold in bytes after which read data in the buffer should be discarded.
|
||||
*/
|
||||
@Override
|
||||
public int getDiscardThreshold() {
|
||||
return discardThreshold;
|
||||
}
|
||||
@ -216,7 +216,8 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
* @throws NotEnoughDataDecoderException
|
||||
* Need more chunks
|
||||
*/
|
||||
public List<InterfaceHttpData> getBodyHttpDatas() throws NotEnoughDataDecoderException {
|
||||
@Override
|
||||
public List<InterfaceHttpData> getBodyHttpDatas() {
|
||||
checkDestroyed();
|
||||
|
||||
if (!isLastChunk) {
|
||||
@ -236,8 +237,8 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
* @throws NotEnoughDataDecoderException
|
||||
* need more chunks
|
||||
*/
|
||||
public List<InterfaceHttpData> getBodyHttpDatas(String name)
|
||||
throws NotEnoughDataDecoderException {
|
||||
@Override
|
||||
public List<InterfaceHttpData> getBodyHttpDatas(String name) {
|
||||
checkDestroyed();
|
||||
|
||||
if (!isLastChunk) {
|
||||
@ -258,7 +259,8 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
* @throws NotEnoughDataDecoderException
|
||||
* need more chunks
|
||||
*/
|
||||
public InterfaceHttpData getBodyHttpData(String name) throws NotEnoughDataDecoderException {
|
||||
@Override
|
||||
public InterfaceHttpData getBodyHttpData(String name) {
|
||||
checkDestroyed();
|
||||
|
||||
if (!isLastChunk) {
|
||||
@ -280,8 +282,8 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
* if there is a problem with the charset decoding or other
|
||||
* errors
|
||||
*/
|
||||
public HttpPostStandardRequestDecoder offer(HttpContent content)
|
||||
throws ErrorDataDecoderException {
|
||||
@Override
|
||||
public HttpPostStandardRequestDecoder offer(HttpContent content) {
|
||||
checkDestroyed();
|
||||
|
||||
// Maybe we should better not copy here for performance reasons but this will need
|
||||
@ -313,7 +315,8 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
* @throws EndOfDataDecoderException
|
||||
* No more data will be available
|
||||
*/
|
||||
public boolean hasNext() throws EndOfDataDecoderException {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
checkDestroyed();
|
||||
|
||||
if (currentStatus == MultiPartStatus.EPILOGUE) {
|
||||
@ -337,7 +340,8 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
* @throws EndOfDataDecoderException
|
||||
* No more data will be available
|
||||
*/
|
||||
public InterfaceHttpData next() throws EndOfDataDecoderException {
|
||||
@Override
|
||||
public InterfaceHttpData next() {
|
||||
checkDestroyed();
|
||||
|
||||
if (hasNext()) {
|
||||
@ -353,7 +357,7 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
* if there is a problem with the charset decoding or other
|
||||
* errors
|
||||
*/
|
||||
private void parseBody() throws ErrorDataDecoderException {
|
||||
private void parseBody() {
|
||||
if (currentStatus == MultiPartStatus.PREEPILOGUE || currentStatus == MultiPartStatus.EPILOGUE) {
|
||||
if (isLastChunk) {
|
||||
currentStatus = MultiPartStatus.EPILOGUE;
|
||||
@ -387,7 +391,7 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
* if there is a problem with the charset decoding or other
|
||||
* errors
|
||||
*/
|
||||
private void parseBodyAttributesStandard() throws ErrorDataDecoderException {
|
||||
private void parseBodyAttributesStandard() {
|
||||
int firstpos = undecodedChunk.readerIndex();
|
||||
int currentpos = firstpos;
|
||||
int equalpos;
|
||||
@ -501,7 +505,7 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
* if there is a problem with the charset decoding or other
|
||||
* errors
|
||||
*/
|
||||
private void parseBodyAttributes() throws ErrorDataDecoderException {
|
||||
private void parseBodyAttributes() {
|
||||
SeekAheadOptimize sao;
|
||||
try {
|
||||
sao = new SeekAheadOptimize(undecodedChunk);
|
||||
@ -623,7 +627,7 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
}
|
||||
}
|
||||
|
||||
private void setFinalBuffer(ByteBuf buffer) throws ErrorDataDecoderException, IOException {
|
||||
private void setFinalBuffer(ByteBuf buffer) throws IOException {
|
||||
currentAttribute.addContent(buffer, true);
|
||||
String value = decodeAttribute(currentAttribute.getByteBuf().toString(charset), charset);
|
||||
currentAttribute.setValue(value);
|
||||
@ -636,8 +640,7 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
*
|
||||
* @return the decoded component
|
||||
*/
|
||||
private static String decodeAttribute(String s, Charset charset)
|
||||
throws ErrorDataDecoderException {
|
||||
private static String decodeAttribute(String s, Charset charset) {
|
||||
if (s == null) {
|
||||
return "";
|
||||
}
|
||||
@ -652,10 +655,8 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
|
||||
/**
|
||||
* Skip control Characters
|
||||
*
|
||||
* @throws NotEnoughDataDecoderException
|
||||
*/
|
||||
void skipControlCharacters() throws NotEnoughDataDecoderException {
|
||||
void skipControlCharacters() {
|
||||
SeekAheadOptimize sao;
|
||||
try {
|
||||
sao = new SeekAheadOptimize(undecodedChunk);
|
||||
@ -692,6 +693,7 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
* Destroy the {@link HttpPostStandardRequestDecoder} and release all it resources. After this method
|
||||
* was called it is not possible to operate on it anymore.
|
||||
*/
|
||||
@Override
|
||||
public void destroy() {
|
||||
checkDestroyed();
|
||||
cleanFiles();
|
||||
@ -711,6 +713,7 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
/**
|
||||
* Clean all HttpDatas (on Disk) for the current request.
|
||||
*/
|
||||
@Override
|
||||
public void cleanFiles() {
|
||||
checkDestroyed();
|
||||
|
||||
@ -720,6 +723,7 @@ public class HttpPostStandardRequestDecoder implements InterfaceHttpPostRequestD
|
||||
/**
|
||||
* Remove the given FileUpload from the list of FileUploads to clean
|
||||
*/
|
||||
@Override
|
||||
public void removeHttpDataFromClean(InterfaceHttpData data) {
|
||||
checkDestroyed();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user