diff options
Diffstat (limited to 'petascope/src/petascope/wcs2/schemas/SchemaServlet.java')
-rw-r--r-- | petascope/src/petascope/wcs2/schemas/SchemaServlet.java | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/petascope/src/petascope/wcs2/schemas/SchemaServlet.java b/petascope/src/petascope/wcs2/schemas/SchemaServlet.java deleted file mode 100644 index f2c874f..0000000 --- a/petascope/src/petascope/wcs2/schemas/SchemaServlet.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * This file is part of rasdaman community. - * - * Rasdaman community is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Rasdaman community is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>. - * - * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / - rasdaman GmbH. - * - * For more information please see <http://www.rasdaman.org> - * or contact Peter Baumann via <baumann@rasdaman.com>. - */ -package petascope.wcs2.schemas; - -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.io.PrintWriter; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.apache.commons.io.IOUtils; - -/** Servlet that handles GET requests for the WCS 2.0 schema files. - * - * @author Andrei Aiordachioaie - */ -public class SchemaServlet extends HttpServlet { - - /** - * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - protected void processRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - response.setContentType("application/xml;charset=UTF-8"); - PrintWriter out = response.getWriter(); - try { - String schemaFile = request.getPathInfo(); - String pathPrefix = "/xml/ogc/wcs/2.0.0/"; - File file = new File(getServletContext().getRealPath(pathPrefix + schemaFile)); - String fileContents = IOUtils.toString(new FileReader(file)); - out.write(fileContents); - } finally { - out.close(); - } - } - - /** - * Handles the HTTP <code>GET</code> method. - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Handles the HTTP <code>POST</code> method. - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Returns a short description of the servlet. - * @return a String containing servlet description - */ - @Override - public String getServletInfo() { - return "Short description"; - } -} |