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