1 00:00:01,880 --> 00:00:02,910 Welcome my face. 2 00:00:03,500 --> 00:00:04,600 Welcome to this lecture. 3 00:00:04,760 --> 00:00:08,870 In this lecture, we will learn about Soviet life-cycle and its steps. 4 00:00:09,620 --> 00:00:11,720 So let us get started with the step by step. 5 00:00:12,020 --> 00:00:17,870 The first step is that the subject gets loaded, the loading of the subject when the wind of solar. 6 00:00:17,880 --> 00:00:22,010 In our case, it is that what you don't get starts starts up. 7 00:00:22,490 --> 00:00:25,870 Then the solar container deploys in the woods, all the subjects. 8 00:00:26,570 --> 00:00:31,500 So during start up, the subject is deployed and it is loaded. 9 00:00:31,850 --> 00:00:33,590 This is not true for all cases. 10 00:00:33,950 --> 00:00:40,300 You have to specifically mention this, that you need it to be deployed and loaded at startup, explode 11 00:00:40,310 --> 00:00:43,640 and load on startup and then don't need to happen otherwise. 12 00:00:44,000 --> 00:00:49,130 When the first request is made to distill it, then it gets deployed and loaded. 13 00:00:49,960 --> 00:00:57,970 OK, now in step two, we create the instance of the subject at this stage, it is only an object. 14 00:00:57,970 --> 00:01:02,530 An instance of a Soviet means that, as we know in Java, it is an object. 15 00:01:03,010 --> 00:01:10,840 And this object, it becomes an object based on a class, based on a template of a class and based on 16 00:01:10,840 --> 00:01:11,710 the constructor. 17 00:01:11,770 --> 00:01:20,110 So in this case, a no argument, no argument constructor is called and this object is created. 18 00:01:20,390 --> 00:01:21,580 It is not a solid yet. 19 00:01:21,580 --> 00:01:23,740 It is just a plain old Java object. 20 00:01:24,490 --> 00:01:27,370 Now, the third step is we invoke init method. 21 00:01:28,080 --> 00:01:30,670 Now, there are a couple of things that we need to understand. 22 00:01:30,680 --> 00:01:34,600 First of all, it is after this init method, it becomes a subject. 23 00:01:35,260 --> 00:01:36,580 Where is this method? 24 00:01:37,690 --> 00:01:39,250 Who defines this method? 25 00:01:40,750 --> 00:01:42,460 So what makes a solnik? 26 00:01:42,460 --> 00:01:51,100 Possibly the servlet becomes a servlet because our subject is extending a class and that class is a 27 00:01:51,520 --> 00:01:52,630 piece of class. 28 00:01:52,990 --> 00:01:54,910 This class is an abstract class. 29 00:01:55,360 --> 00:02:00,400 Now we know that in an abstract class, that may or may not be an implementation of different methods. 30 00:02:00,790 --> 00:02:06,090 But when we extend it, we have to give implementation if it for instance. 31 00:02:06,430 --> 00:02:08,790 So we have to give an implementation of these methods. 32 00:02:09,160 --> 00:02:13,390 Such a method is the init method you can give. 33 00:02:13,420 --> 00:02:15,090 You can override the method. 34 00:02:15,640 --> 00:02:23,930 You can see that super in it, which means that whatever is in the bed in class, which is the servlet 35 00:02:23,950 --> 00:02:30,280 class that should be done, it should be done that because all the configuration and context and everything 36 00:02:30,580 --> 00:02:36,760 is handled by the should be subject class and it contains the implementation of a unique method. 37 00:02:37,060 --> 00:02:42,910 You can also make something in your init justice and we will check that up when we write the code. 38 00:02:44,200 --> 00:02:48,610 Now, next comes the step forward, which is invoking the service method. 39 00:02:49,000 --> 00:02:51,220 The service method is invoked by the container. 40 00:02:51,790 --> 00:02:55,840 The container invokes the init method and then comes back. 41 00:02:56,260 --> 00:03:01,410 The control comes back to the container and the container now calls the service method. 42 00:03:01,720 --> 00:03:07,840 It calls this service method whenever a request is asked and the request, if it does get request, 43 00:03:07,840 --> 00:03:10,750 then the service method for the calls Huguet method. 44 00:03:11,140 --> 00:03:15,910 If the request is Borst, then the service method further calls to post method. 45 00:03:16,270 --> 00:03:21,010 The service method is defined in again, the Soviet method. 46 00:03:21,430 --> 00:03:21,790 Right. 47 00:03:22,060 --> 00:03:29,590 And B we override the budget and brute force method in other Soulet and we see what functionality we 48 00:03:29,590 --> 00:03:30,430 want to provide. 49 00:03:30,640 --> 00:03:31,590 What do we want to do? 50 00:03:31,600 --> 00:03:36,490 We want to handle the request and then send the response, processing it and then send the response 51 00:03:37,090 --> 00:03:38,610 so we can do a lot of things. 52 00:03:39,190 --> 00:03:44,590 So that's the first and the Fifth Circuit invoking the disagreement before the object is destroyed. 53 00:03:46,270 --> 00:03:49,830 Before the before the object is just destroyed as a solid. 54 00:03:49,840 --> 00:03:53,210 It has destroyed the destroy method discard just before that. 55 00:03:53,530 --> 00:03:59,930 So if you wanted to clean up your act before destroying the subject, you can use that destroy method. 56 00:04:00,190 --> 00:04:03,070 So these are the basic steps of servlet lifecycle. 57 00:04:03,730 --> 00:04:06,140 Now, there may be some confusion. 58 00:04:06,140 --> 00:04:07,090 There may be some doubt. 59 00:04:07,360 --> 00:04:11,440 I'll go to this to a diagram also in the next lecture. 60 00:04:11,920 --> 00:04:12,250 Right. 61 00:04:12,400 --> 00:04:14,550 And after that, I'll go to the program. 62 00:04:14,570 --> 00:04:19,000 We will go to the sample program and we'll understand these steps further. 63 00:04:19,150 --> 00:04:20,450 So don't worry about it. 64 00:04:20,510 --> 00:04:22,260 OK, see you in the next lecture.