Enum should not have a non-final value
This commit is contained in:
parent
c06722c232
commit
b0b765001c
@ -15,11 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.jboss.netty.handler.codec.http.multipart;
|
package org.jboss.netty.handler.codec.http.multipart;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
|
|
||||||
import org.jboss.netty.buffer.ChannelBuffer;
|
import org.jboss.netty.buffer.ChannelBuffer;
|
||||||
import org.jboss.netty.util.CharsetUtil;
|
import org.jboss.netty.util.CharsetUtil;
|
||||||
|
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shared Static object between HttpMessageDecoder, HttpPostRequestDecoder and HttpPostRequestEncoder
|
* Shared Static object between HttpMessageDecoder, HttpPostRequestDecoder and HttpPostRequestEncoder
|
||||||
*/
|
*/
|
||||||
@ -97,7 +97,7 @@ final class HttpPostBodyUtil {
|
|||||||
*/
|
*/
|
||||||
BINARY("binary");
|
BINARY("binary");
|
||||||
|
|
||||||
public String value;
|
private final String value;
|
||||||
|
|
||||||
TransferEncodingMechanism(String value) {
|
TransferEncodingMechanism(String value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
@ -107,6 +107,10 @@ final class HttpPostBodyUtil {
|
|||||||
value = name();
|
value = name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String value() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return value;
|
return value;
|
||||||
|
@ -15,15 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.jboss.netty.handler.codec.http.multipart;
|
package org.jboss.netty.handler.codec.http.multipart;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
import org.jboss.netty.buffer.ChannelBuffer;
|
import org.jboss.netty.buffer.ChannelBuffer;
|
||||||
import org.jboss.netty.buffer.ChannelBuffers;
|
import org.jboss.netty.buffer.ChannelBuffers;
|
||||||
import org.jboss.netty.handler.codec.http.HttpChunk;
|
import org.jboss.netty.handler.codec.http.HttpChunk;
|
||||||
@ -36,6 +27,15 @@ import org.jboss.netty.handler.codec.http.multipart.HttpPostBodyUtil.SeekAheadOp
|
|||||||
import org.jboss.netty.handler.codec.http.multipart.HttpPostBodyUtil.TransferEncodingMechanism;
|
import org.jboss.netty.handler.codec.http.multipart.HttpPostBodyUtil.TransferEncodingMechanism;
|
||||||
import org.jboss.netty.util.internal.CaseIgnoringComparator;
|
import org.jboss.netty.util.internal.CaseIgnoringComparator;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This decoder will decode Body and can handle POST BODY.
|
* This decoder will decode Body and can handle POST BODY.
|
||||||
*/
|
*/
|
||||||
@ -1108,13 +1108,13 @@ public class HttpPostRequestDecoder {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ErrorDataDecoderException(e);
|
throw new ErrorDataDecoderException(e);
|
||||||
}
|
}
|
||||||
if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BIT7.value)) {
|
if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BIT7.value())) {
|
||||||
localCharset = HttpPostBodyUtil.US_ASCII;
|
localCharset = HttpPostBodyUtil.US_ASCII;
|
||||||
} else if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BIT8.value)) {
|
} else if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BIT8.value())) {
|
||||||
localCharset = HttpPostBodyUtil.ISO_8859_1;
|
localCharset = HttpPostBodyUtil.ISO_8859_1;
|
||||||
mechanism = TransferEncodingMechanism.BIT8;
|
mechanism = TransferEncodingMechanism.BIT8;
|
||||||
} else if (code
|
} else if (code
|
||||||
.equals(HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value)) {
|
.equals(HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value())) {
|
||||||
// no real charset, so let the default
|
// no real charset, so let the default
|
||||||
mechanism = TransferEncodingMechanism.BINARY;
|
mechanism = TransferEncodingMechanism.BINARY;
|
||||||
} else {
|
} else {
|
||||||
@ -1157,7 +1157,7 @@ public class HttpPostRequestDecoder {
|
|||||||
currentFileUpload = factory.createFileUpload(
|
currentFileUpload = factory.createFileUpload(
|
||||||
request,
|
request,
|
||||||
nameAttribute.getValue(), filenameAttribute.getValue(),
|
nameAttribute.getValue(), filenameAttribute.getValue(),
|
||||||
contentTypeAttribute.getValue(), mechanism.value,
|
contentTypeAttribute.getValue(), mechanism.value(),
|
||||||
localCharset, size);
|
localCharset, size);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
throw new ErrorDataDecoderException(e);
|
throw new ErrorDataDecoderException(e);
|
||||||
|
@ -290,7 +290,7 @@ public class HttpPostRequestEncoder implements ChunkedInput {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isText) {
|
if (!isText) {
|
||||||
contentTransferEncoding = HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value;
|
contentTransferEncoding = HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value();
|
||||||
}
|
}
|
||||||
FileUpload fileUpload = factory.createFileUpload(request, name, file.getName(),
|
FileUpload fileUpload = factory.createFileUpload(request, name, file.getName(),
|
||||||
scontentType, contentTransferEncoding, null, file.length());
|
scontentType, contentTransferEncoding, null, file.length());
|
||||||
@ -540,9 +540,9 @@ public class HttpPostRequestEncoder implements ChunkedInput {
|
|||||||
String contentTransferEncoding = fileUpload.getContentTransferEncoding();
|
String contentTransferEncoding = fileUpload.getContentTransferEncoding();
|
||||||
if (contentTransferEncoding != null &&
|
if (contentTransferEncoding != null &&
|
||||||
contentTransferEncoding.equals(
|
contentTransferEncoding.equals(
|
||||||
HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value)) {
|
HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value())) {
|
||||||
internal.addValue("\r\n" + HttpHeaders.Names.CONTENT_TRANSFER_ENCODING +
|
internal.addValue("\r\n" + HttpHeaders.Names.CONTENT_TRANSFER_ENCODING +
|
||||||
": " + HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value +
|
": " + HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value() +
|
||||||
"\r\n\r\n");
|
"\r\n\r\n");
|
||||||
} else if (fileUpload.getCharset() != null) {
|
} else if (fileUpload.getCharset() != null) {
|
||||||
internal.addValue("; " + HttpHeaders.Values.CHARSET + "=" +
|
internal.addValue("; " + HttpHeaders.Values.CHARSET + "=" +
|
||||||
|
Loading…
Reference in New Issue
Block a user