001    /*
002     * Copyright 1999-2001,2004 The Apache Software Foundation.
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    package org.apache.commons.latka.servlet;
018    
019    import java.io.IOException;
020    import java.io.PrintWriter;
021    
022    import java.net.URL;
023    
024    import javax.servlet.http.HttpServlet;
025    import javax.servlet.http.HttpServletRequest;
026    import javax.servlet.http.HttpServletResponse;
027    
028    import org.apache.commons.latka.Suite;
029    
030    /**
031     * A servlet to view the Latka Suite
032     *
033     * @author Morgan Delagrange
034     * @version $Id: ViewSuiteServlet.java 155424 2005-02-26 13:09:29Z dirkv $
035     */
036    public class ViewSuiteServlet extends HttpServlet {
037      
038        /**
039         * perform a get request
040         *
041         * @param req the http request
042         * @param res the http response
043         * @throws IOException when an error occurs writing the response
044         */
045        public void doPost(HttpServletRequest req, HttpServletResponse res) 
046            throws IOException {
047            doGet(req, res);
048        }
049    
050        /**
051         * Perform a get request
052         *
053         * @param req the http request
054         * @param res the http response
055         * @throws IOException when an error occurs writing the response
056         */
057        public void doGet(HttpServletRequest req, HttpServletResponse res) 
058            throws IOException {
059    
060            res.setHeader("Content-type", "text/xml");
061            
062            String suiteUrl = req.getParameter("url");
063            Suite suite = new Suite(new URL(suiteUrl));
064    
065            PrintWriter writer = res.getWriter();
066            writer.print("not yet implemented");
067      }
068    
069    }