Summary of the invention
The technical problem to be solved in the present invention provides a kind of implementation method of browse service COOKIE of wireless application protocol gateway, can make the WAP terminal of not supporting COOKIE also can enjoy the facility that the COOKIE technology is brought.
In order to solve the problems of the technologies described above, the invention provides a kind of implementation method of browse service COOKIE of wireless application protocol gateway, be applied to comprise the system of WAP (wireless application protocol) WAP terminal by the WAP gateway access application server, this method comprises that WAP gateway receives WAP terminal access processing of request process, may further comprise the steps:
(a) after WAP gateway is received the request first time of WAP terminal access application server, obtain all permanent COOKIE of this terminal and put into buffer memory;
When (b) WAP gateway is received subsequent request, from its buffer memory, obtain all session COOKIE of this session according to the unique sign of the session of obtaining, the session COOKIE that obtains coupling according to the application server domain name and the path of this terminal access then, and obtain the permanent COOKIE that mates in the buffer memory;
(c) WAP gateway is integrated permanent COOKIE and the session COOKIE that obtains, and the message that structure has COOKIE information sends to this application server;
This method comprises that also WAP gateway receives COOKIE information processing process, may further comprise the steps:
(h) after WAP gateway is received the COOKIE information that application server returns, resolve described COOKIE in unified data structure;
(i) this WAP gateway judges that the COOKIE that receives is session COOKIE or permanent COOKIE, again with buffer memory in the COOKIE of same type mate, upgrade the COOKIE in the buffer memory when matching, otherwise add this COOKIE in buffer memory.
Further, said method also can have following characteristics: the WAP gateway in the described system be distributed setting and a database that is connected with each WAP gateway arranged, in the described step (a), after the WAP terminal request access application server, judge that earlier whether this request is to ask for the first time after terminal is reached the standard grade, if, WAP gateway is earlier according to the WAP terminal iidentification, obtain all permanent COOKIE of this terminal correspondence in the database, and with buffer memory in existing permanent COOKIE compare, upgrade in the buffer memory existing permanent COOKIE or add new permanent COOKIE to buffer memory.
Further, said method also can have following characteristics: this WAP gateway also mates according to the domain name of the application server of WAP terminal access and the path permanent COOKIE to this terminal in the buffer memory in the described step (a), and the information of the permanent COOKIE that matches is sent to application server.
Further, said method also can have following characteristics: in the described step (i), this WAP gateway is judged the type of described COOKIE, if session COOKIE, session COOKIE in itself and this all time periods of session is mated according to the domain name and the path of described application server, if the match is successful then upgrade described COOKIE, otherwise it is preserved buffer memory into described WAP gateway; If described COOKIE is permanent COOKIE, according to the sign of described terminal and the domain name and the path of described application server, permanent COOKIE all in itself and the described WAP gateway buffer memory is mated, if the match is successful, upgrade in the buffer memory should coupling COOKIE content; Otherwise, preserve described permanent COOKIE in described buffer memory.
Further, said method also can have following characteristics: in the described step (c), whether comprise the type that outdated information is judged described COOKIE according to described COOKIE information.
Further, said method also can have following characteristics: when the WAP terminal rolls off the production line, WAP gateway obtains the unique sign of session COOKIE, deletes all session COOKIE of this terminal in the described WAP gateway buffer memory according to the unique sign of this session, discharges all session COOKIE resources.
Further, said method also can have following characteristics: when the WAP terminal rolled off the production line, WAP gateway matched all permanent COOKIE of this terminal from described WAP gateway buffer memory according to unique terminal iidentification; After filtering out expired COOKIE, described permanent COOKIE is saved in the database, simultaneously all COOKIE that mate with this terminal of deletion among the permanent COOKIE from described buffer memory.
Further, said method also can have following characteristics: when preserving all permanent COOKIE, to mate according to the permanent COOKIE that unified resource is located in title and path, terminal iidentification and the database, if the match is successful, illustrate that there has been old version in this COOKIE information, then more be somebody's turn to do the content of mating COOKIE in the new database; Otherwise it fails to match, preserves this COOKIE in database.
Further, said method also can have following characteristics: expired COOKIE will be made regular check on and delete to database.
Further, said method also can have following characteristics: in the described step (b), structure has before the information of COOKIE, filters out expired COOKIE earlier.
In sum, the inventive method is by adopting WAP gateway, making does not support the WAP terminal of COOKIE can realize the COOKIE function yet, for the WAP terminal of not supporting COOKIE provides better web page browsing environment, and the mode that adopts database to combine with buffer memory is come buffer memory session and permanent COOKIE, has remedied some defectives of hard disk preserving type.
Embodiment
Below in conjunction with drawings and Examples the present invention is further described:
At present general COOKIE is kept on the local hard drive of WAP terminal, and the information that retrieval is relevant when visiting same server subsequently sends to application server.This common COOKIE storage is unaccommodated to WAP gateway.At first, for session COOKIE, there is no need to be saved on the hard disk, only need preserve relevant session COOKIE in buffer memory just can, because concerning the WAP terminal, according to the feature of business, the WAP terminal can not be in line states for a long time always, and in a single day all COOKIE of this session of rolling off the production line are without any use, so realize improving the treatment effeciency of COOKIE with buffer memory.
Secondly, in WAP gateway, in order to improve the disposal ability of WAP terminal by the WAP gateway access application server, WAP gateway is made up of the machine of many equal traffic handing capacities.Once reaching the standard grade to the request the line process from the WAP terminal like this is that a unique service processor is handled, but the different inferior requests in the line process of reaching the standard grade to can not guarantee it is that a unique processor is handled to mobile phone, all requests that are the WAP terminal are to be distributed on the different service processors to handle, and it is that different machines is handled that the COOKIE that can cause application server to return like this handles.If be saved in WAP gateway local hard drive on by general COOKIE information processing this moment is worthless, can cause the COOKIE information of mobile phone to be kept on many machines, can't accurately locate corresponding COOKIE information fast during like this to request next time of WAP terminal, so in order to reach above purpose, need be saved in information and be convenient to different service processors in the database on the public machine and handle.Therefore, the system of present embodiment comprises the some WAP terminals and the some WAP gateways that connect by the internet, database and the application server that is connected with described WAP gateway respectively, and wherein, expired permanent cookie is made regular check on and deleted to database.
The WAP terminal is by the WAP gateway access application server, and the COOKIE information that WAP gateway needs application server to return is handled, some information of visit before keeping when mobile phone is visited relevant application server once more after being convenient to.At present WAP gateway is all to preserve processing to the COOKIE information that the application server of WAP terminal access returns, and to not supporting the mobile phone of COOKIE, gateway is need carry out COOKIE to obtain operation (the COOKIE information to former preservation is filtered), and supports that to own the mobile phone gateway of COOKIE is not obtain the COOKIE information of preservation in the past.
Fig. 1 shows the handling process after WAP gateway in the embodiment of the invention is received WAP terminal access application server, may further comprise the steps:
Step 110, WAP terminal request access application server;
Step 120, WAP gateway judge that whether this request is the request first time after terminal is reached the standard grade, if, carry outstep 130, otherwise, carry outstep 150;
Step 130, WAP gateway obtains and preserves unique sign of this session, and according to WAP terminal iidentification Query Database, obtain this terminal correspondence all permanent COOKIE (the permanent COOKIE that comprises other server) and with buffer memory in permanent COOKIE relatively, upgrade in the buffer memory existing permanent COOKIE or add new permanent COOKIE in buffer memory;
Step 140, WAP gateway mates according to the domain name (being the URL title) of the application server of WAP terminal access and the path permanent COOKIE to this terminal in the buffer memory, and the information of the permanent COOKIE that matches is sent to application server, finishes;
Step 150, WAP gateway mates the session COOKIE in the buffer memory according to the domain name and the path of the application server of the unique identification of this session, visit, obtains the session COOKIE of coupling; Simultaneously, WAP gateway mates the permanent COOKIE in the buffer memory according to the domain name and the path of the application server of terminal iidentification, visit, obtains the permanent COOKIE of coupling;
Step 160, WAP gateway filter out permanent COOKIE expired among the permanent COOKIE that matches, and then session COOKIE and the permanent COOKIE that selects are integrated, and the message that structure has the information of these COOKIE sends to application server, finishes.
Session COOKIE design is the notion of 2 grades of chained lists, and permanent COOKIE is the notion of one-level chained list, but session COOKIE took out all COOKIE (storing in the chained list mode) in all these session phases before this according to the session sign when coupling, from this child list, mate then, and permanent COOKIE directly mates from chained list, and the two matching principle when finally matching the COOKIE of a certain server of visit all mates according to URL, path and end mark.
Fig. 2 shows the flow process of the COOKIE information that the preservation application server returns in the embodiment of the invention, may further comprise the steps:
Step 210, WAP gateway are resolved in the unified data structure according to the COOKIE information that application server returns, promptly in the data structure of Ding Yi COOKIE information;
Step 220 judges according to the content that is resolved to whether this COOKIE information is expired, if expired then discharge content in this data structure, finishes; Otherwise, carry outstep 230;
Whetherstep 230 comprises expires (expired) information according to the above-mentioned COOKIE information of returning, and judges the type of this COOKIE, if session COOKIE carry outstep 240, otherwise, be permanent COOKIE, carry outstep 250;
Step 240, obtain the unique sign of session, from the buffer memory of WAP gateway, take out session COOKIE in all time periods of this session according to the unique sign of session, mate the above-mentioned COOKIE that returns in domain name and path according to the application server of its visit, if the match is successful, there has been the COOKIE that is complementary with the above-mentioned COOKIE that returns in the expression buffer memory, therefore upgraded the COOKIE in the buffer memory; Otherwise, the above-mentioned COOKIE that returns is added in the buffer memory, finish;
Step 250, then from the buffer memory of WAP gateway, take out all permanent COOKIE, domain name and path, terminal iidentification and the above-mentioned COOKIE that returns according to the application server of WAP terminal access mate, if the match is successful, illustrate that there has been old version in this COOKIE information, then upgrades the content of this coupling of buffer memory COOKIE; Otherwise it fails to match, preserves the above-mentioned COOKIE that returns in buffer memory, finishes.
Fig. 3 shows the flow process of deleting session COOKIE in the embodiment of the invention when the WAP terminal rolls off the production line, and may further comprise the steps:
Step 310, when the WAP terminal rolled off the production line, WAP gateway obtained the unique sign of session COOKIE;
Step 320 according to all session COOKIE of this terminal in the unique sign deletion of the session buffer memory, discharges all session COOKIE resources.
Fig. 4 shows the flow process of preserving permanent COOKIE in the embodiment of the invention when the WAP terminal rolls off the production line, and may further comprise the steps:
Step 410, when the WAP terminal rolled off the production line, WAP gateway matched all permanent COOKIE of this terminal from buffer memory according to unique terminal iidentification;
Step 420, filter out expired COOKIE after, above-mentioned permanent COOKIE is saved in the database, simultaneously all COOKIE that mate with this terminal of deletion from the permanent COOKIE of buffer memory.
When preserving all permanent COOKIE, to mate according to the permanent COOKIE in URL title and path, terminal iidentification and the database, if the match is successful, illustrate that there has been old version in this COOKIE information, then more be somebody's turn to do the content of mating COOKIE in the new database; Otherwise it fails to match, and then explanation is new COOKIE, preserves this COOKIE in database.