/*
 * $Id: ForwardResponse.java,v 1.3 2006/04/14 03:32:45 sugimotokenichi Exp $
 * Copyright (C) 2006 SUGIMOTO Ken-ichi
 * 作成日: 2006/03/17
 */
package feat2.impl;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;

import feat2.CommandContext;
import feat2.Response;
import feat2.config.ForwardConfig;

/**
 * HTTPリクエストのフォワード。
 * @author SUGIMOTO Ken-ichi
 */
public class ForwardResponse implements Response {

    private ForwardConfig config;


    public ForwardResponse(ForwardConfig config) {
        this.config = config;
    }


    public String output(CommandContext ctx)
            throws IOException, ServletException {

        RequestDispatcher rd = ctx.getServletContext().getRequestDispatcher(config.getPath());
        rd.forward(ctx.getRequest(), ctx.getResponse());

        return null;

    }

}
