JIVE Note 1 - Regarding the verification and related class calls in jive1

zhaozj2021-02-16  44

Date: 2001-4-24 5:25 PM All JSP pages All JSP pages Verified the following code Verified User ID <% // Authorization CHECK // Check for the Existence of An Authorization Token Authorization Authtoken = Skinutils.getuserageRauthorization (Request, Response); // if the token was null, they're not authorized. Since this skin will // allow guests to view forums, we'll set a "guest" authentication // token if (authToken == null) {authToken = AuthorizationFactory. Getanonymousauthorization ();}%> The first sentence is nothing to say, is the old man's Static code, get the Authorization object from the session or cookie so-called Authxxx object, but a user ID. The second sentence: if the first sentence Returning NULL, as an anonymizationFactory.GetanonymousAuthorization (); first call a private member function: AuthorizationFactory.LoadAuthorizationFactory () In this function, the program loads the corresponding encrypted verification class, if you write related classes Need to add: AuthorizationFactory.className = Your_full_class_name = yourizationFactory.className = yourizationFactory.className. Otherwise, load the default class: com.coolservlets.forum.database.dbauthorizationFactory. The code is as follows: class c = class.Forname (classname); factory = (authorizationFactory) C.NewInstance (); actually, C is the DBAUTHORIZATIONFACTORY type, but for versatility, Upcasting is the parent class. Java's dynamic binding technology can correctly call the corresponding member function. So, the code we have to see, in the DBauthorizationFactory class. Ok, we got a Factory, through Factory.createAnonymousAuthorization (); you can get an anonymous authorization object instance. Remember, although Factory is an AuthorizationFactory type, but the code that is really called in DBauthorizationFactory.class . Continue tracking analysis factory.createAnonymousAuthorization (); actually returns a UserId as the AUTHORIZATION object instance. Note that the Authorization object here is actually a DBAUTHORIZATION object, and then you can get ForumFactory through the Authorization object, then get Forums, then ...

转载请注明原文地址:https://www.9cbs.com/read-27858.html

New Post(0)