Package com.jk.web.faces.controllers
Class JKUtilWebController
java.lang.Object
com.jk.web.faces.controllers.JKWebController
com.jk.web.faces.controllers.JKUtilWebController
- All Implemented Interfaces:
Serializable
This class is a controller, providing utility methods and properties for web
applications.
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
- See Also:
-
Field Summary
Fields inherited from class com.jk.web.faces.controllers.JKWebController
logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
This method retrieves the current year.boolean
This method checks if a file with the given filename exists.getPath()
This method gets the path from the request URI.getTheme()
This method gets the current theme selected for the web application.String[]
This method gets the list of available themes.boolean
isMobile()
This method checks if the user agent indicates a mobile device.list
(int size) This method generates a list of integers from 0 to (size-1).static void
This main method is used for testing purposes.random()
This method generates a random number as a string.This method reloads the random value.void
This method sets the current theme for the web application.This method converts an object to its string representation.Methods inherited from class com.jk.web.faces.controllers.JKWebController
context, error, error, executeAsyc, getContextParam, getContextPath, getFromAppliaction, getFromRequest, getFromSession, getParam, getParamterFromRequest, getRoles, getTenantId, getUserName, getViewScopedManagedBean, handleException, init, isDebug, isDevelopmentMode, logAction, postConstruct, redirect, request, session, showErrorDialogMessage, showInfoDialogMessage, showWarningDialogMessage, success, success, suggestName, updateUi, warning
-
Constructor Details
-
JKUtilWebController
public JKUtilWebController()This method constructs a newJKUtilWebController
.
-
-
Method Details
-
random
This method generates a random number as a string.- Returns:
- a random number as a string.
-
reloadRandom
This method reloads the random value.If in debug mode, generates a new random number; otherwise, returns the live random value.
- Returns:
- the random value.
-
currentYear
public int currentYear()This method retrieves the current year.- Returns:
- the current year.
-
getPath
This method gets the path from the request URI.- Returns:
- the path.
-
exists
This method checks if a file with the given filename exists.- Parameters:
fileName
- Specifies the name of the file.- Returns:
- true, if the file exists, false otherwise.
-
isMobile
public boolean isMobile()This method checks if the user agent indicates a mobile device.- Returns:
- true, if the user agent indicates a mobile device, false otherwise.
-
main
This main method is used for testing purposes.- Parameters:
args
- the command-line arguments.
-
list
This method generates a list of integers from 0 to (size-1).- Parameters:
size
- Specifies the size of the list.- Returns:
- the list of integers.
-
toString
This method converts an object to its string representation. If the object is null, returns "-".- Parameters:
o
- Specifies the object to convert.- Returns:
- the string representation of the object.
-
getTheme
This method gets the current theme selected for the web application.- Returns:
- the current theme.
-
getThemes
This method gets the list of available themes.- Returns:
- an array of theme names.
-
setTheme
This method sets the current theme for the web application.- Parameters:
theme
- Specifies the new theme for the web application.
-