List of usage examples for org.apache.commons.lang StringEscapeUtils escapeHtml
public static String escapeHtml(String input)
From source file:com.epam.cme.storefront.util.PageTitleResolver.java
/** * creates page title for given code and facets *///from w ww . ja v a2 s . c o m public <STATE> String resolveCategoryPageTitle(final CategoryModel category, final List<BreadcrumbData<STATE>> appliedFacets) { final CMSSiteModel currentSite = getCmsSiteService().getCurrentSite(); final String name = category.getName(); final StringBuilder builder = new StringBuilder(); if (CollectionUtils.isEmpty(appliedFacets)) { if (!StringUtils.isEmpty(name)) { builder.append(name).append(SEPARATOR); } builder.append(currentSite.getName()); } else { for (final BreadcrumbData pathElement : appliedFacets) { builder.append(pathElement.getFacetValueName()).append(SEPARATOR); } builder.append(currentSite.getName()); } return StringEscapeUtils.escapeHtml(builder.toString()); }
From source file:ch.entwine.weblounge.test.site.GreeterHTMLAction.java
/** * {@inheritDoc}/*from w ww. ja v a 2 s . c om*/ * * @see ch.entwine.weblounge.common.impl.site.HTMLActionSupport#startStage(ch.entwine.weblounge.common.request.WebloungeRequest, * ch.entwine.weblounge.common.request.WebloungeResponse, * ch.entwine.weblounge.common.content.page.Composer) */ @Override public int startStage(WebloungeRequest request, WebloungeResponse response, Composer composer) throws ActionException { try { String htmlGreeting = StringEscapeUtils.escapeHtml(greeting); IOUtils.write("<h1>" + htmlGreeting + "</h1>", response.getWriter()); // Include another pagelet include(request, response, PAGELET_ID, null); return HTMLAction.SKIP_COMPOSER; } catch (IOException e) { throw new ActionException("Unable to send json response", e); } }
From source file:com.aurel.track.fieldType.runtime.custom.text.CustomLongTextRT.java
@Override public String getShowValue(Object value, WorkItemContext workItemContext, Integer fieldID) { String strValue = ""; try {/*from w ww .jav a 2 s . c om*/ strValue = (String) value; String escapedHTML = StringEscapeUtils.escapeHtml(strValue); return Text2HTML.addHTMLBreaks(escapedHTML); } catch (Exception e) { return strValue; } }
From source file:com.fluidops.iwb.ui.ProviderEditTable.java
/** * Get Value for row and column//from ww w . j a v a2 s . c om * @param rowIndex * @param columnIndex * @return Value at cell */ private Object getValueAt(int rowIndex, int columnIndex) { AbstractFlexProvider provider = providers.get(rowIndex); if (provider == null) { return null; } switch (columnIndex) { case 0: { List<Context> newContext = ReadDataManagerImpl.getDataManager(Global.repository) .getContextsForSource(provider.providerID); if (!newContext.isEmpty()) return new HtmlString("<a href='" + EndpointImpl.api().getRequestMapper() .getRequestStringFromValue(newContext.get(0).getURI()) + "'>" + StringEscapeUtils.escapeHtml(EndpointImpl.api().getRequestMapper() .getReconvertableUri(provider.providerID, false)) + "</a>"); return EndpointImpl.api().getRequestMapper().getReconvertableUri(provider.providerID, false); } case 1: return provider.getClass().getSimpleName(); case 2: return provider.lastDuration == null ? "n/a" : UnitConverter.convertTimeFitting((long) provider.lastDuration, Unit.MILLISECONDS); case 3: return provider.lastUpdate == null ? "n/a" : provider.lastUpdate; case 4: { String providerSize = "n/a"; if (provider.size != null) providerSize = "" + provider.size; return providerSize; } case 5: { if (provider.pollInterval == null || provider.pollInterval <= 0) return "DISABLED"; else return UnitConverter.convertTimeFitting((long) provider.pollInterval, Unit.MILLISECONDS); } case 6: { if (provider.running != null && provider.running) return new HtmlString("<span id=\"status" + rowIndex + "\">running</span>"); else if (provider.error != null) { ToolTip tt = new ToolTip("errorTooltip" + rowIndex); tt.setInnerHTML("<span id=\"status" + rowIndex + "\" ><img src=\"" + EndpointImpl.api().getRequestMapper().getContextPath() + "/images/error.png\"/> </span>"); tt.setTooltipHTML(provider.error.replaceAll("\\n", "<br>"), true); return tt; } return new HtmlString("<span id=\"status" + rowIndex + "\">not running</span>"); } } return null; }
From source file:com.activecq.api.helpers.DesignHelper.java
/** * Returns an script tag for the script path. * * @param path/* ww w . j a va 2 s . c om*/ * @param page * @return */ public String scriptTag(String path, Page page) { String src = scriptSrc(path, page); if (StringUtils.isBlank(src)) { return "<!-- Missing Script : " + path + ".js -->"; } // Begin writing script tag src = StringEscapeUtils.escapeHtml(src); return "<script src=\"" + src + "\" ></script>"; }
From source file:com.predic8.membrane.core.interceptor.authentication.BasicAuthenticationInterceptor.java
@Override public String getLongDescription() { StringBuilder sb = new StringBuilder(); sb.append(getShortDescription());// ww w .jav a 2 s.co m sb.append("<br/>"); sb.append("Users: "); for (User user : users) { sb.append(StringEscapeUtils.escapeHtml(user.getName())); sb.append(", "); } sb.delete(sb.length() - 2, sb.length()); sb.append("<br/>Passwords are not shown."); return sb.toString(); }
From source file:edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils.java
/** * returns a table of the req attributes * @param req//from w ww . j a v a 2 s . co m * @return */ public static String getRequestAttributes(HttpServletRequest req) { String val = "<table>"; Enumeration names = req.getAttributeNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); val += "\n\t<tr><td>" + name + "</td><td><pre>"; String value = null; try { Object obj = req.getAttribute(name); value = (obj instanceof Model || obj instanceof ModelCom) ? "[Jena model object]" : (obj == null) ? "[null]" : StringEscapeUtils.escapeHtml(obj.toString()); } catch (Exception ex) { value = "unable to get value"; } catch (Error er) { value = "unable to get value"; } catch (Throwable th) { value = "unable to get value"; } val += value + "</pre></td></tr>\n"; } return val + "</table>"; }
From source file:de.hybris.platform.acceleratorservices.storefront.util.PageTitleResolver.java
/** * creates page title for given code and facets *//*from w ww . ja va2s.co m*/ public <STATE> String resolveCategoryPageTitle(final CategoryModel category, final List<BreadcrumbData<STATE>> appliedFacets) { final CMSSiteModel currentSite = getCmsSiteService().getCurrentSite(); final String name = category.getName(); final StringBuilder builder = new StringBuilder(); if (CollectionUtils.isEmpty(appliedFacets)) { if (!StringUtils.isEmpty(name)) { builder.append(name).append(TITLE_WORD_SEPARATOR); } builder.append(currentSite.getName()); } else { for (final BreadcrumbData pathElement : appliedFacets) { builder.append(pathElement.getFacetValueName()).append(TITLE_WORD_SEPARATOR); } builder.append(currentSite.getName()); } return StringEscapeUtils.escapeHtml(builder.toString()); }
From source file:com.bst.tags.JavascriptHref.java
/** * Removes a parameter from the href./*www . j a v a 2s . c om*/ * @param name String */ public void removeParameter(String name) { // warning, param names are escaped this.parameters.remove(StringEscapeUtils.escapeHtml(name)); }
From source file:com.fhzz.dubbo.sync.util.Tool.java
public static String encodeHtml(String html) { return StringEscapeUtils.escapeHtml(html); }