/** * @see {@link ServletConfigUtils#isEmpty(String)} * @param s * @return */ public static boolean isEmpty(String s) { return ServletConfigUtils.isEmpty(s); }
/** * Replaces in String str the characters &,>,<,",' * with their corresponding character entity codes. * @param str - the String where to replace * @return String * */ protected String doEscapeXml(String str) { return HstRequestUtils.escapeXml(str); }
/** * @return a HashMap<String, VirtualHostService> that throws an exception when you put in the same key twice */ public static HashMap<String, MutableVirtualHost> virtualHostHashMap(){ return new DuplicateKeyNotAllowedHashMap<>(); }
public HstLinkImpl(String path, HstSite hstSite, boolean containerResource) { this.path = PathUtils.normalizePath(path); this.hstSite = hstSite; this.containerResource = containerResource; }
private static String getFarthestUrlPrefix(final HttpServletRequest servletRequest) { final String farthestRequestScheme = HstRequestUtils.getFarthestRequestScheme(servletRequest); final String farthestRequestHost = HstRequestUtils.getFarthestRequestHost(servletRequest, false); return farthestRequestScheme + "://" + farthestRequestHost; }
/** * @see {@link ServletConfigUtils#getInitParameter(String, String, Object...)} * @param paramName * @param defaultValue * @param configs * @return */ public static String getInitParameter(String paramName, String defaultValue, Object ... configs) { return ServletConfigUtils.getInitParameter(paramName, defaultValue, configs); }
/** * Get the most accurate and complete version available of the information * represented in the current node if available. * * @param node * @param defaultNode * @return the node with the most accurate representation of this node if available. * @throws java.lang.IllegalArgumentException when canonical node is not found for the node. * @throws java.lang.RuntimeException when the repository throws a general repository exception */ public static Node getCanonicalNode(Node node) { return getCanonicalNode(node, null); }
/** * Facility method for sending a redirect to a sitemap path. * * @param request the HstRequest * @param response the HstResponse * @param path the sitemap path you want to redirect to */ public static void sendRedirect(HstRequest request, HstResponse response, String path) { sendRedirect(request, response, path, null, null); }
/** * Creates <CODE>ObjectConverter</CODE>. * @param annotatedClasses Annotated class mapping against jcr primary node types. * @param ignoreDuplicates Flag whether duplicate mapping for a node type is ignored or not. If it is false, it throws <CODE>IllegalArgumentException</CODE> on duplicate mappings. * @return the ObjectConverter for these<code>annotatedClasses</code> * @throws IllegalArgumentException when two annotatedClasses have the same {@link Node#jcrType()} and <code>ignoreDuplicates</code> is false */ @SuppressWarnings("unchecked") public static ObjectConverter createObjectConverter(final Collection<Class<? extends HippoBean>> annotatedClasses, boolean ignoreDuplicates) throws IllegalArgumentException { return createObjectConverter(annotatedClasses, (Class<? extends HippoBean> []) DEFAULT_BUILT_IN_MAPPING_CLASSES, DEFAULT_FALLBACK_NODE_TYPES, ignoreDuplicates); }
/** * @param request * @return the decoded getRequestURI after the context path but before the query string in the request URL */ public static String getRequestPath(HttpServletRequest request) { return getDecodedPath(null, request, null, false); }
/** * Returns the remote client address. * @param request * @return */ public static String getFarthestRemoteAddr(HttpServletRequest request) { return getRemoteAddrs(request)[0]; }
/** * @see {@link ServletConfigUtils#isBlank(String)} * @param s * @return */ public static boolean isBlank(String s) { return ServletConfigUtils.isBlank(s); }
/** * Returns the original host information requested by the client. * @param request * @return */ public static String getFarthestRequestHost(HttpServletRequest request) { return getRequestHosts(request)[0]; }
/** * Facility method for sending a redirect to a sitemap path. * * @param request the HstRequest * @param response the HstResponse * @param path the sitemap path you want to redirect to * @param queryParams query parameters to append to the redirection url */ public static void sendRedirect(HstRequest request, HstResponse response, String path, Map<String, String []> queryParams) { sendRedirect(request, response, path, queryParams, null); }
/** * @return a HashMap<String, VirtualHostService> that throws an exception when you put in the same key twice */ public final static HashMap<String, VirtualHostService> virtualHostHashMap(){ return new DuplicateKeyNotAllowedHashMap<String, VirtualHostService>(); }
/** * Creates <CODE>ObjectConverter</CODE>, with ignoreDuplicates = false, which means that when there are two annotated beans with the same * value for {@link Node#jcrType()}, an IllegalArgumentException is thrown. * @param annotatedClasses Annotated class mapping against jcr primary node types. * @return the ObjectConverter for these<code>annotatedClasses</code> * @throws IllegalArgumentException when two annotatedClasses have the same {@link Node#jcrType()} */ public static ObjectConverter createObjectConverter(final Collection<Class<? extends HippoBean>> annotatedClasses) throws IllegalArgumentException { return createObjectConverter(annotatedClasses, false); }
/** * @param request * @param characterEncoding * @return the decoded getRequestURI after the context path but before the query string in the request URL */ public static String getRequestPath(HttpServletRequest request, String characterEncoding) { return getDecodedPath(null, request, characterEncoding, false); }
/** * <p> * Facility method for sending a redirect to a sitemap path including query params. You do not have to take into account the context path or {@link Mount} path * </p> * @see HstResponse#sendRedirect(String) * @param path the sitemap path you want to redirect to * @param request the HstRequest * @param queryParams query parameters to append to the redirection url * @param response the HstResponse */ public void sendRedirect(String path, HstRequest request, HstResponse response, Map<String, String []> queryParams) { HstResponseUtils.sendRedirect(request, response, path, queryParams); }
/** * Returns any extra path information associated with the URL the client sent when it made this request. * The extra path information that comes after the context path and after the (resolved) mountpath but before the query string in the request URL * This method extracts and decodes the path information from the request URI returned from * <CODE>HttpServletRequest#getRequestURI()</CODE>. * @param resSiteMount * @param request * @return the decoded getRequestURI after the context path and after the (resolved) sitemount but before the query string in the request URL */ public static String getPathInfo(ResolvedSiteMount resSiteMount, HttpServletRequest request) { return getDecodedPath(resSiteMount, request, null, true); }
/** * <p> * Facility method for sending a redirect to a sitemap path. You do not have to take into account the context path or {@link Mount} path * </p> * * @see HstResponse#sendRedirect(String) * @param path the sitemap path you want to redirect to * @param request the HstRequest * @param response the HstResponse */ public void sendRedirect(String path, HstRequest request, HstResponse response) { HstResponseUtils.sendRedirect(request, response, path); }