com.day.cq.xss.taglib.Utils Maven / Gradle / Ivy
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* __________________
*
* Copyright 2011 Adobe Systems Incorporated
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
**************************************************************************/
package com.day.cq.xss.taglib;
import javax.servlet.ServletRequest;
import javax.servlet.jsp.PageContext;
import org.apache.sling.api.scripting.SlingBindings;
import org.apache.sling.api.scripting.SlingScriptHelper;
import com.day.cq.xss.XSSProtectionService;
/**
* This class provides utility methods for the XSS protection taglib.
* @deprecated
*/
@Deprecated
class Utils {
/**
* Gets the XSSPreventionService
from the given page context.
*
* @param pageContext page context
* @return the service instance to use
*/
public static XSSProtectionService getService(PageContext pageContext) {
ServletRequest req = pageContext.getRequest();
SlingBindings bindings =
(SlingBindings) req.getAttribute(SlingBindings.class.getName());
SlingScriptHelper scriptHelper = bindings.getSling();
return scriptHelper.getService(XSSProtectionService.class);
}
}