View Javadoc
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   * <p>
31   * The interface is implemented by a Sling Model. You can adapt from
32   * {@link org.apache.sling.api.SlingHttpServletRequest} or {@link org.apache.sling.api.resource.Resource} to get a
33   * context-specific handler instance.
34   * </p>
35   */
36  @ProviderType
37  public interface IntegratorHandler {
38  
39    /**
40     * Selector for "integrator template" mode.
41     */
42    @NotNull
43    String SELECTOR_INTEGRATORTEMPLATE = "integratortemplate";
44    /**
45     * Selector for "integrator template" secure mode.
46     */
47    @NotNull
48    String SELECTOR_INTEGRATORTEMPLATE_SECURE = "integratortemplatesecure";
49  
50    /**
51     * Checks if current request is in integrator template mode.
52     * @return true if in integrator template mode
53     */
54    boolean isIntegratorTemplateMode();
55  
56    /**
57     * Checks if current request is in integrator secure template mode.
58     * @return true if in integrator template secure mode
59     */
60    boolean isIntegratorTemplateSecureMode();
61  
62    /**
63     * Returns selector for integrator template mode.
64     * In HTTPS mode the secure selector is returned, otherwise the default selector.
65     * HTTPS mode is active if the current page is an integrator page and has simple mode-HTTPs activated, or
66     * the secure integrator mode selector is included in the current request.
67     * @return Integrator template selector
68     */
69    @NotNull
70    String getIntegratorTemplateSelector();
71  
72    /**
73     * Get integrator mode configured for the current page.
74     * @return Integrator mode
75     */
76    @NotNull
77    IntegratorMode getIntegratorMode();
78  
79    /**
80     * Get integrator mode configured for the given page.
81     * @param page Page
82     * @return Integrator mode
83     */
84    @NotNull
85    IntegratorMode getIntegratorMode(@Nullable Page page);
86  
87  }