Class WebUtil
- java.lang.Object
-
- org.pentaho.platform.web.WebUtil
-
public class WebUtil extends Object
Utility class containing web related functionality.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isCorsRequestsAllowed()
Gets a value that indicates if CORS is enabled, in principle.static void
setCorsResponseHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Sets the default CORS response headers if CORS is enabled and the request origin is allowed.static void
setCorsResponseHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Map<String,List<String>> corsHeadersConfiguration)
Sets the default CORS response headers and the additional provided headers if CORS is enabled and the request origin is allowed.
-
-
-
Method Detail
-
setCorsResponseHeaders
public static void setCorsResponseHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Sets the default CORS response headers if CORS is enabled and the request origin is allowed.The default headers are the
Access-Control-Allow-Origin
header with the current allowed origin as a value and theAccess-Control-Allow-Credentials
with valuetrue
.This method exists for when it is needed to set CORS headers programmatically. It's generally preferable to configure the system's CORS filter, by editing
applicationContext-spring-security-cors.xml
or by publishing an implementation ofcom.hitachivantara.security.web.api.model.cors.CorsRequestSetConfiguration
with the Pentaho system.- Parameters:
request
- The HTTP request.response
- The HTTP response.
-
setCorsResponseHeaders
public static void setCorsResponseHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Map<String,List<String>> corsHeadersConfiguration)
Sets the default CORS response headers and the additional provided headers if CORS is enabled and the request origin is allowed.The default headers are the
Access-Control-Allow-Origin
header with the current allowed origin as a value and theAccess-Control-Allow-Credentials
with valuetrue
.This method exists for when it is needed to set CORS headers programmatically. It's generally preferable to configure the system's CORS filter, by editing
applicationContext-spring-security-cors.xml
or by publishing an implementation ofcom.hitachivantara.security.web.api.model.cors.CorsRequestSetConfiguration
with the Pentaho system.- Parameters:
request
- The HTTP request.response
- The HTTP response.corsHeadersConfiguration
- Additional headers to conditionally define.
-
isCorsRequestsAllowed
public static boolean isCorsRequestsAllowed()
Gets a value that indicates if CORS is enabled, in principle.Further restrictions apply to determine if a specific cross origin or CORS request is actualy enabled.
- Returns:
true
if enabled;false
, otherwise.
-
-