-
-
Notifications
You must be signed in to change notification settings - Fork 107
Use mime type from config field in Elasticsearch indexer while posting HTTP request #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
a359903
117ee91
d6e2d73
7576829
4146ffe
722137e
6a670a5
4fabced
e67b6a8
ed77e45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,10 @@ | |
| checkUrl="'${resURL}/descriptorByName/LogstashInstallation/checkString?value='+escape(this.value)" /> | ||
| </f:entry> | ||
| <f:advanced> | ||
| <f:entry title="${%MIME type}" field="mimeType"> | ||
| <f:textbox value="${descriptor.mimeType}" default="application/json" | ||
|
||
| checkUrl="'${resURL}/descriptorByName/LogstashInstallation/checkMimeType?value='+escape(this.value)" /> | ||
| </f:entry> | ||
| <f:entry title="${%Syslog format}" field="syslogFormat"> | ||
| <f:enum value="${descriptor.syslogFormat}">${it.name()}</f:enum> | ||
| </f:entry> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <div> | ||
| <p> | ||
| MIME type of the request body that is sent to ELASTICSEARCH indexer. It should be at least of the form <b>type/subtype</b><br> | ||
| For e.g. <i>application/json</i> | ||
| </p> | ||
| </div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to reuse https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/entity/ContentType.html#parse(java.lang.String)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did think of this earlier. But I did not end up using it in my code because I realized it does not actually parse
Mime-Type. for e.g.ContentType.parse("application/json%%")(which is clearly not a valid mime-type) does not complain instead it returnsContentTypeobject with this invalid mimetype.For this reason I did not use it in the code and ended up validating by my own as per RFC-4288. This would potentially eliminate unwanted surprises that could cause with invalid mime-type.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I assumed
means it does validate it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just validates Content-Type as a whole and does not look for mime-type validity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use javax.activation.MimeType
This does validate the mimetype. Though it seems
&is a valid character in a mimetype. Mimetype fails when you use§see RFC 2045