Java Code Examples for io.netty.handler.codec.http.HttpConstants#DEFAULT_CHARSET

The following examples show how to use io.netty.handler.codec.http.HttpConstants#DEFAULT_CHARSET . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpPostRequestEncoderTest.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Test
public void testDataIsMultipleOfChunkSize1() throws Exception {
    DefaultHttpDataFactory factory = new DefaultHttpDataFactory(DefaultHttpDataFactory.MINSIZE);
    DefaultFullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,
            HttpMethod.POST, "http://localhost");
    HttpPostRequestEncoder encoder = new HttpPostRequestEncoder(factory, request, true,
            HttpConstants.DEFAULT_CHARSET, HttpPostRequestEncoder.EncoderMode.RFC1738);

    MemoryFileUpload first = new MemoryFileUpload("resources", "", "application/json", null,
            CharsetUtil.UTF_8, -1);
    first.setMaxSize(-1);
    first.setContent(new ByteArrayInputStream(new byte[7955]));
    encoder.addBodyHttpData(first);

    MemoryFileUpload second = new MemoryFileUpload("resources2", "", "application/json", null,
            CharsetUtil.UTF_8, -1);
    second.setMaxSize(-1);
    second.setContent(new ByteArrayInputStream(new byte[7928]));
    encoder.addBodyHttpData(second);

    assertNotNull(encoder.finalizeRequest());

    checkNextChunkSize(encoder, 8080);
    checkNextChunkSize(encoder, 8080);

    HttpContent httpContent = encoder.readChunk((ByteBufAllocator) null);
    assertTrue("Expected LastHttpContent is not received", httpContent instanceof LastHttpContent);
    httpContent.release();

       assertTrue("Expected end of input is not receive", encoder.isEndOfInput());
}
 
Example 2
Source File: MixedAttribute.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
public MixedAttribute(String name, long definedSize, long limitSize) {
    this(name, definedSize, limitSize, HttpConstants.DEFAULT_CHARSET);
}
 
Example 3
Source File: MixedAttribute.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
public MixedAttribute(String name, String value, long limitSize) {
    this(name, value, limitSize, HttpConstants.DEFAULT_CHARSET);
}
 
Example 4
Source File: MemoryAttribute.java    From netty4.0.27Learn with Apache License 2.0 4 votes vote down vote up
public MemoryAttribute(String name) {
    super(name, HttpConstants.DEFAULT_CHARSET, 0);
}
 
Example 5
Source File: MemoryAttribute.java    From netty4.0.27Learn with Apache License 2.0 4 votes vote down vote up
public MemoryAttribute(String name, String value) throws IOException {
    super(name, HttpConstants.DEFAULT_CHARSET, 0); // Attribute have no default size
    setValue(value);
}
 
Example 6
Source File: DiskAttribute.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
public DiskAttribute(String name, String value) throws IOException {
    this(name, value, HttpConstants.DEFAULT_CHARSET);
}
 
Example 7
Source File: DiskAttribute.java    From netty4.0.27Learn with Apache License 2.0 4 votes vote down vote up
/**
 * Constructor used for huge Attribute
 */
public DiskAttribute(String name) {
    super(name, HttpConstants.DEFAULT_CHARSET, 0);
}
 
Example 8
Source File: DiskAttribute.java    From netty4.0.27Learn with Apache License 2.0 4 votes vote down vote up
public DiskAttribute(String name, String value) throws IOException {
    super(name, HttpConstants.DEFAULT_CHARSET, 0); // Attribute have no default size
    setValue(value);
}
 
Example 9
Source File: MemoryAttribute.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
public MemoryAttribute(String name) {
    this(name, HttpConstants.DEFAULT_CHARSET);
}
 
Example 10
Source File: HttpPostRequestDecoder.java    From dorado with Apache License 2.0 2 votes vote down vote up
/**
 *
 * @param request
 *            the request to decode
 * @throws NullPointerException
 *             for request
 * @throws ErrorDataDecoderException
 *             if the default charset was wrong when decoding or other
 *             errors
 */
public HttpPostRequestDecoder(HttpRequest request) {
    this(new DefaultHttpDataFactory(DefaultHttpDataFactory.MINSIZE), request, HttpConstants.DEFAULT_CHARSET);
}
 
Example 11
Source File: HttpPostMultipartRequestDecoder.java    From dorado with Apache License 2.0 2 votes vote down vote up
/**
 *
 * @param request the request to decode
 * @throws NullPointerException      for request
 * @throws ErrorDataDecoderException if the default charset was wrong when
 *                                   decoding or other errors
 */
public HttpPostMultipartRequestDecoder(HttpRequest request) {
	this(new DefaultHttpDataFactory(DefaultHttpDataFactory.MINSIZE), request, HttpConstants.DEFAULT_CHARSET);
}
 
Example 12
Source File: HttpPostMultipartRequestDecoder.java    From netty4.0.27Learn with Apache License 2.0 2 votes vote down vote up
/**
 *
 * @param factory
 *            the factory used to create InterfaceHttpData
 * @param request
 *            the request to decode
 * @throws NullPointerException
 *             for request or factory
 * @throws ErrorDataDecoderException
 *             if the default charset was wrong when decoding or other
 *             errors
 */
public HttpPostMultipartRequestDecoder(HttpDataFactory factory, HttpRequest request) {
    this(factory, request, HttpConstants.DEFAULT_CHARSET);
}
 
Example 13
Source File: HttpPostMultipartRequestDecoder.java    From netty-4.1.22 with Apache License 2.0 2 votes vote down vote up
/**
 *
 * @param factory
 *            the factory used to create InterfaceHttpData
 * @param request
 *            the request to decode
 * @throws NullPointerException
 *             for request or factory
 * @throws ErrorDataDecoderException
 *             if the default charset was wrong when decoding or other
 *             errors
 */
public HttpPostMultipartRequestDecoder(HttpDataFactory factory, HttpRequest request) {
    this(factory, request, HttpConstants.DEFAULT_CHARSET);
}
 
Example 14
Source File: HttpPostMultipartRequestDecoder.java    From netty-4.1.22 with Apache License 2.0 2 votes vote down vote up
/**
 *
 * @param request
 *            the request to decode
 * @throws NullPointerException
 *             for request
 * @throws ErrorDataDecoderException
 *             if the default charset was wrong when decoding or other
 *             errors
 */
public HttpPostMultipartRequestDecoder(HttpRequest request) {
    this(new DefaultHttpDataFactory(DefaultHttpDataFactory.MINSIZE), request, HttpConstants.DEFAULT_CHARSET);
}
 
Example 15
Source File: HttpPostRequestEncoder.java    From netty4.0.27Learn with Apache License 2.0 2 votes vote down vote up
/**
 *
 * @param factory
 *            the factory used to create InterfaceHttpData
 * @param request
 *            the request to encode
 * @param multipart
 *            True if the FORM is a ENCTYPE="multipart/form-data"
 * @throws NullPointerException
 *             for request and factory
 * @throws ErrorDataEncoderException
 *             if the request is not a POST
 */
public HttpPostRequestEncoder(HttpDataFactory factory, HttpRequest request, boolean multipart)
        throws ErrorDataEncoderException {
    this(factory, request, multipart, HttpConstants.DEFAULT_CHARSET, EncoderMode.RFC1738);
}
 
Example 16
Source File: HttpPostRequestEncoder.java    From netty-4.1.22 with Apache License 2.0 2 votes vote down vote up
/**
 *
 * @param request
 *            the request to encode
 * @param multipart
 *            True if the FORM is a ENCTYPE="multipart/form-data"
 * @throws NullPointerException
 *             for request
 * @throws ErrorDataEncoderException
 *             if the request is a TRACE
 */
public HttpPostRequestEncoder(HttpRequest request, boolean multipart) throws ErrorDataEncoderException {
    this(new DefaultHttpDataFactory(DefaultHttpDataFactory.MINSIZE), request, multipart,
            HttpConstants.DEFAULT_CHARSET, EncoderMode.RFC1738);
}
 
Example 17
Source File: HttpPostRequestDecoder.java    From netty-4.1.22 with Apache License 2.0 2 votes vote down vote up
/**
 *
 * @param factory
 *            the factory used to create InterfaceHttpData
 * @param request
 *            the request to decode
 * @throws NullPointerException
 *             for request or factory
 * @throws ErrorDataDecoderException
 *             if the default charset was wrong when decoding or other
 *             errors
 */
public HttpPostRequestDecoder(HttpDataFactory factory, HttpRequest request) {
    this(factory, request, HttpConstants.DEFAULT_CHARSET);
}
 
Example 18
Source File: HttpPostMultipartRequestDecoder.java    From dorado with Apache License 2.0 2 votes vote down vote up
/**
 *
 * @param factory the factory used to create InterfaceHttpData
 * @param request the request to decode
 * @throws NullPointerException      for request or factory
 * @throws ErrorDataDecoderException if the default charset was wrong when
 *                                   decoding or other errors
 */
public HttpPostMultipartRequestDecoder(HttpDataFactory factory, HttpRequest request) {
	this(factory, request, HttpConstants.DEFAULT_CHARSET);
}
 
Example 19
Source File: HttpPostStandardRequestDecoder.java    From netty-4.1.22 with Apache License 2.0 2 votes vote down vote up
/**
 *
 * @param factory
 *            the factory used to create InterfaceHttpData
 * @param request
 *            the request to decode
 * @throws NullPointerException
 *             for request or factory
 * @throws ErrorDataDecoderException
 *             if the default charset was wrong when decoding or other
 *             errors
 */
public HttpPostStandardRequestDecoder(HttpDataFactory factory, HttpRequest request) {
    this(factory, request, HttpConstants.DEFAULT_CHARSET);
}
 
Example 20
Source File: HttpPostStandardRequestDecoder.java    From netty4.0.27Learn with Apache License 2.0 2 votes vote down vote up
/**
 *
 * @param factory
 *            the factory used to create InterfaceHttpData
 * @param request
 *            the request to decode
 * @throws NullPointerException
 *             for request or factory
 * @throws ErrorDataDecoderException
 *             if the default charset was wrong when decoding or other
 *             errors
 */
public HttpPostStandardRequestDecoder(HttpDataFactory factory, HttpRequest request) {
    this(factory, request, HttpConstants.DEFAULT_CHARSET);
}