• 13.Changing the Server Route Config
  • Changing the Routing Context Interface




    Download 1.03 Mb.
    bet5/7
    Sana21.03.2017
    Hajmi1.03 Mb.
    #802
    1   2   3   4   5   6   7

    11.Changing the Routing Context Interface


    Change your current RoutingContext interface to this:

    You need to reflect those changes in the RoutingContextImpl.


    12.Changing the Request Handler Implementation


    For our RequestHandlerImpl we need to create an empty constructor. Now we need to create a setter for our function:

    Create empty constructors in the GetHandler and PostHandler classes.


    13.Changing the Server Route Config


    First of all, now our constructor should accept a ClassProvider, that we need to keep in a field:

    Create a new method called initializeServerConfig():



    In this method, we will initialize our ControllerAnnotationParser and we are going to save the routes it creates in a map.



    Now, we need to traverse that map and create our server routes, based on the annotation routes. We need to iterate our inner map:



    First, we need to create a new RequestHandlerImpl based on the request method:



    Now we need to create a new RoutingContext and save the route in our private field:



    Finally, we need to call this method from our constructor.




    Download 1.03 Mb.
    1   2   3   4   5   6   7




    Download 1.03 Mb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Changing the Routing Context Interface

    Download 1.03 Mb.