Package su.mvc.util

Source Code of su.mvc.util.ImageBytesResult

package su.mvc.util;

import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Result;
import su.mvc.action.image.ImageAction;

public class ImageBytesResult  implements Result {

    public void execute(ActionInvocation invocation) throws Exception {

        ImageAction action = (ImageAction) invocation.getAction();
        HttpServletResponse response = ServletActionContext.getResponse();

        response.setContentType(action.getContentType());
        response.getOutputStream().write(action.getImageInByte());
        response.getOutputStream().flush();

    }

}
TOP

Related Classes of su.mvc.util.ImageBytesResult

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.