@Override public InputStream getInputStream() throws IOException { // Milton doesn't check for null InputStream, but there are some places where it checks for -1 // Don't call target.isEntityAvailable(), doesn't work for PUT, see its source... if (getTarget().getEntity() != null && getTarget().getEntity().isAvailable()) { InputStream stream = getTarget().getEntity().getStream(); if (stream != null) return stream; } return new InputStream() { @Override public int read() throws IOException { return -1; } }; }
if (getTarget().getEntity() != null && getTarget().getEntity().isAvailable()) { if (MediaType.APPLICATION_WWW_FORM.equals(getTarget().getEntity().getMediaType(), true)) { params.putAll( new Form(getTarget().getEntity(), true).getValuesMap() ); } else if (MediaType.MULTIPART_FORM_DATA.equals(getTarget().getEntity().getMediaType(), true)) { throw new UnsupportedOperationException("Multipart file uploading not implemented");