View Javadoc
1   /*
2    * #%L
3    * wcm.io
4    * %%
5    * Copyright (C) 2019 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.impl.clientlib;
21  
22  import org.jetbrains.annotations.NotNull;
23  
24  /**
25   * Rewrites links to static resources from client libraries that are in "allowProxy" mode to /etc.clientlibs.
26   */
27  public interface ClientlibProxyRewriter {
28  
29    /**
30     * Checks if the given path is (potential) a static resource path from a client library.
31     * If this is the case, it is checked if the client library is located below /apps or /libs
32     * and has the "allowProxy" mode enabled.
33     * If yes, the path is rewritten to /etc.clientlibs. Otherwise it is returned unchanged.
34     * @param path Static resource path
35     * @return Rewritten path or original path
36     */
37    @NotNull
38    String rewriteStaticResourcePath(@NotNull String path);
39  
40  }