001/*
002 * (C) Copyright 2016 Nuxeo SA (http://nuxeo.com/) and others.
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 * Contributors:
017 *     Antoine Taillefer <ataillefer@nuxeo.com>
018 */
019package org.nuxeo.ecm.platform.ui.web.auth;
020
021import java.io.IOException;
022
023import javax.servlet.ServletException;
024import javax.servlet.http.HttpServlet;
025import javax.servlet.http.HttpServletRequest;
026import javax.servlet.http.HttpServletResponse;
027
028import org.apache.commons.logging.Log;
029import org.apache.commons.logging.LogFactory;
030import org.nuxeo.ecm.platform.ui.web.auth.service.LoginScreenConfig;
031import org.nuxeo.ecm.platform.ui.web.auth.service.LoginStartupPage;
032
033/**
034 * Servlet redirecting to the startup page after form authentication from login.jsp, depending on the
035 * {@link LoginScreenConfig}/{@link LoginStartupPage} contributions to the {@code loginScreen} extension point.
036 *
037 * @since 8.4
038 */
039public class StartupPageServlet extends HttpServlet {
040
041    private static final long serialVersionUID = 1L;
042
043    protected static final Log log = LogFactory.getLog(StartupPageServlet.class);
044
045    @Override
046    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
047        resp.sendRedirect(LoginScreenHelper.getStartupPageURL(req));
048    }
049
050}