List of usage examples for org.apache.commons.lang StringEscapeUtils escapeHtml
public static String escapeHtml(String input)
From source file:com.sonymobile.backlogtool.Epic.java
public String getDescription() { return StringEscapeUtils.escapeHtml(description); }
From source file:accessories.plugins.util.html.ClickableImageCreator.java
public String generateHtml() { StringBuffer htmlArea = new StringBuffer(); for (Iterator i = area.iterator(); i.hasNext();) { AreaHolder holder = (AreaHolder) i.next(); htmlArea.append("<area shape=\"" + holder.shape + "\" href=\"#" + holder.href.replaceFirst("^(.*)$", regExpLinkReplacement) + "\" alt=\"" + StringEscapeUtils.escapeHtml(holder.alt) + "\" title=\"" + StringEscapeUtils.escapeHtml(holder.title) + "\" coords=\"" + holder.coordinates.x + "," + holder.coordinates.y + "," + (holder.coordinates.width + holder.coordinates.x) + "," + +(holder.coordinates.height + holder.coordinates.y) + "\" />"); }// w ww. jav a 2 s . c om return htmlArea.toString(); }
From source file:it.unimi.di.big.mg4j.query.GenericItem.java
public Template handleRequest(final HttpServletRequest request, final HttpServletResponse response, final Context context) throws Exception { if (request.getParameter("doc") != null) { DocumentCollection collection = (DocumentCollection) getServletContext().getAttribute("collection"); response.setContentType(request.getParameter("m")); response.setCharacterEncoding("UTF-8"); final Document document = collection.document(Long.parseLong(request.getParameter("doc"))); final DocumentFactory factory = collection.factory(); final ObjectArrayList<String> fields = new ObjectArrayList<String>(); final int numberOfFields = factory.numberOfFields(); LOGGER.debug("ParsingFactory declares " + numberOfFields + " fields"); for (int field = 0; field < numberOfFields; field++) { if (factory.fieldType(field) != FieldType.TEXT) fields.add(StringEscapeUtils.escapeHtml(document.content(field).toString())); else//from w w w .j a va2 s .co m fields.add(StringEscapeUtils.escapeHtml(IOUtils.toString((Reader) document.content(field))) .replaceAll("\n", "<br>\n")); } context.put("title", document.title()); context.put("fields", fields); context.put("factory", factory); return getTemplate("it/unimi/dsi/mg4j/query/generic.velocity"); } return null; }
From source file:com.sonymobile.backlogtool.Note.java
/** * @return The message */ public String getMessage() { return StringEscapeUtils.escapeHtml(message); }
From source file:eu.delving.sip.xml.ResultLinkChecks.java
public static void validLinesToHTML(List<String> lines, LinkChecker linkChecker, StringBuilder out) { out.append("<table width='100%'>\n"); for (String line : lines) { ReportStrings.Match matcher = ReportStrings.LINK.matcher(line); if (!matcher.matches()) continue; // RuntimeException? RecDef.Check check = RecDef.Check.valueOf(matcher.group(1)); String content = matcher.group(2); out.append("<tr><td>"); out.append(String.format("<table width='100%%'><tr><td><h2>%s</h2></td></tr><td>", check)); switch (check) { case LANDING_PAGE: case DIGITAL_OBJECT: case THUMBNAIL: case DEEP_ZOOM: case THESAURUS_REFERENCE: case LOD_REFERENCE: out.append(String.format("<a href=\"%s\">%s<a><br>\n", content, StringEscapeUtils.escapeHtml(content))); if (linkChecker == null || !linkChecker.contains(content)) { out.append("<ul><li>unchecked</li></ul>"); } else { if (check == RecDef.Check.THUMBNAIL) { out.append(String.format( "<table cellpadding=10><tr><td><img src=\"%s\"/></td</tr></table><br>", content)); }/*from www . j av a2s . c o m*/ LinkCheck linkCheck = linkChecker.lookup(content); out.append("<ul>\n"); out.append(String.format("<li>Ok: %s</li>\n", linkCheck.ok)); out.append(String.format("<li>Checked: %s</li>\n", linkCheck.getTime())); out.append(String.format("<li>HTTP status: %d</li>\n", linkCheck.httpStatus)); out.append(String.format("<li>Status reason: %s</li>\n", linkCheck.getStatusReason())); out.append(String.format("<li>File size: %d</li>\n", linkCheck.fileSize)); out.append(String.format("<li>MIME type: %s</li>\n", linkCheck.mimeType)); out.append("</ul>\n"); } break; case GEO_COORDINATE: String thumbnail = String.format( "http://maps.google.com/maps/api/staticmap?center=%s&size=400x400&zoom=10&maptype=roadmap&format=jpg&sensor=false&markers=color:blue%%7Clabel:S%%7C%s", content, content); out.append(String.format("<table cellpadding=10><tr><td><img src=\"%s\"/></td</tr></table><br>", thumbnail)); out.append( String.format("<a href=\"https://maps.google.com/maps?q=%s\">%s<a><br>", content, content)); break; case DATE: out.append(content); out.append("<ul><li>not checking yet</li></ul>"); break; } out.append("</td></tr></table>"); out.append("</td><tr>"); } out.append("</table>\n"); }
From source file:at.gv.egovernment.moa.id.protocols.oauth20.protocol.OAuth20BaseRequest.java
protected void populateParameters(final HttpServletRequest request) throws OAuth20Exception { // moa id - load oa with client id! try {/* ww w .j a v a 2 s . c om*/ String oaURL = StringEscapeUtils .escapeHtml(this.getParam(request, OAuth20Constants.PARAM_CLIENT_ID, true)); if (!ParamValidatorUtils.isValidOA(oaURL)) { throw new OAuth20WrongParameterException(OAuth20Constants.PARAM_CLIENT_ID); } this.setOAURL(oaURL); OAAuthParameter oaParam = AuthConfigurationProvider.getInstance().getOnlineApplicationParameter(oaURL); if (oaParam == null) { throw new OAuth20WrongParameterException(OAuth20Constants.PARAM_CLIENT_ID); } this.setTarget(oaParam.getTarget()); OAOAUTH20 config = oaParam.getoAuth20Config(); if (config == null) { throw new OAuth20InvalidRequestException(); } if (StringUtils.isEmpty(config.getOAuthClientSecret()) || StringUtils.isEmpty(config.getOAuthClientId()) || StringUtils.isEmpty(config.getOAuthRedirectUri())) { throw new OAuth20OANotSupportedException(); } } catch (ConfigurationException e) { throw new OAuth20WrongParameterException(OAuth20Constants.PARAM_CLIENT_ID); } // oAuth this.populateSpecialParameters(request); // cleanup parameters this.checkAllowedParameters(request); }
From source file:hudson.plugins.emailext.plugins.content.BuildLogMultilineRegexContent.java
private void appendMatchedSegment(StringBuilder buffer, String segment, boolean escapeHtml, String style) { if (escapeHtml) { segment = StringEscapeUtils.escapeHtml(segment); }//w w w. j av a2s. c o m if (style != null) { buffer.append("<b"); if (style.length() > 0) { buffer.append(" style=\""); buffer.append(style); buffer.append("\""); } buffer.append(">"); } buffer.append(segment); if (style != null) { buffer.append("</b>"); } buffer.append('\n'); }
From source file:com.technophobia.substeps.utils.SubstepsToHTML.java
/** * @param scenario/*w ww.j ava2s . c om*/ * @param buf */ private void toHTML(final Scenario scenario, final StringBuilder buf) { appendTags(scenario.getTags(), buf); if (scenario.isOutline()) { appendKeyword("Blue", "Scenario Outline", scenario.getDescription(), buf); } else { appendKeyword("Blue", "Scenario", scenario.getDescription(), buf); } buf.append("<div style=\"position:relative;left:5em\">"); for (final Step step : scenario.getSteps()) { buf.append(StringEscapeUtils.escapeHtml(step.getLine())).append("<br/>").append("\n"); } buf.append("</div>"); buf.append("<br/><br/>\n"); // TODO // scenario.getExampleParameters(); }
From source file:ch.systemsx.cisd.openbis.generic.shared.translator.ExperimentTranslator.java
public final static ExperimentType translate(final ExperimentTypePE experimentType) { final ExperimentType result = new ExperimentType(); result.setCode(StringEscapeUtils.escapeHtml(experimentType.getCode())); result.setDescription(StringEscapeUtils.escapeHtml(experimentType.getDescription())); result.setDatabaseInstance(DatabaseInstanceTranslator.translate(experimentType.getDatabaseInstance())); result.setExperimentTypePropertyTypes(ExperimentTypePropertyTypeTranslator .translate(experimentType.getExperimentTypePropertyTypes(), result)); return result; }
From source file:de.arago.rike.task.action.StartTask.java
@Override public void execute(IDataWrapper data) throws Exception { if (data.getRequestAttribute("id") != null) { String user = SecurityHelper.getUserEmail(data.getUser()); if (TaskHelper.getTasksInProgressForUser(user).size() < Integer .parseInt(GlobalConfig.get(WORKFLOW_WIP_LIMIT))) { Task task = TaskHelper.getTask(data.getRequestAttribute("id")); if (!TaskHelper.canDoTask(user, task) || task.getStatusEnum() != Task.Status.OPEN) { return; }/* w w w .j av a2s . c o m*/ task.setOwner(user); task.setStart(new Date()); task.setStatus(Task.Status.IN_PROGRESS); if (GlobalConfig.get(WORKFLOW_TYPE).equalsIgnoreCase("arago Technologies")) { GregorianCalendar c = new GregorianCalendar(); c.setTime(task.getStart()); c.add(Calendar.DAY_OF_MONTH, Integer.parseInt(GlobalConfig.get(WORKFLOW_DAYS_TO_FINISH_TASK))); task.setDueDate(c.getTime()); } TaskHelper.save(task); StatisticHelper.update(); data.setSessionAttribute("task", task); HashMap<String, Object> notificationParam = new HashMap<String, Object>(); notificationParam.put("id", task.getId().toString()); data.setEvent("TaskUpdateNotification", notificationParam); ActivityLogHelper.log( " started Task #" + task.getId() + " <a href=\"/web/guest/rike/-/show/task/" + task.getId() + "\">" + StringEscapeUtils.escapeHtml(task.getTitle()) + "</a> ", task.getStatus(), user, data, task.toMap()); } } }