This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch feature/SLING-8266
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-jsp-taglib.git
The following commit(s) were added to refs/heads/feature/SLING-8266 by this
push:
new 6a238b7 SLING-8019 - Use XSS API
6a238b7 is described below
commit 6a238b71611edc56703b60d7962dec93c7af8ed9
Author: Robert Munteanu <[email protected]>
AuthorDate: Mon Feb 11 16:21:37 2019 +0100
SLING-8019 - Use XSS API
Stop exporting the XSSSupport component, this will be contributed by a
compat bundle.
---
.../sling/scripting/jsp/taglib/EncodeTag.java | 6 +++---
.../sling/scripting/jsp/taglib/SlingFunctions.java | 2 +-
.../scripting/jsp/taglib/helpers/package-info.java | 21 ---------------------
.../taglib/{helpers => internal}/XSSSupport.java | 12 +++++-------
.../sling/scripting/jsp/taglib/XSSSupportRule.java | 2 +-
5 files changed, 10 insertions(+), 33 deletions(-)
diff --git a/src/main/java/org/apache/sling/scripting/jsp/taglib/EncodeTag.java
b/src/main/java/org/apache/sling/scripting/jsp/taglib/EncodeTag.java
index e7bf741..ce3a460 100644
--- a/src/main/java/org/apache/sling/scripting/jsp/taglib/EncodeTag.java
+++ b/src/main/java/org/apache/sling/scripting/jsp/taglib/EncodeTag.java
@@ -22,8 +22,8 @@ import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
import org.apache.commons.lang3.StringUtils;
-import org.apache.sling.scripting.jsp.taglib.helpers.XSSSupport;
-import org.apache.sling.scripting.jsp.taglib.helpers.XSSSupport.ENCODING_MODE;
+import org.apache.sling.scripting.jsp.taglib.internal.XSSSupport;
+import org.apache.sling.scripting.jsp.taglib.internal.XSSSupport.EncodingMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -38,7 +38,7 @@ public class EncodeTag extends BodyTagSupport {
private static final Logger log = LoggerFactory.getLogger(EncodeTag.class);
private String value;
private String defaultValue;
- private ENCODING_MODE mode;
+ private EncodingMode mode;
private boolean readBody = false;
/*
diff --git
a/src/main/java/org/apache/sling/scripting/jsp/taglib/SlingFunctions.java
b/src/main/java/org/apache/sling/scripting/jsp/taglib/SlingFunctions.java
index afef86e..2034f37 100644
--- a/src/main/java/org/apache/sling/scripting/jsp/taglib/SlingFunctions.java
+++ b/src/main/java/org/apache/sling/scripting/jsp/taglib/SlingFunctions.java
@@ -32,7 +32,7 @@ import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.api.scripting.SlingBindings;
import org.apache.sling.api.scripting.SlingScriptHelper;
import org.apache.sling.caconfig.resource.ConfigurationResourceResolver;
-import org.apache.sling.scripting.jsp.taglib.helpers.XSSSupport;
+import org.apache.sling.scripting.jsp.taglib.internal.XSSSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git
a/src/main/java/org/apache/sling/scripting/jsp/taglib/helpers/package-info.java
b/src/main/java/org/apache/sling/scripting/jsp/taglib/helpers/package-info.java
deleted file mode 100644
index 03938c9..0000000
---
a/src/main/java/org/apache/sling/scripting/jsp/taglib/helpers/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
[email protected]("3.0.0")
-package org.apache.sling.scripting.jsp.taglib.helpers;
-
diff --git
a/src/main/java/org/apache/sling/scripting/jsp/taglib/helpers/XSSSupport.java
b/src/main/java/org/apache/sling/scripting/jsp/taglib/internal/XSSSupport.java
similarity index 88%
rename from
src/main/java/org/apache/sling/scripting/jsp/taglib/helpers/XSSSupport.java
rename to
src/main/java/org/apache/sling/scripting/jsp/taglib/internal/XSSSupport.java
index 2928300..feed421 100644
---
a/src/main/java/org/apache/sling/scripting/jsp/taglib/helpers/XSSSupport.java
+++
b/src/main/java/org/apache/sling/scripting/jsp/taglib/internal/XSSSupport.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sling.scripting.jsp.taglib.helpers;
+package org.apache.sling.scripting.jsp.taglib.internal;
import org.apache.sling.xss.XSSAPI;
import org.osgi.service.component.annotations.Component;
@@ -47,7 +47,7 @@ public class XSSSupport {
/**
* The encoding modes supported by this tag.
*/
- public enum ENCODING_MODE {
+ public enum EncodingMode {
/**
* Encodes the content as HTML
*/
@@ -63,10 +63,8 @@ public class XSSSupport {
* @param mode
* the mode with which to encode the string
* @return the encoded string
- * @deprecated since bundle version 2.4.0. Use the {@link
#encodeString(String, ENCODING_MODE)} method instead.
*/
- @Deprecated
- public static String encode(String unencoded, ENCODING_MODE mode) {
+ public static String encode(String unencoded, EncodingMode mode) {
if ( XSS_API == null )
throw new IllegalStateException("No XSS_API field set. Is the
XSSAPI service available?");
@@ -94,8 +92,8 @@ public class XSSSupport {
* @param modeStr the mode string
* @return the encoding mode
*/
- public static ENCODING_MODE getEncodingMode(String modeStr) {
- return ENCODING_MODE.valueOf(modeStr.toUpperCase());
+ public static EncodingMode getEncodingMode(String modeStr) {
+ return EncodingMode.valueOf(modeStr.toUpperCase());
}
private XSSSupport() {
diff --git
a/src/test/java/org/apache/sling/scripting/jsp/taglib/XSSSupportRule.java
b/src/test/java/org/apache/sling/scripting/jsp/taglib/XSSSupportRule.java
index 220d9e9..9af5021 100644
--- a/src/test/java/org/apache/sling/scripting/jsp/taglib/XSSSupportRule.java
+++ b/src/test/java/org/apache/sling/scripting/jsp/taglib/XSSSupportRule.java
@@ -18,7 +18,7 @@ package org.apache.sling.scripting.jsp.taglib;
import java.lang.reflect.Field;
-import org.apache.sling.scripting.jsp.taglib.helpers.XSSSupport;
+import org.apache.sling.scripting.jsp.taglib.internal.XSSSupport;
import org.apache.sling.xss.impl.XSSAPIImpl;
import org.apache.sling.xss.impl.XSSFilterImpl;
import org.junit.rules.ExternalResource;