Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package pl.matisoft.soy;
  
  import org.slf4j.Logger;
 
 import java.util.Map;

Created with IntelliJ IDEA. User: mati Date: 19/06/2013 Time: 23:32
 
 public class SoyView implements ViewBeanNameAware {
 
     private static final Logger logger = LoggerFactory.getLogger(SoyView.class);

    
Compiled soy binary objects
 
     protected Optional<SoyTofucompiledTemplates = Optional.absent();

    
name of the template with namespace, .e.g. ajax_macros.show_customer_data
 
     protected String templateName;
 
 
     protected ModelAdjuster modelAdjuster = new EmptyModelAdjuster();
 
 
     protected LocaleProvider localeProvider = new EmptyLocaleProvider();
 
 
     private String contentType = "text/html; charset=" + .;
 
     private String beanName = "";
 
     public SoyView() {
     }
 
     @Override
     public void render(Map<String, ? extends ObjectmodelHttpServletRequest requestHttpServletResponse responsethrows Exception {
         Preconditions.checkNotNull("templateName cannot be null");
         Preconditions.checkNotNull("templateRenderer cannot be null");
         Preconditions.checkNotNull("modelAdjuster cannot be null");
         Preconditions.checkNotNull("globalModelResolver cannot be null");
         Preconditions.checkNotNull("localeProvider cannot be null");
         Preconditions.checkNotNull("soyMsgBundleResolver cannot be null");
 
         .debug("SoyView rendering with beanName:{} and model:{}"model);
 
         if (!.isPresent()) {
             throw new IOException("Unable to render - compiled templates are empty!");
         }
 
         final Object adjustedModel = .adjust(model);
 
         final RenderRequest renderRequest = new RenderRequest.Builder()
                 .compiledTemplates()
                 .templateName()
                 .model(adjustedModel)
                 .request(request)
                 .response(response)
                 .globalRuntimeModel(.resolveData(requestresponsemodel))
                 .soyMsgBundle(.resolve(.resolveLocale(request)))
                 .soyView(this)
                 .build();
 
         .render(renderRequest);
     }
 
     @Override
     public String getContentType() {
         return ;
     }
 
     public void setContentType(String contentType) {
         this. = contentType;
     }
    @Override
    public void setBeanName(String beanName) {
        this. = beanName;
    }
    public String getBeanName() {
        return ;
    }
    public void setTemplateName(String templateName) {
        this. = templateName;
    }
    public void setCompiledTemplates(Optional<SoyTofucompiledTemplates) {
        this. = compiledTemplates;
    }
    public void setTemplateRenderer(TemplateRenderer templateRenderer) {
        this. = templateRenderer;
    }
    public void setModelAdjuster(ModelAdjuster modelAdjuster) {
        this. = modelAdjuster;
    }
    public void setGlobalRuntimeModelResolver(GlobalRuntimeModelResolver globalRuntimeModelResolver) {
        this. = globalRuntimeModelResolver;
    }
    public void setLocaleProvider(LocaleProvider localeProvider) {
        this. = localeProvider;
    }
    public void setSoyMsgBundleResolver(SoyMsgBundleResolver soyMsgBundleResolver) {
        this. = soyMsgBundleResolver;
    }
New to GrepCode? Check out our FAQ X