Class ServletParameterBinder

java.lang.Object
fr.paris.lutece.portal.util.mvc.binding.ServletParameterBinder

@ApplicationScoped public class ServletParameterBinder extends Object
Handles the binding of method parameters from an HttpServletRequest.

This class uses available ParameterResolver implementations to resolve and bind method parameters in the context of an MVC controller. It supports standard types like HttpServletRequest, and delegates other parameter types to custom resolvers. If no resolver is found, a binding error is recorded.

This class is application-scoped and managed by CDI.

  • Constructor Details

    • ServletParameterBinder

      public ServletParameterBinder()
  • Method Details

    • bindParameters

      public Object[] bindParameters(jakarta.servlet.http.HttpServletRequest request, Method method)
      Binds the parameters of the given method using values from the HttpServletRequest.

      Each method parameter is matched against a set of ParameterResolvers. If a matching resolver is found, it is used to resolve the value; otherwise, a binding error is logged and recorded. The special case of HttpServletRequest parameters is handled directly.

      Parameters:
      request - The HTTP servlet request containing the input data.
      method - The method whose parameters are to be bound.
      Returns:
      An array of arguments corresponding to the method's parameters, with resolved values or null if unresolved.