[Reprint] DotText source code reading (7)-Pingback/TrackBack

Source: Internet
Author: User
From: orders. Therefore, to analyze the blog program, we need to understand the implementation details of this Protocol and the Protocol. In the source code of dottext, we can see that pingback is supported in the published works, and trackback is implemented in the implementation of web services. As for what is the piongback/trackback protocol, google should be able to find it, and I do not have to pay for it. <HttpHandlerpattern = "/(?: Admin) "type =" Dottext. web. UI. handlers. blogExistingPageHandler, Dottext. web "handlerType =" Factory "/> ing allows us to access the admin directory of each blog, will UrlRewrite to the corresponding aspx file under the dottexweb \ admin directory (refer to the previous section). When posting a post, we can see that this call relationship is: private void UpdatePost () {if (Page. isValid) {string successMessage = Constants. RES_SUCCESSNEW; try {Entry entry = new Entry (EntryType); entry. title = txbTitle. text; entry. body = Globals. stripRTB (FtbBody. Text, Request. Url. Host );... Entry. blogID = Config. currentBlog (Context ). blogID; if (PostID> 0) {// is the update operation successMessage = Constants. RES_SUCCESSEDIT; entry. dateUpdated = DateTime. now; // BlogTime. currentBloggerTime; entry. entryID = PostID ;... Entries. Update (entry );...} Else {// Create Operation entry. DateCreated = DateTime. Now; // BlogTime. CurrentBloggerTime; PostID = Entries. Create (entry );}...} Catch (Exception ex ){...} Finally {... }}} Entries. create (entry); is like this: public static int Create (Entry entry, int [] CategoryIDs) {HandlerManager. preCommit (entry, ProcessAction. insert); int result = DTOProvider. instance (). create (entry, CategoryIDs); if (result> 0) {HandlerManager. postCommit (entry, ProcessAction. insert);} return result;} the final data storage test calls DTOProvider, that is, DataDTOProvider, and finally falls into SqlDataProvider for data storage operations. However, we noticed the HandlerManager. PostCommit (entry, ProcessAction. Insert); operation. Take a closer look: HandlerManager is a Wrapper class for the Entry operation class. PreCommit is defined as follows: Process (ProcessState. preCommit, e, pa); While Process reads the web. config's public static void Process (ProcessState ps, Entry e, ProcessAction pa) {// Do we have factories? Are you sure you want to use the factory mode? EntryHandler [] hanlers = Config. Settings. EntryHandlers; // This is deserialization. The Config here is Dottext. Framework. Configuration. Config if (e! = Null & hanlers! = Null) {// walk the entries traversal all processing routines for (int I = 0; I

TrackBackPing: string pageText = BlogRequest. getPageText (link, e. link); the source code of the referenced address will be downloaded using the http protocol of BlogRequest, and then the link is the address of another blog, and e. link is reffer to inform the recipient that the page references link. After safe decoding, the source code of the link is obtained. Then, TrackBackPing will analyze and find the string sPattern = @ "<rdf: \ w + \ s [^>] *?> (</Rdf: rdf> )? "; The matched part analyzes the reference announcement address. The next step is to use SendPing (string trackBackItem, string parameters) to post an application/x-www-form-urlencoded data to the target address. This completes one trackBack.

Several other EntryHandler are also divided into synchronous and asynchronous ones. You can read them here.

ASIDE: For those so-called blogs that do not politely implement pingback/Trackback, do not pretend to be self-proclaimed as a blog service provider (BSP.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.