001/*
002 * (C) Copyright 2012 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     bjalon
016 */
017package org.nuxeo.ecm.mobile.handler;
018
019import java.util.Map;
020
021import javax.servlet.http.HttpServletRequest;
022
023/**
024 * A mobile application redirection service provide a way to expose easily a new dedicated UI for a specific type of
025 * environment (essentially user agent browser). Pointer of the implementation of this interface is given into the
026 * Application descriptor. Here is implemented the logic to tell if the request is candidate for the application
027 * described.
028 * 
029 * @author <a href="mailto:bjalon@nuxeo.com">Benjamin JALON</a>
030 * @since 5.5
031 */
032public interface RequestHandler {
033
034    /**
035     * Used for initialize request handler with properties given in descriptor definition.
036     */
037    public RequestHandler init(Map<String, String> properties);
038
039    /**
040     * return true if the request is a candidate for the Application described into the {@code ApplicationDescriptor}.
041     */
042    public boolean isRequestRedirectedToApplication(HttpServletRequest request);
043
044    /**
045     * return true if the request is a candidate for the specific login form described by application
046     */
047    public boolean isRequestRedirectedToApplicationLoginForm(HttpServletRequest request);
048
049}