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;
018
019import java.util.List;
020
021import javax.servlet.http.HttpServletRequest;
022
023/**
024 * This service will store all the information needed to redirect the user to the right url according his navigation
025 * choice or the request context. This is needed for instance when we want to redirect the user to a dedicated
026 * application according the user-agent browser or logic implemented into your RequestHandler.
027 * 
028 * @author <a href="mailto:bjalon@nuxeo.com">Benjamin JALON</a>
029 * @since 5.5
030 */
031public interface ApplicationDefinitionService {
032
033    /**
034     * Return the root path of the web application where the request must be redirected according request context. If
035     * there is no application that match this request context, null is returned. Absolute URL is retuned with the
036     * protocole, the servername, ...
037     */
038    public String getApplicationBaseURL(HttpServletRequest request);
039
040    public String getApplicationBaseURI(HttpServletRequest request);
041
042    /**
043     * Return the login url according request context. This is the absolute URL with the protocole, the servername, ...
044     */
045    public String getLoginURL(HttpServletRequest request);
046
047    /**
048     * Return the logout url according request context.This is the absolute URL with the protocole, the servername, ...
049     */
050    public String getLogoutURL(HttpServletRequest request);
051
052    /**
053     * Return the list of relative unprotected URI for all application
054     */
055    public List<String> getUnAuthenticatedURLPrefix();
056
057    /**
058     * Return the list of relative unprotected URI for this request
059     */
060    public List<String> getUnAuthenticatedURLPrefix(HttpServletRequest request);
061
062    /**
063     * Return true if the given request is a resource for the application this request match
064     */
065    public boolean isResourceURL(HttpServletRequest request);
066
067}