List of usage examples for org.apache.commons.lang StringEscapeUtils escapeHtml
public static String escapeHtml(String input)
From source file:com.igormaznitsa.mindmap.exporters.MindmupExporter.java
private static String makeHtmlFromExtras(final Topic topic) { final ExtraFile file = (ExtraFile) topic.getExtras().get(Extra.ExtraType.FILE); final ExtraNote note = (ExtraNote) topic.getExtras().get(Extra.ExtraType.NOTE); final ExtraLink link = (ExtraLink) topic.getExtras().get(Extra.ExtraType.LINK); if (file == null && link == null && note == null) { return null; }// w w w . j a va 2 s.c o m final StringBuilder result = new StringBuilder(); if (file != null) { final String uri = file.getValue().asString(true, false); result.append("FILE: <a href=\"").append(uri).append("\">").append(uri).append("</a><br>"); //NOI18N } if (link != null) { final String uri = link.getValue().asString(true, true); result.append("LINK: <a href=\"").append(uri).append("\">").append(uri).append("</a><br>"); //NOI18N } if (note != null) { if (file != null || link != null) { result.append("<br>"); //NOI18N } result.append("<pre>").append(StringEscapeUtils.escapeHtml(note.getValue())).append("</pre>"); //NOI18N } return result.toString(); }
From source file:ch.systemsx.cisd.openbis.generic.shared.translator.ExternalDataTranslator.java
private static Invalidation translateInvalidation(InvalidationPE invalidationPE) { if (invalidationPE == null) { return null; }// www.ja va 2 s .c om Invalidation result = new Invalidation(); result.setReason(StringEscapeUtils.escapeHtml(invalidationPE.getReason())); result.setRegistrationDate(invalidationPE.getRegistrationDate()); result.setRegistrator(PersonTranslator.translate(invalidationPE.getRegistrator())); return result; }
From source file:com.buaa.cfs.conf.ReconfigurationServlet.java
/** * Apply configuratio changes after admin has approved them. *//* ww w .java 2 s.c o m*/ private void applyChanges(PrintWriter out, Reconfigurable reconf, HttpServletRequest req) throws ReconfigurationException { Configuration oldConf = reconf.getConf(); Configuration newConf = new Configuration(); Enumeration<String> params = getParams(req); synchronized (oldConf) { while (params.hasMoreElements()) { String rawParam = params.nextElement(); String param = StringEscapeUtils.unescapeHtml(rawParam); String value = StringEscapeUtils.unescapeHtml(req.getParameter(rawParam)); if (value != null) { if (value.equals(newConf.getRaw(param)) || value.equals("default") || value.equals("null") || value.isEmpty()) { if ((value.equals("default") || value.equals("null") || value.isEmpty()) && oldConf.getRaw(param) != null) { out.println("<p>Changed \"" + StringEscapeUtils.escapeHtml(param) + "\" from \"" + StringEscapeUtils.escapeHtml(oldConf.getRaw(param)) + "\" to default</p>"); reconf.reconfigureProperty(param, null); } else if (!value.equals("default") && !value.equals("null") && !value.isEmpty() && (oldConf.getRaw(param) == null || !oldConf.getRaw(param).equals(value))) { // change from default or value to different value if (oldConf.getRaw(param) == null) { out.println("<p>Changed \"" + StringEscapeUtils.escapeHtml(param) + "\" from default to \"" + StringEscapeUtils.escapeHtml(value) + "\"</p>"); } else { out.println("<p>Changed \"" + StringEscapeUtils.escapeHtml(param) + "\" from \"" + StringEscapeUtils.escapeHtml(oldConf.getRaw(param)) + "\" to \"" + StringEscapeUtils.escapeHtml(value) + "\"</p>"); } reconf.reconfigureProperty(param, value); } else { LOG.info("property " + param + " unchanged"); } } else { // parameter value != newConf value out.println("<p>\"" + StringEscapeUtils.escapeHtml(param) + "\" not changed because value has changed from \"" + StringEscapeUtils.escapeHtml(value) + "\" to \"" + StringEscapeUtils.escapeHtml(newConf.getRaw(param)) + "\" since approval</p>"); } } } } }
From source file:gov.medicaid.binders.BaseFormBinder.java
/** * Sets the given values to the model.//from w w w. ja va 2s. com * * @param mv the model and view to add to * @param key the attribute key (this will prepend the namespace) * @param value the value to be set */ protected void attr(Map<String, Object> mv, String key, String value) { mv.put(name(key), StringEscapeUtils.escapeHtml(value)); }
From source file:it.eng.spagobi.engines.network.bean.CrossNavigationLink.java
/** * Get the map (type,(parameter,property)) for the dynamic parameters. * The dynamic parameters are the ones with type EDGE and NODE. * We need these three informations to create the cross navigation link. * Type: to understand the event//from w w w . ja v a2 s . c o m * Parameter: name of the parameter * Property: the property of the object to bind * @return */ public Map<String, Map<String, String>> getDynamicParameters() { CrossNavigationParameter parameter; Map<String, String> edgesList = new HashMap<String, String>(); Map<String, String> nodesList = new HashMap<String, String>(); Map<String, Map<String, String>> dynamicParameter = new HashMap<String, Map<String, String>>(); for (int i = 0; i < parameters.size(); i++) { parameter = parameters.get(i); if (parameter.getType().equals(CrossNavigationParameterType.EDGE)) { edgesList.put(StringEscapeUtils.escapeHtml(parameter.getProperty()), StringEscapeUtils.escapeHtml(parameter.getName())); } else if (parameter.getType().equals(CrossNavigationParameterType.NODE)) { nodesList.put(StringEscapeUtils.escapeHtml(parameter.getProperty()), StringEscapeUtils.escapeHtml(parameter.getName())); } } dynamicParameter.put(CrossNavigationParameterType.EDGE.getValue(), edgesList); dynamicParameter.put(CrossNavigationParameterType.NODE.getValue(), nodesList); return dynamicParameter; }
From source file:com.connexience.server.model.security.User.java
public String getDisplayName() { return StringEscapeUtils.escapeHtml(this.getFirstName() + " " + this.getSurname()); }
From source file:edu.cornell.mannlib.vitro.webapp.controller.visualization.ShortURLVisualizationController.java
private Map<String, String> getParamatersForVis(List<String> matchedPatternGroups, VitroRequest vitroRequest) { Map<String, String> parameters = new HashMap<String, String>(); /*//from w w w .ja v a2 s .c om * We need to convert the short-form URI into a long form. So we use the * default namespace to construct one. * Since VIVO allows non-default namespaces, there are chances that short URLs * will have a "uri" parameter instead of individual uri being part of the formal * url. * */ String subjectURI = null; if (matchedPatternGroups.size() <= 1) { subjectURI = vitroRequest.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY); } else { subjectURI = vitroRequest.getWebappDaoFactory().getDefaultNamespace() + matchedPatternGroups.get(1); } subjectURI = StringEscapeUtils.escapeHtml(subjectURI); parameters.put(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY, subjectURI); if (VisualizationFrameworkConstants.COAUTHORSHIP_VIS_SHORT_URL .equalsIgnoreCase(matchedPatternGroups.get(0))) { parameters.put(VisualizationFrameworkConstants.VIS_MODE_KEY, VisualizationFrameworkConstants.COAUTHOR_VIS_MODE); } else if (VisualizationFrameworkConstants.COINVESTIGATOR_VIS_SHORT_URL .equalsIgnoreCase(matchedPatternGroups.get(0))) { parameters.put(VisualizationFrameworkConstants.VIS_MODE_KEY, VisualizationFrameworkConstants.COPI_VIS_MODE); } else { /* * Currently temporal vis for both grants & publications do not require use of * vis_modes in their request handlers, so no need to provide anything other than * the URI. * */ } return parameters; }
From source file:com.predic8.membrane.core.interceptor.statistics.StatisticsCSVInterceptor.java
@Override public String getShortDescription() { return "Logs access statistics into the CSV-based file " + StringEscapeUtils.escapeHtml(fileName) + " ."; }
From source file:eu.earthobservatory.org.StrabonEndpoint.DescribeBean.java
/** * Processes the request made from the HTML visual interface of Strabon Endpoint. * /* www . j a va 2 s . c om*/ * @param request * @param response * @throws ServletException * @throws IOException */ private void processVIEWRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // get the dispatcher for forwarding the rendering of the response RequestDispatcher dispatcher = request.getRequestDispatcher("describe.jsp"); String query = URLDecoder.decode(request.getParameter("query"), "UTF-8"); String format = request.getParameter("format"); String handle = request.getParameter("handle"); RDFFormat rdfFormat = RDFFormat.valueOf(format); if (format == null || query == null || rdfFormat == null) { request.setAttribute(ERROR, PARAM_ERROR); dispatcher.forward(request, response); } else { // set the query, format and handle to be selected in the rendered page //request.setAttribute("query", URLDecoder.decode(query, "UTF-8")); //request.setAttribute("format", URLDecoder.decode(reqFormat, "UTF-8")); //request.setAttribute("handle", URLDecoder.decode(handle, "UTF-8")); if ("download".equals(handle)) { // download as attachment ServletOutputStream out = response.getOutputStream(); response.setContentType(rdfFormat.getDefaultMIMEType()); response.setHeader("Content-Disposition", "attachment; filename=results." + rdfFormat.getDefaultFileExtension() + "; " + rdfFormat.getCharset()); try { strabonWrapper.describe(query, format, out); response.setStatus(HttpServletResponse.SC_OK); } catch (Exception e) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); out.print(ResponseMessages.getXMLHeader()); out.print(ResponseMessages.getXMLException(e.getMessage())); out.print(ResponseMessages.getXMLFooter()); } out.flush(); } else //plain { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); strabonWrapper.describe(query, format, bos); request.setAttribute(RESPONSE, StringEscapeUtils.escapeHtml(bos.toString())); } catch (Exception e) { request.setAttribute(ERROR, e.getMessage()); } dispatcher.forward(request, response); } } }
From source file:com.redhat.rhn.frontend.struts.RhnAction.java
/** * Add a success message to the request with 1 parameter: * * Your System55 has been updated/*from www . jav a 2 s .c om*/ * * where System55 is the value placed in param1. param1 * * @param req to add the message to * @param msgKey resource key to lookup * @param param1 String value to fill in for the first parameter. * (param1 is HTML escaped as well) */ protected void createSuccessMessage(HttpServletRequest req, String msgKey, String param1) { ActionMessages msg = new ActionMessages(); Object[] args = new Object[1]; args[0] = StringEscapeUtils.escapeHtml(param1); msg.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(msgKey, args)); saveMessages(req, msg); }