/** * Create an object of {@link InterfaceHttpData} to build Netty multipart request body. * * @see Part#getData(HttpRequest, HttpDataFactory) */ @Override InterfaceHttpData getData(HttpRequest request, HttpDataFactory factory) { return factory.createAttribute(request, name, value); } }
/** * Add a simple attribute in the body as Name=Value * * @param name * name of the parameter * @param value * the value of the parameter * @throws NullPointerException * for name * @throws ErrorDataEncoderException * if the encoding is in error or if the finalize were already done */ public void addBodyAttribute(String name, String value) throws ErrorDataEncoderException { String svalue = value != null? value : StringUtil.EMPTY_STRING; Attribute data = factory.createAttribute(request, checkNotNull(name, "name"), svalue); addBodyHttpData(data); }
private Attribute getContentDispositionAttribute(String... values) { String name = cleanString(values[0]); String value = values[1]; // Filename can be token, quoted or encoded. See https://tools.ietf.org/html/rfc5987 if (HttpHeaderValues.FILENAME.contentEquals(name)) { // Value is quoted or token. Strip if quoted: int last = value.length() - 1; if (last > 0 && value.charAt(0) == HttpConstants.DOUBLE_QUOTE && value.charAt(last) == HttpConstants.DOUBLE_QUOTE) { value = value.substring(1, last); } } else if (FILENAME_ENCODED.equals(name)) { try { name = HttpHeaderValues.FILENAME.toString(); String[] split = value.split("'", 3); value = QueryStringDecoder.decodeComponent(split[2], Charset.forName(split[0])); } catch (ArrayIndexOutOfBoundsException e) { throw new ErrorDataDecoderException(e); } catch (UnsupportedCharsetException e) { throw new ErrorDataDecoderException(e); } } else { // otherwise we need to clean the value value = cleanString(value); } return factory.createAttribute(request, name, value); }
String key = decodeAttribute(undecodedChunk.toString(firstpos, equalpos - firstpos, charset), charset); currentAttribute = factory.createAttribute(request, key); firstpos = currentpos; } else if (read == '&') { // special empty FIELD String key = decodeAttribute( undecodedChunk.toString(firstpos, ampersandpos - firstpos, charset), charset); currentAttribute = factory.createAttribute(request, key); currentAttribute.setValue(""); // empty addHttpData(currentAttribute);
Attribute newattribute = factory.createAttribute(request, key, value); multipartHttpDatas.add(newattribute); globalBodySize += newattribute.getName().length() + 1 + newattribute.length() + 1; Attribute newattribute = factory.createAttribute(request, key, value); multipartHttpDatas.add(newattribute); globalBodySize += newattribute.getName().length() + 1 + newattribute.length() + 1;
Attribute attribute; try { attribute = factory.createAttribute(request, HttpHeaderNames.CONTENT_TRANSFER_ENCODING.toString(), cleanString(contents[1])); } catch (NullPointerException e) { Attribute attribute; try { attribute = factory.createAttribute(request, HttpHeaderNames.CONTENT_LENGTH.toString(), cleanString(contents[1])); } catch (NullPointerException e) { Attribute attribute; try { attribute = factory.createAttribute(request, charsetHeader, cleanString(values)); } catch (NullPointerException e) { throw new ErrorDataDecoderException(e); Attribute attribute; try { attribute = factory.createAttribute(request, cleanString(contents[0]), contents[i]); } catch (NullPointerException e) {
currentAttribute = factory.createAttribute(request, cleanString(nameAttribute.getValue()), size); } else { currentAttribute = factory.createAttribute(request, cleanString(nameAttribute.getValue()));
String key = decodeAttribute(undecodedChunk.toString(firstpos, equalpos - firstpos, charset), charset); currentAttribute = factory.createAttribute(request, key); firstpos = currentpos; } else if (read == '&') { // special empty FIELD String key = decodeAttribute( undecodedChunk.toString(firstpos, ampersandpos - firstpos, charset), charset); currentAttribute = factory.createAttribute(request, key); currentAttribute.setValue(""); // empty addHttpData(currentAttribute);
/** * Create an object of {@link InterfaceHttpData} to build Netty multipart request body. * * @see Part#getData(HttpRequest, HttpDataFactory) */ @Override InterfaceHttpData getData(HttpRequest request, HttpDataFactory factory) { return factory.createAttribute(request, name, value); } }
/** * Create an object of {@link InterfaceHttpData} to build Netty multipart request body. * * @see Part#getData(HttpRequest, HttpDataFactory) */ @Override InterfaceHttpData getData(HttpRequest request, HttpDataFactory factory) { return factory.createAttribute(request, name, value); } }
/** * Add a simple attribute in the body as Name=Value * * @param name * name of the parameter * @param value * the value of the parameter * @throws NullPointerException * for name * @throws ErrorDataEncoderException * if the encoding is in error or if the finalize were already done */ public void addBodyAttribute(String name, String value) throws ErrorDataEncoderException { String svalue = value != null? value : StringUtil.EMPTY_STRING; Attribute data = factory.createAttribute(request, checkNotNull(name, "name"), svalue); addBodyHttpData(data); }
/** * Add a simple attribute in the body as Name=Value * * @param name * name of the parameter * @param value * the value of the parameter * @throws NullPointerException * for name * @throws ErrorDataEncoderException * if the encoding is in error or if the finalize were already done */ public void addBodyAttribute(String name, String value) throws ErrorDataEncoderException { String svalue = value != null? value : StringUtil.EMPTY_STRING; Attribute data = factory.createAttribute(request, checkNotNull(name, "name"), svalue); addBodyHttpData(data); }
/** * Add a simple attribute in the body as Name=Value * * @param name * name of the parameter * @param value * the value of the parameter * @throws NullPointerException * for name * @throws ErrorDataEncoderException * if the encoding is in error or if the finalize were already done */ public void addBodyAttribute(String name, String value) throws ErrorDataEncoderException { String svalue = value != null? value : StringUtil.EMPTY_STRING; Attribute data = factory.createAttribute(request, checkNotNull(name, "name"), svalue); addBodyHttpData(data); }
/** * Add a simple attribute in the body as Name=Value * * @param name * name of the parameter * @param value * the value of the parameter * @throws NullPointerException * for name * @throws ErrorDataEncoderException * if the encoding is in error or if the finalize were already done */ public void addBodyAttribute(String name, String value) throws ErrorDataEncoderException { String svalue = value != null? value : StringUtil.EMPTY_STRING; Attribute data = factory.createAttribute(request, checkNotNull(name, "name"), svalue); addBodyHttpData(data); }
private Attribute getContentDispositionAttribute(String... values) { String name = cleanString(values[0]); String value = values[1]; // Filename can be token, quoted or encoded. See https://tools.ietf.org/html/rfc5987 if (HttpHeaderValues.FILENAME.contentEquals(name)) { // Value is quoted or token. Strip if quoted: int last = value.length() - 1; if (last > 0 && value.charAt(0) == HttpConstants.DOUBLE_QUOTE && value.charAt(last) == HttpConstants.DOUBLE_QUOTE) { value = value.substring(1, last); } } else if (FILENAME_ENCODED.equals(name)) { try { name = HttpHeaderValues.FILENAME.toString(); String[] split = value.split("'", 3); value = QueryStringDecoder.decodeComponent(split[2], Charset.forName(split[0])); } catch (ArrayIndexOutOfBoundsException e) { throw new ErrorDataDecoderException(e); } catch (UnsupportedCharsetException e) { throw new ErrorDataDecoderException(e); } } else { // otherwise we need to clean the value value = cleanString(value); } return factory.createAttribute(request, name, value); }
private Attribute getContentDispositionAttribute(String... values) { String name = cleanString(values[0]); String value = values[1]; // Filename can be token, quoted or encoded. See https://tools.ietf.org/html/rfc5987 if (HttpHeaderValues.FILENAME.contentEquals(name)) { // Value is quoted or token. Strip if quoted: int last = value.length() - 1; if (last > 0 && value.charAt(0) == HttpConstants.DOUBLE_QUOTE && value.charAt(last) == HttpConstants.DOUBLE_QUOTE) { value = value.substring(1, last); } } else if (FILENAME_ENCODED.equals(name)) { try { name = HttpHeaderValues.FILENAME.toString(); String[] split = value.split("'", 3); value = QueryStringDecoder.decodeComponent(split[2], Charset.forName(split[0])); } catch (ArrayIndexOutOfBoundsException e) { throw new ErrorDataDecoderException(e); } catch (UnsupportedCharsetException e) { throw new ErrorDataDecoderException(e); } } else { // otherwise we need to clean the value value = cleanString(value); } return factory.createAttribute(request, name, value); }
private Attribute getContentDispositionAttribute(String... values) { String name = cleanString(values[0]); String value = values[1]; // Filename can be token, quoted or encoded. See https://tools.ietf.org/html/rfc5987 if (HttpHeaderValues.FILENAME.contentEquals(name)) { // Value is quoted or token. Strip if quoted: int last = value.length() - 1; if (last > 0 && value.charAt(0) == HttpConstants.DOUBLE_QUOTE && value.charAt(last) == HttpConstants.DOUBLE_QUOTE) { value = value.substring(1, last); } } else if (FILENAME_ENCODED.equals(name)) { try { name = HttpHeaderValues.FILENAME.toString(); String[] split = value.split("'", 3); value = QueryStringDecoder.decodeComponent(split[2], Charset.forName(split[0])); } catch (ArrayIndexOutOfBoundsException e) { throw new ErrorDataDecoderException(e); } catch (UnsupportedCharsetException e) { throw new ErrorDataDecoderException(e); } } else { // otherwise we need to clean the value value = cleanString(value); } return factory.createAttribute(request, name, value); }
private Attribute getContentDispositionAttribute(String... values) { String name = cleanString(values[0]); String value = values[1]; // Filename can be token, quoted or encoded. See https://tools.ietf.org/html/rfc5987 if (HttpHeaderValues.FILENAME.contentEquals(name)) { // Value is quoted or token. Strip if quoted: int last = value.length() - 1; if (last > 0 && value.charAt(0) == HttpConstants.DOUBLE_QUOTE && value.charAt(last) == HttpConstants.DOUBLE_QUOTE) { value = value.substring(1, last); } } else if (FILENAME_ENCODED.equals(name)) { try { name = HttpHeaderValues.FILENAME.toString(); String[] split = value.split("'", 3); value = QueryStringDecoder.decodeComponent(split[2], Charset.forName(split[0])); } catch (ArrayIndexOutOfBoundsException e) { throw new ErrorDataDecoderException(e); } catch (UnsupportedCharsetException e) { throw new ErrorDataDecoderException(e); } } else { // otherwise we need to clean the value value = cleanString(value); } return factory.createAttribute(request, name, value); }
private Attribute getContentDispositionAttribute(String... values) { String name = cleanString(values[0]); String value = values[1]; // Filename can be token, quoted or encoded. See // https://tools.ietf.org/html/rfc5987 if (HttpHeaderValues.FILENAME.contentEquals(name)) { // Value is quoted or token. Strip if quoted: int last = value.length() - 1; if (last > 0 && value.charAt(0) == HttpConstants.DOUBLE_QUOTE && value.charAt(last) == HttpConstants.DOUBLE_QUOTE) { value = value.substring(1, last); } } else if (FILENAME_ENCODED.equals(name)) { try { name = HttpHeaderValues.FILENAME.toString(); String[] split = value.split("'", 3); value = QueryStringDecoder.decodeComponent(split[2], Charset.forName(split[0])); } catch (ArrayIndexOutOfBoundsException e) { throw new ErrorDataDecoderException(e); } catch (UnsupportedCharsetException e) { throw new ErrorDataDecoderException(e); } } else { // otherwise we need to clean the value value = cleanString(value); } return factory.createAttribute(request, name, value); }
String key = decodeAttribute(undecodedChunk.toString(firstpos, equalpos - firstpos, charset), charset); currentAttribute = factory.createAttribute(request, key); firstpos = currentpos; } else if (read == '&') { // special empty FIELD String key = decodeAttribute( undecodedChunk.toString(firstpos, ampersandpos - firstpos, charset), charset); currentAttribute = factory.createAttribute(request, key); currentAttribute.setValue(""); // empty addHttpData(currentAttribute);