001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.servlet;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.util.Portal;
020    import com.liferay.portal.util.PortalUtil;
021    
022    import java.io.IOException;
023    
024    import javax.servlet.RequestDispatcher;
025    import javax.servlet.ServletContext;
026    import javax.servlet.ServletException;
027    import javax.servlet.http.HttpServlet;
028    import javax.servlet.http.HttpServletRequest;
029    import javax.servlet.http.HttpServletResponse;
030    
031    /**
032     * @author David Truong
033     */
034    public class RobotsServlet extends HttpServlet {
035    
036            @Override
037            public void service(
038                            HttpServletRequest request, HttpServletResponse response)
039                    throws IOException, ServletException {
040    
041                    try {
042                            String redirect = Portal.PATH_MAIN + "/layouts_admin/robots";
043    
044                            ServletContext servletContext = getServletContext();
045    
046                            RequestDispatcher requestDispatcher =
047                                    servletContext.getRequestDispatcher(redirect);
048    
049                            requestDispatcher.forward(request, response);
050                    }
051                    catch (Exception e) {
052                            _log.error(e, e);
053    
054                            PortalUtil.sendError(
055                                    HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e, request,
056                                    response);
057                    }
058            }
059    
060            private static Log _log = LogFactoryUtil.getLog(RobotsServlet.class);
061    
062    }