List of usage examples for org.apache.commons.lang StringEscapeUtils escapeHtml
public static String escapeHtml(String input)
From source file:gov.nih.nci.calims2.uic.html.TagRenderer.java
private String getStartTag(Tag tag, boolean closed) { StringBuilder buf = new StringBuilder(); buf.append("<"); if (tag.getPrefix() != null) { buf.append(tag.getPrefix());/* ww w . j a v a 2 s . co m*/ buf.append(":"); } buf.append(tag.getTagName()); for (Map.Entry<String, String> entry : tag.getAttributes().entrySet()) { buf.append(" "); buf.append(entry.getKey()); buf.append("=\""); buf.append(StringEscapeUtils.escapeHtml(entry.getValue())); buf.append("\""); } if (closed) { buf.append("/"); } buf.append(">"); return buf.toString(); }
From source file:com.redhat.rhn.frontend.action.user.DisableUserSetupAction.java
/** {@inheritDoc} */ public ActionForward execute(ActionMapping mapping, ActionForm formIn, HttpServletRequest request, HttpServletResponse response) {//from w ww .j a va2s . com RequestContext requestContext = new RequestContext(request); if (!AclManager.hasAcl("user_role(org_admin)", request, null)) { //Throw an exception with a nice error message so the user //knows what went wrong. LocalizationService ls = LocalizationService.getInstance(); PermissionException pex = new PermissionException("Only Org Admins can disable users"); pex.setLocalizedTitle(ls.getMessage("permission.jsp.title.disableuser")); pex.setLocalizedSummary(ls.getMessage("permission.jsp.summary.disableuser")); throw pex; } Long uid = requestContext.getRequiredParam("uid"); User user = UserManager.lookupUser(requestContext.getCurrentUser(), uid); request.setAttribute(RhnHelper.TARGET_USER, user); if (user.isDisabled()) { ActionMessages msg = new ActionMessages(); msg.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("userdisable.error.userdisabled", StringEscapeUtils.escapeHtml(user.getLogin()))); getStrutsDelegate().saveMessages(request, msg); } return mapping.findForward(RhnHelper.DEFAULT_FORWARD); }
From source file:com.redhat.rhn.frontend.action.user.EnableUserSetupAction.java
/** {@inheritDoc} */ public ActionForward execute(ActionMapping mapping, ActionForm formIn, HttpServletRequest request, HttpServletResponse response) {/*from w w w .j a v a 2 s . c o m*/ if (!AclManager.hasAcl("user_role(org_admin)", request, null)) { //Throw an exception with a nice error message so the user //knows what went wrong. LocalizationService ls = LocalizationService.getInstance(); PermissionException pex = new PermissionException("Only org admin's can reactivate users"); pex.setLocalizedTitle(ls.getMessage("permission.jsp.title.enableuser")); pex.setLocalizedSummary(ls.getMessage("permission.jsp.summary.enableuser")); throw pex; } RequestContext requestContext = new RequestContext(request); Long uid = requestContext.getRequiredParam("uid"); User user = UserManager.lookupUser(requestContext.getCurrentUser(), uid); request.setAttribute(RhnHelper.TARGET_USER, user); if (!user.isDisabled()) { ActionMessages msg = new ActionMessages(); msg.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("userenable.error.usernotdisabled", StringEscapeUtils.escapeHtml(user.getLogin()))); getStrutsDelegate().saveMessages(request, msg); } return mapping.findForward(RhnHelper.DEFAULT_FORWARD); }
From source file:com.github.luuuis.myzone.preference.TimeZoneInfo.java
public String getDisplayNameHtml() { return StringEscapeUtils.escapeHtml(getDisplayName()); }
From source file:com.epam.cme.storefront.util.PageTitleResolver.java
public String resolveContentPageTitle(final String title) { final CMSSiteModel currentSite = getCmsSiteService().getCurrentSite(); final StringBuilder builder = new StringBuilder(); if (!StringUtils.isEmpty(title)) { builder.append(title).append(SEPARATOR); }//from w w w .j av a2 s.c o m builder.append(currentSite.getName()); return StringEscapeUtils.escapeHtml(builder.toString()); }
From source file:com.redhat.rhn.domain.action.config.ConfigActionFormatter.java
private String displayRevision(ConfigRevision revision) { ConfigFile file = revision.getConfigFile(); StringBuilder buffy = new StringBuilder(); Object[] args = new Object[5]; args[0] = "/rhn/configuration/file/FileDetails.do?cfid=" + file.getId() + "&crid=" + revision.getId(); args[1] = revision.getRevision();/*from w w w. ja v a 2s . c om*/ args[2] = StringEscapeUtils.escapeHtml(file.getConfigFileName().getPath()); args[3] = "/rhn/configuration/ChannelOverview.do?ccid=" + file.getConfigChannel().getId(); args[4] = file.getConfigChannel().getName(); buffy.append(LocalizationService.getInstance().getMessage("config.actionnote", args)); buffy.append("<br />"); return buffy.toString(); }
From source file:de.hybris.platform.acceleratorservices.storefront.util.PageTitleResolver.java
public String resolveContentPageTitle(final String title) { final CMSSiteModel currentSite = getCmsSiteService().getCurrentSite(); final StringBuilder builder = new StringBuilder(); if (!StringUtils.isEmpty(title)) { builder.append(title).append(TITLE_WORD_SEPARATOR); }//from w ww.j a v a 2 s .co m builder.append(currentSite.getName()); return StringEscapeUtils.escapeHtml(builder.toString()); }
From source file:de.arago.rike.task.action.SaveArtifact.java
@Override public void execute(IDataWrapper data) throws Exception { DataHelperRike<Artifact> helper = new DataHelperRike<Artifact>(Artifact.class); Artifact artifact = null;/*from w w w . ja v a 2s . c om*/ boolean newArtifactCreated = false; if (data.getRequestAttribute("id") != null && !data.getRequestAttribute("id").isEmpty()) { artifact = helper.find(data.getRequestAttribute("id")); } if (artifact == null) { newArtifactCreated = true; artifact = new Artifact(); } artifact.setName(data.getRequestAttribute("name")); artifact.setUrl(data.getRequestAttribute("url")); artifact.setCreated(new Date()); artifact.setCreator(SecurityHelper.getUser(data.getUser()).getEmailAddress()); artifact.setClient(""); helper.save(artifact); data.setSessionAttribute("artifact", artifact); data.setSessionAttribute("targetView", "viewArtifact"); String message = " changed Artifact #"; if (newArtifactCreated) { message = " created Artifact #"; } ActivityLogHelper.log( message + artifact.getId() + " <a href=\"/web/guest/rike/-/show/artifact/" + artifact.getId() + "\">" + StringEscapeUtils.escapeHtml(artifact.getName()) + "</a>", "", artifact.getCreator(), data, artifact.toMap()); }
From source file:com.careerly.common.support.msgconverter.JsonpHttpMessageConverter.java
@Override protected void writeInternal(JsonpResponse t, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException { ServletServerHttpResponse response = (ServletServerHttpResponse) outputMessage; response.getServletResponse().setCharacterEncoding("UTF-8"); BufferedWriter bw = new BufferedWriter( new OutputStreamWriter(outputMessage.getBody(), Charset.forName("UTF-8"))); try {// www . j av a 2 s . c o m if (StringUtils.isNotBlank(t.getCallback())) { bw.write(StringEscapeUtils.escapeHtml(t.getCallback())); bw.write("("); } bw.write(JsonUtils.marshalToString(t.getJson())); if (StringUtils.isNotBlank(t.getCallback())) { bw.write(")"); } } finally { bw.close(); } }
From source file:com.crawljax.plugins.errorreport.ReportErrorReader.java
/** * @return the description of the error */ public String getDescription() { return StringEscapeUtils.escapeHtml(this.reportError.getDescription()); }