CN101382985A - Method and filter for conversing JSF original page request - Google Patents

Method and filter for conversing JSF original page request Download PDF

Info

Publication number
CN101382985A
CN101382985A CNA2008101705428A CN200810170542A CN101382985A CN 101382985 A CN101382985 A CN 101382985A CN A2008101705428 A CNA2008101705428 A CN A2008101705428A CN 200810170542 A CN200810170542 A CN 200810170542A CN 101382985 A CN101382985 A CN 101382985A
Authority
CN
China
Prior art keywords
jsf
request
suffix
parent page
descriptor file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CNA2008101705428A
Other languages
Chinese (zh)
Inventor
邓智志
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SHENZHEN KINGDEE MIDDLEWARE CO Ltd
Original Assignee
SHENZHEN KINGDEE MIDDLEWARE CO Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SHENZHEN KINGDEE MIDDLEWARE CO Ltd filed Critical SHENZHEN KINGDEE MIDDLEWARE CO Ltd
Priority to CNA2008101705428A priority Critical patent/CN101382985A/en
Publication of CN101382985A publication Critical patent/CN101382985A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a method for requesting to change a JSF original webpage and a filter thereof. The method includes: according to a deployment description file, a designated suffix of the JSF original webpage corresponding to a current application program is obtained; comparison that a suffix of a requested resource name of an intercepted request and the designated suffix are the same is carried out, and that the intercepted request is a request for the JSF original webpage is determined; and the request for the JSF original webpage is transformed into a JSF request. The embodiment directly obtains the designated suffix of the JSF original webpage in a current application program in the deployment description file, which ensures the realization of the requested transformation of the JSF original webpage in various application programs, thereby having universality; and when the deployment description file is changed, transformation arithmetic of the filter is not necessary to be manually modified.

Description

A kind of method of conversing JSF original page request and filtrator
Technical field
The present invention relates to computer application field, especially relate to a kind of method and filtrator of conversing JSF original page request.
Background technology
When if client is asked directly visit JSF (Java Service Face intentionally or by mistake, the user's interface unit framework) during the file resource of parent page, will cause following two kinds of possible results: JSF parent page is used as response and directly returns and show, because of having broken away from the JSF technical support, the information that shows is mess code mostly; JSF parent page is used as the unknown format file and downloads, and at this moment client can be seen the complete source code of JSF parent page, cause the potential safety hazard of webpage.Therefore, client has caused developer's attention to the request of JSF parent page.
In the prior art, each JavaEE (Java 2 Platform Enterprise Edition, Java 2 Platform Enterprise Edition) developer of application program writes filtrator voluntarily, will convert the JSF request to the request of JSF parent page to, avoids client directly to obtain JSF parent page.
In research and practice process to prior art, the present inventor finds that there is following problem in prior art:
Support that at present the JavaEE application server of JSF technology does not all provide container levels other support to the request of JSF parent page, cause the developer of each JavaEE application program only to write filtrator at the JavaEE application program of current exploitation, this filtrator is not suitable for other JavaEE application programs, does not possess versatility; And because the restriction of the application programming interface (API) of security strategy and JavaEE standard, the JavaEE Application developer is difficult to get access to the whole transformation rules in the deployment descriptor file, and be the transfer algorithm of writing filtrator according to the transformation rule of oneself understanding, so when deployment descriptor file changes, need revise the transfer algorithm of filtrator manually.
Summary of the invention
A kind of method and filtrator of the conversing JSF original page request that is provided by container is provided the technical matters that the embodiment of the invention will solve, make the conversion of JSF parent page request between each JavaEE application program, possess versatility, and when deployment descriptor file changes, need not to revise manually the transfer algorithm of filtrator.
For solving the problems of the technologies described above, embodiment provided by the present invention is achieved through the following technical solutions:
A kind of method of conversing JSF original page request: the designated suffix of obtaining the JSF parent page corresponding according to deployment descriptor file with current application program; The suffix that compares the request institute requested resource title of intercepting is identical with described designated suffix, judges the described request of intercepting and be the request to JSF parent page; Convert described request to the JSF request to JSF parent page.
A kind of converter comprises: acquiring unit is used for obtaining according to deployment descriptor file the designated suffix of the JSF parent page corresponding with current application program; Judging unit, the suffix that is used to compare institute's requested resource title is identical with the described designated suffix that acquiring unit obtains, and judges the request of intercepting and be the request to JSF parent page; Converting unit, the request to JSF parent page that is used for going out through judgment unit judges convert the JSF request to.
By technique scheme as can be seen, the embodiment of the invention is obtained the designated suffix of the JSF parent page of current application program correspondence according to deployment descriptor file, when the request institute requested resource title to JSF parent page is during with the ending of described designated suffix, will convert the JSF request to the request of JSF parent page; Because be directly to obtain designated suffix,, and when deployment descriptor file changes, need not to revise manually the transfer algorithm of filtrator so the conversion of JSF parent page request can both realize possessing versatility in each application program from deployment descriptor file.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art, to do to introduce simply to the accompanying drawing of required use in embodiment or the description of the Prior Art below, apparently, accompanying drawing in describing below only is some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
Fig. 1 is the method flow synoptic diagram of the embodiment of the invention one;
Fig. 2 is the method flow synoptic diagram of the embodiment of the invention two;
Fig. 3 is the method flow synoptic diagram of the embodiment of the invention three;
Fig. 4 is the structural representation of embodiment of the invention converter.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
A kind of method of the conversing JSF original page request that is provided by container is provided the embodiment of the invention, makes the conversion of JSF parent page request possess versatility, and when deployment descriptor file changes, need not to revise manually the transfer algorithm of filtrator.Below be described with reference to the accompanying drawings by three embodiment.
Embodiment one, describe in detail referring to Fig. 1, Fig. 1 is the method flow synoptic diagram of the embodiment of the invention one.
Step 101: the designated suffix of obtaining the JSF parent page corresponding according to deployment descriptor file with current application program.
Filtrator makes an explanation to it after reading in deployment descriptor file Web.xml by container, obtains wherein the designated suffix of the JSF parent page corresponding with current application program.
Filtrator is directly to obtain designated suffix according to deployment descriptor file, and therefore, when deployment descriptor file changed, filtrator also can need not to revise manually filtrator directly obtaining designated suffix according to the deployment descriptor file after changing.
Step 102: the suffix that compares the request institute requested resource title of intercepting is identical with described designated suffix, judges the described request of intercepting and be the request to JSF parent page.
Filtrator is intercepted when request, judges that then whether this request is the request to JSF parent page, if this request institute requested resource title is to end up with the described designated suffix of step 101, then judges this request and be the request to JSF parent page.
Step 103: convert described request to the JSF request to JSF parent page.
Conversion can be carried out according to mapping ruler, mapping ruler can be in deployment descriptor file predefine, can be divided into prefix pattern and suffix pattern.
If successfully will convert the JSF request to the request of JSF parent page, then this JSF request is forwarded to the inlet Servlet of JSF engine, carry out subsequent treatment.
The embodiment of the invention is directly obtained the designated suffix of JSF parent page in the current application program in the deployment descriptor file, makes the conversion of JSF parent page request can both realize possessing versatility in each application program; And when deployment descriptor file changes, need not to revise manually the transfer algorithm of filtrator.
Embodiment two, referring to Fig. 2, Fig. 2 is the method flow synoptic diagram of the embodiment of the invention two.
Step 201: container initialization filtrator.
After filtrator was used in configuration in deployment descriptor file Web.xml, container read deployment descriptor file, and makes an explanation.
Embodiment of the invention filtrator can be provided by container, and configuration code can be completely fixed, and after filtrator is used in configuration in deployment descriptor file, does not then need manually it to be made an amendment again and go for each JavaEE application program; And, can also further provide support by programming tool, filtrator is used in configuration in deployment descriptor file automatically, does not influence the realization of the embodiment of the invention.
Step 202: filtrator obtains the designated suffix of the JSF parent page corresponding with current application program.
Filtrator obtains the Configuration Values of javax.faces.DEFAULT_SUFFIX parameter in the deployment descriptor file that container explains, obtains the designated suffix of the JSF parent page of current application program correspondence.
Filtrator is directly to obtain designated suffix according to deployment descriptor file, and therefore, when deployment descriptor file changed, filtrator also can need not to revise manually filtrator directly obtaining designated suffix according to the deployment descriptor file after changing.
Step 203: filtrator is preserved described designated suffix.
In the front filter example, preserve this designated suffix.Then, filtrator then is in listening state.
Step 204: filtrator is intercepted a request.
Step 205: it is request to JSF parent page that filtrator is judged the request of intercepting.
In the request institute requested resource title of intercepting is when ending up with the parent page suffix, and it is request to JSF parent page that filtrator is judged the request of intercepting.
Step 206: convert the described request of intercepting to the JSF request to JSF parent page.
Conversion is carried out according to mapping ruler, mapping ruler can be in deployment descriptor file predefine, can be divided into prefix pattern and suffix pattern.
The mapping ruler of prefix pattern promptly refers to and will add the prefix pattern character string in the request front to JSF parent page, can start by character "/".For example, mapping ruler is "/jsf/* ", to the request of JSF parent page be " http: // .../page1.xhtml ", then the request of the JSF after the conversion for " http: // .../jsf/page1.xhtml ".
The mapping ruler of suffix pattern promptly refers to remove the original suffix to the request of JSF parent page, adds the suffix model string, can start by character ". ".For example, mapping ruler is " faces ", to the request of JSF parent page be " http: // .../page1.xhtml ", then the request of the JSF after the conversion for " http: // .../page1.faces ".
Following examples three become JSF request processing afterwards to describe in conjunction with the request successful conversion to JSF parent page.
Embodiment three, referring to Fig. 3, Fig. 3 is the method flow synoptic diagram of the embodiment of the invention three.
Step 301: container initialization filtrator.
After filtrator was used in configuration in deployment descriptor file Web.xml, container read deployment descriptor file, and makes an explanation.
The configuration code of embodiment of the invention filtrator can be completely fixed, and after filtrator is used in configuration in deployment descriptor file, does not then need manually it to be made an amendment again and go for each application program; And, can also further provide support by programming tool, filtrator is used in configuration in deployment descriptor file automatically, does not influence the realization of the embodiment of the invention.
Step 302: filtrator obtains the designated suffix of the JSF parent page corresponding with current application program.
Filtrator obtains the Configuration Values of javax.faces.DEFAULT_SUFFIX parameter in the deployment descriptor file that container explains, obtains the designated suffix of the JSF parent page of current application program correspondence.
Filtrator is directly to obtain designated suffix according to deployment descriptor file, and therefore, when deployment descriptor file changed, filtrator also can need not to revise manually filtrator directly obtaining designated suffix according to the deployment descriptor file after changing.
Step 303: filtrator is preserved described designated suffix.
In the front filter example, preserve this designated suffix.Then, filtrator then is in listening state.
Step 304: filtrator is intercepted a request.
Step 305: it is request to JSF parent page that filtrator is judged the request of intercepting.
When whether the request institute requested resource title of intercepting ended up with the parent page suffix, it was request to JSF parent page that filtrator is judged the request of intercepting.
Step 306: convert the described request of intercepting to the JSF request to JSF parent page.
Conversion is carried out according to mapping ruler, mapping ruler can be in deployment descriptor file predefine, can be divided into prefix pattern and suffix pattern.
The mapping ruler of prefix pattern promptly refers to and will add the prefix pattern character string in the request front to JSF parent page, can start by character "/".For example, mapping ruler is "/jsf/* ", is http to the request of JSF parent page: // .../page1.xhtml, then the request of the JSF after the conversion for " http: // .../jsf/page1.xhtml ".
The mapping ruler of suffix pattern promptly refers to remove the original suffix to the request of JSF parent page, adds the suffix model string, can start by character ". ".For example, mapping ruler is " .faces ", be http to the request of JSF parent page: // .../page1.xhtml, then the request of the JSF after the conversion is " http: // .../page1.faces ".
Step 307: the JSF request that will meet mapping ruler after will changing is distributed to the inlet Servlet of JSF.
Container assert according to the mapping ruler of Servlet standard whether the JSF request is legal JSF request, and the request that meets the mapping ruler of Servlet standard then is legal JSF request.
Mapping ruler generally has two kinds of prefix pattern and suffix patterns:
Prefix pattern match comprises URL (the Uniform Resource Locations of a certain section character string, URL(uniform resource locator)), for example: match pattern is "/abc/* ", can match http://www.abc.com/abc/somepage and http://www.abc.com/abc/someotherpage (wherein http://www.abc.com/ is the context root) etc. and comprise the URL of character "/abc/ ", but can not mate the URL that does not comprise character "/abc/ " as http://www.abc.com/bcd/somepage.
The suffix pattern is then mated the URL with a certain section character string ending.For example mapping ruler is " * .jsf ", the URL with character " .jsf " ending such as http://www.abc.com/mypage.jsf and http://www.abc.com/otherpage.jsf (wherein http://www.abc.com/ is the context root) can be matched, and the URL that does not end up can not be mated with character " .jsf " as http://www.abc.com/mypage.xhtml.
Step 308:JSF inlet Servlet handles the JSF request.
Servlet gives the JSF engine with the JSF request and handles, the JSF engine is according to the information in the request URL, in conjunction with the runtime contextual information, calculate actual parent page resource location in conjunction with the specified acquiescence suffix of javax.faces.DEFAULT_SUFFIX parameter in the deployment descriptor file.The JSF engine can directly not read the parent page file, but obtains parent page by container, handles.
The embodiment of the invention is directly obtained the designated suffix of JSF parent page in the current application program in the deployment descriptor file, makes the conversion of JSF parent page request can both realize possessing versatility in each application program; And when deployment descriptor file changes, need not to revise manually the transfer algorithm of filtrator.
Can also provide further support by programming tool, in deployment descriptor file, add the configuration of filtrator automatically, make that the use of embodiment of the invention filtrator is more convenient.
Need to prove, for aforesaid each method embodiment, for simple description, so it all is expressed as a series of combination of actions, but those skilled in the art should know, the present invention is not subjected to the restriction of described sequence of movement, because according to the present invention, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in the instructions all belongs to preferred embodiment, and related action and module might not be that the present invention is necessary.
In the above-described embodiments, the description of each embodiment is all emphasized particularly on different fields, do not have the part that describes in detail among certain embodiment, can be referring to the associated description of other embodiment.
A kind of method of conversing JSF original page request more than is provided, and the embodiment of the invention also provides a kind of converter of conversing JSF original page request.
A kind of converter can the conversing JSF original page request, and referring to Fig. 4, Fig. 4 is the structural representation of embodiment of the invention converter, comprising:
Acquiring unit 401 is used for obtaining according to deployment descriptor file the designated suffix of the JSF parent page of current application program correspondence; Designated suffix can obtain from the Configuration Values of the javax.faces.DEFAULT_SUFFIX parameter the deployment descriptor file Web.xml.
It is identical that judging unit 402, the suffix that is used to compare institute's requested resource title and acquiring unit 401 obtain described designated suffix, judges the request of intercepting and be the request to JSF parent page;
Converting unit 403, the request to JSF parent page that is used for judging through judging unit 402 convert the JSF request to; Conversion is carried out according to mapping ruler, mapping ruler can be in deployment descriptor file predefine, can be divided into prefix pattern and suffix pattern.
Obtain the designated suffix of the JSF parent page of current application program correspondence according to deployment descriptor file at acquiring unit 401, it is identical that the suffix that judging unit 402 compares institute's requested resource title and acquiring unit 401 obtain described designated suffix, when judging the request of intercepting and be the request to JSF parent page, converting unit 403 will convert the JSF request through the described request of intercepting to JSF parent page that judging unit 402 is judged to.
The embodiment of the invention is directly obtained the designated suffix of JSF parent page in the current application program in the deployment descriptor file, makes the conversion of JSF parent page request can both realize possessing versatility in each application program; And when deployment descriptor file changes, need not to revise manually the transfer algorithm of filtrator.
One of ordinary skill in the art will appreciate that, realize all or part of flow process in the foregoing description method, be to instruct relevant hardware to finish by computer program, described program can be stored in the computer read/write memory medium, this program can comprise the flow process as the embodiment of above-mentioned each side method when carrying out.Wherein, described storage medium can be magnetic disc, CD, read-only storage memory body (Read-OnlyMemory, ROM) or at random store memory body (Random Access Memory, RAM) etc.
More than the method and the filtrator of a kind of conversing JSF original page request that the embodiment of the invention provided is described in detail, used specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.

Claims (7)

1, a kind of method of conversing JSF original page request is characterized in that:
Obtain the designated suffix of the JSF parent page corresponding with current application program according to deployment descriptor file;
The suffix that compares the request institute requested resource title of intercepting is identical with described designated suffix, judges the described request of intercepting and be the request to JSF parent page;
Convert described request to the JSF request to JSF parent page.
2, the method for conversing JSF original page request according to claim 1 is characterized in that, the described designated suffix of obtaining the JSF parent page corresponding with current application program according to deployment descriptor file is specially:
Obtain the designated suffix of the JSF parent page corresponding with current application program according to the javax.faces.DEFAULT_SUFFIX parameter value in the deployment descriptor file.
3, the method for conversing JSF original page request according to claim 1 is characterized in that, the described designated suffix of obtaining the JSF parent page corresponding with current application program according to deployment descriptor file is specially:
The deployment descriptor file that reads according to container obtains the designated suffix of the JSF parent page corresponding with current application program.
4, the method for conversing JSF original page request according to claim 1 is characterized in that, describedly converts described request to JSF parent page to JSF request and is specially:
According to predefined mapping ruler, convert described request to the JSF request to JSF parent page.
According to the method for each described conversing JSF original page request of claim 1 to 4, it is characterized in that 5, the described designated suffix of obtaining the JSF parent page of current application program correspondence according to deployment descriptor file also comprises before:
Manually or automatically in deployment descriptor file, dispose and use filtrator.
According to the method for each described conversing JSF original page request of claim 1 to 4, it is characterized in that 6, the described described request of intercepting to JSF parent page is converted to also comprises after JSF asks:
The JSF request that meets mapping ruler after the conversion is distributed to Servlet.
7, a kind of converter is characterized in that, comprising:
Acquiring unit is used for obtaining according to deployment descriptor file the designated suffix of the JSF parent page corresponding with current application program;
Judging unit, the suffix that is used to compare institute's requested resource title is identical with the described designated suffix that acquiring unit obtains, and judges the request of intercepting and be the request to JSF parent page;
Converting unit, the request to JSF parent page that is used for going out through judgment unit judges convert the JSF request to.
CNA2008101705428A 2008-10-17 2008-10-17 Method and filter for conversing JSF original page request Pending CN101382985A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNA2008101705428A CN101382985A (en) 2008-10-17 2008-10-17 Method and filter for conversing JSF original page request

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNA2008101705428A CN101382985A (en) 2008-10-17 2008-10-17 Method and filter for conversing JSF original page request

Publications (1)

Publication Number Publication Date
CN101382985A true CN101382985A (en) 2009-03-11

Family

ID=40462819

Family Applications (1)

Application Number Title Priority Date Filing Date
CNA2008101705428A Pending CN101382985A (en) 2008-10-17 2008-10-17 Method and filter for conversing JSF original page request

Country Status (1)

Country Link
CN (1) CN101382985A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109976872A (en) * 2019-02-21 2019-07-05 北京达佳互联信息技术有限公司 Data processing method, device, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109976872A (en) * 2019-02-21 2019-07-05 北京达佳互联信息技术有限公司 Data processing method, device, electronic equipment and storage medium
CN109976872B (en) * 2019-02-21 2021-05-18 北京达佳互联信息技术有限公司 Data processing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110968325B (en) Applet conversion method and device
CN102567516B (en) Script loading method and device
AU2004206974B2 (en) Programming interface for a computer platform
CN108196876B (en) PHP service configuration method based on file and central server
JP2014044743A (en) Programming interface for computer platform
JP2014525622A (en) Description of the operating system's native application programming interface using metadata
Nagarajan et al. Ontology driven data mediation in web services
Deitel et al. Java Web Services: For Java Programmers
US20130091416A1 (en) Method for establishing a relationship between semantic data and the running of a widget
CN102664874A (en) Method and system for secure logging in
US20070198541A1 (en) Method and system for efficiently storing semantic web statements in a relational database
US20130179152A1 (en) Computer Implemented Method, Apparatus, Network Server And Computer Program Product
CN110362792B (en) Method and device for converting RN file into applet file and conversion equipment
CN103914293A (en) Page generation method and server
US20110296373A1 (en) Command line shell command generation based on schema
CN104361094A (en) Storage method and device for file in search result, and browser client
CN102004633A (en) Method and device for processing control property
CN101382985A (en) Method and filter for conversing JSF original page request
US20070236369A1 (en) Configurable importers and resource writers
CN101639836A (en) Data processing device and data processing method
CN112307398A (en) Method for automatically converting interface data into webpage and storage medium
JP5325635B2 (en) Metadata automatic assigning system and method
US8959246B2 (en) Method and computer program for a mediation processing node to update a message
Tripathi et al. Towards introducing and implementation of SOA design antipatterns
CN104750728A (en) Method and device for controlling web page request mode

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Open date: 20090311