Class JKWebUtil

java.lang.Object
com.jk.web.util.JKWebUtil

public class JKWebUtil extends Object
This class is a utility class for web-related operations and common tasks.
Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    This method encodes a password using a hashing mechanism.
    protected static String
    fixHtml(jakarta.servlet.http.HttpServletRequest request, String xhtml)
    This method replaces occurrences of &nbsp with a space character in the provided XHTML.
    static String
    getContextPath(jakarta.servlet.http.HttpServletRequest req)
    This method retrieves the context path of the HttpServletRequest.
    static boolean
    This method checks if the application is in debug mode.
    static void
    main(String[] args)
    This main method used for testing and demonstrating string manipulation.
    static boolean
    matchPasswords(String rawPassword, String encodedPassword)
    This method compares a raw password with an encoded password to check for a match.
    static void
    toPDF(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String xhtml)
    This method is yet to be implemented (TBI).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JKWebUtil

      public JKWebUtil()
  • Method Details

    • fixHtml

      protected static String fixHtml(jakarta.servlet.http.HttpServletRequest request, String xhtml)
      This method replaces occurrences of &nbsp with a space character in the provided XHTML.

      Also adjusts stylesheet references to use the context path.

      Parameters:
      request - Specifies the HttpServletRequest object.
      xhtml - Specifies the input XHTML content to be processed.
      Returns:
      the processed XHTML content.
    • getContextPath

      public static String getContextPath(jakarta.servlet.http.HttpServletRequest req)
      This method retrieves the context path of the HttpServletRequest.
      Parameters:
      req - Specifies the HttpServletRequest object.
      Returns:
      the context path of the request.
    • main

      public static void main(String[] args)
      This main method used for testing and demonstrating string manipulation.
      Parameters:
      args - the command-line arguments.
    • toPDF

      public static void toPDF(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String xhtml) throws Exception
      This method is yet to be implemented (TBI).
      Parameters:
      request - Specifies the parameter that is yet to be implemented (TBI).
      response - Specifies the parameter that is yet to be implemented (TBI).
      xhtml - Specifies the parameter that is yet to be implemented (TBI).
      Throws:
      Exception - Specifies the exception that is yet to be implemented (TBI).
    • isDebug

      public static boolean isDebug()
      This method checks if the application is in debug mode.
      Returns:
      false.
    • encodePassword

      public static String encodePassword(String password)
      This method encodes a password using a hashing mechanism.
      Parameters:
      password - Specifies the plain text password to be encoded.
      Returns:
      the encoded password.
    • matchPasswords

      public static boolean matchPasswords(String rawPassword, String encodedPassword)
      This method compares a raw password with an encoded password to check for a match.
      Parameters:
      rawPassword - Specifies the plain text password to be compared.
      encodedPassword - Specifies the encoded password to be compared.
      Returns:
      true, if the passwords match, false otherwise.