Class FkMethods

  • All Implemented Interfaces:
    Fork

    public final class FkMethods
    extends Object
    implements Fork
    Fork by method matching.

    Use this class in combination with TkFork, for example:

     Take take = new TkFork(
       new FkMethods("GET", new TkLoad()),
       new FkMethods("PUT", new TkSave())
     );

    The class is immutable and thread-safe.

    Since:
    0.4
    See Also:
    TkFork
    • Constructor Detail

      • FkMethods

        public FkMethods​(String mtd,
                         Response rsp)
        Ctor.
        Parameters:
        mtd - Method
        rsp - Response
        Since:
        0.22
      • FkMethods

        public FkMethods​(String mtd,
                         Take tke)
        Ctor.
        Parameters:
        mtd - Method
        tke - Take
      • FkMethods

        public FkMethods​(Collection<String> mtds,
                         Take tke)
        Ctor.
        Parameters:
        mtds - Methods
        tke - Take
    • Method Detail

      • route

        public Opt<Response> route​(Request req)
                            throws Exception
        Description copied from interface: Fork
        Process this request or ignore it.
        Specified by:
        route in interface Fork
        Parameters:
        req - Request
        Returns:
        Non-empty list of responses if it was processed
        Throws:
        Exception - If fails