Search in sources :

Example 1 with GroovyMarkupViewResolver

use of org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver in project spring-framework by spring-projects.

the class ViewResolverRegistryTests method groovyMarkupDefaultValues.

@Test
public void groovyMarkupDefaultValues() {
    this.registry.groovy();
    GroovyMarkupViewResolver resolver = checkAndGetResolver(GroovyMarkupViewResolver.class);
    checkPropertyValues(resolver, "prefix", "", "suffix", ".tpl");
}
Also used : GroovyMarkupViewResolver(org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver) Test(org.junit.Test)

Example 2 with GroovyMarkupViewResolver

use of org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver in project spring-framework by spring-projects.

the class ViewResolverRegistryTests method groovyMarkup.

@Test
public void groovyMarkup() {
    this.registry.groovy().prefix("/").suffix(".groovy").cache(true);
    GroovyMarkupViewResolver resolver = checkAndGetResolver(GroovyMarkupViewResolver.class);
    checkPropertyValues(resolver, "prefix", "/", "suffix", ".groovy", "cacheLimit", 1024);
}
Also used : GroovyMarkupViewResolver(org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver) Test(org.junit.Test)

Example 3 with GroovyMarkupViewResolver

use of org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver in project spring-boot by spring-projects.

the class GroovyTemplateAutoConfigurationTests method render.

private MockHttpServletResponse render(String viewName, Locale locale) throws Exception {
    LocaleContextHolder.setLocale(locale);
    GroovyMarkupViewResolver resolver = this.context.getBean(GroovyMarkupViewResolver.class);
    View view = resolver.resolveViewName(viewName, locale);
    assertThat(view).isNotNull();
    HttpServletRequest request = new MockHttpServletRequest();
    request.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE, this.context);
    MockHttpServletResponse response = new MockHttpServletResponse();
    view.render(null, request, response);
    return response;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) GroovyMarkupViewResolver(org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) View(org.springframework.web.servlet.View) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse)

Aggregations

GroovyMarkupViewResolver (org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver)3 Test (org.junit.Test)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)1 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)1 View (org.springframework.web.servlet.View)1