This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/master by this push:
new 112d1dc2d6 add option to enable/disable multipart data requests, fixes
#2917
new 8564c83493 Merge pull request #3077 from
hansva/#2917-http-post-bad-request
112d1dc2d6 is described below
commit 112d1dc2d69503b8bed97128e2a51ac540f1836e
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Wed Jul 12 14:32:19 2023 +0200
add option to enable/disable multipart data requests, fixes #2917
---
.../ROOT/pages/pipeline/transforms/httppost.adoc | 1 +
.../hop/pipeline/transforms/httppost/HttpPost.java | 34 +++++----
.../transforms/httppost/HttpPostDialog.java | 86 ++++++++++++++--------
.../pipeline/transforms/httppost/HttpPostMeta.java | 85 +++++++++++++++------
.../httppost/messages/messages_en_US.properties | 3 +
5 files changed, 143 insertions(+), 66 deletions(-)
diff --git
a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/httppost.adoc
b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/httppost.adoc
index ff1812337d..d3b359f2ae 100644
--- a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/httppost.adoc
+++ b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/httppost.adoc
@@ -56,6 +56,7 @@ When enabled, the Post a file option will retrieve the file
named in this field,
|Post a file|If a file is defined in the Request entity field, its contents
will be posted if this option is checked.
Currently "Request entity field" must be filled in order for "Post a file" to
work.
Selecting "Post a file" and specifying a field under "Body parameters" without
selecting a value for "Request entity field" (the place for the file name) will
fail silently.
+|Use MultiPart Upload|This will send the data to the server in the form of a
multipart request, this is useful when posting files
|Connection timeout|Defines the timeout (defaults to 10000) in Milliseconds
when a connection attempt will error out.
|Socket timeout|Defines the timeout (defaults to 10000) in Milliseconds when a
socket will error out.
|Connection close wait time|Define the wait time after the connection is
closed in Milliseconds, the default -1 means the default wait time from the
operating system (often 2 minutes).
diff --git
a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPost.java
b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPost.java
index 5405eb74bb..4b541dc8b0 100644
---
a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPost.java
+++
b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPost.java
@@ -17,7 +17,17 @@
package org.apache.hop.pipeline.transforms.httppost;
+import static
org.apache.hop.pipeline.transforms.httppost.HttpPostMeta.DEFAULT_ENCODING;
+
import com.google.common.annotations.VisibleForTesting;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.URLEncoder;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.hop.core.Const;
import org.apache.hop.core.exception.HopException;
@@ -42,6 +52,7 @@ import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
@@ -52,17 +63,6 @@ import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.json.simple.JSONObject;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-import java.net.HttpURLConnection;
-import java.net.URLEncoder;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import static
org.apache.hop.pipeline.transforms.httppost.HttpPostMeta.DEFAULT_ENCODING;
-
/** Make a HTTP Post call */
public class HttpPost extends BaseTransform<HttpPostMeta, HttpPostData> {
@@ -201,6 +201,7 @@ public class HttpPost extends BaseTransform<HttpPostMeta,
HttpPostData> {
MultipartEntityBuilder multipartEntityBuilder =
MultipartEntityBuilder.create();
String tmp = data.inputRowMeta.getString(rowData,
data.indexOfRequestEntity);
HttpEntity entity = null;
+ byte[] bytes = null;
// Request content will be retrieved directly
// from the input stream
// Per default, the request content needs to be buffered
@@ -214,16 +215,19 @@ public class HttpPost extends BaseTransform<HttpPostMeta,
HttpPostData> {
"file", HopVfs.getFileObject(resolve(tmp)).getPath().toFile());
}
} else {
- byte[] bytes;
if ((data.realEncoding != null) && (data.realEncoding.length() > 0))
{
bytes = tmp.getBytes(data.realEncoding);
} else {
bytes = tmp.getBytes();
}
- multipartEntityBuilder.addBinaryBody("file", bytes);
+ if (meta.isMultipartupload()) {
+ multipartEntityBuilder.addBinaryBody("file", bytes);
+ entity = multipartEntityBuilder.build();
+ post.setEntity(entity);
+ } else {
+ post.setEntity(new ByteArrayEntity(bytes));
+ }
}
- entity = multipartEntityBuilder.build();
- post.setEntity(entity);
}
// Execute request
diff --git
a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostDialog.java
b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostDialog.java
index cb79f01d38..524ab1ce2c 100644
---
a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostDialog.java
+++
b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostDialog.java
@@ -17,6 +17,9 @@
package org.apache.hop.pipeline.transforms.httppost;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.hop.core.Const;
import org.apache.hop.core.Props;
import org.apache.hop.core.exception.HopException;
@@ -62,10 +65,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.List;
-
public class HttpPostDialog extends BaseTransformDialog implements
ITransformDialog {
private static final Class<?> PKG = HttpPostMeta.class; // For Translator
@@ -120,6 +119,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private boolean gotPreviousFields = false;
private ComboVar wEncoding;
+ private Button wMultiPartUpload;
private Button wPostAFile;
@@ -156,7 +156,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.Shell.Title"));
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
setupButtons(margin);
setupTransformNameField(lsMod);
@@ -190,6 +190,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
setupUrlFieldNameLine(lsMod, gSettings);
setupEncodingLine(lsMod, gSettings);
setupRequestEntityLine(lsMod, gSettings);
+ setupMultiPartUpload(gSettings);
setupPostFileLine(gSettings);
setupConnectionTimeoutLine(lsMod, gSettings);
setupSocketTimeout(lsMod, gSettings);
@@ -350,7 +351,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
}
private void setupQueryParamBlock(ModifyListener lsMod, Composite
wAdditionalComp) {
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlQuery = new Label(wAdditionalComp, SWT.NONE);
wlQuery.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.QueryParameters.Label"));
PropsUi.setLook(wlQuery);
@@ -402,8 +403,9 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
wQuery.setLayoutData(fdQuery);
}
- private Button setupBodyParamBlock(ModifyListener lsMod, Group gProxy,
Composite wAdditionalComp) {
- int margin = props.getMargin();
+ private Button setupBodyParamBlock(
+ ModifyListener lsMod, Group gProxy, Composite wAdditionalComp) {
+ int margin = PropsUi.getMargin();
Label wlFields = new Label(wAdditionalComp, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.Parameters.Label"));
PropsUi.setLook(wlFields);
@@ -464,7 +466,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupProxyPort(ModifyListener lsMod, Group gProxy) {
// Proxy port
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlProxyPort = new Label(gProxy, SWT.RIGHT);
wlProxyPort.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.ProxyPort.Label"));
PropsUi.setLook(wlProxyPort);
@@ -487,7 +489,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupProxyHost(ModifyListener lsMod, Group gProxy) {
// Proxy host
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlProxyHost = new Label(gProxy, SWT.RIGHT);
wlProxyHost.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.ProxyHost.Label"));
PropsUi.setLook(wlProxyHost);
@@ -521,7 +523,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupHttpPasswordLine(ModifyListener lsMod, Group gHttpAuth) {
// HTTP Password
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlHttpPassword = new Label(gHttpAuth, SWT.RIGHT);
wlHttpPassword.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.HttpPassword.Label"));
PropsUi.setLook(wlHttpPassword);
@@ -545,7 +547,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupHttpLoginLine(ModifyListener lsMod, Group gHttpAuth) {
// HTTP Login
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlHttpLogin = new Label(gHttpAuth, SWT.RIGHT);
wlHttpLogin.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.HttpLogin.Label"));
PropsUi.setLook(wlHttpLogin);
@@ -579,7 +581,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupResponseHeaderLine(ModifyListener lsMod, Group
gOutputFields) {
// Response header line...
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlResponseHeader = new Label(gOutputFields, SWT.RIGHT);
wlResponseHeader.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.ResponseHeader.Label"));
PropsUi.setLook(wlResponseHeader);
@@ -601,7 +603,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupResponseTimeLine(ModifyListener lsMod, Group
gOutputFields) {
// Response time line...
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlResponseTime = new Label(gOutputFields, SWT.RIGHT);
wlResponseTime.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.ResponseTime.Label"));
PropsUi.setLook(wlResponseTime);
@@ -623,7 +625,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupStatusCodeLine(ModifyListener lsMod, Group gOutputFields) {
// Resultcode line...
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlResultCode = new Label(gOutputFields, SWT.RIGHT);
wlResultCode.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.ResultCode.Label"));
PropsUi.setLook(wlResultCode);
@@ -645,7 +647,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupResultLine(ModifyListener lsMod, Group gOutputFields) {
// Result line...
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlResult = new Label(gOutputFields, SWT.RIGHT);
wlResult.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.Result.Label"));
PropsUi.setLook(wlResult);
@@ -677,7 +679,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupCloseWaitConnectionLine(ModifyListener lsMod, Group
gSettings) {
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlCloseIdleConnectionsTime = new Label(gSettings, SWT.RIGHT);
wlCloseIdleConnectionsTime.setText(
BaseMessages.getString(PKG,
"HTTPPOSTDialog.CloseIdleConnectionsTime.Label"));
@@ -702,7 +704,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupSocketTimeout(ModifyListener lsMod, Group gSettings) {
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlSocketTimeOut = new Label(gSettings, SWT.RIGHT);
wlSocketTimeOut.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.SocketTimeOut.Label"));
PropsUi.setLook(wlSocketTimeOut);
@@ -725,7 +727,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupConnectionTimeoutLine(ModifyListener lsMod, Group
gSettings) {
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlConnectionTimeOut = new Label(gSettings, SWT.RIGHT);
wlConnectionTimeOut.setText(
BaseMessages.getString(PKG, "HTTPPOSTDialog.ConnectionTimeOut.Label"));
@@ -747,17 +749,41 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
wConnectionTimeOut.setLayoutData(fdConnectionTimeOut);
}
- private void setupPostFileLine( Group gSettings) {
+ private void setupMultiPartUpload(Group gSettings) {
+ // MultiPart Upload?
+ int middle = props.getMiddlePct();
+ int margin = PropsUi.getMargin();
+ Label wlMultiPartUpload = new Label(gSettings, SWT.RIGHT);
+ wlMultiPartUpload.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.MultiPartUpload.Label"));
+ PropsUi.setLook(wlMultiPartUpload);
+ FormData fdlMultiPartUpload = new FormData();
+ fdlMultiPartUpload.left = new FormAttachment(0, 0);
+ fdlMultiPartUpload.right = new FormAttachment(middle, -margin);
+ fdlMultiPartUpload.top = new FormAttachment(wRequestEntity, margin);
+ wlMultiPartUpload.setLayoutData(fdlMultiPartUpload);
+ wMultiPartUpload = new Button(gSettings, SWT.CHECK);
+ wMultiPartUpload.setToolTipText(
+ BaseMessages.getString(PKG, "HTTPPOSTDialog.MultiPartUpload.Tooltip"));
+ PropsUi.setLook(wMultiPartUpload);
+ FormData fdMultiPartUpload = new FormData();
+ fdMultiPartUpload.left = new FormAttachment(middle, 0);
+ fdMultiPartUpload.top = new FormAttachment(wlMultiPartUpload, 0,
SWT.CENTER);
+ fdMultiPartUpload.right = new FormAttachment(100, 0);
+ wMultiPartUpload.setLayoutData(fdMultiPartUpload);
+ wMultiPartUpload.addSelectionListener(new
ComponentSelectionListener(input));
+ }
+
+ private void setupPostFileLine(Group gSettings) {
// Post file?
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlPostAFile = new Label(gSettings, SWT.RIGHT);
wlPostAFile.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.postAFile.Label"));
PropsUi.setLook(wlPostAFile);
FormData fdlPostAFile = new FormData();
fdlPostAFile.left = new FormAttachment(0, 0);
fdlPostAFile.right = new FormAttachment(middle, -margin);
- fdlPostAFile.top = new FormAttachment(wRequestEntity, margin);
+ fdlPostAFile.top = new FormAttachment(wMultiPartUpload, margin);
wlPostAFile.setLayoutData(fdlPostAFile);
wPostAFile = new Button(gSettings, SWT.CHECK);
wPostAFile.setToolTipText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.postAFile.Tooltip"));
@@ -773,7 +799,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupRequestEntityLine(ModifyListener lsMod, Group gSettings) {
// requestEntity Line
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlRequestEntity = new Label(gSettings, SWT.RIGHT);
wlRequestEntity.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.requestEntity.Label"));
PropsUi.setLook(wlRequestEntity);
@@ -812,7 +838,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupEncodingLine(ModifyListener lsMod, Group gSettings) {
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlEncoding = new Label(gSettings, SWT.RIGHT);
wlEncoding.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.Encoding.Label"));
PropsUi.setLook(wlEncoding);
@@ -851,7 +877,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupUrlFieldNameLine(ModifyListener lsMod, Group gSettings) {
// UrlField Line
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
wlUrlField = new Label(gSettings, SWT.RIGHT);
wlUrlField.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.UrlField.Label"));
PropsUi.setLook(wlUrlField);
@@ -891,7 +917,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupUrlInFieldLine(Group gSettings) {
// UrlInField line
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
Label wlUrlInField = new Label(gSettings, SWT.RIGHT);
wlUrlInField.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.UrlInField.Label"));
PropsUi.setLook(wlUrlInField);
@@ -920,7 +946,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupIgnoreSslLine(Group gSettings) {
// ignoreSsl line
//
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
int middle = props.getMiddlePct();
Label wlIgnoreSsl = new Label(gSettings, SWT.RIGHT);
wlIgnoreSsl.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.IgnoreSsl.Label"));
@@ -948,7 +974,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupUrlLine(ModifyListener lsMod, Group gSettings) {
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
wlUrl = new Label(gSettings, SWT.RIGHT);
wlUrl.setText(BaseMessages.getString(PKG, "HTTPPOSTDialog.URL.Label"));
PropsUi.setLook(wlUrl);
@@ -982,7 +1008,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
private void setupTransformNameField(ModifyListener lsMod) {
// TransformName line
int middle = props.getMiddlePct();
- int margin = props.getMargin();
+ int margin = PropsUi.getMargin();
wlTransformName = new Label(shell, SWT.RIGHT);
wlTransformName.setText(BaseMessages.getString(PKG,
"HTTPPOSTDialog.TransformName.Label"));
PropsUi.setLook(wlTransformName);
@@ -1122,6 +1148,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
wEncoding.setText(input.getEncoding());
}
wPostAFile.setSelection(input.isPostAFile());
+ wMultiPartUpload.setSelection(input.isMultipartupload());
if (input.getHttpLogin() != null) {
wHttpLogin.setText(input.getHttpLogin());
@@ -1214,6 +1241,7 @@ public class HttpPostDialog extends BaseTransformDialog
implements ITransformDia
input.setEncoding(wEncoding.getText());
input.setPostAFile(wPostAFile.getSelection());
+ input.setMultipartupload(wMultiPartUpload.getSelection());
input.setHttpLogin(wHttpLogin.getText());
input.setHttpPassword(wHttpPassword.getText());
input.setProxyHost(wProxyHost.getText());
diff --git
a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostMeta.java
b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostMeta.java
index 29e1ac63d3..c59c0b18bb 100644
---
a/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostMeta.java
+++
b/plugins/transforms/httppost/src/main/java/org/apache/hop/pipeline/transforms/httppost/HttpPostMeta.java
@@ -17,6 +17,8 @@
package org.apache.hop.pipeline.transforms.httppost;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.hop.core.CheckResult;
import org.apache.hop.core.ICheckResult;
import org.apache.hop.core.annotations.Transform;
@@ -34,9 +36,6 @@ import org.apache.hop.pipeline.PipelineMeta;
import org.apache.hop.pipeline.transform.BaseTransformMeta;
import org.apache.hop.pipeline.transform.TransformMeta;
-import java.util.ArrayList;
-import java.util.List;
-
@Transform(
id = "HttpPost",
image = "httppost.svg",
@@ -93,6 +92,11 @@ public class HttpPostMeta extends
BaseTransformMeta<HttpPost, HttpPostData> {
@HopMetadataProperty(key = "postafile", injectionKeyDescription =
"HTTPPOST.Injection.postAFile")
private boolean postAFile;
+ @HopMetadataProperty(
+ key = "multipartupload",
+ injectionKeyDescription = "HTTPPOST.Injection.multipartupload")
+ private boolean multipartupload;
+
@HopMetadataProperty(injectionKeyDescription =
"HTTPPOST.Injection.proxyHost")
private String proxyHost;
@@ -122,47 +126,65 @@ public class HttpPostMeta extends
BaseTransformMeta<HttpPost, HttpPostData> {
this.encoding = encoding;
}
- /** @return Returns the connectionTimeout. */
+ /**
+ * @return Returns the connectionTimeout.
+ */
public String getConnectionTimeout() {
return connectionTimeout;
}
- /** @param connectionTimeout The connectionTimeout to set. */
+ /**
+ * @param connectionTimeout The connectionTimeout to set.
+ */
public void setConnectionTimeout(String connectionTimeout) {
this.connectionTimeout = connectionTimeout;
}
- /** @return Returns the closeIdleConnectionsTime. */
+ /**
+ * @return Returns the closeIdleConnectionsTime.
+ */
public String getCloseIdleConnectionsTime() {
return closeIdleConnectionsTime;
}
- /** @param closeIdleConnectionsTime The connectionTimeout to set. */
+ /**
+ * @param closeIdleConnectionsTime The connectionTimeout to set.
+ */
public void setCloseIdleConnectionsTime(String closeIdleConnectionsTime) {
this.closeIdleConnectionsTime = closeIdleConnectionsTime;
}
- /** @return Returns the socketTimeout. */
+ /**
+ * @return Returns the socketTimeout.
+ */
public String getSocketTimeout() {
return socketTimeout;
}
- /** @param socketTimeout The socketTimeout to set. */
+ /**
+ * @param socketTimeout The socketTimeout to set.
+ */
public void setSocketTimeout(String socketTimeout) {
this.socketTimeout = socketTimeout;
}
- /** @return Returns the procedure. */
+ /**
+ * @return Returns the procedure.
+ */
public String getUrl() {
return url;
}
- /** @param procedure The procedure to set. */
+ /**
+ * @param procedure The procedure to set.
+ */
public void setUrl(String procedure) {
this.url = procedure;
}
- /** @return Is the url coded in a field? */
+ /**
+ * @return Is the url coded in a field?
+ */
public boolean isUrlInField() {
return urlInField;
}
@@ -175,27 +197,45 @@ public class HttpPostMeta extends
BaseTransformMeta<HttpPost, HttpPostData> {
this.postAFile = postafile;
}
- /** @param urlInField Is the url coded in a field? */
+ public boolean isMultipartupload() {
+ return multipartupload;
+ }
+
+ public void setMultipartupload(boolean multipartupload) {
+ this.multipartupload = multipartupload;
+ }
+
+ /**
+ * @param urlInField Is the url coded in a field?
+ */
public void setUrlInField(boolean urlInField) {
this.urlInField = urlInField;
}
- /** @return The field name that contains the url. */
+ /**
+ * @return The field name that contains the url.
+ */
public String getUrlField() {
return urlField;
}
- /** @param urlField name of the field that contains the url */
+ /**
+ * @param urlField name of the field that contains the url
+ */
public void setUrlField(String urlField) {
this.urlField = urlField;
}
- /** @param requestEntity the requestEntity to set */
+ /**
+ * @param requestEntity the requestEntity to set
+ */
public void setRequestEntity(String requestEntity) {
this.requestEntity = requestEntity;
}
- /** @return requestEntity */
+ /**
+ * @return requestEntity
+ */
public String getRequestEntity() {
return requestEntity;
}
@@ -227,6 +267,7 @@ public class HttpPostMeta extends
BaseTransformMeta<HttpPost, HttpPostData> {
public void setDefault() {
encoding = DEFAULT_ENCODING;
postAFile = false;
+ multipartupload = false;
lookupFields.add(new HttpPostLookupField());
resultFields.add(new HttpPostResultField());
socketTimeout = String.valueOf(DEFAULT_SOCKET_TIMEOUT);
@@ -254,12 +295,10 @@ public class HttpPostMeta extends
BaseTransformMeta<HttpPost, HttpPostData> {
}
if (!Utils.isEmpty(resultFields.get(0).getResponseTimeFieldName())) {
IValueMeta v =
- new ValueMetaInteger(
-
variables.resolve(resultFields.get(0).getResponseTimeFieldName()));
+ new
ValueMetaInteger(variables.resolve(resultFields.get(0).getResponseTimeFieldName()));
inputRowMeta.addValueMeta(v);
}
- String headerFieldName =
- variables.resolve(resultFields.get(0).getResponseHeaderFieldName());
+ String headerFieldName =
variables.resolve(resultFields.get(0).getResponseHeaderFieldName());
if (!Utils.isEmpty(headerFieldName)) {
IValueMeta v = new ValueMetaString(headerFieldName);
v.setOrigin(name);
@@ -400,7 +439,9 @@ public class HttpPostMeta extends
BaseTransformMeta<HttpPost, HttpPostData> {
this.httpPassword = httpPassword;
}
- /** @return */
+ /**
+ * @return
+ */
public String getHttpPassword() {
return httpPassword;
}
diff --git
a/plugins/transforms/httppost/src/main/resources/org/apache/hop/pipeline/transforms/httppost/messages/messages_en_US.properties
b/plugins/transforms/httppost/src/main/resources/org/apache/hop/pipeline/transforms/httppost/messages/messages_en_US.properties
index 94fe53c547..97f54b91ee 100644
---
a/plugins/transforms/httppost/src/main/resources/org/apache/hop/pipeline/transforms/httppost/messages/messages_en_US.properties
+++
b/plugins/transforms/httppost/src/main/resources/org/apache/hop/pipeline/transforms/httppost/messages/messages_en_US.properties
@@ -40,6 +40,8 @@ HTTPPOST.LineNumber=linenr
HTTPPOSTDialog.GetFields.Button=\ &Get Fields
HTTPPOSTDialog.postAFile.Label=Post a file
HTTPPOSTDialog.postAFile.Tooltip=Post a file
+HTTPPOSTDialog.MultiPartUpload.Label=Use MultiPart Upload
+HTTPPOSTDialog.MultiPartUpload.Tooltip=Use MultiPart Upload
HTTPPOST.Exception.ErrorFindingField=Error finding field [{0}] \!
HTTPPOSTDialog.FailedToGetFields.DialogTitle=Error getting fields
HTTPPOSTDialog.Log.FoundArguments=Found {0} arguments
@@ -115,5 +117,6 @@ HTTPPOST.Injection.ResultFieldName=Result field name
HTTPPOST.Injection.ResultFieldCode=HTTP status code field name
HTTPPOST.Injection.ResultFieldResponseTime=Response time (milliseconds)
HTTPPOST.Injection.ResultFieldResponseHeader=Response header field name
+HTTPPOST.Injection.multipartupload=Use MultiPart upload (Y/N)
HttpPostMeta.keyword=http,post