Search in sources :

Example 1 with AuthViewBeanBase

use of com.sun.identity.authentication.UI.AuthViewBeanBase 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 AuthViewBeanBase

use of com.sun.identity.authentication.UI.AuthViewBeanBase in project OpenAM by OpenRock.

the class DSAMEResBundleTag method doStartTag.

/**
     * performs start tag
     *
     * @return EVAL_BODY_INCLUDE always
     * @throws JspException if request context is null
     */
public int doStartTag() throws JspException {
    reset();
    ViewBean vb = getParentViewBean();
    java.util.Locale locale;
    if (vb instanceof AuthViewBeanBase) {
        AuthViewBeanBase ab = (AuthViewBeanBase) vb;
        locale = ab.getRequestLocale();
    } else {
        locale = java.util.Locale.getDefault();
    }
    String rbName = (String) getValue("BundleName");
    String resKey = (String) getValue("ResourceKey");
    String resValue;
    ResourceBundle rb = AMResourceBundleCache.getInstance().getResBundle(rbName, locale);
    try {
        resValue = rb.getString(resKey);
    } catch (MissingResourceException ex) {
        resValue = resKey;
    }
    writeOutput(resValue);
    return SKIP_BODY;
}
Also used : MissingResourceException(java.util.MissingResourceException) ResourceBundle(java.util.ResourceBundle) AuthViewBeanBase(com.sun.identity.authentication.UI.AuthViewBeanBase) ViewBean(com.iplanet.jato.view.ViewBean)

Example 3 with AuthViewBeanBase

use of com.sun.identity.authentication.UI.AuthViewBeanBase in project OpenAM by OpenRock.

the class DSAMEFormTag method setTilePrefix.

public void setTilePrefix(String name) throws JspException {
    ViewBean vb = getParentViewBean();
    if (vb instanceof AuthViewBeanBase) {
        AuthViewBeanBase ab = (AuthViewBeanBase) vb;
        setValue("name", name + ab.getTileIndex());
    } else {
        setValue("name", name);
    }
}
Also used : AuthViewBeanBase(com.sun.identity.authentication.UI.AuthViewBeanBase) ViewBean(com.iplanet.jato.view.ViewBean)

Aggregations

ViewBean (com.iplanet.jato.view.ViewBean)3 AuthViewBeanBase (com.sun.identity.authentication.UI.AuthViewBeanBase)3 CompleteRequestException (com.iplanet.jato.CompleteRequestException)1 NonSyncStringBuffer (com.iplanet.jato.util.NonSyncStringBuffer)1 MissingResourceException (java.util.MissingResourceException)1 ResourceBundle (java.util.ResourceBundle)1