List of usage examples for org.apache.commons.lang StringEscapeUtils escapeHtml
public static String escapeHtml(String input)
From source file:corner.orm.tapestry.component.prototype.autocompleter.AbstractSelectModel.java
protected String escapeHtml(Object v) { return v == null ? "" : StringEscapeUtils.escapeHtml(v.toString()); }
From source file:au.edu.ausstage.exchange.types.Event.java
public String toHtml() { StringBuilder builder = new StringBuilder("<li>"); builder.append("<a href=\"" + url + "\" title=\"View this record in AusStage\">" + StringEscapeUtils.escapeHtml(name) + "</a>"); builder.append(", " + StringEscapeUtils.escapeHtml(venue)); builder.append(", " + firstDate); builder.append("</li>"); return builder.toString(); }
From source file:ch.systemsx.cisd.openbis.generic.server.business.bo.common.EntityPropertiesEnricher.java
/** * Enriches the entities with given <var>entityIDs</var> with its properties. The entities will * be resolved by the {@link IEntityPropertiesHolderResolver} and will be enriched in place. *//*from w w w.j a v a2s. c om*/ public void enrich(final LongSet entityIDs, final IEntityPropertiesHolderResolver entities) { final Long2ObjectMap<PropertyType> propertyTypes = getPropertyTypes(); // Generic properties for (GenericEntityPropertyRecord val : setQuery.getEntityPropertyGenericValues(entityIDs)) { final IEntityPropertiesHolder entity = entities.get(val.entity_id); final IEntityProperty property = new GenericValueEntityProperty(); property.setValue(StringEscapeUtils.escapeHtml(val.value)); property.setPropertyType(propertyTypes.get(val.prty_id)); entity.getProperties().add(property); } // Controlled vocabulary properties Long2ObjectMap<String> vocabularyURLMap = null; Long2ObjectMap<VocabularyTerm> terms = new Long2ObjectOpenHashMap<VocabularyTerm>(); for (VocabularyTermRecord val : setQuery.getEntityPropertyVocabularyTermValues(entityIDs)) { if (vocabularyURLMap == null) { vocabularyURLMap = getVocabularyURLs(); } final IEntityPropertiesHolder entity = entities.get(val.entity_id); final IEntityProperty property = new VocabularyTermValueEntityProperty(); VocabularyTerm vocabularyTerm = terms.get(val.id); if (vocabularyTerm == null) { vocabularyTerm = new VocabularyTerm(); vocabularyTerm.setCode(StringEscapeUtils.escapeHtml(val.code)); vocabularyTerm.setLabel(StringEscapeUtils.escapeHtml(val.label)); final String template = vocabularyURLMap.get(val.covo_id); if (template != null) { vocabularyTerm.setUrl(StringEscapeUtils.escapeHtml( template.replaceAll(BasicConstant.VOCABULARY_URL_TEMPLATE_TERM_PATTERN, val.code))); } terms.put(val.id, vocabularyTerm); } property.setVocabularyTerm(vocabularyTerm); property.setPropertyType(propertyTypes.get(val.prty_id)); entity.getProperties().add(property); } // Material-type properties Long2ObjectMap<MaterialType> materialTypes = null; Long2ObjectMap<Material> materials = new Long2ObjectOpenHashMap<Material>(); for (MaterialEntityPropertyRecord val : setQuery.getEntityPropertyMaterialValues(entityIDs)) { if (materialTypes == null) { materialTypes = getMaterialTypes(); } final IEntityPropertiesHolder entity = entities.get(val.entity_id); final IEntityProperty property = new MaterialValueEntityProperty(); Material material = materials.get(val.id); if (material == null) { material = new Material(); material.setCode(StringEscapeUtils.escapeHtml(val.code)); material.setMaterialType(materialTypes.get(val.maty_id)); materials.put(val.id, material); } property.setMaterial(material); property.setPropertyType(propertyTypes.get(val.prty_id)); entity.getProperties().add(property); } }
From source file:com.redhat.rhn.frontend.action.kickstart.KickstartFileDownloadAction.java
/** * {@inheritDoc}/* ww w . jav a2 s . c om*/ */ protected void setupFormValues(RequestContext ctx, DynaActionForm form, BaseKickstartCommand cmdIn) { HttpServletRequest request = ctx.getRequest(); KickstartFileDownloadCommand cmd = (KickstartFileDownloadCommand) cmdIn; KickstartData data = cmd.getKickstartData(); KickstartHelper helper = new KickstartHelper(request); /* * To generate the file data, our kickstart channel must have at least * a minimum list of packages. Verify that those are there before even * trying to render the file. However, the auto-kickstart packages are * not needed. */ if (helper.verifyKickstartChannel(cmdIn.getKickstartData(), ctx.getCurrentUser(), false)) { try { request.setAttribute(FILEDATA, StringEscapeUtils.escapeHtml(KickstartManager.getInstance().renderKickstart(data))); request.setAttribute(KSURL, KickstartUrlHelper.getCobblerProfileUrl(data)); } catch (DownloadException de) { request.setAttribute(FILEERROR, StringEscapeUtils.escapeHtml(de.getContent())); createErrorMessage(request, "kickstart.jsp.error.template_message", null); } } else { request.setAttribute(INVALID_CHANNEL, "true"); } }
From source file:lu.lippmann.cdb.dt.ui.DecisionTreeToGraphViewHelper.java
public static String buildHTML(final String title, final List<String> l) { final StringBuilder sb = new StringBuilder("<html>"); sb.append("<b>").append(title).append("</b><br/><br/>"); if (l != null) { for (final String s : l) { sb.append(StringEscapeUtils.escapeHtml(s)).append("<br/>"); }/*from w w w .j a v a 2s. c om*/ sb.setLength(sb.length() - 1); sb.append("</html>"); } return sb.toString(); }
From source file:fr.paris.lutece.portal.service.editor.ParserBbcodeServlet.java
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * /*from w w w . ja va 2 s . c o m*/ * @param request * servlet request * @param response * servlet response * @throws ServletException * the servlet Exception * @throws IOException * the io exception */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String strValue = request.getParameter(PARAMETER_DATA); String strEscaped = StringEscapeUtils.escapeHtml(strValue); String strValueReturn = (strValue != null) ? EditorBbcodeService.getInstance().parse(strEscaped) : ""; OutputStream out = response.getOutputStream(); out.write(strValueReturn.getBytes(AppPropertiesService.getProperty(PROPERTY_ENCODING))); out.flush(); out.close(); }
From source file:com.crawljax.plugins.errorreport.ReportErrorReader.java
/** * @return the type of the error */ public String getTypeDescription() { return StringEscapeUtils.escapeHtml(this.reportError.getTypeDescription()); }
From source file:gov.nih.nci.ncicb.cadsr.common.cdebrowser.DataElementSearchBean.java
public DataElementSearchBean(HttpServletRequest request) throws SQLException { strArray = request.getParameterValues("SEARCH"); vdPrefName = StringEscapeUtils.escapeHtml(request.getParameter("txtValueDomain")); decPrefName = StringEscapeUtils.escapeHtml(request.getParameter("txtDataElementConcept")); csiName = StringEscapeUtils.escapeHtml(request.getParameter("txtClassSchemeItem")); searchText = StringEscapeUtils.escapeHtml(request.getParameter("jspKeyword")); simpleSearchStr = StringEscapeUtils.escapeHtml(request.getParameter("jspSimpleKeyword")); aslName = request.getParameterValues("jspStatus"); regStatus = request.getParameterValues("regStatus"); altNames = request.getParameterValues("altName"); vdIdseq = StringEscapeUtils.escapeHtml(request.getParameter("jspValueDomain")); decIdseq = StringEscapeUtils.escapeHtml(request.getParameter("jspDataElementConcept")); csCsiIdseq = StringEscapeUtils.escapeHtml(request.getParameter("jspClassification")); cdeId = StringEscapeUtils.escapeHtml(request.getParameter("jspCdeId")); latVersionInd = StringEscapeUtils.escapeHtml(request.getParameter("jspLatestVersion")); contextUse = StringEscapeUtils.escapeHtml(request.getParameter("contextUse")); validValue = StringEscapeUtils.escapeHtml(request.getParameter("jspValidValue")); altName = StringEscapeUtils.escapeHtml(request.getParameter("jspAltName")); basicSearchType = StringEscapeUtils.escapeHtml(request.getParameter("jspBasicSearchType")); conceptName = StringEscapeUtils.escapeHtml(request.getParameter("jspConceptName")); conceptCode = StringEscapeUtils.escapeHtml(request.getParameter("jspConceptCode")); objectClass = StringEscapeUtils.escapeHtml(request.getParameter("jspObjectClass")); property = StringEscapeUtils.escapeHtml(request.getParameter("jspProperty")); nameSearchMode = StringEscapeUtils.escapeHtml(request.getParameter("jspNameSearchMode")); pvSearchMode = StringEscapeUtils.escapeHtml(request.getParameter("jspPVSearchMode")); if (contextUse == null) { contextUse = ""; }// w w w . ja v a 2 s. com //Prefrences //buildContextNameFullList(contextsExcludeList, dbUtil); /* Moved to diffrent method to support search pref buildWorkflowFullList(aslNameExcludeList, dbUtil); buildRegStatusFullList(regStatusExcludeList,dbUtil); buildWorkflowList(aslName, dbUtil); buildRegStatusList(regStatus,dbUtil); buildAlternateNameList(altNames, dbUtil); buildContextUseList(contextUse); */ searchInList = new StringBuffer(""); String[] searchIn = request.getParameterValues("jspSearchIn"); this.buildSearchInList(searchIn); }
From source file:com.fluidops.iwb.api.valueresolver.ValueResolverUtil.java
/** * Converts a system date like '2011-03-31T19:54:33' to user-readable date. * If the input is not a valid system date, the value is returned as is. * /* w w w . j a v a 2 s .c om*/ * @param sysdate * @return */ @SuppressWarnings("deprecation") public static String resolveSystemDate(String sysdate) { Date d = ReadDataManagerImpl.ISOliteralToDate(sysdate); if (d == null) return StringEscapeUtils.escapeHtml(sysdate); DateFormat df = null; if (d.getHours() == 0 && d.getMinutes() == 0 && d.getSeconds() == 0) df = new SimpleDateFormat("MMMMM dd, yyyy"); else df = new SimpleDateFormat("MMMMM dd, yyyy, HH:mm:ss"); return df.format(d); }
From source file:com.cueup.hegemon.testing.server.ResponseListener.java
@Override public void testFinished(Description description) throws Exception { if (this.ignored.contains(description.getDisplayName())) { this.output.println("<span class=\"ignored\">IGNORED</span>"); if (this.customOutput != null) { this.customOutput.testIgnored(this.output); }//from w w w .ja v a2 s . co m } else if (this.failed.containsKey(description.getDisplayName())) { this.output.println("<span class=\"fail\">FAILED</span>"); this.output.print("<pre>"); this.output.print(linkFiles(StringEscapeUtils .escapeHtml(ExceptionUtils.getStackTrace(this.failed.get(description.getDisplayName()))))); this.output.print("</pre>"); if (this.customOutput != null) { this.customOutput.testFailure(this.output); } } else { this.output.println("<span class=\"ok\">OK</span>"); if (this.customOutput != null) { this.customOutput.testSuccess(this.output); } } this.output.println("<br>"); this.output.flush(); }