Java Code Examples for org.apache.commons.lang3.StringEscapeUtils.escapeJson()

The following are Jave code examples for showing how to use escapeJson() of the org.apache.commons.lang3.StringEscapeUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: uroborosql   File: AuditLogSqlFilter.java   View Source Code Vote up 6 votes
/**
 * @param userName ユーザ名
 * @param funcId 機能I
 * @param sqlId SQL-ID
 * @param sqlName SQL名
 * @param sql SQL文
 * @param rowCount
 */
private AuditData(final String userName, final String funcId, final String sqlId, final String sqlName,
		final String sql, final int rowCount) {
	super();
	this.userName = StringEscapeUtils.escapeJson(userName);
	this.funcId = StringEscapeUtils.escapeJson(funcId);
	this.sqlId = StringEscapeUtils.escapeJson(sqlId);
	this.sqlName = StringEscapeUtils.escapeJson(sqlName);
	this.sql = StringEscapeUtils.escapeJson(PAT.matcher(sql).replaceAll(" "));
	this.rowCount = rowCount;
}
 
Example 2
Project: springboot-shiro-cas-mybatis   File: InternalConfigStateController.java   View Source Code Vote up 5 votes
/**
 * Handle request.
 *
 * @param request the request
 * @param response the response
 * @return the model and view
 * @throws Exception the exception
 */
@RequestMapping(method = RequestMethod.GET)
protected ModelAndView handleRequestInternal(
        final HttpServletRequest request, final HttpServletResponse response)
        throws Exception {

    final Map<String, Object> list = getBeans(this.applicationContext);
    LOGGER.debug("Found [{}] beans to report", list.size());

    final JsonSerializer<Object> serializer = new BeanObjectJsonSerializer();
    final StringBuilder builder = new StringBuilder();
    builder.append('[');

    final Set<Map.Entry<String, Object>> entries = list.entrySet();
    final Iterator<Map.Entry<String, Object>> it = entries.iterator();

    while (it.hasNext()) {
        final Map.Entry<String, Object> entry = it.next();
        final Object obj = entry.getValue();

        final StringWriter writer = new StringWriter();
        writer.append('{');
        writer.append('\"' + entry.getKey() + "\":");
        serializer.toJson(writer, obj);
        writer.append('}');
        builder.append(writer);

        if (it.hasNext()) {
            builder.append(',');
        }
    }
    builder.append(']');
    final ModelAndView mv = new ModelAndView(VIEW_CONFIG);
    final String jsonData = StringEscapeUtils.escapeJson(builder.toString());

    mv.addObject("jsonData", jsonData);
    mv.addObject("properties", casProperties.entrySet());
    return mv;
}
 
Example 3
Project: rest-modeling-framework   File: ResourceGenModel.java   View Source Code Vote up 4 votes
public String getDescription() throws JsonProcessingException {
    return StringEscapeUtils.escapeJson(resource.getDescription());
}
 
Example 4
Project: rest-modeling-framework   File: ItemGenModel.java   View Source Code Vote up 4 votes
public String getDescription() {
    return StringEscapeUtils.escapeJson(method.getDescription());
}
 
Example 5
Project: rest-modeling-framework   File: ActionGenModel.java   View Source Code Vote up 4 votes
public String getExample() {
    return StringEscapeUtils.escapeJson(example);
}
 
Example 6
Project: rest-modeling-framework   File: ActionGenModel.java   View Source Code Vote up 4 votes
@Override
public String getDescription() {
    return StringEscapeUtils.escapeJson(type.getDescription());
}
 
Example 7
Project: JarCraftinator   File: JSONObject.java   View Source Code Vote up 4 votes
private String encode(String str) {
    return StringEscapeUtils.escapeJson(str);
}
 
Example 8
Project: JarCraftinator   File: JSONArray.java   View Source Code Vote up 4 votes
private String encode(String str) {
    return StringEscapeUtils.escapeJson(str);
}
 
Example 9
Project: dremio-oss   File: ProfileWrapper.java   View Source Code Vote up 4 votes
public String getPlanText() {
  return StringEscapeUtils.escapeJson(profile.getPlan());
}
 
Example 10
Project: uroborosql   File: CoverageData.java   View Source Code Vote up 2 votes
/**
 * JSON化
 *
 * @return JSON
 */
public String toJSON() {
	return "{\"sqlName\":" + StringEscapeUtils.escapeJson(sqlName) + ",\"md5\":" + md5 + ",\"passRoute\":"
			+ passRoute + "}";
}