Class GetLocaleCommand<C extends WebContext>

java.lang.Object
org.apache.commons.chain.web.jakarta.GetLocaleCommand<C>
Type Parameters:
C - Type of the context associated with this command
All Implemented Interfaces:
Command<C>

public class GetLocaleCommand<C extends WebContext> extends Object implements Command<C>
Base Command implementation for retrieving the requested Locale from our Context, and storing it under the context attribute key returned by the localeKey property.
Since:
Chain 1.3
Author:
Stefan Graff
  • Constructor Details

    • GetLocaleCommand

      public GetLocaleCommand(Function<C,Locale> localeFunction)
      Construct a new instance to get the locale from the context.
      Parameters:
      localeFunction - Function to get the Locale from the context
  • Method Details

    • getLocaleKey

      public String getLocaleKey()
      Return the context attribute key under which we will store the request Locale.
      Returns:
      The context attribute key of the request Locale.
    • setLocaleKey

      public void setLocaleKey(String localeKey)
      Set the context attribute key under which we will store the request Locale.
      Parameters:
      localeKey - The new context attribute key
    • execute

      public boolean execute(C context) throws Exception
      Retrieve the Locale for this request, and store it under the specified context attribute.
      Specified by:
      execute in interface Command<C extends WebContext>
      Parameters:
      context - The Context we are operating on
      Returns:
      false so that processing will continue
      Throws:
      Exception - If an error occurs during execution.