@Override public String getName() { return attribute.getName(); }
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); } }
@Override public boolean equals(Object o) { if (!(o instanceof Attribute)) { return false; } Attribute attribute = (Attribute) o; return getName().equalsIgnoreCase(attribute.getName()); }
@Override public boolean equals(Object o) { if (!(o instanceof Attribute)) { return false; } Attribute attribute = (Attribute) o; return getName().equalsIgnoreCase(attribute.getName()); }
public int compareTo(Attribute o) { return getName().compareToIgnoreCase(o.getName()); }
public int compareTo(Attribute o) { return getName().compareToIgnoreCase(o.getName()); }
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 void setContent(File file) throws IOException { checkSize(file.length()); if (file.length() > limitSize) { if (attribute instanceof MemoryAttribute) { // change to Disk attribute = new DiskAttribute(attribute.getName(), attribute.definedLength()); attribute.setMaxSize(maxSize); } } attribute.setContent(file); }
@Override public void setContent(ByteBuf buffer) throws IOException { checkSize(buffer.readableBytes()); if (buffer.readableBytes() > limitSize) { if (attribute instanceof MemoryAttribute) { // change to Disk attribute = new DiskAttribute(attribute.getName(), attribute.definedLength()); attribute.setMaxSize(maxSize); } } attribute.setContent(buffer); }
@Override public void setContent(InputStream inputStream) throws IOException { if (attribute instanceof MemoryAttribute) { // change to Disk even if we don't know the size attribute = new DiskAttribute(attribute.getName(), attribute.definedLength()); attribute.setMaxSize(maxSize); } attribute.setContent(inputStream); }
@Override public void addContent(ByteBuf buffer, boolean last) throws IOException { if (attribute instanceof MemoryAttribute) { checkSize(attribute.length() + buffer.readableBytes()); if (attribute.length() + buffer.readableBytes() > limitSize) { DiskAttribute diskAttribute = new DiskAttribute(attribute .getName(), attribute.definedLength()); diskAttribute.setMaxSize(maxSize); if (((MemoryAttribute) attribute).getByteBuf() != null) { diskAttribute.addContent(((MemoryAttribute) attribute) .getByteBuf(), false); } attribute = diskAttribute; } } attribute.addContent(buffer, last); }
Attribute attr = (Attribute) data; try { formAttributes().add(attr.getName(), attr.getValue()); } catch (Exception e) {
try { String key = encodeAttribute(attribute.getName(), charset); String value = encodeAttribute(attribute.getValue(), charset); Attribute newattribute = factory.createAttribute(request, key, value); multipartHttpDatas.add(newattribute); globalBodySize += newattribute.getName().length() + 1 + newattribute.length() + 1; } catch (IOException e) { throw new ErrorDataEncoderException(e); Attribute newattribute = factory.createAttribute(request, key, value); multipartHttpDatas.add(newattribute); globalBodySize += newattribute.getName().length() + 1 + newattribute.length() + 1; + HttpHeaderValues.NAME + "=\"" + attribute.getName() + "\"\r\n");
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(); } }
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(); } }
@Override public boolean equals(Object o) { if (!(o instanceof Attribute)) { return false; } Attribute attribute = (Attribute) o; return getName().equalsIgnoreCase(attribute.getName()); }
@Override public void setContent(ByteBuf buffer) throws IOException { checkSize(buffer.readableBytes()); if (buffer.readableBytes() > limitSize) { if (attribute instanceof MemoryAttribute) { // change to Disk attribute = new DiskAttribute(attribute.getName(), attribute.definedLength()); attribute.setMaxSize(maxSize); } } attribute.setContent(buffer); }