[
https://issues.apache.org/jira/browse/NIFI-2460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15416086#comment-15416086
]
ASF GitHub Bot commented on NIFI-2460:
--------------------------------------
GitHub user devin-fisher opened a pull request:
https://github.com/apache/nifi/pull/833
Add String Escape Utils to Nifi Expression Language (redo)
jira:[NIFI-2460](https://issues.apache.org/jira/browse/NIFI-2460)
Added functions to escape and unescape common transport formats that are
supported by common-lang's
[StringEscapeUtils](https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringEscapeUtils.html).
Since I added ten functions, I created a new section in the Documentation.
I also moved URL encode and decode there too.
Don't add a lot of unit tests since I'm directly piping it through to
[StringEscapeUtils](https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringEscapeUtils.html)
and they have extensive testing
[there](https://github.com/apache/commons-lang/blob/master/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java).
The test are most to verify that it is going to the right function.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/devin-fisher/nifi add_escape_utils
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/nifi/pull/833.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #833
----
commit e5c9bc957d7eff6a70728c778bd3e065e78b7cdd
Author: Devin Fisher <[email protected]>
Date: 2016-07-02T23:53:16Z
EscapeJson function added to expression-language
Made use of org.apache.commons.lang3.StringEscapeUtils to do that
actual processing
commit 46f91a23e680be9bded1687070d5b1195c73e88e
Author: Devin Fisher <[email protected]>
Date: 2016-07-03T12:45:09Z
fix a copy past error
commit 3074072d7920bf762e410400f9fe27aa94e9d2d9
Author: devin fisher <[email protected]>
Date: 2016-07-28T03:17:39Z
added functions for escaping text to the expression language
commit 5362b5b2b016b333d948326fbb2244e7fab7297a
Author: devin fisher <[email protected]>
Date: 2016-07-28T04:18:50Z
Added more test for escape and unescape functions
commit 663960f67619d92d2dd6c18157de4975e6736ced
Author: Devin Fisher <[email protected]>
Date: 2016-07-28T23:23:41Z
Added documentation for the new expression language functions for escapes
commit 48823a00ae8af3cf80727246132d669fd85ec3bc
Author: Devin Fisher <[email protected]>
Date: 2016-08-10T21:41:04Z
Changed the heading for doc to encode instead of escape
----
> Add StringEscapeUtils function to Nifi Expression Language
> ----------------------------------------------------------
>
> Key: NIFI-2460
> URL: https://issues.apache.org/jira/browse/NIFI-2460
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Core Framework
> Reporter: Devin Fisher
>
> When using Nifi Expression Language to build up a transport format (like JSON
> or XML) there is no go way to make sure that it has been properly escaped.
> Example Use Case:
> When using PutHTTP to a Web Service that requires JSON input. If the
> incoming data could contain String with quotes or other disallow character in
> JSON there is no reliable way to Escape the inputs as you put them into a
> larger JSON object.
> Proposed Change:
> StringEscapeUtils is part of apache commons-lang which is already a
> dependency for nifi base POM. The functions in StringEscapeUtils can easily
> be mapped into functions in nifi expression language.
> Work Done:
> I have the work done on a fork and am ready to submit a PR. That PR should
> get good review since it is my first contribution (outside of a fixed typo)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)