Example usage for javax.servlet.jsp JspWriter print

List of usage examples for javax.servlet.jsp JspWriter print

Introduction

In this page you can find the example usage for javax.servlet.jsp JspWriter print.

Prototype


abstract public void print(Object obj) throws IOException;

Source Link

Document

Print an object.

Usage

From source file:gov.nih.nci.rembrandt.web.taglib.KaplanMeierPlotTag.java

public int doStartTag() {

    ServletRequest request = pageContext.getRequest();
    HttpSession session = pageContext.getSession();
    Object o = request.getAttribute(beanName);
    JspWriter out = pageContext.getOut();
    ServletResponse response = pageContext.getResponse();
    String dataName;//ww w  . jav a2  s . com
    try {
        dataName = BeanUtils.getSimpleProperty(o, datasetName);
        KaplanMeierStoredData cacheData = (KaplanMeierStoredData) presentationTierCache
                .getSessionGraphingData(session.getId(), dataName);
        JFreeChart chart = CaIntegratorChartFactory
                .getKaplanMeierGraph(cacheData.getPlotPointSeriesCollection());

        RembrandtImageFileHandler imageHandler = new RembrandtImageFileHandler(session.getId(), "png", 700,
                500);
        //The final complete path to be used by the webapplication
        String finalPath = imageHandler.getSessionTempFolder();
        /**
         * Create the actual chart, writing it to the session temp folder
         */
        ChartUtilities.writeChartAsPNG(new FileOutputStream(finalPath), chart, 700, 500);
        /*
         *   This is here to put the thread into a loop while it waits for the
         *   image to be available.  It has an unsophisticated timer but at 
         *   least it is something to avoid an endless loop.
         *  
         */
        boolean imageReady = false;
        int timeout = 1000;
        FileInputStream inputStream = null;
        while (!imageReady) {
            timeout--;
            try {
                inputStream = new FileInputStream(finalPath);
                inputStream.available();
                imageReady = true;
                inputStream.close();
            } catch (IOException ioe) {
                imageReady = false;
                if (inputStream != null) {
                    inputStream.close();
                }
            }
            if (timeout <= 1) {

                break;
            }
        }
        out.print(imageHandler.getImageTag());
        out.print(createLegend(cacheData));
    } catch (IllegalAccessException e1) {
        logger.error(e1);
    } catch (InvocationTargetException e1) {
        logger.error(e1);
    } catch (NoSuchMethodException e1) {
        logger.error(e1);
    } catch (IOException e) {
        logger.error(e);
    } catch (Exception e) {
        logger.error(e);
    } catch (Throwable t) {
        logger.error(t);
    }

    return EVAL_BODY_INCLUDE;
}

From source file:org.dspace.app.webui.jsptag.ItemTag.java

/**
 * Render full item record// w w w .  j  a va 2 s  . c o m
 */
private void renderFull() throws IOException, SQLException {
    JspWriter out = pageContext.getOut();
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    Context context = UIUtil.obtainContext(request);

    // Get all the metadata
    DCValue[] values = item.getMetadata(Item.ANY, Item.ANY, Item.ANY, Item.ANY);

    out.println("<p align=\"center\">"
            + LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.ItemTag.full")
            + "</p>");

    // Three column table - DC field, value, language
    out.println("<center><table class=\"itemDisplayTable\">");
    out.println("<tr><th id=\"s1\" class=\"standard\">"
            + LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.ItemTag.dcfield")
            + "</th><th id=\"s2\" class=\"standard\">"
            + LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.ItemTag.value")
            + "</th><th id=\"s3\" class=\"standard\">"
            + LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.ItemTag.lang")
            + "</th></tr>");

    for (int i = 0; i < values.length; i++) {
        if (!MetadataExposure.isHidden(context, values[i].schema, values[i].element, values[i].qualifier)) {
            out.print("<tr><td headers=\"s1\" class=\"metadataFieldLabel\">");
            out.print(values[i].schema);
            out.print("." + values[i].element);

            if (values[i].qualifier != null) {
                out.print("." + values[i].qualifier);
            }

            out.print("</td><td headers=\"s2\" class=\"metadataFieldValue\">");
            out.print(Utils.addEntities(values[i].value));
            out.print("</td><td headers=\"s3\" class=\"metadataFieldValue\">");

            if (values[i].language == null) {
                out.print("-");
            } else {
                out.print(values[i].language);
            }

            out.println("</td></tr>");
        }
    }

    listCollections();

    out.println("</table></center><br/>");

    listBitstreams();

    if (ConfigurationManager.getBooleanProperty("webui.licence_bundle.show")) {
        out.println("<br/><br/>");
        showLicence();
    }
}

From source file:nl.strohalm.cyclos.taglibs.RichTextAreaTag.java

@Override
public int doEndTag() throws JspException {

    final JspWriter out = pageContext.getOut();
    final String value = this.value;
    final String id = StringUtils.isEmpty(styleId) ? name : styleId;
    try {/*  www.j ava2s .  c o  m*/
        final StringBuilder sb = new StringBuilder();
        if (disabled) {
            // When a rich text field is not enabled, render a div and the text inside.
            // Only when enabling it the editor will be rendered
            sb.append("<div style='position:relative;padding-right:6px;'><div id='textOfField_").append(id)
                    .append("' class='fakeFieldDisabled' style='width:479px;height:200px;overflow:auto;'><table cellpadding='0' cellspacing='0' border='0' width='100%'><tr><td style='padding:0px'>");
            sb.append(StringUtils.isEmpty(value) ? "&nbsp;" : value);
            sb.append("</td></tr></table></div></div>");
            sb.append("<div id='envelopeOfField_").append(id).append("' style='display:none'>");
        }

        final StringBuilder className = new StringBuilder();
        if (StringUtils.isNotEmpty(styleClass)) {
            className.append(styleClass);
        }
        className.append(" full");
        className.append(disabled ? " richEditorDisabled" : " richEditor");
        final String containerId = "container_" + id;
        sb.append("<div class='richTextAreaContainer' id=\"").append(containerId).append("\">");
        sb.append("<textarea rows='6' name='").append(name).append('\'');
        if (StringUtils.isNotEmpty(styleId)) {
            sb.append(" id='" + styleId + '\'');
            sb.append(" fieldId='" + styleId + '\'');
        }
        sb.append(" class='").append(className).append('\'');
        sb.append(' ').append(attributesForTag()).append('>');
        sb.append(value);
        sb.append("</textarea>");
        sb.append("</div>");
        if (disabled) {
            sb.append("</div>");
        } else {
            // Eager init if not disabled
            sb.append("<script>\n");
            sb.append("richEditorsToInitialize.push($('").append(containerId).append("').firstChild);\n");
            sb.append("</script>\n");
        }
        out.print(sb.toString());
        return EVAL_PAGE;
    } catch (final IOException e) {
        throw new JspException(e);
    } finally {
        release();
    }
}

From source file:org.kuali.mobility.writer.tags.ArticleImageTag.java

public void doTag() {
    PageContext pageContext = (PageContext) getJspContext();
    JspWriter out = pageContext.getOut();
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    String contextPath = request.getContextPath();
    ServletContext servletContext = pageContext.getServletContext();
    WebApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(servletContext);

    IconsService iconService = (IconsService) ac.getBean("iconsService");

    String thumbNailPath;/* w w  w  . jav  a  2  s  .  co m*/
    String fullPath = null;
    final String instanceURL = contextPath + prefix + instance;
    /*
     * First check if the article exits, and it has image media.
     * If it does not exist or has no image, we need to use
     * the default image for that instance of the tool
     */
    if (article == null || article.getImage() == null || article.getImage().getId() == 0) {

        /*
         * Check if there is an icon themed for this instance of the writer tool
         */
        if (StringUtils.isEmpty(instance) && iconService.getIcon(WRITER_ICON_NAME, instance) != null) {
            thumbNailPath = contextPath + "/getIcon/" + WRITER_ICON_NAME + "-" + instance + "-80@2.png";
        } else {
            thumbNailPath = contextPath + "/getIcon/WriterArticle-80@2.png";
        }
    } else {
        thumbNailPath = instanceURL + "/media/" + article.getImage().getId() + "?thumb=1";
        fullPath = instanceURL + "/media/view/" + article.getImage().getId();
    }
    boolean addLink = (wrapLink && fullPath != null);
    boolean isNative = (Boolean) request.getSession(true).getAttribute(NativeCookieInterceptor.SESSION_NATIVE);
    try {
        // Wrap with link if required
        if (addLink && isNative) {
            String serverPath = request.getScheme() + "://" + request.getServerName();
            if (request.getServerPort() != 80) {
                serverPath += ":" + request.getServerPort();
            }
            serverPath += fullPath;
            writeChildBrowserJS(out, serverPath);
        } else if (addLink) {
            out.print("<a href=\"");
            out.print(fullPath);
            out.print("\">");
        }

        // Put image container
        out.print("<img src=\"");
        out.print(thumbNailPath);
        out.print("\"");

        // Add image id if specified
        if (this.id != null) {
            out.print(" id=\"");
            out.print(this.id);
            out.print("\"");
        }

        // Add style if specified
        if (this.style != null) {
            out.print(" style=\"");
            out.print(this.style);
            out.print("\"");
        }

        out.print(" />");

        // Close wrapping link
        if (addLink) {
            out.print("</a>");
        }
    } catch (IOException e) {
        LOG.error(e.getMessage(), e);
    }
}

From source file:org.apache.jsp.view.doclist_jsp.java

public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;//from   w  w  w.j a va 2  s. c  om
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
        response.setContentType("text/html; charset=UTF-8");
        pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
        _jspx_page_context = pageContext;
        application = pageContext.getServletContext();
        config = pageContext.getServletConfig();
        session = pageContext.getSession();
        out = pageContext.getOut();
        _jspx_out = out;

        out.write('\r');
        out.write('\n');
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");

        String contextPath = (String) request.getContextPath();
        pageContext.setAttribute("contextPath", contextPath);

        out.write("\r\n");
        out.write("\r\n");
        out.write(" ");
        out.write("\r\n");
        out.write(
                "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
        out.write("\r\n");
        out.write("<html> \r\n");
        out.write("<head> \r\n");
        out.write("    <title>Bounty Questions - Stack Overflow</title> \r\n");
        out.write(
                "    <script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\"></script>\r\n");
        out.write(
                "    <script type=\"text/javascript\" src=\"http://cdn.sstatic.net/js/stub.js?v=c014461b9109\"></script>\r\n");
        out.write("    <link rel=\"stylesheet\" type=\"text/css\" href=\"");
        out.print(contextPath);
        out.write("/css/all.css\">\r\n");

        String sort = (String) request.getAttribute("sort");
        if (StringUtils.isEmpty(sort)) {
            sort = "newest";
        }

        out.write("\r\n");
        out.write("</head>\r\n");
        out.write("<body class=\"questions-page\">\r\n");
        out.write("    <noscript><div id=\"noscript-padding\"></div></noscript>\r\n");
        out.write("    <div id=\"notify-container\"></div>\r\n");
        out.write("    <div id=\"overlay-header\"></div>\r\n");
        out.write("    <div id=\"custom-header\"></div>\r\n");
        out.write("\r\n");
        out.write("    <div class=\"container\">\r\n");
        out.write("        ");
        out.write("\r\n");
        out.write("\t\r\n");
        out.write("\t\r\n");
        out.write("\t\t<div id=\"header\">\r\n");
        out.write("            <div id=\"topbar\">  \r\n");
        out.write("            </div>  \r\n");
        out.write("            <div id=\"hmenus\">\r\n");
        out.write("                <div class=\"nav mainnavs\">\r\n");
        out.write("                    <ul>\r\n");
        out.write("                        <li class=\"youarehere\"><a id=\"nav-questions\" href=\"");
        out.print(contextPath);
        out.write("/s/doc\"></a></li>\r\n");
        out.write("                        <li><a id=\"nav-tags\" href=\"/tags\">Tags</a></li>\r\n");
        out.write("                        <li><a id=\"nav-users\" href=\"/users\">Users</a></li>\r\n");
        out.write("                        <li><a id=\"nav-badges\" href=\"/badges\">Badges</a></li>\r\n");
        out.write(
                "                        <li><a id=\"nav-unanswered\" href=\"/unanswered\">Unanswered</a></li>\r\n");
        out.write("                    </ul>\r\n");
        out.write("                </div>\r\n");
        out.write("                \r\n");
        out.write("            </div>\r\n");
        out.write("        </div>");
        out.write("\r\n");
        out.write("\r\n");
        out.write("        <div id=\"content\">\r\n");
        out.write("            \r\n");
        out.write("            <div id=\"mainbar\">    \r\n");
        out.write("\t\t\t\t<div class=\"subheader\">\r\n");
        out.write("\t\t\t\t\t<div id=\"tabs\">\r\n");
        out.write("<a ");
        out.print("newest".equals(sort) ? "class=\"youarehere\"" : "");
        out.write(
                "  href=\"/questions?sort=newest\" title=\"the most recently asked questions\"></a>\r\n");
        out.write("<a ");
        out.print("featured".equals(sort) ? "class=\"youarehere\"" : "");
        out.write(" href=\"/questions?sort=featured\" title=\"questions with open bounties\"></a>\r\n");
        out.write("<a ");
        out.print("unanswered".equals(sort) ? "class=\"youarehere\"" : "");
        out.write(" href=\"/questions?sort=faq\" title=\"questions with the most links\"></a>\r\n");
        out.write("<a ");
        out.print("votes".equals(sort) ? "class=\"youarehere\"" : "");
        out.write(" href=\"/questions?sort=votes\" title=\"questions with the most votes\">?</a>\r\n");
        out.write("<a ");
        out.print("active".equals(sort) ? "class=\"youarehere\"" : "");
        out.write(
                " href=\"/questions?sort=active\" title=\"questions that have recent activity\">active</a>\r\n");
        out.write("<a ");
        out.print("question".equals(sort) ? "class=\"youarehere\"" : "");
        out.write(" href=\"");
        out.print(contextPath);
        out.write("/view/ask.jsp\" title=\"??\">??</a>\r\n");
        out.write("\t\t\t\t\t</div>  \r\n");
        out.write("\t\t\t\t\t<h1 id=\"h-all-questions\"></h1> \r\n");
        out.write("\t\t\t\t\t\r\n");
        out.write("\t\t\t\t</div>   \r\n");
        out.write("\t\t\t\t\r\n");
        out.write("\t\t\t\t<div id=\"questions\">\r\n");
        //  c:forEach
        org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_005fforEach_005f0 = (org.apache.taglibs.standard.tag.rt.core.ForEachTag) _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems
                .get(org.apache.taglibs.standard.tag.rt.core.ForEachTag.class);
        _jspx_th_c_005fforEach_005f0.setPageContext(_jspx_page_context);
        _jspx_th_c_005fforEach_005f0.setParent(null);
        // /view/doclist.jsp(46,0) name = items type = javax.el.ValueExpression reqTime = true required = false fragment = false deferredValue = true expectedTypeName = java.lang.Object deferredMethod = false methodSignature = null
        _jspx_th_c_005fforEach_005f0
                .setItems(new org.apache.jasper.el.JspValueExpression("/view/doclist.jsp(46,0) '${doclist}'",
                        _el_expressionfactory.createValueExpression(_jspx_page_context.getELContext(),
                                "${doclist}", java.lang.Object.class))
                                        .getValue(_jspx_page_context.getELContext()));
        // /view/doclist.jsp(46,0) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
        _jspx_th_c_005fforEach_005f0.setVar("doc");
        int[] _jspx_push_body_count_c_005fforEach_005f0 = new int[] { 0 };
        try {
            int _jspx_eval_c_005fforEach_005f0 = _jspx_th_c_005fforEach_005f0.doStartTag();
            if (_jspx_eval_c_005fforEach_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
                do {
                    out.write("\r\n");
                    out.write("\r\n");
                    out.write("\t\t\t\t\t<div class=\"question-summary\" id=\"question-summary-");
                    out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(
                            "${doc.docid}", java.lang.String.class, (PageContext) _jspx_page_context, null,
                            false));
                    out.write("\">\r\n");
                    out.write("\t\t\t\t\t\t<div class=\"statscontainer\">\r\n");
                    out.write("\t\t\t\t\t\t\t<div class=\"statsarrow\"></div>\r\n");
                    out.write("\t\t\t\t\t\t\t<div class=\"stats\">\r\n");
                    out.write("\t\t\t\t\t\t\t\t<div class=\"vote\">\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t<div class=\"votes\">\r\n");
                    out.write(
                            "\t\t\t\t\t\t\t\t\t\t<span class=\"vote-count-post\"><strong>6</strong></span>\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t\t<div class=\"viewcount\">votes</div>\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t</div>\r\n");
                    out.write("\t\t\t\t\t\t\t\t</div>\r\n");
                    out.write("\t\t\t\t\t\t\t\t<div class=\"status answered\">\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t<strong>3</strong>answers\r\n");
                    out.write("\t\t\t\t\t\t\t\t</div>\r\n");
                    out.write("\t\t\t\t\t\t\t\t<div class=\"views\" title=\"188 views\">188 views</div>\r\n");
                    out.write("\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\r\n");
                    out.write("\t\t\t\t\t\t</div>\r\n");
                    out.write("\t\t\t\t\t\t<div class=\"summary\">        \r\n");
                    out.write("\t\t\t\t\t\t\t<h3><a href=\"");
                    out.print(contextPath);
                    out.write("/s/doc/id/");
                    out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(
                            "${doc.docid}", java.lang.String.class, (PageContext) _jspx_page_context, null,
                            false));
                    out.write("\" class=\"question-hyperlink\">");
                    out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(
                            "${doc.title}", java.lang.String.class, (PageContext) _jspx_page_context, null,
                            false));
                    out.write("</a></h3>\r\n");
                    out.write("\t\t\t\t\t\t\t<div class=\"excerpt\">\r\n");
                    out.write("\t\t\t\t\t\t\t\t");
                    out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(
                            "${doc.content}", java.lang.String.class, (PageContext) _jspx_page_context, null,
                            false));
                    out.write("\t \r\n");
                    out.write("\t\t\t\t\t\t\t</div>\r\n");
                    out.write("\t\t\t\t\t\t\t<div class=\"tags t-android t-webview t-textview\">\r\n");
                    out.write(
                            "\t\t\t\t\t\t\t\t<a href=\"/questions/tagged/android\" class=\"post-tag\" title=\"show questions tagged 'android'\" rel=\"tag\">\r\n");
                    out.write(
                            "\t\t\t\t\t\t\t\t\t<img src=\"http://cdn.sstatic.net/img/hosted/tKsDb.png\" height=\"16\" width=\"18\" alt=\"\" class=\"sponsor-tag-img\">android</a> \r\n");
                    out.write(
                            "\t\t\t\t\t\t\t\t<a href=\"/questions/tagged/webview\" class=\"post-tag\" title=\"show questions tagged 'webview'\" rel=\"tag\">webview</a> \r\n");
                    out.write(
                            "\t\t\t\t\t\t\t\t<a href=\"/questions/tagged/textview\" class=\"post-tag\" title=\"show questions tagged 'textview'\" rel=\"tag\">textview</a> \r\n");
                    out.write("\r\n");
                    out.write("\t\t\t\t\t\t\t</div>\r\n");
                    out.write("\t\t\t\t\t\t\t<div class=\"started fr\">\r\n");
                    out.write("\t\t\t\t\t\t\t\t<div class=\"user-info\"> \r\n");
                    out.write("\t\t\t\t\t\t\t\t\t<div class=\"user-gravatar32\">\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t\t<a href=\"/users/565319/richard\">\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t\t\t<div class=\"\"><img src=\"");
                    out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(
                            "${pageScope.contextPath}", java.lang.String.class,
                            (PageContext) _jspx_page_context, null, false));
                    out.write('/');
                    out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(
                            "${doc.creater.imageurl}", java.lang.String.class, (PageContext) _jspx_page_context,
                            null, false));
                    out.write("\" alt=\"\" width=\"32\" height=\"32\"></div>\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t\t</a>\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t</div>\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t<div class=\"user-details\">\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t\t<a href=\"/users/");
                    out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(
                            "${doc.creater.userid}", java.lang.String.class, (PageContext) _jspx_page_context,
                            null, false));
                    out.write('"');
                    out.write('>');
                    out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(
                            "${doc.creater.username}", java.lang.String.class, (PageContext) _jspx_page_context,
                            null, false));
                    out.write("</a><br>\r\n");
                    out.write(
                            "\t\t\t\t\t\t\t\t\t\t\t<span class=\"reputation-score\" title=\"reputation score\" dir=\"ltr\">296</span>\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t\t\t<span title=\"1 silver badge\">\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"badge2\"></span>\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"badgecount\">1</span>\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t\t\t</span>\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t\t\t<span title=\"13 bronze badges\">\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"badge3\"></span>\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"badgecount\">13</span>\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t\t\t</span>\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t\t</div>\r\n");
                    out.write("\t\t\t\t\t\t\t\t\t</div>\r\n");
                    out.write(
                            "\t\t\t\t\t\t\t\t\t<div class=\"user-action-time\">asked <span title=\"\" class=\"relativetime\">");
                    out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(
                            "${doc.createdate}", java.lang.String.class, (PageContext) _jspx_page_context, null,
                            false));
                    out.write("</span></div>\r\n");
                    out.write("\t\t\t\t\t\t\t</div>  \r\n");
                    out.write("\t\t\t\t\t\t</div>\r\n");
                    out.write("\t\t\t\t\t</div>\r\n");
                    int evalDoAfterBody = _jspx_th_c_005fforEach_005f0.doAfterBody();
                    if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
                        break;
                } while (true);
            }
            if (_jspx_th_c_005fforEach_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
                return;
            }
        } catch (Throwable _jspx_exception) {
            while (_jspx_push_body_count_c_005fforEach_005f0[0]-- > 0)
                out = _jspx_page_context.popBody();
            _jspx_th_c_005fforEach_005f0.doCatch(_jspx_exception);
        } finally {
            _jspx_th_c_005fforEach_005f0.doFinally();
            _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.reuse(_jspx_th_c_005fforEach_005f0);
        }
        out.write("\r\n");
        out.write("\t\t\t\t</div>\r\n");
        out.write("\t\t\t\t<br class=\"cbt\">\r\n");
        out.write("\t\t\t\t<div class=\"page-sizer fr\">\r\n");
        out.write(
                "\t\t\t\t\t<a href=\"/questions?sort=featured&amp;pagesize=15\" title=\"show 15 items per page\" class=\"current page-numbers\">15</a>\r\n");
        out.write(
                "\t\t\t\t\t<a href=\"/questions?sort=featured&amp;pagesize=30\" title=\"show 30 items per page\" class=\"page-numbers\">30</a>\r\n");
        out.write(
                "\t\t\t\t\t<a href=\"/questions?sort=featured&amp;pagesize=50\" title=\"show 50 items per page\" class=\"page-numbers\">50</a>\r\n");
        out.write("\t\t\t\t\t<span class=\"page-numbers desc\">per page</span>\r\n");
        out.write("\t\t\t\t</div>\r\n");
        out.write("\t\t\t\t<div class=\"pager fl\" >\r\n");
        out.write("\t\t\t\t\t<span class=\"page-numbers current\">1</span>\r\n");
        out.write(
                "\t\t\t\t\t<a href=\"/questions?page=2&amp;sort=featured\" title=\"go to page 2\"><span class=\"page-numbers\">2</span></a>\r\n");
        out.write(
                "\t\t\t\t\t<a href=\"/questions?page=3&amp;sort=featured\" title=\"go to page 3\"><span class=\"page-numbers\">3</span></a>\r\n");
        out.write(
                "\t\t\t\t\t<a href=\"/questions?page=4&amp;sort=featured\" title=\"go to page 4\"><span class=\"page-numbers\">4</span></a>\r\n");
        out.write(
                "\t\t\t\t\t<a href=\"/questions?page=5&amp;sort=featured\" title=\"go to page 5\"><span class=\"page-numbers\">5</span></a>\r\n");
        out.write("\t\t\t\t\t<span class=\"page-numbers dots\">&hellip;</span>\r\n");
        out.write(
                "\t\t\t\t\t<a href=\"/questions?page=21&amp;sort=featured\" title=\"go to page 21\"><span class=\"page-numbers\">21</span></a>\r\n");
        out.write(
                "\t\t\t\t\t<a href=\"/questions?page=2&amp;sort=featured\" title=\"go to page 2\" rel=\"next\"><span class=\"page-numbers next\"> next</span></a>\r\n");
        out.write("\t\t\t\t</div>\r\n");
        out.write("\r\n");
        out.write("\t\t\t</div>\r\n");
        out.write("\t\t\t\r\n");
        out.write("\t\t\t\r\n");
        out.write("\t\t\t<div id=\"sidebar\">\r\n");
        out.write("\t\t\t\t<div class=\"module\" id=\"questions-count\">\r\n");
        out.write("\t\t\t\t\t<div class=\"summarycount al\">305</div>\r\n");
        out.write("\t\t\t\t\t<p>questions</p>\r\n");
        out.write("\t\t\t\t</div>   \r\n");
        out.write("\t\t\t\t<div class=\"everyonelovesstackoverflow\" id=\"adzerk2\">\r\n");
        out.write("\t\t\t\t</div> \r\n");
        out.write("\r\n");
        out.write("\t\t\t\t<div class=\"module\" id=\"related-tags\">\r\n");
        out.write("\t\t\t\t\t<h4 id=\"h-related-tags\">Related Tags</h4>\r\n");
        out.write(
                "\t\t\t\t\t<a href=\"/questions/tagged/android\" class=\"post-tag\" title=\"show questions tagged 'android'\" rel=\"tag\"><img src=\"http://cdn.sstatic.net/img/hosted/tKsDb.png\" height=\"16\" width=\"18\" alt=\"\" class=\"sponsor-tag-img\">android</a><span class=\"item-multiplier\"><span class=\"item-multiplier-x\">&times;</span>&nbsp;<span class=\"item-multiplier-count\">42</span></span>            <br>\r\n");
        out.write("\t\t\t\t\r\n");
        out.write(
                "\t\t\t\t\t<a href=\"/questions/tagged/c%23\" class=\"post-tag\" title=\"show questions tagged 'c#'\" rel=\"tag\">c#</a><span class=\"item-multiplier\"><span class=\"item-multiplier-x\">&times;</span>&nbsp;<span class=\"item-multiplier-count\">27</span></span>            <br>\r\n");
        out.write("\t\t\t\t\r\n");
        out.write(
                "\t\t\t\t\t<a href=\"/questions/tagged/javascript\" class=\"post-tag\" title=\"show questions tagged 'javascript'\" rel=\"tag\">javascript</a><span class=\"item-multiplier\"><span class=\"item-multiplier-x\">&times;</span>&nbsp;<span class=\"item-multiplier-count\">25</span></span>            <br>\r\n");
        out.write("\t\t\t\t\r\n");
        out.write(
                "\t\t\t\t\t<a href=\"/questions/tagged/java\" class=\"post-tag\" title=\"show questions tagged 'java'\" rel=\"tag\">java</a><span class=\"item-multiplier\"><span class=\"item-multiplier-x\">&times;</span>&nbsp;<span class=\"item-multiplier-count\">24</span></span>            <br> \r\n");
        out.write("\t\t\t\t</div>\r\n");
        out.write("\t\t\t</div>\r\n");
        out.write("\r\n");
        out.write("\t\t</div>\r\n");
        out.write("    </div>\r\n");
        out.write("    ");
        out.write("\t<div id=\"footer\">\r\n");
        out.write("        <div class=\"footerwrap\">\r\n");
        out.write("            <div id=\"footer-menu\">\r\n");
        out.write("                <a href=\"/about\">about</a> |\r\n");
        out.write(
                "                <a href=\"/faq\">faq</a> | <a href=\"http://blog.stackexchange.com?blt=1\">blog</a> |\r\n");
        out.write("                    <a href=\"http://chat.stackoverflow.com\">chat</a> |\r\n");
        out.write("                <a href=\"http://data.stackexchange.com\">data</a> |\r\n");
        out.write(
                "                <a href=\"http://blog.stackoverflow.com/category/podcasts/\">podcast</a> |\r\n");
        out.write("                <a href=\"http://shop.stackexchange.com/\">shop</a> |\r\n");
        out.write("                <a href=\"http://stackexchange.com/legal\">legal</a>\r\n");
        out.write("                <div id=\"footer-sites\">\r\n");
        out.write("                    \r\n");
        out.write(
                "                        <span style=\"color:#FE7A15;font-size:140%\">&#9632;</span>&nbsp;<a href=\"http://stackoverflow.com\">stackoverflow.com</a>&nbsp; \r\n");
        out.write(
                "                        <span style=\"color:#FE7A15;font-size:140%\">&#9632;</span>&nbsp;<a href=\"http://stackapps.com\">api/apps</a>&nbsp; \r\n");
        out.write(
                "                        <span style=\"color:#FE7A15;font-size:140%\">&#9632;</span>&nbsp;<a href=\"http://careers.stackoverflow.com\">careers</a>&nbsp; \r\n");
        out.write(
                "                        <span style=\"color:#E8272C;font-size:140%\">&#9632;</span>&nbsp;<a href=\"http://serverfault.com\">serverfault.com</a>&nbsp; \r\n");
        out.write(
                "                        <span style=\"color:#00AFEF;font-size:140%\">&#9632;</span>&nbsp;<a href=\"http://superuser.com\">superuser.com</a>&nbsp; \r\n");
        out.write(
                "                        <span style=\"color:#969696;font-size:140%\">&#9632;</span>&nbsp;<a href=\"http://meta.stackoverflow.com\">meta</a>&nbsp; \r\n");
        out.write(
                "                        <span style=\"color:#46937D;font-size:140%\">&#9632;</span>&nbsp;<a href=\"http://area51.stackexchange.com\">area&nbsp;51</a>&nbsp; \r\n");
        out.write(
                "                        <span style=\"color:#C0D0DC;font-size:140%\">&#9632;</span>&nbsp;<a href=\"http://webapps.stackexchange.com\">webapps</a>&nbsp; \r\n");
        out.write("                        <span style=\"color:#000000;font-size:140%\">&#9632;</span>\r\n");
        out.write("                </div>\r\n");
        out.write("            </div>\r\n");
        out.write("            <div id=\"footer-flair\">\r\n");
        out.write("                <a class=\"peer1\" href=\"http://www.peer1.com/stackoverflow\"></a>  \r\n");
        out.write(
                "                <a href=\"http://creativecommons.org/licenses/by-sa/3.0/\" class=\"cc-wiki-link\"></a>\r\n");
        out.write("                <div id=\"svnrev\">rev 2012.3.7.1488</div>\r\n");
        out.write("            </div>\r\n");
        out.write("            <div id=\"copyright\">\r\n");
        out.write("                site design / logo &copy; 2012 stack exchange inc; \r\n");
        out.write(
                "                user contributions licensed under <a href=\"http://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc-wiki</a> with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n");
        out.write("            </div>\r\n");
        out.write("        </div>\r\n");
        out.write("    </div>");
        out.write("\r\n");
        out.write("</body>\r\n");
        out.write("</html>");
    } catch (Throwable t) {
        if (!(t instanceof SkipPageException)) {
            out = _jspx_out;
            if (out != null && out.getBufferSize() != 0)
                try {
                    out.clearBuffer();
                } catch (java.io.IOException e) {
                }
            if (_jspx_page_context != null)
                _jspx_page_context.handlePageException(t);
        }
    } finally {
        _jspxFactory.releasePageContext(_jspx_page_context);
    }
}

From source file:gov.nih.nci.ncicb.cadsr.common.jsp.tag.handler.AltQuestionText.java

public int doStartTag() throws javax.servlet.jsp.JspException {
    HttpServletRequest req;//  w  w  w  . j  a v  a2  s.c o  m
    JspWriter out;
    try {
        req = (HttpServletRequest) pageContext.getRequest();
        out = pageContext.getOut();
        Question currQuestion = (Question) pageContext.getAttribute(questionBeanId);
        String longName = currQuestion.getLongName();
        DataElement de = currQuestion.getDataElement();
        if (questionProperty != null && orgModuleBeanId != null) {
            // Get the property from the Question in the orgModule
            // If its a new Question the get the property value from
            // the DataElement for deProperty if deProperty is defined
            Module orgModule = (Module) pageContext.getSession().getAttribute(orgModuleBeanId);
            if (orgModule == null)
                throw new JspException("No Bean by name " + orgModuleBeanId + "in session");
            List orgQuestions = orgModule.getQuestions();
            String propValue = null;
            if (orgQuestions.contains(currQuestion)) {
                Question orgQuestion = getQuestionFromList(currQuestion.getQuesIdseq(), orgQuestions);
                propValue = (String) PropertyUtils.getProperty(orgQuestion, questionProperty);
            } else// get the value from the de
            {
                if (deProperty != null) {
                    if (de != null)
                        propValue = (String) PropertyUtils.getProperty(de, deProperty);
                }
            }

            /*if(propValue==null)
                return Tag.SKIP_BODY;
              */
            /* for saved question, use the default question text when CDE does not have preferred question text
                This is a temporary fix for GF1437 - to keep saved question behavior consistent for CDE
                with/without Preferred Question Text
            */
            if ((propValue == null || propValue.length() == 0) && "longCDEName".equals(deProperty)
                    && "longName".equals(questionProperty)) {
                propValue = "Data Element " + de.getLongName() + " does not have Preferred Question Text";
            }
            String script = generateJavaScript("question", formIndex, questionIndex, questionProperty,
                    propValue);
            StringBuffer linkStr = new StringBuffer(
                    "<a href=\"javascript:question" + questionIndex + questionProperty + "populate()\">");
            linkStr.append(propValue);
            linkStr.append("</a>");
            out.print(script);
            out.print(linkStr.toString());
        } else if (de != null) {
            String propValue = (String) PropertyUtils.getProperty(de, deProperty);
            /*if(propValue==null)
              return Tag.SKIP_BODY;
             */
            /* for saved question, use the default question text when CDE does not have preferred question text
                 This is a temporary fix for GF1437 - to keep saved question behavior consistent for CDE
                 with/without Preferred Question Text
             */
            if (propValue == null && "longCDEName".equals(deProperty) && "longName".equals(questionProperty)) {
                propValue = "Data Element " + de.getLongName() + " does not have Preferred Question Text";
            }
            if (propValue.equals(longName)) {
                out.print(propValue);
            } else {
                String script = generateJavaScript("questionde", formIndex, questionIndex, deProperty,
                        propValue);
                StringBuffer linkStr = new StringBuffer(
                        "<a href=\"javascript:questionde" + questionIndex + deProperty + "populate()\">");
                linkStr.append(propValue);
                linkStr.append("</a>");
                out.print(script);
                out.print(linkStr.toString());
            }
        }
        //out.print(getTableFooter());
    } catch (Exception ioe) {
        throw new JspException("I/O Error : " + ioe.getMessage());
    } //end try/catch
    return Tag.SKIP_BODY;

}

From source file:org.apache.jsp.decorators.general_jsp.java

public void _jspService(final javax.servlet.http.HttpServletRequest request,
        final javax.servlet.http.HttpServletResponse response)
        throws java.io.IOException, javax.servlet.ServletException {

    final javax.servlet.jsp.PageContext pageContext;
    javax.servlet.http.HttpSession session = null;
    final javax.servlet.ServletContext application;
    final javax.servlet.ServletConfig config;
    javax.servlet.jsp.JspWriter out = null;
    final java.lang.Object page = this;
    javax.servlet.jsp.JspWriter _jspx_out = null;
    javax.servlet.jsp.PageContext _jspx_page_context = null;

    try {//from w  w w  . jav  a 2 s.c  o m
        response.setContentType("text/html");
        pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
        _jspx_page_context = pageContext;
        application = pageContext.getServletContext();
        config = pageContext.getServletConfig();
        session = pageContext.getSession();
        out = pageContext.getOut();
        _jspx_out = out;

        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");

        WebResourceManager webResourceManager = ComponentAccessor.getComponent(WebResourceManager.class);
        webResourceManager.requireResourcesForContext("atl.general");
        webResourceManager.requireResourcesForContext("jira.general");

        final FieldsResourceIncluder headFieldResourceIncluder = ComponentAccessor
                .getComponent(FieldsResourceIncluder.class);
        headFieldResourceIncluder.includeFieldResourcesForCurrentUser();

        out.write('\n');
        out.write("\n");
        out.write("<!DOCTYPE html>\n");
        out.write("<html lang=\"");
        out.print(ComponentAccessor.getJiraAuthenticationContext().getI18nHelper().getLocale().getLanguage());
        out.write("\">\n");
        out.write("<head>\n");
        out.write("    ");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        //  decorator:usePage
        com.opensymphony.module.sitemesh.taglib.decorator.UsePageTag _jspx_th_decorator_005fusePage_005f0 = (com.opensymphony.module.sitemesh.taglib.decorator.UsePageTag) _005fjspx_005ftagPool_005fdecorator_005fusePage_0026_005fid_005fnobody
                .get(com.opensymphony.module.sitemesh.taglib.decorator.UsePageTag.class);
        _jspx_th_decorator_005fusePage_005f0.setPageContext(_jspx_page_context);
        _jspx_th_decorator_005fusePage_005f0.setParent(null);
        // /includes/decorators/aui-layout/head-common.jsp(8,0) name = id type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
        _jspx_th_decorator_005fusePage_005f0.setId("originalPage");
        int _jspx_eval_decorator_005fusePage_005f0 = _jspx_th_decorator_005fusePage_005f0.doStartTag();
        if (_jspx_th_decorator_005fusePage_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
            _005fjspx_005ftagPool_005fdecorator_005fusePage_0026_005fid_005fnobody
                    .reuse(_jspx_th_decorator_005fusePage_005f0);
            return;
        }
        _005fjspx_005ftagPool_005fdecorator_005fusePage_0026_005fid_005fnobody
                .reuse(_jspx_th_decorator_005fusePage_005f0);
        com.opensymphony.module.sitemesh.Page originalPage = null;
        originalPage = (com.opensymphony.module.sitemesh.Page) _jspx_page_context.findAttribute("originalPage");
        out.write('\n');

        //
        // IDEA gives you a warning below because it cant resolve JspWriter.  I don't know why but its harmless
        //
        HeaderFooterRendering headerFooterRendering = getComponent(HeaderFooterRendering.class);

        out.write("\n");
        out.write("<meta charset=\"utf-8\">\n");
        out.write("<meta http-equiv=\"X-UA-Compatible\" content=\"");
        out.print(headerFooterRendering.getXUACompatible(originalPage));
        out.write("\"/>\n");
        out.write("<title>");
        out.print(headerFooterRendering.getPageTitle(originalPage));
        out.write("</title>\n");

        // include version meta information
        headerFooterRendering.includeVersionMetaTags(out);

        headerFooterRendering.includeGoogleSiteVerification(out);

        // writes the <meta> tags into the page head
        headerFooterRendering.requireCommonMetadata();
        headerFooterRendering.includeMetadata(out);

        // include web panels
        headerFooterRendering.includeWebPanels(out, "atl.header");

        out.write('\n');
        out.write('\n');
        out.write('\n');

        XsrfTokenGenerator xsrfTokenGenerator = ComponentAccessor.getComponent(XsrfTokenGenerator.class);

        out.write("    \n");
        out.write("<meta id=\"atlassian-token\" name=\"atlassian-token\" content=\"");
        out.print(xsrfTokenGenerator.generateToken(request));
        out.write("\">\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("<link rel=\"shortcut icon\" href=\"");
        out.print(headerFooterRendering.getRelativeResourcePrefix());
        out.write("/favicon.ico\">\n");
        out.write("<link rel=\"search\" type=\"application/opensearchdescription+xml\" href=\"");
        out.print(request.getContextPath());
        out.write("/osd.jsp\" title=\"");
        out.print(headerFooterRendering.getPageTitle(originalPage));
        out.write("\"/>\n");
        out.write("\n");
        out.write("    ");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("<!--[if IE]><![endif]-->");
        out.write("\n");
        out.write("<script type=\"text/javascript\">var contextPath = '");
        out.print(request.getContextPath());
        out.write("';</script>\n");

        //
        // IDEA gives you a warning below because it cant resolve JspWriter.  I don't know why but its harmless
        //
        HeaderFooterRendering headerAndFooter = ComponentAccessor.getComponent(HeaderFooterRendering.class);

        headerAndFooter.requireCommonResources();
        headerAndFooter.includeResources(out);

        out.write("\n");
        out.write("<script type=\"text/javascript\" src=\"");
        out.print(headerAndFooter.getKeyboardShortCutScript(request));
        out.write("\"></script>\n");

        headerAndFooter.includeWebPanels(out, "atl.header.after.scripts");

        out.write('\n');
        out.write("\n");
        out.write("    ");
        if (_jspx_meth_decorator_005fhead_005f0(_jspx_page_context))
            return;
        out.write("\n");
        out.write("</head>\n");
        out.write("<body id=\"jira\" class=\"aui-layout aui-theme-default ");
        if (_jspx_meth_decorator_005fgetProperty_005f0(_jspx_page_context))
            return;
        out.write('"');
        out.write(' ');
        out.print(ComponentAccessor.getComponent(ProductVersionDataBeanProvider.class).get()
                .getBodyHtmlAttributes());
        out.write(">\n");
        out.write("<div id=\"page\">\n");
        out.write("    <header id=\"header\" role=\"banner\">\n");
        out.write("        ");
        out.write("\n");
        out.write("    ");
        out.write("\n");
        out.write("        ");
        out.write("\n");
        out.write("            ");
        out.write("\n");
        out.write("        ");
        out.write("\n");
        out.write("    ");
        out.write('\n');
        out.write('\n');
        out.write('\n');
        out.write('\n');
        out.write('\n');
        out.write("\n");
        out.write("<script>\n");
        out.write("    AJS.$(function () {\n");
        out.write("        var licenseBanner = require(\"jira/license-banner\");\n");
        out.write("        licenseBanner.showLicenseBanner(\"");
        out.print(StringEscapeUtils.escapeEcmaScript(
                ComponentAccessor.getComponentOfType(LicenseBannerHelper.class).getExpiryBanner()));
        out.write("\");\n");
        out.write("        licenseBanner.showLicenseFlag(\"");
        out.print(StringEscapeUtils.escapeEcmaScript(
                ComponentAccessor.getComponentOfType(LicenseBannerHelper.class).getMaintenanceFlag()));
        out.write("\");\n");
        out.write("    });\n");
        out.write("</script>\n");
        out.write('\n');
        out.write('\n');
        out.write('\n');
        out.write('\n');

        final User loggedInUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
        if (loggedInUser != null) {
            final InternalWebSudoManager websudoManager = ComponentAccessor
                    .getComponent(InternalWebSudoManager.class);

            if (websudoManager.isEnabled() && websudoManager.hasValidSession(session)) {
                request.setAttribute("helpUtil", HelpUtil.getInstance());

                out.write("\n");
                out.write("<div class=\"aui-message aui-message-warning\" id=\"websudo-banner\">\n");

                if (websudoManager.isWebSudoRequest(request)) {

                    out.write("\n");
                    out.write("    <p>\n");
                    out.write("        ");
                    if (_jspx_meth_ww_005ftext_005f0(_jspx_page_context))
                        return;
                    out.write("\n");
                    out.write("    </p>\n");

                } else {

                    out.write("\n");
                    out.write("    <p>\n");
                    out.write("        ");
                    if (_jspx_meth_ww_005ftext_005f1(_jspx_page_context))
                        return;
                    out.write("\n");
                    out.write("    </p>\n");

                }

                out.write("\n");
                out.write("</div>\n");

            }
        }

        out.write('\n');
        out.write('\n');
        out.write("\n");
        out.write("        ");
        out.write('\n');
        if (_jspx_meth_ww_005fbean_005f0(_jspx_page_context))
            return;
        out.write('\n');
        out.write('\n');

        final UnsupportedBrowserManager browserManager = ComponentAccessor
                .getComponent(UnsupportedBrowserManager.class);
        if (browserManager.isCheckEnabled() && !browserManager.isHandledCookiePresent(request)
                && browserManager.isUnsupportedBrowser(request)) {
            request.setAttribute("messageKey", browserManager.getMessageKey(request));

            out.write('\n');
            if (_jspx_meth_aui_005fcomponent_005f0(_jspx_page_context))
                return;
            out.write('\n');
        }
        out.write("\n");
        out.write("        ");
        out.write('\n');
        out.write('\n');
        //  decorator:usePage
        com.opensymphony.module.sitemesh.taglib.decorator.UsePageTag _jspx_th_decorator_005fusePage_005f1 = (com.opensymphony.module.sitemesh.taglib.decorator.UsePageTag) _005fjspx_005ftagPool_005fdecorator_005fusePage_0026_005fid_005fnobody
                .get(com.opensymphony.module.sitemesh.taglib.decorator.UsePageTag.class);
        _jspx_th_decorator_005fusePage_005f1.setPageContext(_jspx_page_context);
        _jspx_th_decorator_005fusePage_005f1.setParent(null);
        // /includes/decorators/aui-layout/header.jsp(3,0) name = id type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
        _jspx_th_decorator_005fusePage_005f1.setId("p");
        int _jspx_eval_decorator_005fusePage_005f1 = _jspx_th_decorator_005fusePage_005f1.doStartTag();
        if (_jspx_th_decorator_005fusePage_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
            _005fjspx_005ftagPool_005fdecorator_005fusePage_0026_005fid_005fnobody
                    .reuse(_jspx_th_decorator_005fusePage_005f1);
            return;
        }
        _005fjspx_005ftagPool_005fdecorator_005fusePage_0026_005fid_005fnobody
                .reuse(_jspx_th_decorator_005fusePage_005f1);
        com.opensymphony.module.sitemesh.Page p = null;
        p = (com.opensymphony.module.sitemesh.Page) _jspx_page_context.findAttribute("p");
        out.write('\n');

        //
        // IDEA gives you a warning below because it cant resolve JspWriter.  I don't know why but its harmless
        //
        ComponentAccessor.getComponent(HeaderFooterRendering.class).includeTopNavigation(out, request, p);

        out.write("\n");
        out.write("    </header>\n");
        out.write("    ");
        out.write('\n');
        out.write('\n');

        AnnouncementBanner banner = ComponentAccessor.getComponentOfType(AnnouncementBanner.class);
        if (banner.isDisplay()) {

            out.write("\n");
            out.write("<div id=\"announcement-banner\" class=\"alertHeader\">\n");
            out.write("    ");
            out.print(banner.getViewHtml());
            out.write("\n");
            out.write("</div>\n");

        }

        out.write('\n');
        out.write("\n");
        out.write("    <section id=\"content\" role=\"main\">\n");
        out.write("        ");
        if (_jspx_meth_decorator_005fbody_005f0(_jspx_page_context))
            return;
        out.write("\n");
        out.write("    </section>\n");
        out.write("    <footer id=\"footer\" role=\"contentinfo\">\n");
        out.write("        ");
        out.write("\n");
        out.write("        ");
        out.write("\n");
        out.write("\n");
        out.write("<section class=\"footer-body\">\n");

        //
        // IDEA gives you a warning below because it cant resolve JspWriter.  I don't know why but its harmless
        //
        HeaderFooterRendering footerRendering = getComponent(HeaderFooterRendering.class);
        footerRendering.includeFooters(out, request);
        // include web panels
        footerRendering.includeWebPanels(out, "atl.footer");

        out.write("\n");
        out.write("    <div id=\"footer-logo\"><a href=\"http://www.atlassian.com/\">Atlassian</a></div>\n");
        out.write("</section>\n");
        org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response,
                "/includes/decorators/global-translations.jsp", out, false);
        out.write("\n");
        out.write("    </footer>\n");
        out.write("</div>\n");
        out.write("</body>\n");
        out.write("</html>\n");
    } catch (java.lang.Throwable t) {
        if (!(t instanceof javax.servlet.jsp.SkipPageException)) {
            out = _jspx_out;
            if (out != null && out.getBufferSize() != 0)
                try {
                    out.clearBuffer();
                } catch (java.io.IOException e) {
                }
            if (_jspx_page_context != null)
                _jspx_page_context.handlePageException(t);
            else
                throw new ServletException(t);
        }
    } finally {
        _jspxFactory.releasePageContext(_jspx_page_context);
    }
}

From source file:org.jahia.taglibs.template.TokenizedFormTag.java

@Override
public int doEndTag() throws JspException {
    boolean hasCaptcha = false;
    if (pageContext.findAttribute("hasCaptcha") != null) {
        hasCaptcha = (Boolean) pageContext.findAttribute("hasCaptcha");
    }/*from  w  ww .j  av a2 s.  com*/
    try {
        String id = (String) pageContext.findAttribute("currentFormId");

        RenderContext renderContext = (RenderContext) pageContext.findAttribute("renderContext");
        JspWriter out = pageContext.getOut();

        String bodyContent = getBodyContent().getString();
        Source source = new Source(bodyContent);

        OutputDocument outputDocument = new OutputDocument(source);

        TreeMap<String, List<String>> hiddenInputs = new TreeMap<String, List<String>>();
        List<StartTag> formTags = source.getAllStartTags("form");

        StartTag formTag = formTags.get(0);
        String action = formTag.getAttributeValue("action");

        if (!action.startsWith("/") && !action.contains("://")) {
            String requestURI = ((HttpServletRequest) pageContext.getRequest()).getRequestURI();
            if (requestURI.startsWith("/gwt/")) {
                requestURI = renderContext.getURLGenerator().buildURL(renderContext.getMainResource().getNode(),
                        renderContext.getMainResourceLocale().toString(),
                        renderContext.getMainResource().getTemplate(),
                        renderContext.getMainResource().getTemplateType());
            }
            action = StringUtils.substringBeforeLast(requestURI, "/") + "/" + action;
        }
        hiddenInputs.put("form-action", Arrays.asList(StringUtils.substringBeforeLast(action, ";")));
        hiddenInputs.put("form-method",
                Arrays.asList(StringUtils.capitalize(formTag.getAttributeValue("method"))));

        List<StartTag> inputTags = source.getAllStartTags("input");
        for (StartTag inputTag : inputTags) {
            if ("hidden".equals(inputTag.getAttributeValue("type"))) {
                String name = inputTag.getAttributeValue("name");
                List<String> strings = hiddenInputs.get(name);
                String value = inputTag.getAttributeValue("value");
                if (strings == null) {
                    strings = new LinkedList<String>();
                }
                strings.add(value);
                hiddenInputs.put(name, strings);
            }
        }

        if (hasCaptcha) {
            // Put random number here, will be replaced by the captcha servlet with the expected value
            hiddenInputs.put("jcrCaptcha", Arrays.asList(java.util.UUID.randomUUID().toString()));
        }

        hiddenInputs.put("disableXSSFiltering", Arrays.asList(String.valueOf(disableXSSFiltering)));
        hiddenInputs.put("allowsMultipleSubmits", Arrays.asList(String.valueOf(allowsMultipleSubmits)));
        outputDocument.insert(formTag.getEnd(),
                "<input type=\"hidden\" name=\"disableXSSFiltering\" value=\"" + disableXSSFiltering + "\"/>");

        outputDocument.insert(formTag.getEnd(),
                "<jahia:token-form id='" + id + "' forms-data='" + JSONUtil.toJSON(hiddenInputs) + "'/>");

        out.print(outputDocument.toString());
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }

    pageContext.removeAttribute("hasCaptcha", PageContext.REQUEST_SCOPE);
    pageContext.removeAttribute("currentFormId", PageContext.REQUEST_SCOPE);

    // Restore the aggregation for the following fragments
    if (skipAggregation) {
        pageContext.getRequest().removeAttribute(AggregateFilter.SKIP_AGGREGATION);
        skipAggregation = false;
    }
    return super.doEndTag();
}

From source file:org.squale.welcom.taglib.progressbar.ProgressBarTag.java

public int doStartTag() throws JspException {
    JspWriter out = this.pageContext.getOut();

    try {/*from ww w  .j a  v  a 2s .  com*/
        // Inclusion de la librairie JS
        CanvasUtil.addJs(
                WelcomConfigurator.getMessage(WelcomConfigurator.HEADER_LOCALJS_PATH_KEY) + "progressbar.js",
                this, pageContext);

        boolean isIE = false;
        boolean isSafari = false;
        boolean isOpera = false;
        String userAgent = ((HttpServletRequest) pageContext.getRequest()).getHeader("User-Agent");

        if (userAgent != null) {
            if (userAgent.indexOf("MSIE") != -1) {
                isIE = true;
            } else {
                if (userAgent.indexOf("Safari") != -1) {
                    isSafari = true;
                } else {
                    if (userAgent.indexOf("Opera") != -1) {
                        isOpera = true;
                    }
                }
            }
        }

        String pbProperties = " wRefreshRate='" + refreshRate + "'";

        if (!GenericValidator.isBlankOrNull(onChangeHook)) {
            pbProperties += " wOnChangeHook='" + onChangeHook + "'";
        }

        if (!GenericValidator.isBlankOrNull(onCompleteHook)) {
            pbProperties += " wOnCompleteHook='" + onCompleteHook + "'";
        }

        pbProperties += " wIsFullScreen='" + isFullScreen + "'";

        out.println("<input type='hidden' id='wWatchedTaskId' name='wWatchedTaskId'>");

        out.println("<DIV id='" + id + "' " + pbProperties + ">");

        if (isFullScreen) {

            // Cration de variable pour viter de passer ces infos dans l'appel
            // JS

            if (isIE) {
                out.println("<IFRAME frameborder=0 id=wDivProgressBarBG style=\"background-color:#ffffff;");
                out.println("filter:alpha(opacity=60);");
                out.println("visibility: hidden;");
                out.println(
                        "position:absolute; top:0px; left:0px; width:1400px; height:909px; z-index:123; padding:0; border-width:0; border-style:none, margin:0;\">");
                out.println("</IFRAME>");
            } else {
                out.println("<div id=wDivProgressBarBG style=\"background-color:#ffffff;");
                out.print("-moz-opacity:0.6;");
                out.print("opacity: 0.6;");
                out.print("visibility: hidden;");
                out.print(
                        "position:absolute; top:0px; left:0px; width:100%; height:100%; z-index:123; margin:0;\">");
                out.println("</div>");
            }

            out.println("<div id=wDivProgressBar style=\"background-color:#FFFFFF;");
            out.print("position:absolute;");
            out.print("left:50%;");
            out.print("top:50%;");
            out.print("visibility: hidden;");
            out.print("margin-left:-50px;");
            out.print("margin-top:-50px; ");
            out.print("z-index:124;");
            out.print("border:1px solid #888\">");
        } // Fin IF isFullScreen

        // Cration de la zone d'affichage
        String tdStatus;
        if (showStatusText) {
            tdStatus = "<span style=\"color:#000\" id='" + getId() + "_status'>-</span>";
        } else {
            tdStatus = "";
        }

        String tdPct;
        if (showPctText) {
            tdPct = "<span style=\"color:#000\" id=\"" + getId() + "_pctText\">0%</span>";
        } else {
            tdPct = "";
        }

        boolean leftExists = false;
        boolean topExists = false;
        boolean rightExists = false;
        boolean bottomExists = false;
        boolean progressSolo = true;

        if (showPctText || showStatusText) {
            if ((pctTextPosition.equals(POS_LEFT)) || (statusTextPosition.equals(POS_LEFT))) {
                leftExists = true;
                progressSolo = false;
            }

            if ((pctTextPosition.equals(POS_TOP)) || (statusTextPosition.equals(POS_TOP))) {
                topExists = true;
                progressSolo = false;
            }

            if ((pctTextPosition.equals(POS_RIGHT)) || (statusTextPosition.equals(POS_RIGHT))) {
                rightExists = true;
                progressSolo = false;
            }

            if ((pctTextPosition.equals(POS_BOTTOM)) || (statusTextPosition.equals(POS_BOTTOM))) {
                bottomExists = true;
                progressSolo = false;
            }
        }

        if (isSafari) {
            progressSolo = true;
            bottomExists = false;
            topExists = false;
            leftExists = false;
            rightExists = false;
        }

        if (isFullScreen()) {
            out.println(
                    "<div style=\"background-image:url(theme/charte_v03_001/img/lignage/lignage_trans.gif);background-position:left bottom;background-repeat:repeat-x;height:32px;width:"
                            + width
                            + "px;\" class=\"bg_theme\"><div style=\"margin: 0pt; padding: 0px 5px; font-family: Verdana,Arial,Helvetica,sans-serif; font-weight: bold; font-size: 10px; color: rgb(255, 255, 255); background-color: rgb(5, 16, 57); cursor: default; height: 16px; float: left;\">Execution</div></div>");
        }

        // out.println("<div>");
        out.println("<table border=\"0\" cellspacing=\"2px\" style=\"0px 3px 3px 3px\" width=\"" + width
                + "px\" >");

        // Formattage
        out.print("<tr>");
        if (leftExists) {
            out.print("<th style='width: 15%'></th>");
        }

        if (!progressSolo) {
            if (leftExists && rightExists) {
                out.print("<th style='width: 70%'></th>");
            } else {
                if (leftExists || rightExists) {
                    out.print("<th style='width: 85%'></th>");
                } else {
                    out.print("<th style='width: 100%'></th>");
                }

            }
        }

        if (rightExists) {
            out.print("<th style='width: 15%'></th>");
        }

        out.println("</tr>");

        // ###############
        // LIGNE du haut
        // ###############

        if (topExists) {
            out.println("<tr>");

            // ------------

            if (leftExists || rightExists) {
                out.println("<td " + STYLE_TD_NOBORDER_PADDING + " colspan=2>");
            } else {
                out.println("<td " + STYLE_TD_NOBORDER_PADDING + " >");
            }

            if (pctTextPosition.equals(POS_TOP)) {
                out.println(tdPct);
            }

            if (statusTextPosition.equals(POS_TOP)) {
                out.println(tdStatus);
            }
            out.println("</td>");

            // ------------

            out.println("</tr>");
        }

        // ###############
        // LIGNE du milieu
        // ###############
        // ------------
        out.println("<tr>");
        if (leftExists) {

            out.println("<td " + STYLE_TD_NOBORDER_PADDING + " >");
            if (pctTextPosition.equals(POS_LEFT)) {
                out.println(tdPct);
            }

            if (statusTextPosition.equals(POS_LEFT)) {
                out.println(tdStatus);
            }
            out.println("</td>");

        }
        // ------------

        out.print(" <td " + STYLE_TD_NOBORDER_PADDING + ">");

        // ----- PROGRESS BAR -----
        if (isSafari) {
            out.print(render.drawAnimatedProgressBar());
        } else {
            out.print(render.drawRealProgressBar(getId()));
        }

        // ----- PROGRESS BAR -----
        out.println("   </td>");

        // ------------
        if (rightExists) {
            out.println("<td " + STYLE_TD_NOBORDER + " >");
            if (pctTextPosition.equals(POS_RIGHT)) {
                out.println(tdPct);
            }

            if (statusTextPosition.equals(POS_RIGHT)) {
                out.println(tdStatus);
            }
            out.println("</td>");
        }

        out.println("</tr>");
        // ------------

        // ###############
        // LIGNE du bas
        // ###############
        if (bottomExists) {
            out.println("<tr>");

            // ------------

            if (leftExists || rightExists) {
                out.println("<td  " + STYLE_TD_NOBORDER_PADDING + " colspan=2>");
            } else {
                out.println("<td " + STYLE_TD_NOBORDER_PADDING + " >");
            }

            if (pctTextPosition.equals(POS_BOTTOM)) {
                out.println(tdPct);
            }

            if (statusTextPosition.equals(POS_BOTTOM)) {
                out.println(tdStatus);
            }
            out.println("</td>");

            // ------------

            out.println("</tr>");
        }

        out.println("</table>");
        // out.println("</div>");
        if (isFullScreen) {
            out.println(
                    "<div style=\"background-image:url(theme/charte_v03_001/img/lignage/footer_trans.gif);background-position:left bottom;clear:both;height:20px;width:"
                            + width + "px;\" class=\"bg_theme\"></div>");
            out.println("</div>");
        }
        out.println("</div>");
    } catch (IOException e) {
        try {
            out.println("unable to render tag due to " + e.getClass().getName() + ":" + e.getMessage());
        } catch (IOException e1) {
            // On fait rien car l'exception doit tre la mme que celle du
            // bloc catch englobant
        }
        e.printStackTrace();
    }

    // Continue processing this page
    release();
    return (EVAL_PAGE);
}

From source file:gov.nih.nci.ispy.web.taglib.CatCorrPlotTag.java

public int doStartTag() {

    ServletRequest request = pageContext.getRequest();
    HttpSession session = pageContext.getSession();
    Object o = request.getAttribute(beanName);
    JspWriter out = pageContext.getOut();
    ServletResponse response = pageContext.getResponse();

    ISPYCategoricalCorrelationFinding corrFinding = (ISPYCategoricalCorrelationFinding) businessTierCache
            .getSessionFinding(session.getId(), taskId);

    try {//  w w  w.  j a va 2 s .  co  m
        List<DataPointVector> dataSet = corrFinding.getDataVectors();
        List<ReporterInfo> reporterInfoList = corrFinding.getCatCorrRequest().getReporters();

        //get better labels for X and Y axis.
        ContinuousType ct = corrFinding.getContType();
        String xLabel, yLabel;
        if (ct == ContinuousType.GENE) {
            yLabel = "Log base 2 expression value";
        } else {
            yLabel = ct.toString();
        }

        //if there are reporters involved then send them in so that they can be used to create
        //a series.

        ISPYCategoricalCorrelationPlot plot = new ISPYCategoricalCorrelationPlot(dataSet, reporterInfoList,
                "Category", yLabel, corrFinding.getContType(), ColorByType.CLINICALRESPONSE);

        chart = plot.getChart();
        ISPYImageFileHandler imageHandler = new ISPYImageFileHandler(session.getId(), "png", 650, 600);
        //The final complete path to be used by the webapplication
        String finalPath = imageHandler.getSessionTempFolder();
        String finalURLpath = imageHandler.getFinalURLPath();
        /*
         * Create the actual charts, writing it to the session temp folder
        */
        ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
        String mapName = imageHandler.createUniqueMapName();
        //PrintWriter writer = new PrintWriter(new FileWriter(mapName));
        ChartUtilities.writeChartAsPNG(new FileOutputStream(finalPath), chart, 650, 600, info);
        //ImageMapUtil.writeBoundingRectImageMap(writer,"PCAimageMap",info,true);
        //writer.close();

        /*   This is here to put the thread into a loop while it waits for the
         *   image to be available.  It has an unsophisticated timer but at 
         *   least it is something to avoid an endless loop.
         **/
        boolean imageReady = false;
        int timeout = 1000;
        FileInputStream inputStream = null;
        while (!imageReady) {
            timeout--;
            try {
                inputStream = new FileInputStream(finalPath);
                inputStream.available();
                imageReady = true;
                inputStream.close();
            } catch (IOException ioe) {
                imageReady = false;
                if (inputStream != null) {
                    inputStream.close();
                }
            }
            if (timeout <= 1) {

                break;
            }
        }

        out.print(ImageMapUtil.getBoundingRectImageMapTag(mapName, true, info));
        finalURLpath = finalURLpath.replace("\\", "/");
        long randomness = System.currentTimeMillis(); //prevent image caching
        out.print("<img id=\"geneChart\" name=\"geneChart\" src=\"" + finalURLpath + "?" + randomness
                + "\" usemap=\"#" + mapName + "\" border=\"0\" />");

        //(imageHandler.getImageTag(mapFileName));

    } catch (IOException e) {
        logger.error(e);
    } catch (Exception e) {
        logger.error(e);
    } catch (Throwable t) {
        logger.error(t);
    }

    return EVAL_BODY_INCLUDE;
}