Conditions
Info: The URL Rewriter feature in Bloomreach Content requires a standard or premium license. Contact Bloomreach for licensing details.
Overview
Conditions define the criteria that must be met for a URL Rewriter rule to be applied. You can configure rules to require that either all conditions match, or that at least one condition matches. The order of conditions can affect rule evaluation.
Condition Types
Each condition type specifies a property of the incoming request or server environment to evaluate.
| Type | Description |
|---|---|
| header | Evaluates the value of a specific HTTP header. Specify the header name using the name attribute. |
| method | Checks the HTTP method of the request (e.g., GET, POST, HEAD). |
| port | Checks the port on which the web application server is running. |
| time | Evaluates the current server time as the number of seconds since 00:00:00 UTC, January 1, 1970 (Unix time). Use this to control when content becomes available. |
| year | Checks the current year on the server. See Calendar.YEAR. |
| month | Checks the current month on the server (January is 0). See Calendar.MONTH. |
| dayofmonth | Checks the day of the month on the server (March 1 is 1). See Calendar.DAY_OF_MONTH. |
| dayofweek | Checks the day of the week on the server (Saturday is 1, Sunday is 7). See Calendar.DAY_OF_WEEK. |
| ampm | Checks whether the server time is AM or PM. See Calendar.AM_PM. |
| hourofday | Checks the hour of the day (24-hour clock) on the server (e.g., 22 for 10 PM). See Calendar.HOUR_OF_DAY. |
| minute | Checks the minute value of the current server time. See Calendar.MINUTE. |
| second | Checks the second value of the current server time. See Calendar.SECOND. |
| millisecond | Checks the millisecond value of the current server time. See Calendar.MILLISECOND. |
| attribute | Evaluates the value of a request attribute. Specify the attribute name using the name parameter. See request.getAttribute(name). |
| auth-type | Checks the authentication type of the request. See request.getAuthType(). |
| character-encoding | Checks the character encoding of the incoming request. See request.getCharacterEncoding(). |
| content-length | Checks the content length of the incoming request. Useful for restricting large requests. See request.getContentLength(). |
| content-type | Checks the content type of the incoming request. See request.getContentType(). |
| context-path | Checks the context path of the incoming request. See request.getContextPath(). |
| cookie | Evaluates the value of a specific cookie. Specify the cookie name using the name parameter. See request.getCookies(). |
| parameter | Checks the value of a request parameter (from GET or POST). Specify the parameter name using the name parameter. See request.getParameter(name). |
| path-info | Checks the path info of the request. See request.getPathInfo(). |
| path-translated | Checks the translated path of the request. See request.getPathTranslated(). |
| protocol | Checks the protocol used for the request (e.g., HTTP/1.1). See request.getProtocol(). |
| query-string | Checks the query string of the request, if present (e.g., id=2345&name=bob). See request.getQueryString(). |
| remote-addr | Checks the IP address of the client making the request. See request.getRemoteAddr(). |
| remote-host | Checks the host name of the client making the request. Host name resolution must be enabled on the server. See request.getRemoteHost(). |
| remote-user | Checks the authenticated user making the request, if available. See request.getRemoteUser(). |
| requested-session-id | Checks the session ID specified by the client. See request.getRequestedSessionId(). |
| requested-session-id-from-cookie | Checks if the session ID comes from a cookie. See request.isRequestedSessionIdFromCookie(). |
| requested-session-id-from-url | Checks if the session ID comes from the URL. See request.isRequestedSessionIdFromURL(). |
| requested-session-id-valid | Checks if the session ID is valid. See request.isRequestedSessionIdValid(). |
| request-uri | Checks the request URI, which includes the path from the protocol up to the query string. See request.getRequestURI(). |
| request-url | Checks the reconstructed URL used by the client, including protocol, server name, port, and path (excluding query parameters). See request.getRequestURL(). |
| session-attribute | Checks the value of a session attribute. Specify the attribute name using the name parameter. See session.getAttribute(name). |
| session-isnew | Checks if the session is new. See session.isNew(). |
| server-name | Checks the host name of the server that received the request (from the Host header). See request.getServerName(). |
| scheme | Checks the scheme used for the request (e.g., http, https). See request.getScheme(). |
| user-in-role | Checks if the user is in a specific role. The value cannot be a regular expression. See request.isUserInRole(value). |
Types Requiring Additional Parameters
Some condition types require you to specify an additional parameter, such as a name.
| Type | Required Parameter |
|---|---|
| header | Name of the HTTP header to evaluate |
| attribute | Name of the request attribute to evaluate |
| cookie | Name of the cookie to evaluate |
| parameter | Name of the request parameter to evaluate |
| session-attribute | Name of the session attribute to evaluate |
Operator
The operator defines how the condition is evaluated against the value. For example, you can check for equality, inequality, or use pattern matching depending on the condition type.
Value
Specify the value to compare against the evaluated type. The value is used in conjunction with the operator.
Logical Operator for Chaining Conditions
When multiple conditions are defined, you can control how they are combined:
- Use AND to require that this condition and the next condition both match.
- Use OR to require that either this condition or the next condition matches.
This allows you to create complex rule logic by chaining multiple conditions together.