Class WebApiUtil

java.lang.Object
org.codelibs.fess.util.WebApiUtil

public final class WebApiUtil extends Object
Utility class for web API operations. Provides functionality for setting and retrieving objects from request attributes, error handling, and validation in web API context.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> T
    Gets an object from the current request attributes.
    static void
    setError(int statusCode, Exception e)
    Sets an error in the current request with the specified status code and exception.
    static void
    setError(int statusCode, String message)
    Sets an error in the current request with the specified status code and message.
    static void
    setObject(String name, Object value)
    Sets an object in the current request attributes.
    static void
    Validates the current request by checking for stored web API exceptions.

    Methods inherited from class java.lang.Object

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

    • setObject

      public static void setObject(String name, Object value)
      Sets an object in the current request attributes.
      Parameters:
      name - The attribute name
      value - The attribute value
    • getObject

      public static <T> T getObject(String name)
      Gets an object from the current request attributes.
      Type Parameters:
      T - The type of the object
      Parameters:
      name - The attribute name
      Returns:
      The attribute value, or null if not found
    • setError

      public static void setError(int statusCode, String message)
      Sets an error in the current request with the specified status code and message.
      Parameters:
      statusCode - The HTTP status code
      message - The error message
    • setError

      public static void setError(int statusCode, Exception e)
      Sets an error in the current request with the specified status code and exception.
      Parameters:
      statusCode - The HTTP status code
      e - The exception that caused the error
    • validate

      public static void validate()
      Validates the current request by checking for stored web API exceptions. Throws any stored WebApiException if found.
      Throws:
      WebApiException - If a web API exception was previously stored