@Override public String getValue() throws IOException { return attribute.getValue(); }
private void parseAttribute(Attribute attribute) throws IOException { var name = attribute.getName(); var value = attribute.getValue(); List<String> values; if (this.parameters.containsKey(name)) { values = this.parameters.get(name); values.add(value); } else { values = new ArrayList<>(); values.add(value); this.parameters.put(name, values); } }
private void parseAttribute(Attribute attribute) throws IOException { var name = attribute.getName(); var value = attribute.getValue(); List<String> values; if (this.parameters.containsKey(name)) { values = this.parameters.get(name); values.add(value); } else { values = new ArrayList<>(); values.add(value); this.parameters.put(name, values); } }
private ImmutableMap<String, String> doExtractForms(final HttpPostRequestDecoder decoder) throws IOException { List<InterfaceHttpData> bodyHttpDatas = decoder.getBodyHttpDatas(); Map<String, String> forms = newHashMap(); for (InterfaceHttpData data : bodyHttpDatas) { if (data.getHttpDataType() == InterfaceHttpData.HttpDataType.Attribute) { Attribute attribute = (Attribute) data; forms.put(attribute.getName(), attribute.getValue()); } } return copyOf(forms); } }
@Override public Optional<Object> convert(Attribute object, Class<Object> targetType, ConversionContext context) { try { return conversionService.convert(object.getValue(), targetType, context); } catch (IOException e) { context.reject(e); return Optional.empty(); } } }
@Override public Object get(ChannelHandlerContext ctx, URIDecoder uriDecoder) { List<InterfaceHttpData> bodyHttpDatas = uriDecoder.getBodyHttpDatas(); if (bodyHttpDatas == null || bodyHttpDatas.size() == 0) { return null; } for (InterfaceHttpData data : bodyHttpDatas) { if (name.equals(data.getName())) { if (data.getHttpDataType() == InterfaceHttpData.HttpDataType.Attribute) { Attribute attribute = (Attribute) data; try { return ReflectionUtil.castTo(type, attribute.getValue()); } catch (IOException e) { log.error("Error getting form params. Reason : {}", e.getMessage(), e); } } } } return null; }
Attribute attribute = (Attribute) interfaceHttpData; try { valueList.add(attribute.getValue()); } catch (IOException ex) { throw new RuntimeException(ex);
Attribute attribute = (Attribute) interfaceHttpData; try { valueList.add(attribute.getValue()); } catch (IOException ex) { throw new RuntimeException(ex);
String code; try { code = encoding.getValue().toLowerCase(); } catch (IOException e) { throw new ErrorDataDecoderException(e); if (charsetAttribute != null) { try { localCharset = Charset.forName(charsetAttribute.getValue()); } catch (IOException e) { throw new ErrorDataDecoderException(e); long size; try { size = lengthAttribute != null ? Long.parseLong(lengthAttribute.getValue()) : 0L; } catch (IOException e) { throw new ErrorDataDecoderException(e); String contentType; if (contentTypeAttribute != null) { contentType = contentTypeAttribute.getValue(); } else { contentType = HttpPostBodyUtil.DEFAULT_BINARY_CONTENT_TYPE; cleanString(nameAttribute.getValue()), cleanString(filenameAttribute.getValue()), contentType, mechanism.value(), localCharset, size);
Attribute attr = (Attribute) data; try { formAttributes().add(attr.getName(), attr.getValue()); } catch (Exception e) {
if (charsetAttribute != null) { try { localCharset = Charset.forName(charsetAttribute.getValue()); } catch (IOException e) { throw new ErrorDataDecoderException(e); try { size = lengthAttribute != null? Long.parseLong(lengthAttribute .getValue()) : 0L; } catch (IOException e) { throw new ErrorDataDecoderException(e); if (size > 0) { currentAttribute = factory.createAttribute(request, cleanString(nameAttribute.getValue()), size); } else { currentAttribute = factory.createAttribute(request, cleanString(nameAttribute.getValue()));
private void endDecode() { try { decoder.offer(LastHttpContent.EMPTY_LAST_CONTENT); while (decoder.hasNext()) { InterfaceHttpData data = decoder.next(); if (data instanceof Attribute) { Attribute attr = (Attribute) data; try { attributes().add(attr.getName(), attr.getValue()); } catch (Exception e) { // Will never happen, anyway handle it somehow just in case handleException(e); } } } } catch (HttpPostRequestDecoder.ErrorDataDecoderException e) { handleException(e); } catch (HttpPostRequestDecoder.EndOfDataDecoderException e) { // ignore this as it is expected } finally { decoder.destroy(); } }
String value = encodeAttribute(attribute.getValue(), charset); Attribute newattribute = factory.createAttribute(request, key, value); multipartHttpDatas.add(newattribute);
@Override public String getValue() throws IOException { return attribute.getValue(); }
@Override public String getValue() throws IOException { return attribute.getValue(); }
@Override public String getValue() throws IOException { return attribute.getValue(); }
Attribute attr = (Attribute) data; try { formAttributes().add(attr.getName(), attr.getValue()); } catch (Exception e) {
private void endDecode() { try { decoder.offer(LastHttpContent.EMPTY_LAST_CONTENT); while (decoder.hasNext()) { InterfaceHttpData data = decoder.next(); if (data instanceof Attribute) { Attribute attr = (Attribute) data; try { attributes().add(attr.getName(), attr.getValue()); } catch (Exception e) { // Will never happen, anyway handle it somehow just in case handleException(e); } } } } catch (HttpPostRequestDecoder.ErrorDataDecoderException e) { handleException(e); } catch (HttpPostRequestDecoder.EndOfDataDecoderException e) { // ignore this as it is expected } finally { decoder.destroy(); } }
private void parseAttribute(Attribute attribute) throws IOException { var name = attribute.getName(); var value = attribute.getValue(); List<String> values; if (this.parameters.containsKey(name)) { values = this.parameters.get(name); values.add(value); } else { values = new ArrayList<>(); values.add(value); this.parameters.put(name, values); } }
private Map<String, String> extractParameters(HttpPostRequestDecoder content) { return content.getBodyHttpDatas() .stream() .filter(data -> data instanceof Attribute) .map(data -> (Attribute) data) .collect(toMap(Attribute::getName, (Function<Attribute, String>) (attribute) -> { try { return attribute.getValue(); } catch (IOException e) { throw propagate(e); } })); }