当前位置: 首页>>代码示例>>Java>>正文


Java VelocityContext.get方法代码示例

本文整理汇总了Java中org.apache.velocity.VelocityContext.get方法的典型用法代码示例。如果您正苦于以下问题:Java VelocityContext.get方法的具体用法?Java VelocityContext.get怎么用?Java VelocityContext.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.velocity.VelocityContext的用法示例。


在下文中一共展示了VelocityContext.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildFormDataToSign

import org.apache.velocity.VelocityContext; //导入方法依赖的package包/类
/**
 * Build the form control data string over which the signature is computed.
 * 
 * @param velocityContext the Velocity context which is already populated with the values for SAML message and relay
 *            state
 * @param messageContext  the SAML message context being processed
 * @param sigAlgURI the signature algorithm URI
 * 
 * @return the form control data string for signature computation
 */
protected String buildFormDataToSign(VelocityContext velocityContext, SAMLMessageContext messageContext, String sigAlgURI) {
    StringBuilder builder = new StringBuilder();

    boolean isRequest = false;
    if (velocityContext.get("SAMLRequest") != null) {
        isRequest = true;
    }

    String msgB64;
    if (isRequest) {
        msgB64 = (String) velocityContext.get("SAMLRequest");
    } else {
        msgB64 = (String) velocityContext.get("SAMLResponse");
    }

    String msg = null;
    try {
        msg = new String(Base64.decode(msgB64), "UTF-8");
    } catch (UnsupportedEncodingException e) {
        // All JVM's required to support UTF-8
    }

    if (isRequest) {
        builder.append("SAMLRequest=" + msg);
    } else {
        builder.append("SAMLResponse=" + msg);
    }

    if (messageContext.getRelayState() != null) {
        builder.append("&RelayState=" + messageContext.getRelayState());
    }

    builder.append("&SigAlg=" + sigAlgURI);

    return builder.toString();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:47,代码来源:HTTPPostSimpleSignEncoder.java

示例2: formatMailMessage

import org.apache.velocity.VelocityContext; //导入方法依赖的package包/类
public static MailMessage formatMailMessage(long userId, Event event, Position position) {
    VelocityContext velocityContext = prepareContext(userId, event, position);
    StringWriter writer = new StringWriter();
    getTemplate(event, Context.getConfig().getString("mail.templatesPath", "mail") + "/")
            .merge(velocityContext, writer);
    return new MailMessage((String) velocityContext.get("subject"), writer.toString());
}
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:8,代码来源:NotificationFormatter.java


注:本文中的org.apache.velocity.VelocityContext.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。