Package org.thymeleaf.context

Examples of org.thymeleaf.context.IContext



    public static String processUrl(
            final Configuration configuration, final IProcessingContext processingContext, final String url) {

        final IContext context = processingContext.getContext();
        if (!canApply || !(context instanceof IWebContext)) {
            return url;
        }

        final RequestContext requestContext =
                (RequestContext) context.getVariables().get(SpringContextVariableNames.SPRING_REQUEST_CONTEXT);
        if (requestContext == null) {
            return url;
        }

        if (spring31Delegate != null) {
View Full Code Here


    public static String processAction(
            final Configuration configuration, final IProcessingContext processingContext,
            final String action, final String httpMethod) {

        final IContext context = processingContext.getContext();
        if (!canApply || !(context instanceof IWebContext)) {
            return action;
        }

        final RequestContext requestContext =
                (RequestContext) context.getVariables().get(SpringContextVariableNames.SPRING_REQUEST_CONTEXT);
        if (requestContext == null) {
            return action;
        }

        if (spring4Delegate != null) {
View Full Code Here

    public static String processFormFieldValue(
            final Configuration configuration, final IProcessingContext processingContext,
            final String name, final String value, final String type) {

        final IContext context = processingContext.getContext();
        if (!canApply || !(context instanceof IWebContext)) {
            return value;
        }

        final RequestContext requestContext =
                (RequestContext) context.getVariables().get(SpringContextVariableNames.SPRING_REQUEST_CONTEXT);
        if (requestContext == null) {
            return value;
        }

        if (spring4Delegate != null) {
View Full Code Here


    public static Map<String, String> getExtraHiddenFields(
            final Configuration configuration, final IProcessingContext processingContext) {

        final IContext context = processingContext.getContext();
        if (!canApply || !(context instanceof IWebContext)) {
            return null;
        }

        final RequestContext requestContext =
                (RequestContext) context.getVariables().get(SpringContextVariableNames.SPRING_REQUEST_CONTEXT);
        if (requestContext == null) {
            return null;
        }

        if (spring4Delegate != null) {
View Full Code Here


    public static String processUrl(
            final Configuration configuration, final IProcessingContext processingContext, final String url) {

        final IContext context = processingContext.getContext();
        if (!canApply || !(context instanceof IWebContext)) {
            return url;
        }

        final RequestContext requestContext =
                (RequestContext) context.getVariables().get(SpringContextVariableNames.SPRING_REQUEST_CONTEXT);
        if (requestContext == null) {
            return url;
        }

        if (spring4Delegate != null) {
View Full Code Here

     * @param processingContext the processing context being used
     */
    public Themes(final IProcessingContext processingContext) {

        super();
        final IContext context = processingContext.getContext();
        this.locale = context.getLocale();
        final RequestContext requestContext = (RequestContext) processingContext.getContext().getVariables()
            .get(SpringContextVariableNames.SPRING_REQUEST_CONTEXT);
        this.theme = requestContext != null ? requestContext.getTheme() : null;
    }
View Full Code Here

     * @param processingContext the processing context being used
     */
    public Themes(final IProcessingContext processingContext) {

        super();
        final IContext context = processingContext.getContext();
        this.locale = context.getLocale();
        final RequestContext requestContext = (RequestContext) processingContext.getContext().getVariables()
            .get(SpringContextVariableNames.SPRING_REQUEST_CONTEXT);
        this.theme = requestContext != null ? requestContext.getTheme() : null;
    }
View Full Code Here

    }

    @Test
    public void simple()
    {
        IContext context = new Context();
        context.getVariables().put("titulo", "Mi título en la plantilla");

        String result = templateEngine.process("simple", context);

        assertTrue(result.contains("<h1>Mi título en la plantilla</h1>"));
    }
View Full Code Here

    public void bean()
    {
        Dato dato = new Dato();
        dato.setTitulo("Mi título en la plantilla");

        IContext context = new Context();
        context.getVariables().put("dato", dato);

        String result = templateEngine.process("bean", context);

        assertTrue(result.contains("<h1>Mi título en la plantilla</h1>"));
    }
View Full Code Here

    {
        Producto producto = new Producto();
        producto.setId(1);
        producto.setNombre("Producto 1");

        IContext context = new Context();
        context.getVariables().put("productos", Collections.singletonList(producto));

        String result = templateEngine.process("colecciones", context);
        System.out.println(result);
        assertTrue(result.contains("<td>Producto 1</td>"));
    }
View Full Code Here

TOP

Related Classes of org.thymeleaf.context.IContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.