-
Notifications
You must be signed in to change notification settings - Fork 7
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
JavaScriptFragment.asJson() #5108
Conversation
replace Jsp.unsafe() with JavaScriptFragment.unsafe() in <script> blocks replace new ObjectMapper() with JsonUtil.DEFAULT_MAPPER or JsonUtil.createDefaultMapper()
@@ -388,7 +389,7 @@ private String getBestJson(String currentValue, String newValue, String serverSe | |||
} | |||
|
|||
// Rather than overwrite the current json map, merge the new with the current. | |||
ObjectMapper mapper = new ObjectMapper(); | |||
ObjectMapper mapper = JsonUtil.createDefaultMapper(); |
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.
Could be JsonUtil.DEFAULT_MAPPER
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've taken to using DEFAULT_MAPPER when I can inline the whole usage. Just a style choice and speeds up converting code (what does readerForUpdating() do? beats me.).
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.
There's an h() to q() conversion in there somewhere
@@ -244,7 +245,7 @@ | |||
|
|||
Ext4.onReady(function() | |||
{ | |||
var datasetInfo = <%=unsafe(JsonUtil.DEFAULT_MAPPER.writeValueAsString(datasetInfo))%>; | |||
var datasetInfo = <%=JavaScriptFragment.asJson(datasetInfo)%>; | |||
var store = LABKEY.study.DataViewUtil.getViewCategoriesStore({ | |||
storeId : '<%=h(storeId)%>', |
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.
That looks wrong
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.
Meaning line 250
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 assume this is some Ext weirdness where you have to htmlEncode() id's so they don't get injected into the html? I don't think I changed this.
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.
configRequestabilityRules.jsp has a strange use of h() which I changed to qh(), not sure if it's wrong.
* JavaScriptFragment.asJson() replace Jsp.unsafe() with JavaScriptFragment.unsafe() in <script> blocks replace new ObjectMapper() with JsonUtil.DEFAULT_MAPPER or JsonUtil.createDefaultMapper() * use HtmlString for html * JavaScriptFragment.asString() * typo
replace Jsp.unsafe() with JavaScriptFragment.unsafe() in <script> blocks replace new ObjectMapper() with JsonUtil.DEFAULT_MAPPER or JsonUtil.createDefaultMapper()
Rationale
Related Pull Requests
Changes