Examples of IWebContext


Examples of org.thymeleaf.context.IWebContext

            throw new ConfigurationException(
                    "Thymeleaf execution context is not a web context (implementation of " +
                    IWebContext.class.getName() + ". Spring Security integration can only be used in " +
                    "web environements.");
        }
        final IWebContext webContext = (IWebContext) context;
       
        final HttpServletRequest request = webContext.getHttpServletRequest();
        final HttpServletResponse response = webContext.getHttpServletResponse();
        final ServletContext servletContext = webContext.getServletContext();
       
        final Authentication authentication = AuthUtils.getAuthenticationObject();

        if (authentication == null) {
            return false;
View Full Code Here

Examples of org.thymeleaf.context.IWebContext

            throw new ConfigurationException(
                    "Thymeleaf execution context is not a web context (implementation of " +
                    IWebContext.class.getName() + ". Spring Security integration can only be used in " +
                    "web environements.");
        }
        final IWebContext webContext = (IWebContext) context;
        final ServletContext servletContext = webContext.getServletContext();
       
        final Authentication authentication = AuthUtils.getAuthenticationObject();
        if (authentication == null) {
            return false;
        }
View Full Code Here

Examples of org.thymeleaf.context.IWebContext

   
    public Map<String, Object> getAdditionalExpressionObjects(
            final IProcessingContext processingContext) {
       
        final IContext context = processingContext.getContext();
        final IWebContext webContext =
                (context instanceof IWebContext? (IWebContext)context : null);
       
        final Map<String,Object> objects = new HashMap<String, Object>(3, 1.0f);
       
        /*
         * Create the #authentication and #authorization expression objects
         */
        if (webContext != null) {
           
            final HttpServletRequest request = webContext.getHttpServletRequest();
            final HttpServletResponse response = webContext.getHttpServletResponse();
            final ServletContext servletContext = webContext.getServletContext();
           
            if (request != null && response != null && servletContext != null) {
               
                final Authentication authentication = AuthUtils.getAuthenticationObject();
                final Authorization authorization =
View Full Code Here

Examples of org.thymeleaf.context.IWebContext

            throw new ConfigurationException(
                    "Thymeleaf execution context is not a web context (implementation of " +
                    IWebContext.class.getName() + ". Spring Security integration can only be used in " +
                    "web environements.");
        }
        final IWebContext webContext = (IWebContext) context;
       
        final HttpServletRequest request = webContext.getHttpServletRequest();
        final ServletContext servletContext = webContext.getServletContext();
       
        final Authentication authentication = AuthUtils.getAuthenticationObject();

        if (authentication == null) {
            return false;
View Full Code Here

Examples of org.thymeleaf.context.IWebContext

        Map<String, Object> variables = new HashMap<>();
        variables.put("user", user);
        variables.put("baseUrl", request.getScheme() + "://" +   // "http" + "://
                                 request.getServerName() +       // "myhost"
                                 ":" + request.getServerPort());
        IWebContext context = new SpringWebContext(request, response, servletContext,
                locale, variables, applicationContext);
        return templateEngine.process("activationEmail", context);
    }
View Full Code Here

Examples of org.thymeleaf.context.IWebContext

        Map<String, Object> variables = new HashMap<>();
        variables.put("user", user);
        variables.put("baseUrl", request.getScheme() + "://" +   // "http" + "://
                                 request.getServerName() +       // "myhost"
                                 ":" + request.getServerPort());
        IWebContext context = new SpringWebContext(request, response, servletContext,
                locale, variables, applicationContext);
        return templateEngine.process("activationEmail", context);
    }
View Full Code Here

Examples of org.thymeleaf.context.IWebContext

        variables.put(CONTEXT_VARIABLE_NAME, context);
        variables.put(LOCALE_EVALUATION_VARIABLE_NAME, context.getLocale());

        if (context instanceof IWebContext) {
            final IWebContext webContext = (IWebContext) context;
            // This gives access to the HttpServletRequest and HttpSession objects, if they exist
            variables.put(
                    HTTP_SERVLET_REQUEST_VARIABLE_NAME, webContext.getHttpServletRequest());
            variables.put(
                    HTTP_SESSION_VARIABLE_NAME, webContext.getHttpSession());
        }

        final Object evaluationRoot = processingContext.getExpressionEvaluationRoot();

        /*
 
View Full Code Here

Examples of org.thymeleaf.context.IWebContext

        String numResultsVar = getAttributeValue(element, "numResultsVar", "numResults");
       
        String fieldFilters = element.getAttributeValue("fieldFilters");
        final String sorts = element.getAttributeValue("sorts");

        IWebContext context = (IWebContext) arguments.getContext();    
        HttpServletRequest request = context.getHttpServletRequest();  
        BroadleafRequestContext blcContext = BroadleafRequestContext.getBroadleafRequestContext();
       
        Map<String, Object> mvelParameters = buildMvelParameters(request, arguments, element);
        SandBox currentSandbox = blcContext.getSandBox();
View Full Code Here

Examples of org.thymeleaf.context.IWebContext

        /*
         * Context is web
         */
       
        final IWebContext webContext = (IWebContext) processingContext.getContext();
       
        final HttpServletRequest request = webContext.getHttpServletRequest();
        final HttpServletResponse response = webContext.getHttpServletResponse();

        String url = null;
       
        if (isLinkBaseContextRelative(linkBase)) {
           
View Full Code Here

Examples of org.thymeleaf.context.IWebContext

    public TemplateExecutor(
            final HttpServletRequest request, final HttpServletResponse response,
            final ServletContext servletContext, final MessageSource messageSource,
            final Locale locale, final ApplicationContext applicationContext,
            final ConversionService conversionService) {
        IWebContext context = new OfflineSpringWebContext(request, response, servletContext, applicationContext, conversionService);
        // Model attributes
        context.getVariables().put("product", DAO.loadProduct());
        context.getVariables().put("productList", DAO.loadAllProducts());
        context.getVariables().put("html", "This is an <em>HTML</em> text. <b>Enjoy yourself!</b>");
        context.getVariables().put("customer", DAO.loadCustomer());
        context.getVariables().put("customerName", "Dr. Julius Erwing");
        context.getVariables().put("customerList", DAO.loadAllCustomers());
        context.getVariables().put("genders", Gender.values());
        context.getVariables().put("paymentMethods", PaymentMethod.values());
        context.getVariables().put("price", DAO.loadAmount());
        context.getVariables().put("releaseDate", DAO.loadReleaseDate());
        context.getVariables().put("productId", 273);
        context.getVariables().put("productName", "Red-carpet");
        String templateMode = StandardTemplateModeHandlers.HTML5.getTemplateModeName();
        SpringMessageResolver messageResolver = new SpringMessageResolver();
        messageResolver.setMessageSource(messageSource);
        executor = new StaticTemplateExecutor(context, messageResolver, templateMode);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.