• 2.Controller Annotation
  • Lab: Web Server Annotation Routing




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

    Lab: Web Server Annotation Routing


    This tutorial provides step-by-step guidelines to change the routing of the web server we've created earlier with annotations.

    1.Delete Routing


    First, we must delete the old routing. Delete the AppRouteConfig interface and the AppRouteConfigImpl class. You will get the following warning:

    Now delete the MainApplication class and the Application interface. Open the Main class and you should see this:



    Delete those lines. Now remove the AppRouteConfig from the ServerImpl and ServerRouteConfigImpl constructors. From the ServerRouteConfigImpl delete the initializeServerConfig() and parseRoute() methods. Now the server should be able to start:



    Now we need to create the new routing.


    2.Controller Annotation


    In the server.routing package, create the following annotation:

    We will use this to identify our controllers later on. Only classes with this annotation will be able to declare routings.



    Download 1,03 Mb.
      1   2   3   4   5   6   7




    Download 1,03 Mb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Lab: Web Server Annotation Routing

    Download 1,03 Mb.