Search in sources :

Example 1 with NonSyncStringBuffer

use of com.iplanet.jato.util.NonSyncStringBuffer in project OpenAM by OpenRock.

the class DSAMEHrefTag method doStartTag.

/**
     * performs start tag
     *
     * @return EVAL_BODY_BUFFERED always
     * @throws JspException if request context is null
     */
public int doStartTag() throws JspException {
    reset();
    try {
        if (fireBeginDisplayEvent()) {
            ViewBean viewBean = getParentViewBean();
            AuthViewBeanBase dsameVB = (AuthViewBeanBase) viewBean;
            String value = (String) viewBean.getDisplayFieldValue(getName());
            /*if (debug.messageEnabled()) {
                 *  debug.message("URL value is : " + value);
                 *}
                 */
            buffer = new NonSyncStringBuffer("<a href=\"");
            String pgEncoding = (String) dsameVB.getDisplayFieldValue(AuthViewBeanBase.PAGE_ENCODING);
            int paramIdx = value.indexOf('?');
            if (paramIdx != -1) {
                buffer.append(value.substring(0, paramIdx + 1));
                String qStr = value.substring(paramIdx + 1);
                // parameter values followed by URL must be encoded
                if ((qStr != null) && qStr.length() != 0) {
                    encodeValues(buffer, pgEncoding, qStr);
                    String tmpStr = buffer.toString();
                    if (!tmpStr.endsWith("&amp;") && !tmpStr.endsWith("?")) {
                        buffer.append("&amp;");
                    }
                }
            } else {
                buffer.append(value);
                buffer.append('?');
            }
            if (getAnchor() != null) {
                buffer.append("#").append(getAnchor());
            }
            buffer.append(AuthViewBeanBase.PAGE_ENCODING).append('=').append(dsameVB.getDisplayFieldValue(AuthViewBeanBase.PAGE_ENCODING));
            // buffer.append ("&val="+getName()+"&val2="+value);
            // Append the Query String NVP's that might have been added
            // as JSP tag attributes
            appendQueryParams(buffer);
            buffer.append("\"");
            if (getTarget() != null) {
                buffer.append(" target=\"").append(getTarget()).append("\"");
            }
            if (getTitle() != null) {
                buffer.append(" title=\"").append(getTitle()).append("\"");
            }
            // Append the additional "standard" attributes
            appendCommonHtmlAttributes(buffer);
            appendJavaScriptAttributes(buffer);
            appendStyleAttributes(buffer);
            buffer.append(">");
            displayed = true;
        } else {
            displayed = false;
        }
    } catch (CompleteRequestException e) {
        // CompleteRequestException tunneling workaround:
        // Workaround to allow developers to stop the request
        // from a display event by throwing a CompleteRequestException.
        // The problem is that some containers catch this exception in
        // their JSP rendering subsystem, and so we need to tunnel it
        // through for the developer.
        // Save the exception here to rethrow later (in doEndTag)
        abortedException = e;
        return SKIP_BODY;
    }
    if (displayed) {
        return EVAL_BODY_BUFFERED;
    } else {
        return SKIP_BODY;
    }
}
Also used : CompleteRequestException(com.iplanet.jato.CompleteRequestException) NonSyncStringBuffer(com.iplanet.jato.util.NonSyncStringBuffer) AuthViewBeanBase(com.sun.identity.authentication.UI.AuthViewBeanBase) ViewBean(com.iplanet.jato.view.ViewBean)

Example 2 with NonSyncStringBuffer

use of com.iplanet.jato.util.NonSyncStringBuffer in project OpenAM by OpenRock.

the class DSAMEFormTag method doEndTag.

public int doEndTag() throws JspException {
    ViewBean vb = getParentViewBean();
    NonSyncStringBuffer buffer = new NonSyncStringBuffer();
    buffer.append("<input type=\"hidden\" name=\"");
    buffer.append(AuthViewBeanBase.PAGE_ENCODING).append("\" value=\"").append(vb.getDisplayFieldValue("gx_charset")).append("\"/>").append("</form>");
    writeOutput(buffer);
    return EVAL_PAGE;
}
Also used : NonSyncStringBuffer(com.iplanet.jato.util.NonSyncStringBuffer) ViewBean(com.iplanet.jato.view.ViewBean)

Example 3 with NonSyncStringBuffer

use of com.iplanet.jato.util.NonSyncStringBuffer in project OpenAM by OpenRock.

the class DSAMEFormTag method doStartTag.

/**
     * performs start tag
     *
     * @return EVAL_BODY_INCLUDE always
     * @throws JspException if request context is null
     */
public int doStartTag() throws JspException {
    reset();
    Map m = getValueMap();
    NonSyncStringBuffer buffer = new NonSyncStringBuffer("<form ");
    for (Iterator it = m.keySet().iterator(); it.hasNext(); ) {
        String key = (String) it.next();
        String val = (String) m.get(key);
        buffer.append("  " + key + "=\"" + val + "\"");
    }
    if (!autoCompleteEnabled) {
        buffer.append(" autocomplete=\"off\"");
    }
    buffer.append(">");
    writeOutput(buffer);
    return EVAL_BODY_INCLUDE;
}
Also used : Iterator(java.util.Iterator) NonSyncStringBuffer(com.iplanet.jato.util.NonSyncStringBuffer) Map(java.util.Map)

Aggregations

NonSyncStringBuffer (com.iplanet.jato.util.NonSyncStringBuffer)3 ViewBean (com.iplanet.jato.view.ViewBean)2 CompleteRequestException (com.iplanet.jato.CompleteRequestException)1 AuthViewBeanBase (com.sun.identity.authentication.UI.AuthViewBeanBase)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1