1 /*
2 * #%L
3 * wcm.io
4 * %%
5 * Copyright (C) 2014 wcm.io
6 * %%
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * #L%
19 */
20 package io.wcm.handler.url.integrator;
21
22 import org.jetbrains.annotations.NotNull;
23 import org.jetbrains.annotations.Nullable;
24 import org.osgi.annotation.versioning.ProviderType;
25
26 import com.day.cq.wcm.api.Page;
27
28 /**
29 * Manages detection of integrator template context.
30 *
31 * <p>
32 * The interface is implemented by a Sling Model. You can adapt from
33 * {@link org.apache.sling.api.SlingHttpServletRequest} or {@link org.apache.sling.api.resource.Resource} to get a
34 * context-specific handler instance.
35 * </p>
36 */
37 @ProviderType
38 public interface IntegratorHandler {
39
40 /**
41 * Selector for "integrator template" mode.
42 */
43 @NotNull
44 String SELECTOR_INTEGRATORTEMPLATE = "integratortemplate";
45 /**
46 * Selector for "integrator template" secure mode.
47 */
48 @NotNull
49 String SELECTOR_INTEGRATORTEMPLATE_SECURE = "integratortemplatesecure";
50
51 /**
52 * Checks if current request is in integrator template mode.
53 * @return true if in integrator template mode
54 */
55 boolean isIntegratorTemplateMode();
56
57 /**
58 * Checks if current request is in integrator secure template mode.
59 * @return true if in integrator template secure mode
60 */
61 boolean isIntegratorTemplateSecureMode();
62
63 /**
64 * Returns selector for integrator template mode.
65 * In HTTPS mode the secure selector is returned, otherwise the default selector.
66 * HTTPS mode is active if the current page is an integrator page and has simple mode-HTTPs activated, or
67 * the secure integrator mode selector is included in the current request.
68 * @return Integrator template selector
69 */
70 @NotNull
71 String getIntegratorTemplateSelector();
72
73 /**
74 * Get integrator mode configured for the current page.
75 * @return Integrator mode
76 */
77 @NotNull
78 IntegratorMode getIntegratorMode();
79
80 /**
81 * Get integrator mode configured for the given page.
82 * @param page Page
83 * @return Integrator mode
84 */
85 @NotNull
86 IntegratorMode getIntegratorMode(@Nullable Page page);
87
88 }