All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.skyscreamer.yoga.springmvc.view.YogaSpringView Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package org.skyscreamer.yoga.springmvc.view;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.skyscreamer.yoga.view.AbstractYogaView;
import org.springframework.web.servlet.View;

/**
 * This MessageConvert gets the selector from the request. Children do the
 * interesting output. NOTE: you have to put in a
 * org.skyscreamer.yoga.springmvc.view.RequestHolder in your web.xml file
 * 
 * @author Solomon Duskis
 */
public class YogaSpringView implements View
{
    private AbstractYogaView yogaView;
    
    public void setYogaView( AbstractYogaView yogaView )
    {
        this.yogaView = yogaView;
    }

    @Override
    public void render( Map model, HttpServletRequest request, HttpServletResponse response )
            throws Exception
    {
        response.setContentType( getContentType() );
        yogaView.render( request, response, model.isEmpty() ? null : model.values().iterator().next(), response.getOutputStream() );
    }

    @Override
    public String getContentType()
    {
        return yogaView.getContentType();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy