package weber_4_0_sample.org.itscool.rss;

import org.itscool.commons.document.RequestToXmlDocument;
import org.itscool.weber.action.Action;
import org.itscool.weber.action.ActionBucket;
import org.itscool.weber.controller.Globals;

public class RssSampleAction extends Action {
    public static final String LINE=System.getProperty("line.separator");
    
    public String doExecute(ActionBucket bucket)throws Exception{
        String url = (String)this.getParameter("query");
        System.out.println(url);
        
        //指定したURLに対してリクエストを発行し、
        //受信結果をXMLで取得しています
        RequestToXmlDocument rssDocument = new RequestToXmlDocument(url);
        System.out.println(rssDocument.parseText("Shift_JIS"));
        
        bucket.printXml(rssDocument.getDocument());
        
        return Globals.RET_NOFORWARD;
    }
}