001/*
002 * (C) Copyright 2012 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 *     bjalon
018 */
019package org.nuxeo.ecm.mobile.handler;
020
021import java.util.Map;
022
023import javax.servlet.http.HttpServletRequest;
024
025/**
026 * A mobile application redirection service provide a way to expose easily a new dedicated UI for a specific type of
027 * environment (essentially user agent browser). Pointer of the implementation of this interface is given into the
028 * Application descriptor. Here is implemented the logic to tell if the request is candidate for the application
029 * described.
030 * 
031 * @author <a href="mailto:bjalon@nuxeo.com">Benjamin JALON</a>
032 * @since 5.5
033 */
034public interface RequestHandler {
035
036    /**
037     * Used for initialize request handler with properties given in descriptor definition.
038     */
039    public RequestHandler init(Map<String, String> properties);
040
041    /**
042     * return true if the request is a candidate for the Application described into the {@code ApplicationDescriptor}.
043     */
044    public boolean isRequestRedirectedToApplication(HttpServletRequest request);
045
046    /**
047     * return true if the request is a candidate for the specific login form described by application
048     */
049    public boolean isRequestRedirectedToApplicationLoginForm(HttpServletRequest request);
050
051}