Summary of the invention
The technical problem that the present invention mainly solves provides the method and apparatus of a kind of JAVA application program to this locality transmission information, can realize the function of the JAVA application program of equipment running background to the local application module transmission of equipment information under the prerequisite that does not change the prior art standard.
For solving the problems of the technologies described above, the technical scheme that the present invention adopts is: provide a kind of JAVA application program to transmit the method for information to this locality, comprise: make the JAVA interface platform request [PlatfromRequest (URL)] of JAVA application program by calling standard of equipment, described JAVA application program information to be passed is passed to the JAVA virtual machine, wherein in the request of JAVA interface platform after the domain name, by the pre-defined rule set this JAVA application name is arranged, local application module name and information to be passed, the source of the corresponding information to be passed of described JAVA application name, described local application module name is the target application module title that information to be passed will arrive; Make described JVM give JAVA adaptation layer with the request of JAVA interface platform; Make described JAVA adaptation layer judge whether the URL destination address that is requested in the request of JAVA interface platform is current device callback standard host; When the described URL of being requested destination address is current device callback standard host, make the JAVA adaptation layer parse JAVA application name, local application module name and the information to be passed after the domain name in the request of JAVA interface platform according to described pre-defined rule; Make described JAVA adaptation layer carry out authentication to the JAVA application program according to the JAVA application name; When described JAVA application program authentication is passed through, described information to be passed is issued the pairing local application module of described local application module name.
Wherein, the JAVA adaptation layer is comprised: make the JAVA adaptation layer check in the request of JAVA interface platform first separator and second separator in the character string after the domain name according to the step that described pre-defined rule parses JAVA application name, local application module name and information to be passed after the domain name in the request of JAVA interface platform, Context resolution after the domain name in the request of JAVA interface platform, before first separator is come out, as the JAVA application name; Context resolution after first separator, before second separator is come out, as local application module name; Context resolution to end of string after second separator is come out, as information to be passed.
Wherein, the step of described information to be passed being issued the pairing local application module of described local application module name comprises: after described information shaping to be passed, issue the pairing local application module of described local application module name.
Wherein, the step of described information to be passed being issued the pairing local application module of described local application module name comprises: described information to be passed by the incident between the thread, incident between the process or the incident between thread and the process, is issued the pairing local application module of described local application module name.
Wherein, the step that makes described JVM give the JAVA adaptation layer with the request of JAVA interface platform comprises: make described JVM give JAVA adaptation layer with the request of JAVA interface platform as common request.
Wherein, described JAVA adaptation layer judges whether the URL destination address that is requested in the request of JAVA interface platform is that current device callback standard host step comprises: described JAVA adaptation layer judges that whether the URL destination address that is requested in the request of JAVA interface platform is " Localhost ", " 127.0.0.1 " or ":: 1 ".
For solving the problems of the technologies described above, another technical solution used in the present invention is: a kind of equipment based on JAVA is provided, comprise: request transmitting unit, be used to make the JAVA application program of equipment by calling the JAVA interface platform request of standard, described JAVA application program information to be passed is passed to the JAVA virtual machine, wherein in the request of JAVA interface platform after the domain name, by the pre-defined rule set this JAVA application name is arranged, local application module name and information to be passed, the source of the corresponding information to be passed of described JAVA application name, described local application module name is the target application module title that information to be passed will arrive; First transfer unit is used to make described JVM to give JAVA adaptation layer with the request of JAVA interface platform; The address judging unit, whether the URL destination address that is requested that is used for making described JAVA adaptation layer judge the request of JAVA interface platform is current device callback standard host; The information analysis unit, be used for when the described URL of being requested destination address is current device callback standard host, make the JAVA adaptation layer parse JAVA application name, local application module name and the information to be passed after the domain name in the request of JAVA interface platform according to described pre-defined rule; The program authenticating unit is used to make described JAVA adaptation layer according to the JAVA application name JAVA application program to be carried out authentication; Second transfer unit is used for when described JAVA application program authentication is passed through described information to be passed being issued the pairing local application module of described local application module name.
Wherein, described information analysis unit specifically is used for making the JAVA adaptation layer to check first separator and second separator in the character string after the JAVA interface platform request domain name, Context resolution after the domain name in the request of JAVA interface platform, before first separator is come out, as the JAVA application name; Context resolution after first separator, before second separator is come out, as local application module name; Context resolution to end of string after second separator is come out, as information to be passed.
Wherein, second transfer unit specifically is used for described information to be passed issuing the pairing local application module of described local application module name by the incident between the thread, incident between the process or the incident between thread and the process.
Wherein, described address judging unit specifically is used for described JAVA adaptation layer and judges that whether the URL destination address that is requested of JAVA interface platform request is " Localhost ", " 127.0.0.1 " or ":: 1 ".
The invention has the beneficial effects as follows: be different from prior art based under the present technical standard situation, realize that information is transmitted the too high situation of cost between the local application module of JAVA application program and equipment, the present invention utilizes the host name that can not be reused in the internet technology, be that Localhost is as the bridge between JAVA application program and the local application module of equipment, information to be passed and local application module name are put into the request of JAVA interface platform, whether the JAVA adaptation layer is judged from the URL destination address that is requested in the JAVA interface platform request of JVM is current device callback standard host, be judged as when being, described information to be passed is sent to local application module, need not to change the prior art standard, simple and convenient and cost are low, and occur the situation of serious side effects can not cause the JAVA application program to be moved on other platforms the time.
Embodiment
Localhost is the standard host title of an internet technical field, is used for representing the callback of current device." Localhost " " ..Localhost " also is the international domain name that is reserved, i.e. the host name that can not be reused.Localhost can be translated into a callback IP address, is " 127.0.0.1 " in the IPV4 epoch, in the IPv6 epoch be ":: 1 ".To this locality request of Localhost,, can show the homepage (because http is used as the default protocol that website is browsed) of local WEB website forever, if present as http://Localhost.
Because the particularity of Localhost, most of mobile communication equipments is not because exist a local WEB website,, also needn't accept of the visit of this address in this locality to treat that WEB such as browser use so do not need to support.This adopts the request of this address to the present invention has been created condition to realize the function expansion.
Described function expansion, comprising: customer requirements JAVA application program is when running background, and equipment can be pointed out some key messages from the JAVA application program on the foreground, and promptly the JAVA application program can be transmitted information to this locality.
For simple and easy this market demand that realizes quickly, the JAVA interface of extension standards of the present invention utilizes Localhost as passage, realizes the information transmission of background java application program, and respective handling is carried out after receiving information again in this locality.Serious side effects appears in this method in the time of can not causing this JAVA program to be moved on other platforms.The following specifically describes various embodiments of the present invention:
Consult Fig. 1, the method embodiment that JAVA application program of the present invention is transmitted information to this locality comprises:
Step 101: make the JAVA interface platform request [PlatfromRequest (URL)] of JAVA application program by calling standard of equipment, described JAVA application program information to be passed is passed to JAVA virtual machine (JVM), wherein in the request of JAVA interface platform after the domain name, by the pre-defined rule set this JAVA application name, local application module name and information to be passed are arranged, the source of the corresponding information to be passed of described JAVA application name, described local application module name is the target application module title that information to be passed will arrive;
Step 102: make described JVM give JAVA adaptation layer with the request of JAVA interface platform;
During to this step, all are all following the JAVA technical standard, do not need the special participation of JVM, also can not destroyed data by JVM.
Step 103: make described JAVA adaptation layer judge whether the URL destination address that is requested in the request of JAVA interface platform is current device callback standard host (Localhost);
Step 104: when the described URL of being requested destination address is current device callback standard host, make the JAVA adaptation layer parse JAVA application name, local application module name and the information to be passed after the domain name in the request of JAVA interface platform according to described pre-defined rule;
Such as in an example, in the request of JAVA interface platform, the URL form is the PlatformRequest of " http: // " beginning, and existing JAVA technical standard requires the URL of the browser access appointment on the invocation facility.And this part is to realize by the explanation of JAVA adaptation layer with to the platform application module invokes.By the JAVA adaptation layer, parse JAVA application name, local application module name and the information to be passed after the domain name in the request of JAVA interface platform according to described pre-defined rule.
Step 105: make described JAVA adaptation layer carry out authentication to the JAVA application program according to the JAVA application name;
Promptly, judge whether this application program is familiar with in adaptation layer, and whether this application program can use this method at this equipment, also is authentication according to the JAVA application name.
Step 106: when described JAVA application program authentication is passed through, described information to be passed is issued the pairing local application module of described local application module name.
More than can understand, the present invention utilizes the host name that can not be reused in the internet technology, be that Localhost is as the bridge between JAVA application program and the local application module of equipment, information to be passed and local application module name are put into the request of JAVA interface platform, whether the JAVA adaptation layer is judged from the URL destination address that is requested in the JAVA interface platform request of JVM is current device callback standard host, be judged as when being, described information to be passed is sent to local application module, need not to change the prior art standard, simple and convenient and cost are low, and occur the situation of serious side effects can not cause the JAVA application program to be moved on other platforms the time.
In another embodiment, the JAVA adaptation layer is comprised according to the step that described pre-defined rule parses JAVA application name, local application module name and the information to be passed after the domain name in the request of JAVA interface platform:
Make the JAVA adaptation layer check in the request of JAVA interface platform first separator and second separator in the character string after the domain name, the Context resolution after the domain name in the request of JAVA interface platform, before first separator is come out, as the JAVA application name; Context resolution after first separator, before second separator is come out, as local application module name; Context resolution to end of string after second separator is come out, as information to be passed.
Described separator can be "/", also can be other meeting of being used to discern, cut apart, such as with separator be "/" as an example, then according to the information of character string after the domain name part among the following rule parsing URL:
The character string of URL outside domain name and port section cut apart by "/", and representing destination path information also is catalogue and fileinfo.Wherein have to give a definition:
1) first order directory name after the domain name part is " a JAVA application name " by heavy duty, is used to refer to the source of this request, also is the title of JAVA application program.This title (character string) is predetermined by JAVA application developer and JAVA adaptation layer implementor, is not the name of JAVA application program itself, or the name of its installation file, perhaps its display name after installing.
2) second level directory name is " local application module name " by heavy duty, also i.e. this JAVA application program that application module that will communicate with this locality, and as phone directory, Email, desktop application etc.This also is to need both sides predetermined.
3) to begin to finish to URL be to use relevant data division to third level catalogue.Concrete form pre-determines by both party, and present embodiment is not done particular determination.
After resolving, carry out information extraction:
1) extracts the JAVA application name, also promptly read the information of first order directory location.
2) after the JAVA application program is carried out authentication, extract local application module name, also promptly read the information of second level directory location, and the remainder of the URL after the catalogue of the second level, as application message, the also information content that promptly will transmit.
The form of above-mentioned JAVA application name, local application module name and ensemble of communication to be passed only is an example application, but the invention is not restricted to above-mentioned example, such as adopting " % " as separator.
In another embodiment, the step of described information to be passed being issued the pairing local application module of described local application module name comprises: after described information shaping to be passed, issue the pairing local application module of described local application module name.
Information to be passed through after the information shaping more meets the reception requirement of local application module.
In another embodiment, the step of described information to be passed being issued the pairing local application module of described local application module name comprises: described information to be passed by the incident between the thread, incident between the process or the incident between thread and the process, is issued the pairing local application module of described local application module name.
The mode that information to be passed is issued the pairing local application module of described local application module name can have a lot, and the present invention repeats no more.
In another embodiment, the step that makes described JVM give the JAVA adaptation layer with the request of JAVA interface platform comprises: make described JVM give JAVA adaptation layer with the request of JAVA interface platform as common request.
Certainly, also can make described JVM give JAVA adaptation layer as special request with the request of JAVA interface platform.
In another embodiment, described JAVA adaptation layer judges whether the URL destination address that is requested in the request of JAVA interface platform is that current device callback standard host step comprises: described JAVA adaptation layer judges that whether the URL destination address that is requested in the request of JAVA interface platform is " Localhost ", " 127.0.0.1 " or ":: 1 ".
Lift a concrete instance below:
Need mention following platform request to JVM as the JAVA application program:
PlatfromRequest (http: // 172.0.0.1/MidletX/phonebook/new﹠amp; Name=JohnsonParker﹠amp; Number=00862156890000), according to this method, representing a JAVA application program of being MidletX to require will be information " new﹠amp; Name=JohnsonParker﹠amp; Number=00862156890000 " pass to a local application module that is phonebook.
Consult Fig. 2,, also provide a kind of apparatus embodiments, comprising based on JAVA based on the present invention:
Request transmitting unit, be used to make the JAVA application program of equipment by calling the JAVA interface platform request PlatfromRequest of standard, described JAVA application program information to be passed is passed to JAVA virtual machine JVM, wherein in the request of JAVA interface platform after the domain name, by the pre-defined rule set this JAVA application name, local application module name and information to be passed are arranged, the source of the corresponding information to be passed of described JAVA application name, described local application module name is the target application module title that information to be passed will arrive;
First transfer unit is used to make described JVM to give JAVA adaptation layer with the request of JAVA interface platform;
The address judging unit, whether the URL destination address that is requested that is used for making described JAVA adaptation layer judge the request of JAVA interface platform is current device callback standard host;
The information analysis unit, be used for when the described URL of being requested destination address is current device callback standard host, make the JAVA adaptation layer parse JAVA application name, local application module name and the information to be passed after the domain name in the request of JAVA interface platform according to described pre-defined rule;
The program authenticating unit is used to make described JAVA adaptation layer according to the JAVA application name JAVA application program to be carried out authentication;
Second transfer unit is used for when described JAVA application program authentication is passed through described information to be passed being issued the pairing local application module of described local application module name.
Described equipment based on JAVA can be mobile phone, portable game machine, personal digital assistant, notebook or the like.
Wherein, described information analysis unit specifically is used for making the JAVA adaptation layer to check first separator and second separator in the character string after the JAVA interface platform request domain name, Context resolution after the domain name in the request of JAVA interface platform, before first separator is come out, as the JAVA application name; Context resolution after first separator, before second separator is come out, as local application module name; Context resolution to end of string after second separator is come out, as information to be passed.
Wherein, described second transfer unit specifically is used for described information to be passed issuing the pairing local application module of described local application module name by the incident between the thread, incident between the process or the incident between thread and the process.
Wherein, described address judging unit specifically is used for described JAVA adaptation layer and judges that whether the URL destination address that is requested of JAVA interface platform request is " Localhost ", " 127.0.0.1 " or ":: 1 ".
The above only is embodiments of the invention; be not so limit claim of the present invention; every equivalent structure or equivalent flow process conversion that utilizes specification of the present invention and accompanying drawing content to be done; or directly or indirectly be used in other relevant technical fields, all in like manner be included in the scope of patent protection of the present invention.