/** * Creates the closing line. */ public void end() { this.line(); }
/** * {@inheritDoc} */ @Override public final void run() { if (isLeader) { runOnMaster(); } }
/** * Checks if the request is in mode {@link WCMMode#DISABLED} * * @param request * request to check * @return true if the request is in disabled mode */ public static boolean isDisabled(SlingHttpServletRequest request) { return WCMMode.DISABLED == getMode(request); }
/** * Util for parsing Service properties in the form {@code <value><separator><value>} * * @param value must be in the format => {@code x<separator>y} ... ex. {@code foo:bar} * @param separator separator between the values * @return Returns a {@link Map.Entry} representing the key/value pair. It may be {@code null} in case no separator is found. */ public static Map.Entry<String, String> toMapEntry(final String value, final String separator) { return toSimpleEntry(value, separator, false); }
/** * Remove the Cookies whose names match the provided Regex from Response * * @param request Request to get the Cookies to drop * @param response Response to expire the Cookies on * @param regexes Regex to find Cookies to drop * @return Number of Cookies dropped */ public static int dropCookiesByRegex(final HttpServletRequest request, final HttpServletResponse response, final String cookiePath, final String... regexes) { return dropCookiesByRegexArray(request, response, cookiePath, regexes); }
/** * Get the first suffix segment. * * @param request * @return the String in the first suffix segment or null if no suffix */ public static String getFirstSuffixSegment(final SlingHttpServletRequest request) { return getSuffixSegment(request, 0); }
/** * Creates the opening line. */ public void title() { title(null); }
/** * Gets the default string representation of the parameter object. * * @param obj * @param klass * @return */ public static String toString(final Object obj, final Class<?> klass) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException { return toString(obj, klass, null); }
/** * Convenience wrapper for toMap(jsonObj, Object.class). * * @param json * @return */ public static Map<String, Object> toMap(JSONObject json) throws JSONException { return toMap(json, Object.class); }
/** * Checks if the request is in mode {@link WCMMode#ANALYTICS} * * @param request * request to check * @return true if the request is in analytics mode */ public static boolean isAnalytics(SlingHttpServletRequest request) { return WCMMode.ANALYTICS == getMode(request); }
/** * Creates a line. */ public void line() { line(0); }
/** * {@inheritDoc} */ @Override public final void run() { if (isMaster) { runOnMaster(); } }
/** * Util for parsing Service properties in the form {@code <value><separator><value>} * * @param value must be in the format => {@code x<separator>y} ... ex. {@code foo:bar} * @param separator separator between the values * @return Returns a {@link Map.Entry} representing the key/value pair. The entry's value may be {@code null} in case no separator is found. */ public static Map.Entry<String, String> toMapEntryWithOptionalValue(final String value, final String separator) { return toSimpleEntry(value, separator, true); }
/** * Remove the Cookies whose names match the provided Regex from Response * * @param request Request to get the Cookies to drop * @param response Response to expire the Cookies on * @param regexes Regex to find Cookies to drop * @return Number of Cookies dropped */ public static int dropCookiesByRegex(final HttpServletRequest request, final HttpServletResponse response, final String cookiePath, final String... regexes) { return dropCookiesByRegexArray(request, response, cookiePath, regexes); }
/** * Checks if the request is in mode {@link WCMMode#PREVIEW} * * @param request * request to check * @return true if the request is in preview mode */ public static boolean isPreview(SlingHttpServletRequest request) { return WCMMode.PREVIEW == getMode(request); }
/** * Creates a line. */ public void line() { line(0); }
/** * Checks if the request is in mode {@link WCMMode#READ_ONLY} * * @param request * request to check * @return true if the request is in read-only mode */ public static boolean isReadOnly(SlingHttpServletRequest request) { return WCMMode.READ_ONLY == getMode(request); }
/** * Creates the closing line. */ public void end() { this.line(); }
/** * Checks if the request is in mode {@link WCMMode#DESIGN} * * @param request * request to check * @return true if the request is in design mode */ public static boolean isDesign(SlingHttpServletRequest request) { return WCMMode.DESIGN == getMode(request); }
/** * Checks if the request is in mode {@link WCMMode#EDIT} * * @param request * request to check * @return true if the request is in edit mode */ public static boolean isEdit(SlingHttpServletRequest request) { return WCMMode.EDIT == getMode(request); }