![JAR search and dependency download from the Maven repository](/logo.png)
org.apache.sling.engine.RequestUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aem-sdk-api Show documentation
Show all versions of aem-sdk-api Show documentation
The Adobe Experience Manager SDK
/*
* 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.
*/
package org.apache.sling.engine;
import javax.servlet.Servlet;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* @deprecated Use {@link org.apache.sling.api.request.RequestUtil}
*/
@Deprecated
public class RequestUtil {
/**
* Parses a header of the form:
*
*
* Header = Token { "," Token } .
* Token = name { ";" Parameter } .
* Paramter = name [ "=" value ] .
*
*
* "," and ";" are not allowed within name and value
*
* @param value The header value to parse
* @return A Map indexed by the Token names where the values are Map
* instances indexed by parameter name
*/
public static Map> parserHeader(final String value) {
return org.apache.sling.api.request.RequestUtil.parserHeader(value);
}
/**
* Parses an Accept-*
header of the form:
*
*
* Header = Token { "," Token } .
* Token = name { ";" "q" [ "=" value ] } .
* Paramter = .
*
*
* "," and ";" are not allowed within name and value
*
* @param value The header value to parse
* @return A Map indexed by the Token names where the values are
* Double
instances providing the value of the
* q
parameter.
*/
public static Map parserAcceptHeader(final String value) {
return org.apache.sling.api.request.RequestUtil.parserAcceptHeader(value);
}
/**
* Utility method to return a name for the given servlet. This method
* applies the following algorithm to find a non-null
,
* non-empty name:
*
* - If the servlet has a servlet config, the servlet name from the
* servlet config is taken.
*
- Otherwise check the servlet info
*
- Otherwise use the fully qualified name of the servlet class
*
*
* @param servlet The servlet instance
* @return The name of the servlet
*/
public static String getServletName(final Servlet servlet) {
return org.apache.sling.api.request.RequestUtil.getServletName(servlet);
}
/**
* Sets the named request attribute to the new value and returns the
* previous value.
*
* @param request The request object whose attribute is to be set.
* @param name The name of the attribute to be set.
* @param value The new value of the attribute. If this is null
* the attribute is actually removed from the request.
* @return The previous value of the named request attribute or
* null
if it was not set.
*/
public static Object setRequestAttribute(final HttpServletRequest request, final String name, final Object value) {
return org.apache.sling.api.request.RequestUtil.setRequestAttribute(request, name, value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy