public abstract class Util extends Object
| Modifier and Type | Class and Description | 
|---|---|
static class  | 
Util.IgnoreType  | 
| Modifier and Type | Field and Description | 
|---|---|
protected static String[] | 
hostHeaders  | 
protected static char[] | 
substKeywords
Constant  
substKeywords={ 's', 'h', 'p', 'x', 'c' } | 
| Constructor and Description | 
|---|
Util()  | 
| Modifier and Type | Method and Description | 
|---|---|
static String | 
calculateUrlBase(javax.servlet.http.HttpServletRequest request)
Return a string that represents the fully qualified URL for our servlet
 context, suitable for use in the HTML base tag. 
 | 
static String | 
calculateUrlBase(javax.servlet.http.HttpServletRequest request,
                String path)  | 
static String | 
convertToJsSafeString(String str)
convertToJsSafeString 
 | 
static EventProxy | 
createEventProxy()
Deprecated. 
 
Use dependency injection to wire in an instance of the  
EventProxy instead | 
static String | 
decode(String string)
Encapsulate the deprecated decode method to fix it in one place. 
 | 
static String | 
encode(String string)
Encapsulate the deprecated encode method to fix it in one place. 
 | 
static String | 
formatDateToUIString(Date date)
 | 
static String | 
getHostHeader(javax.servlet.http.HttpServletRequest request)
Obtains the host and port used by the end user. 
 | 
static String | 
getParameter(javax.servlet.http.HttpServletRequest request,
            String name)  | 
static String | 
getParameter(javax.servlet.http.HttpServletRequest request,
            String name,
            String defaultValue)  | 
static String | 
htmlify(String input)
htmlify 
 | 
static String | 
makeHiddenTags(javax.servlet.http.HttpServletRequest request)
Creates hidden tags for all the parameters given in the request. 
 | 
static String | 
makeHiddenTags(javax.servlet.http.HttpServletRequest request,
              Map<String,Object> additions)
Creates hidden tags for all the parameters given in the request. 
 | 
static String | 
makeHiddenTags(javax.servlet.http.HttpServletRequest request,
              Map<String,Object> additions,
              String[] ignores)
Creates hidden tags for all the parameters given in the request plus the
 additions, except for the parameters and additions listed in the ignore
 list. 
 | 
static String | 
makeHiddenTags(javax.servlet.http.HttpServletRequest request,
              Map<String,Object> additions,
              String[] ignores,
              Util.IgnoreType ignoreType)
Creates hidden tags for all the parameters given in the request plus the
 additions, except for the parmeters listed in the ignore list. 
 | 
static String | 
makeHiddenTags(javax.servlet.http.HttpServletRequest request,
              String[] ignores)
Creates hidden tags for all the parameters given in the request. 
 | 
static String | 
makeQueryString(javax.servlet.http.HttpServletRequest request)
Creates a query string of the format "key1=value1&key2=value2" for
 each parameter in the given  
HttpServletRequest. | 
static String | 
makeQueryString(javax.servlet.http.HttpServletRequest request,
               Map<String,Object> additions)
Creates a query string of the format "key1=value1&key2=value2" for
 each parameter in the given  
HttpServletRequest and key in
 given Map. | 
static String | 
makeQueryString(javax.servlet.http.HttpServletRequest request,
               Map<String,Object> additions,
               String[] ignores)
Creates a query string of the format "key1=value1&key2=value2" for
 each parameter in the given  
HttpServletRequest and key in
 given Map that is not listed in the ignore list. | 
static String | 
makeQueryString(javax.servlet.http.HttpServletRequest request,
               Map<String,Object> additions,
               String[] ignores,
               Util.IgnoreType ignoreType)
Creates a query string of the format "key1=value1&key2=value2" for
 each parameter in the given  
HttpServletRequest and key in
 given Map that is not listed in the ignore list. | 
static String | 
makeQueryString(javax.servlet.http.HttpServletRequest request,
               String[] ignores)
Creates a query string of the format "key1=value1&key2=value2" for
 each parameter in the given  
HttpServletRequest that is not
 listed in the ignore list. | 
protected static String | 
substituteUrl(javax.servlet.http.HttpServletRequest request,
             String tmpl)
substituteUrl 
 | 
protected static final char[] substKeywords
substKeywords={ 's', 'h', 'p', 'x', 'c' }protected static final String[] hostHeaders
public static String calculateUrlBase(javax.servlet.http.HttpServletRequest request)
 As an example, suppose your host was www.mycompany.com, you are serving
 from port 80, and your web application name was "opennms," then this
 method would return: http://www.mycompany.com:80/opennms/
 
 If this guess is wrong, you can override it by setting the property
 opennms.web.base-url in opennms.properties
 (for embedded Jetty).
 
request - the servlet request you are servicingString object.public static String calculateUrlBase(javax.servlet.http.HttpServletRequest request, String path)
protected static String substituteUrl(javax.servlet.http.HttpServletRequest request, String tmpl)
substituteUrl
public static String getHostHeader(javax.servlet.http.HttpServletRequest request)
request - a HttpServletRequest object.String object.public static String encode(String string)
string - string to be encodedpublic static String decode(String string)
string - string to be decodedpublic static String makeHiddenTags(javax.servlet.http.HttpServletRequest request)
request - the HttpServletRequest to read the parameters
            fromparamName" value=" paramValue"
         /> tag for each parameter.public static String makeHiddenTags(javax.servlet.http.HttpServletRequest request, Map<String,Object> additions)
request - the HttpServletRequest to read the parameters
            fromadditions - a map of extra parameters to create hidden tags forparamName" value=" paramValue"
         /> tag for each parameter.public static String makeHiddenTags(javax.servlet.http.HttpServletRequest request, String[] ignores)
request - the HttpServletRequest to read the parameters
            fromignores - A string array containing request parameters to ignoreparamName" value=" paramValue"
         /> tag for each parameter.public static String makeHiddenTags(javax.servlet.http.HttpServletRequest request, Map<String,Object> additions, String[] ignores)
request - the HttpServletRequest to read the parameters
            fromadditions - a map of extra parameters to create hidden tags forignores - the list of parameters not to create a hidden tag forparamName" value=" paramValue"
         /> tag for each parameter not in the ignore list.public static String makeHiddenTags(javax.servlet.http.HttpServletRequest request, Map<String,Object> additions, String[] ignores, Util.IgnoreType ignoreType)
request - the HttpServletRequest to read the parameters
            fromadditions - a map of extra parameters to create hidden tags forignores - the list of parameters not to create a hidden tag forignoreType - whether the ignore list applies to the request parameters,
            values in the additions map, or bothparamName" value=" paramValue"
         /> tag for each parameter not in the ignore list.public static String makeQueryString(javax.servlet.http.HttpServletRequest request)
HttpServletRequest.request - a HttpServletRequest object.String object.makeQueryString( HttpServletRequest, Map, String[] )public static String makeQueryString(javax.servlet.http.HttpServletRequest request, Map<String,Object> additions)
HttpServletRequest and key in
 given Map.request - a HttpServletRequest object.additions - a Map object.String object.makeQueryString( HttpServletRequest, Map, String[] )public static String makeQueryString(javax.servlet.http.HttpServletRequest request, String[] ignores)
HttpServletRequest that is not
 listed in the ignore list.request - a HttpServletRequest object.ignores - an array of String objects.String object.makeQueryString( HttpServletRequest, Map, String[] )public static String makeQueryString(javax.servlet.http.HttpServletRequest request, Map<String,Object> additions, String[] ignores)
HttpServletRequest and key in
 given Map that is not listed in the ignore list.request - the HttpServletRequest to read the parameters
            fromadditions - a mapping of strings to strings or string arrays to be
            included in the query stringignores - the list of parameters and map entries not to includepublic static String makeQueryString(javax.servlet.http.HttpServletRequest request, Map<String,Object> additions, String[] ignores, Util.IgnoreType ignoreType)
HttpServletRequest and key in
 given Map that is not listed in the ignore list.request - the HttpServletRequest to read the parameters
            fromadditions - a mapping of strings to strings or string arrays to be
            included in the query stringignores - the list of parameters and map entries not to includeignoreType - a Util.IgnoreType object.public static EventProxy createEventProxy()
EventProxy insteadcreateEventProxy
EventProxy object.public static final String formatDateToUIString(Date date)
fmt:formatDate taglib at the JSP level 
   instead of converting Date instances into String instances inside 
   the model code.date - a Date object.String object.DateFormatpublic static String getParameter(javax.servlet.http.HttpServletRequest request, String name)
Copyright © 2021. All rights reserved.