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


Java BeanModel.getWrappedObject方法代码示例

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


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

示例1: getWrappedObject

import freemarker.ext.beans.BeanModel; //导入方法依赖的package包/类
/**
* Gets BeanModel from FreeMarker context and returns the object that it wraps.
* @param varName the name of the variable in the FreeMarker context.
* @param env the FreeMarker Environment
*/
public static <T> T getWrappedObject(String varName, Environment env) {
    Object obj = null;
    try {
        obj = env.getVariable(varName);
        if (obj != null) {
            if (obj == TemplateModel.NOTHING) {
                obj = null;
            } else if (obj instanceof BeanModel) {
                BeanModel bean = (BeanModel) obj;
                obj = bean.getWrappedObject();
            } else if (obj instanceof SimpleScalar) {
                obj = obj.toString();
            }
        }
    } catch (TemplateModelException e) {
        Debug.logInfo(e.getMessage(), module);
    }
    return UtilGenerics.<T>cast(obj);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:25,代码来源:FreeMarkerWorker.java

示例2: exec

import freemarker.ext.beans.BeanModel; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public Object exec(List args) throws TemplateModelException {
    if (args == null || args.size() != 2)
        throw new TemplateModelException("Invalid number of arguements");
    if (!(args.get(0) instanceof TemplateScalarModel))
        throw new TemplateModelException("First argument not an instance of TemplateScalarModel");
    if (!(args.get(1) instanceof BeanModel) && !(args.get(1) instanceof TemplateNumberModel) && !(args.get(1) instanceof TemplateScalarModel))
        throw new TemplateModelException("Second argument not an instance of BeanModel nor TemplateNumberModel nor TemplateScalarModel");

    Environment env = Environment.getCurrentEnvironment();
    BeanModel req = (BeanModel)env.getVariable("request");
    HttpServletRequest request = (HttpServletRequest) req.getWrappedObject();

    String name = ((TemplateScalarModel) args.get(0)).getAsString();
    Object value = null;
    if (args.get(1) instanceof TemplateScalarModel)
        value = ((TemplateScalarModel) args.get(1)).getAsString();
    if (args.get(1) instanceof TemplateNumberModel)
        value = ((TemplateNumberModel) args.get(1)).getAsNumber();
    if (args.get(1) instanceof BeanModel)
        value = ((BeanModel) args.get(1)).getWrappedObject();

    request.setAttribute(name, value);
    return new SimpleScalar("");
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:26,代码来源:SetRequestAttributeMethod.java

示例3: exec

import freemarker.ext.beans.BeanModel; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public Object exec(List args) throws TemplateModelException {
    if (args == null || args.size() != 2)
        throw new TemplateModelException("Invalid number of arguements");
    if (!(args.get(0) instanceof TemplateScalarModel))
        throw new TemplateModelException("First argument not an instance of TemplateScalarModel");
    if (!(args.get(1) instanceof BeanModel) && !(args.get(1) instanceof TemplateNumberModel) && !(args.get(1) instanceof TemplateScalarModel))
        throw new TemplateModelException("Second argument not an instance of BeanModel nor TemplateNumberModel nor TemplateScalarModel");

    Environment env = Environment.getCurrentEnvironment();
    BeanModel req = (BeanModel)env.getVariable("context");
    Map context = (Map) req.getWrappedObject();

    String name = ((TemplateScalarModel) args.get(0)).getAsString();
    Object value = null;
    if (args.get(1) instanceof TemplateScalarModel)
        value = ((TemplateScalarModel) args.get(1)).getAsString();
    if (args.get(1) instanceof TemplateNumberModel)
        value = ((TemplateNumberModel) args.get(1)).getAsNumber();
    if (args.get(1) instanceof BeanModel)
        value = ((BeanModel) args.get(1)).getWrappedObject();

    context.put(name, value);
    return new SimpleScalar("");
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:26,代码来源:SetContextFieldTransform.java

示例4: exec

import freemarker.ext.beans.BeanModel; //导入方法依赖的package包/类
/**
 * @see freemarker.template.TemplateMethodModel#exec(java.util.List)
 */
public Object exec(List args) throws TemplateModelException
{
    int result = 0;
    
    if (args.size() == 2)
    {
        // arg 0 must be a wrapped TemplateNode object
        BeanModel arg0 = (BeanModel)args.get(0);
        
        // arg 1 can be either wrapped QName object or a String 
        String arg1String = null;
        Object arg1 = args.get(1);
        if (arg1 instanceof BeanModel)
        {
            arg1String = ((BeanModel)arg1).getWrappedObject().toString();
        }
        else if (arg1 instanceof TemplateScalarModel)
        {
            arg1String = ((TemplateScalarModel)arg1).getAsString();
        }
        if (arg0.getWrappedObject() instanceof TemplateNode)
        {
            // test to see if this node has the aspect
            if ( ((TemplateNode)arg0.getWrappedObject()).hasAspect(arg1String) )
            {
                result = 1;
            }
        }
    }
    
    return Integer.valueOf(result);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:HasAspectMethod.java

示例5: exec

import freemarker.ext.beans.BeanModel; //导入方法依赖的package包/类
/**
 * @see freemarker.template.TemplateMethodModel#exec(java.util.List)
 */
public Object exec(List args) throws TemplateModelException
{
    int result = 0;
    
    if (args.size() == 2)
    {
        // arg 0 must be a wrapped TemplateNode object
        BeanModel arg0 = (BeanModel)args.get(0);
        
        // arg 1 must be a String permission name
        String permission;
        Object arg1 = args.get(1);
        if (arg1 instanceof TemplateScalarModel)
        {
            permission = ((TemplateScalarModel)arg1).getAsString();
            
            if (arg0.getWrappedObject() instanceof TemplateNode)
            {
                // test to see if this node has the permission
                if ( ((TemplateNode)arg0.getWrappedObject()).hasPermission(permission) )
                {
                    result = 1;
                }
            }
        }
    }
    
    return Integer.valueOf(result);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:HasPermissionMethod.java

示例6: exec

import freemarker.ext.beans.BeanModel; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public Object exec(List args) throws TemplateModelException {
    if (args == null || args.size() != 2)
        throw new TemplateModelException("Invalid number of arguements");
    if (!(args.get(0) instanceof TemplateScalarModel))
        throw new TemplateModelException("First argument not an instance of TemplateScalarModel");
    // SCIPIO: This is too limiting...
    //if (!(args.get(1) instanceof BeanModel) && !(args.get(1) instanceof TemplateNumberModel) && !(args.get(1) instanceof TemplateScalarModel))
    //    throw new TemplateModelException("Second argument not an instance of BeanModel nor TemplateNumberModel nor TemplateScalarModel");

    Environment env = FreeMarkerWorker.getCurrentEnvironment();
    BeanModel req = (BeanModel)env.getVariable("request");
    HttpServletRequest request = (HttpServletRequest) req.getWrappedObject();

    // SCIPIO: name should not be escaped
    //String name = ((TemplateScalarModel) args.get(0)).getAsString();
    String name = LangFtlUtil.getAsStringNonEscaping(((TemplateScalarModel) args.get(0)));
    Object valueModel = args.get(1);
    Object value = null;
    // SCIPIO: Let DeepUnwrap handle this...
    //if (args.get(1) instanceof TemplateScalarModel)
    //    value = ((TemplateScalarModel) args.get(1)).getAsString();
    //if (args.get(1) instanceof TemplateNumberModel)
    //    value = ((TemplateNumberModel) args.get(1)).getAsNumber();
    //if (args.get(1) instanceof BeanModel)
    //    value = ((BeanModel) args.get(1)).getWrappedObject();
    // SCIPIO: NOTE: Unlike this above, this call will avoid the auto-escaping as implemented by Ofbiz (sensitive to DeepUnwrap implementation)
    value = LangFtlUtil.unwrapAlwaysUnlessNull(valueModel);
    
    request.setAttribute(name, value);
    return new SimpleScalar("");
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:33,代码来源:SetRequestAttributeMethod.java

示例7: exec

import freemarker.ext.beans.BeanModel; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public Object exec(List args) throws TemplateModelException {
    if (args == null || args.size() != 2)
        throw new TemplateModelException("Invalid number of arguements");
    if (!(args.get(0) instanceof TemplateScalarModel))
        throw new TemplateModelException("First argument not an instance of TemplateScalarModel");
    // SCIPIO: This is too limiting...
    //if (!(args.get(1) instanceof BeanModel) && !(args.get(1) instanceof TemplateNumberModel) && !(args.get(1) instanceof TemplateScalarModel))
    //    throw new TemplateModelException("Second argument not an instance of BeanModel nor TemplateNumberModel nor TemplateScalarModel");

    Environment env = FreeMarkerWorker.getCurrentEnvironment();
    BeanModel req = (BeanModel)env.getVariable("context");
    Map context = (Map) req.getWrappedObject();

    // SCIPIO: name should not be escaped
    //String name = ((TemplateScalarModel) args.get(0)).getAsString();
    String name = LangFtlUtil.getAsStringNonEscaping(((TemplateScalarModel) args.get(0)));
    Object valueModel = args.get(1);
    Object value = null;
    // SCIPIO: Let DeepUnwrap handle this...
    //if (args.get(1) instanceof TemplateNumberModel)
    //    value = ((TemplateNumberModel) args.get(1)).getAsNumber();
    //if (args.get(1) instanceof BeanModel)
    //    value = ((BeanModel) args.get(1)).getWrappedObject();
    // SCIPIO: NOTE: Unlike this above, this call will avoid the auto-escaping as implemented by Ofbiz (sensitive to DeepUnwrap implementation)
    value = LangFtlUtil.unwrapAlwaysUnlessNull(valueModel);
            
    context.put(name, value);
    return new SimpleScalar("");
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:31,代码来源:SetContextFieldTransform.java

示例8: exec

import freemarker.ext.beans.BeanModel; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Object exec(List args) throws TemplateModelException {
    if (args == null || args.size() != 2)
        throw new TemplateModelException("Invalid number of arguments");
    if (!(args.get(0) instanceof TemplateScalarModel))
        throw new TemplateModelException("First argument not an instance of TemplateScalarModel");
    // SCIPIO: This is too limiting
    //if (!(args.get(1) instanceof BeanModel) && !(args.get(1) instanceof TemplateNumberModel) && !(args.get(1) instanceof TemplateScalarModel))
    //    throw new TemplateModelException("Second argument not an instance of BeanModel nor TemplateNumberModel nor TemplateScalarModel");

    Environment env = FreeMarkerWorker.getCurrentEnvironment();
    BeanModel globalContextModel = (BeanModel) env.getVariable("globalContext");
    Map<String, Object> globalContext = (Map<String, Object>) globalContextModel.getWrappedObject();

    String name = LangFtlUtil.getAsStringNonEscaping(((TemplateScalarModel) args.get(0)));
    Object valueModel = args.get(1);
    Object value = null;
    // SCIPIO: Let DeepUnwrap handle this...
    //if (args.get(1) instanceof TemplateScalarModel)
    //    value = ((TemplateScalarModel) args.get(1)).getAsString();
    //if (args.get(1) instanceof TemplateNumberModel)
    //    value = ((TemplateNumberModel) args.get(1)).getAsNumber();
    //if (args.get(1) instanceof BeanModel)
    //    value = ((BeanModel) args.get(1)).getWrappedObject();
    // SCIPIO: NOTE: Unlike this above, this call will avoid the auto-escaping as implemented by Ofbiz (sensitive to DeepUnwrap implementation)
    value = LangFtlUtil.unwrapAlwaysUnlessNull(valueModel);
    
    globalContext.put(name, value);
    return new SimpleScalar("");
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:32,代码来源:SetGlobalContextFieldMethod.java

示例9: getWriter

import freemarker.ext.beans.BeanModel; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public Writer getWriter(final Writer out, final Map args) throws TemplateModelException, IOException {
    final StringBuilder buf = new StringBuilder();
    return new Writer(out) {

        @Override
        public void write(char[] cbuf, int off, int len) throws IOException {
            buf.append(cbuf, off, len);
        }

        @Override
        public void flush() throws IOException {
            out.flush();
        }

        @Override
        public void close() throws IOException {
            try {
                Environment env = Environment.getCurrentEnvironment();
                BeanModel req = (BeanModel) env.getVariable("request");
                if (req != null) {
                    String productId = getStringArg(args, "productId");
                    String currentCategoryId = getStringArg(args, "currentCategoryId");
                    String previousCategoryId = getStringArg(args, "previousCategoryId");
                    HttpServletRequest request = (HttpServletRequest) req.getWrappedObject();
                    String catalogUrl = CatalogUrlServlet.makeCatalogUrl(request, productId, currentCategoryId, previousCategoryId);
                    out.write(catalogUrl);
                }
            } catch (TemplateModelException e) {
                throw new IOException(e.getMessage());
            }
        }
    };
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:36,代码来源:OfbizCatalogUrlTransform.java

示例10: execute

import freemarker.ext.beans.BeanModel; //导入方法依赖的package包/类
@Override
public void execute(Environment env, Map args, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException {
    Map<String, TemplateModel> params = UtilGenerics.checkMap(args);
    String productId = (String) DeepUnwrap.unwrap(params.get("productId"));
    String currentCategoryId = (String) DeepUnwrap.unwrap(params.get("currentCategoryId"));
    String previousCategoryId = (String) DeepUnwrap.unwrap(params.get("previousCategoryId"));

    BeanModel req = (BeanModel) env.getVariable("request");

    if (req != null) {
        HttpServletRequest request = (HttpServletRequest) req.getWrappedObject();
        env.getOut().write(CatalogUrlServlet.makeCatalogUrl(request, productId, currentCategoryId, previousCategoryId));
    }
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:15,代码来源:CatalogUrlDirective.java

示例11: getWriter

import freemarker.ext.beans.BeanModel; //导入方法依赖的package包/类
public Writer getWriter(final Writer writer, Map args) throws TemplateModelException, IOException {
    Environment env = Environment.getCurrentEnvironment();
    BeanModel req = (BeanModel) env.getVariable("request");
    BeanModel jpr = (BeanModel) env.getVariable("pages");

    final HttpServletRequest request = (HttpServletRequest) req.getWrappedObject();
    final ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
    final RepositoryWrapper wrapper = (RepositoryWrapper) jpr.getWrappedObject();
    final String contextName = ctx.getServletContextName();
    final long expireTime = this.getExpireTime(args);
    final String include = this.getInclude(args);

    return new Writer(writer) {
        public void write(char cbuf[], int off, int len) throws IOException {
            writer.write(cbuf, off, len);
        }

        public void flush() throws IOException {
            writer.flush();
        }

        public void close() throws IOException {
            Debug.logInfo("Checking for cached content (" + contextName + "." + include + ")", module);
            String content = (String) pageCache.get(contextName + "." + include);
            if (content == null) {
                content =  wrapper.get(include);
                pageCache.put(contextName + "." + include, content, expireTime);
                Debug.logInfo("No content found; cached result for - " + expireTime, module);
            }
            if (content != null) {
                writer.write(content);
            }
        }
    };
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:36,代码来源:JpCacheIncludeTransform.java

示例12: getIterable

import freemarker.ext.beans.BeanModel; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private Iterable<Object> getIterable(Object arg) throws TemplateModelException
{
    if (arg instanceof BeanModel)
    {
        BeanModel beanModel = (BeanModel) arg;
        return (Iterable<Object>) beanModel.getWrappedObject();
    }
    else if (arg instanceof SimpleSequence)
    {
        SimpleSequence simpleSequence = (SimpleSequence) arg;
        return (Iterable<Object>) simpleSequence.toList();
    }
    else if (arg instanceof DefaultIterableAdapter)
    {
        DefaultIterableAdapter adapter = (DefaultIterableAdapter) arg;
        return (Iterable<Object>) adapter.getAdaptedObject(Iterable.class);
    }
    else if (arg instanceof DefaultListAdapter)
    {
        DefaultListAdapter defaultListAdapter = (DefaultListAdapter) arg;
        return (Iterable<Object>) defaultListAdapter.getWrappedObject();
    }
    else
    {
        throw new WindupException("Unrecognized type passed to: " + getMethodName() + ": "
                    + arg.getClass().getCanonicalName());
    }
}
 
开发者ID:windup,项目名称:windup,代码行数:30,代码来源:SortFilesByPathMethod.java

示例13: getWriter

import freemarker.ext.beans.BeanModel; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public Writer getWriter(final Writer out, final Map args)
        throws TemplateModelException, IOException {
    final StringBuilder buf = new StringBuilder();
    return new Writer(out) {
        
        @Override
        public void write(char[] cbuf, int off, int len) throws IOException {
            buf.append(cbuf, off, len);
        }
        
        @Override
        public void flush() throws IOException {
            out.flush();
        }
        
        @Override
        public void close() throws IOException {
            try {
                Environment env = FreeMarkerWorker.getCurrentEnvironment();
                BeanModel req = (BeanModel) env.getVariable("request");
                BeanModel res = (BeanModel) env.getVariable("response");
                if (req != null) {
                    final String escapeAs = TransformUtil.getStringArg(args, "escapeAs"); // SCIPIO: new
                    boolean rawParamsDefault = UtilValidate.isNotEmpty(escapeAs) ? true : false; // SCIPIO: if we're post-escaping, we can assume we should get rawParams
                    boolean rawParams = TransformUtil.getBooleanArg(args, "rawParams", rawParamsDefault); // SCIPIO: new
                    boolean strictDefault = UtilValidate.isNotEmpty(escapeAs) ? true : false; // SCIPIO: if we're post-escaping, we can assume we want strict handling
                    final Boolean strict = TransformUtil.getBooleanArg(args, "strict", strictDefault); // SCIPIO: new
                    
                    String contentId = TransformUtil.getStringArg(args, "contentId", rawParams);
                    String viewContent = TransformUtil.getStringArg(args, "viewContent", rawParams);
                    Boolean urlDecode = TransformUtil.getBooleanArg(args, "urlDecode");
                    HttpServletRequest request = (HttpServletRequest) req.getWrappedObject();
                    HttpServletResponse response = null;
                    if (res != null) {
                        response = (HttpServletResponse) res.getWrappedObject();
                    }
                    String url = "";
                    if (UtilValidate.isNotEmpty(contentId)) {
                        url = ContentUrlFilter.makeContentAltUrl(request, response, contentId, viewContent, urlDecode);
                    }
                    out.write(TransformUtil.escapeGeneratedUrl(url, escapeAs, strict, env));
                }
            } catch (TemplateModelException e) {
                throw new IOException(e.getMessage());
            }
        }
    };
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:51,代码来源:OfbizContentAltUrlTransforms.java

示例14: getWriter

import freemarker.ext.beans.BeanModel; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public Writer getWriter(final Writer out, Map args) {
    final StringBuilder buf = new StringBuilder();

    final Double amount = OfbizAmountTransform.getAmount(args, "amount");
    final String locale = OfbizAmountTransform.getArg(args, "locale");
    final String format = OfbizAmountTransform.getArg(args, "format");

    return new Writer(out) {
        @Override
        public void write(char cbuf[], int off, int len) {
            buf.append(cbuf, off, len);
        }

        @Override
        public void flush() throws IOException {
            out.flush();
        }

        @Override
        public void close() throws IOException {
            try {
                if (Debug.verboseOn()) Debug.logVerbose("parms: " + amount + " " + format + " " + locale, module);
                Locale localeObj = null;
                if (locale.length() < 1) {
                    // Load the locale from the session
                    Environment env = FreeMarkerWorker.getCurrentEnvironment();
                    BeanModel req = (BeanModel) env.getVariable("request");
                    if (req != null) {
                        HttpServletRequest request = (HttpServletRequest) req.getWrappedObject();
                        localeObj = UtilHttp.getLocale(request);
                    } else {
                        localeObj = env.getLocale();
                    }
                } else {
                    localeObj = new Locale(locale);
                }
                if (format.equals(OfbizAmountTransform.SPELLED_OUT_FORMAT)) {
                    out.write(UtilFormatOut.formatSpelledOutAmount(amount.doubleValue(), localeObj));
                } else {
                    out.write(UtilFormatOut.formatAmount(amount.doubleValue(), localeObj));
                }
            } catch (TemplateModelException e) {
                throw new IOException(e.getMessage());
            }
        }
    };
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:49,代码来源:OfbizAmountTransform.java

示例15: getWriter

import freemarker.ext.beans.BeanModel; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public Writer getWriter(final Writer out, Map args) throws TemplateModelException {
    final StringBuilder buf = new StringBuilder();
    final String escapeAs = TransformUtil.getStringArg(args, "escapeAs"); // SCIPIO: new
    boolean rawParamsDefault = UtilValidate.isNotEmpty(escapeAs) ? true : false; // SCIPIO: if we're post-escaping, we can assume we should get rawParams
    final boolean rawParams = TransformUtil.getBooleanArg(args, "rawParams", rawParamsDefault); // SCIPIO: new
    boolean strictDefault = UtilValidate.isNotEmpty(escapeAs) ? true : false; // SCIPIO: if we're post-escaping, we can assume we want strict handling
    final Boolean strict = TransformUtil.getBooleanArg(args, "strict", strictDefault); // SCIPIO: new
    
    final String imgSize = TransformUtil.getStringArg(args, "variant", rawParams);
    final String uri = TransformUtil.getStringArg(args, "uri", rawParams); // SCIPIO: uri as alternative to nested
    final Boolean urlDecode = TransformUtil.getBooleanArg(args, "urlDecode"); // SCIPIO: new
    final Object ctxPrefixObj = TransformUtil.getBooleanOrStringArg(args, "ctxPrefix", null, false, rawParams); // SCIPIO: new
    
    // SCIPIO: autoVariant params: added 2017-08-08
    final String autoVariant = TransformUtil.getStringNonEscapingArg(args, "autoVariant");
    final Integer imgWidth = TransformUtil.getIntegerArg(args, "width");
    final Integer imgHeight = TransformUtil.getIntegerArg(args, "height");
    final String imgVariantCfg = TransformUtil.getStringNonEscapingArg(args, "variantCfg");
    
    return new Writer(out) {
        @Override
        public void write(char cbuf[], int off, int len) {
            buf.append(cbuf, off, len);
        }

        @Override
        public void flush() throws IOException {
            out.flush();
        }

        @Override
        public void close() throws IOException {
            try {
                Environment env = FreeMarkerWorker.getCurrentEnvironment();
                BeanModel req = (BeanModel)env.getVariable("request");
                HttpServletRequest request = req == null ? null : (HttpServletRequest) req.getWrappedObject();

                // SCIPIO: delegated to our new method
                BeanModel resp = (BeanModel) env.getVariable("response");
                HttpServletResponse response = (resp == null) ? null : (HttpServletResponse) resp.getWrappedObject();
                String ctxPrefix = getContentPathPrefix(ctxPrefixObj, rawParams, env); // SCIPIO: new
                String url = ContentRequestWorker.makeContentLink(request, response, UtilValidate.isNotEmpty(uri) ? uri : buf.toString(), imgSize, null, 
                        ctxPrefix, urlDecode, strict, autoVariant, imgWidth, imgHeight, imgVariantCfg);
                        
                out.write(TransformUtil.escapeGeneratedUrl(url, escapeAs, strict, env));
            } catch (TemplateModelException e) {
                throw new IOException(e.getMessage());
            }
        }
    };
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:53,代码来源:OfbizContentTransform.java


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