[
https://issues.apache.org/jira/browse/NIFI-2460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15406082#comment-15406082
]
ASF GitHub Bot commented on NIFI-2460:
--------------------------------------
GitHub user devin-fisher opened a pull request:
https://github.com/apache/nifi/pull/777
Add String Escape Utils to Nifi Expression Language
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 master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/nifi/pull/777.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 #777
----
commit 2a4f1bd68a17d3fc765a9d6c8a4e48ef21c77bfe
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 37651b83bca350dd3c50da16e6b4eee0f2768a7f
Author: Devin Fisher <[email protected]>
Date: 2016-07-03T12:45:09Z
fix a copy past error
commit 181c5751c6e59dadb45dce0d344192eae4c594dd
Author: Devin Fisher <[email protected]>
Date: 2016-07-03T12:45:37Z
Merge remote-tracking branch 'apache/master'
commit b3fbe7540ffa47905bbbfa172ca08da40387cc58
Author: devin fisher <[email protected]>
Date: 2016-07-28T03:17:39Z
added functions for escaping text to the expression language
commit 5a6146ea8575cf732ad23a9ce9a2c19a22ed05fa
Author: devin fisher <[email protected]>
Date: 2016-07-28T03:18:08Z
Merge branch 'master' of https://github.com/apache/nifi
commit 4e6a0d57958a3575b1bfd7647538aaf61b28c712
Author: devin fisher <[email protected]>
Date: 2016-07-28T04:18:50Z
Added more test for escape and unescape functions
commit fd63fe95eaadb31209bf245e393e60d0030dbb88
Author: Devin Fisher <[email protected]>
Date: 2016-07-28T23:23:41Z
Added documentation for the new expression language functions for escapes
commit 851cfa3fe2e1051632f41c47a4d06610029eecaf
Author: Devin Fisher <[email protected]>
Date: 2016-08-02T16:16:30Z
Merge branch 'master' of github.com:apache/nifi
----
> 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)