diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cdfe614..7630913 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,30 @@ -#### :warning:This project is now part of the EE4J initiative. This repository has been archived as all activities are now happening in the [corresponding Eclipse repository](https://github.com/eclipse-ee4j/jsp-api). See [here](https://www.eclipse.org/ee4j/status.php) for the overall EE4J transition status. +--- --- + +# Source Code Submissions +We welcome your contributions and look forward to collaborating with you. We can only accept source code repository +submissions from users who have signed and returned the Oracle +Contributor Agreement. You will find details and the agreement to sign at this OTN web page: +[Oracle Contributor Agreement](http://www.oracle.com/technetwork/community/oca-486395.html). + +# Other Contributions +For all project Submissions other than source code repository contributions, the following also applies: Oracle does +not claim ownership of Your Submissions. However, in order to fulfill +the purposes of this project, You must give Oracle and all Users +the right to post, access, discuss, use, publish, disseminate, and refine +Your Submissions. + +In legalese: *You hereby grant to Oracle and all +Users a royalty-free, perpetual, irrevocable, worldwide, non-exclusive, +and fully sub-licensable right and license, under Your intellectual +property rights, to reproduce, modify, adapt, publish, translate, create +derivative works from, distribute, perform, display, and use Your +Submissions (in whole or part) and to incorporate or implement them in +other works in any form, media, or technology now known or later +developed, all subject to the obligation to retain any copyright notices +included in Your Submissions. All Users, Oracle, and their +sublicensees are responsible for any modifications they make to the +Submissions of others.* + +Copyright © 2017 Oracle and/or its affiliates. All rights reserved. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index b1c74f9..0000000 --- a/LICENSE +++ /dev/null @@ -1,759 +0,0 @@ -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1 - -1. Definitions. - - 1.1. "Contributor" means each individual or entity that creates or - contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Software, prior Modifications used by a Contributor (if any), and - the Modifications made by that particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or (b) - Modifications, or (c) the combination of files containing Original - Software with files containing Modifications, in each case including - portions thereof. - - 1.4. "Executable" means the Covered Software in any form other than - Source Code. - - 1.5. "Initial Developer" means the individual or entity that first - makes Original Software available under this License. - - 1.6. "Larger Work" means a work which combines Covered Software or - portions thereof with code not governed by the terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable form of - any of the following: - - A. Any file that results from an addition to, deletion from or - modification of the contents of a file containing Original Software - or previous Modifications; - - B. Any new file that contains any part of the Original Software or - previous Modification; or - - C. Any new file that is contributed or otherwise made available - under the terms of this License. - - 1.10. "Original Software" means the Source Code and Executable form - of computer software code that is originally released under this - License. - - 1.11. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer software - code in which modifications are made and (b) associated - documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, - this License. For legal entities, "You" includes any entity which - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject - to third party intellectual property claims, the Initial Developer - hereby grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer, to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Software (or portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using or selling of - Original Software, to make, have made, use, practice, sell, and - offer for sale, and/or otherwise dispose of the Original Software - (or portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) are effective on - the date Initial Developer first distributes or otherwise makes the - Original Software available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: (1) for code that You delete from the Original Software, or - (2) for infringements caused by: (i) the modification of the - Original Software, or (ii) the combination of the Original Software - with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject - to third party intellectual property claims, each Contributor hereby - grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as Covered Software - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling - of Modifications made by that Contributor either alone and/or in - combination with its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, have made, and/or - otherwise dispose of: (1) Modifications made by that Contributor (or - portions thereof); and (2) the combination of Modifications made by - that Contributor with its Contributor Version (or portions of such - combination). - - (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective - on the date Contributor first distributes or otherwise makes the - Modifications available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: (1) for any code that Contributor has deleted from the - Contributor Version; (2) for infringements caused by: (i) third - party modifications of Contributor Version, or (ii) the combination - of Modifications made by that Contributor with other software - (except as part of the Contributor Version) or other devices; or (3) - under Patent Claims infringed by Covered Software in the absence of - Modifications made by that Contributor. - -3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make available - in Executable form must also be made available in Source Code form - and that Source Code form must be distributed only under the terms - of this License. You must include a copy of this License with every - copy of the Source Code form of the Covered Software You distribute - or otherwise make available. You must inform recipients of any such - Covered Software in Executable form as to how they can obtain such - Covered Software in Source Code form in a reasonable manner on or - through a medium customarily used for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You contribute are - governed by the terms of this License. You represent that You - believe Your Modifications are Your original creation(s) and/or You - have sufficient rights to grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications that - identifies You as the Contributor of the Modification. You may not - remove or alter any copyright, patent or trademark notices contained - within the Covered Software, or any notices of licensing or any - descriptive text giving attribution to any Contributor or the - Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered Software in - Source Code form that alters or restricts the applicable version of - this License or the recipients' rights hereunder. You may choose to - offer, and to charge a fee for, warranty, support, indemnity or - liability obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on behalf of - the Initial Developer or any Contributor. You must make it - absolutely clear that any such warranty, support, indemnity or - liability obligation is offered by You alone, and You hereby agree - to indemnify the Initial Developer and every Contributor for any - liability incurred by the Initial Developer or such Contributor as a - result of warranty, support, indemnity or liability terms You offer. - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered Software under - the terms of this License or under the terms of a license of Your - choice, which may contain terms different from this License, - provided that You are in compliance with the terms of this License - and that the license for the Executable form does not attempt to - limit or alter the recipient's rights in the Source Code form from - the rights set forth in this License. If You distribute the Covered - Software in Executable form under a different license, You must make - it absolutely clear that any terms which differ from this License - are offered by You alone, not by the Initial Developer or - Contributor. You hereby agree to indemnify the Initial Developer and - every Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software with - other code not governed by the terms of this License and distribute - the Larger Work as a single product. In such a case, You must make - sure the requirements of this License are fulfilled for the Covered - Software. - -4. Versions of the License. - - 4.1. New Versions. - - Oracle is the initial license steward and may publish revised and/or - new versions of this License from time to time. Each version will be - given a distinguishing version number. Except as provided in Section - 4.3, no one other than the license steward has the right to modify - this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise make the - Covered Software available under the terms of the version of the - License under which You originally received the Covered Software. If - the Initial Developer includes a notice in the Original Software - prohibiting it from being distributed or otherwise made available - under any subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the version - of the License under which You originally received the Covered - Software. Otherwise, You may also choose to use, distribute or - otherwise make the Covered Software available under the terms of any - subsequent version of the License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a new - license for Your Original Software, You may create and use a - modified version of this License if You: (a) rename the license and - remove any references to the name of the license steward (except to - note that the license differs from this License); and (b) otherwise - make it clear that the license contains terms which differ from this - License. - -5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE - IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR - NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE - DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY - OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, - REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN - ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS - AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -6. TERMINATION. - - 6.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to - cure such breach within 30 days of becoming aware of the breach. - Provisions which, by their nature, must remain in effect beyond the - termination of this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or a - Contributor (the Initial Developer or Contributor against whom You - assert such claim is referred to as "Participant") alleging that the - Participant Software (meaning the Contributor Version where the - Participant is a Contributor or the Original Software where the - Participant is the Initial Developer) directly or indirectly - infringes any patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial Developer (if the - Initial Developer is not the Participant) and all Contributors under - Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice - from Participant terminate prospectively and automatically at the - expiration of such 60 day notice period, unless if within such 60 - day period You withdraw Your claim with respect to the Participant - Software against such Participant either unilaterally or pursuant to - a written agreement with Participant. - - 6.3. If You assert a patent infringement claim against Participant - alleging that the Participant Software directly or indirectly - infringes any patent where such claim is resolved (such as by - license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 6.4. In the event of termination under Sections 6.1 or 6.2 above, - all end user licenses that have been validly granted by You or any - distributor hereunder prior to termination (excluding licenses - granted to You by any distributor) shall survive termination. - -7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE - TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER - FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR - LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE - POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT - APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH - PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH - LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR - LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION - AND LIMITATION MAY NOT APPLY TO YOU. - -8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is defined - in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" (as that term is defined at 48 C.F.R. § - 252.227-7014(a)(1)) and "commercial computer software documentation" - as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent - with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 - (June 1995), all U.S. Government End Users acquire Covered Software - with only those rights set forth herein. This U.S. Government Rights - clause is in lieu of, and supersedes, any other FAR, DFAR, or other - clause or provision that addresses Government rights in computer - software under this License. - -9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - the law of the jurisdiction specified in a notice contained within - the Original Software (except to the extent applicable law, if any, - provides otherwise), excluding such jurisdiction's conflict-of-law - provisions. Any litigation relating to this License shall be subject - to the jurisdiction of the courts located in the jurisdiction and - venue specified in a notice contained within the Original Software, - with the losing party responsible for costs, including, without - limitation, court costs and reasonable attorneys' fees and expenses. - The application of the United Nations Convention on Contracts for - the International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall be - construed against the drafter shall not apply to this License. You - agree that You alone are responsible for compliance with the United - States export administration regulations (and the export control - laws and regulation of any other countries) when You use, distribute - or otherwise make available any Covered Software. - -10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - ------------------------------------------------------------------------- - -NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION -LICENSE (CDDL) - -The code released under the CDDL shall be governed by the laws of the -State of California (excluding conflict-of-law provisions). Any -litigation relating to this License shall be subject to the jurisdiction -of the Federal Courts of the Northern District of California and the -state courts of the State of California, with venue lying in Santa Clara -County, California. - - - - The GNU General Public License (GPL) Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor -Boston, MA 02110-1335 -USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to -share and change it. By contrast, the GNU General Public License is -intended to guarantee your freedom to share and change free software--to -make sure the software is free for all its users. This General Public -License applies to most of the Free Software Foundation's software and -to any other program whose authors commit to using it. (Some other Free -Software Foundation software is covered by the GNU Library General -Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. -Our General Public Licenses are designed to make sure that you have the -freedom to distribute copies of free software (and charge for this -service if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone -to deny you these rights or to ask you to surrender the rights. These -restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis -or for a fee, you must give the recipients all the rights that you have. -You must make sure that they, too, receive or can get the source code. -And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - -Finally, any free program is threatened constantly by software patents. -We wish to avoid the danger that redistributors of a free program will -individually obtain patent licenses, in effect making the program -proprietary. To prevent this, we have made it clear that any patent must -be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and -modification follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains a -notice placed by the copyright holder saying it may be distributed under -the terms of this General Public License. The "Program", below, refers -to any such program or work, and a "work based on the Program" means -either the Program or any derivative work under copyright law: that is -to say, a work containing the Program or a portion of it, either -verbatim or with modifications and/or translated into another language. -(Hereinafter, translation is included without limitation in the term -"modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of running -the Program is not restricted, and the output from the Program is -covered only if its contents constitute a work based on the Program -(independent of having been made by running the Program). Whether that -is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source -code as you receive it, in any medium, provided that you conspicuously -and appropriately publish on each copy an appropriate copyright notice -and disclaimer of warranty; keep intact all the notices that refer to -this License and to the absence of any warranty; and give any other -recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of -it, thus forming a work based on the Program, and copy and distribute -such modifications or work under the terms of Section 1 above, provided -that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any part - thereof, to be licensed as a whole at no charge to all third parties - under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a notice - that there is no warranty (or else, saying that you provide a - warranty) and that users may redistribute the program under these - conditions, and telling the user how to view a copy of this License. - (Exception: if the Program itself is interactive but does not - normally print such an announcement, your work based on the Program - is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, and -can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based on -the Program, the distribution of the whole must be on the terms of this -License, whose permissions for other licensees extend to the entire -whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of a -storage or distribution medium does not bring the other work under the -scope of this License. - -3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections 1 - and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your cost - of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to - distribute corresponding source code. (This alternative is allowed - only for noncommercial distribution and only if you received the - program in object code or executable form with such an offer, in - accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source code -means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to control -compilation and installation of the executable. However, as a special -exception, the source code distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies the -executable. - -If distribution of executable or object code is made by offering access -to copy from a designated place, then offering equivalent access to copy -the source code from the same place counts as distribution of the source -code, even though third parties are not compelled to copy the source -along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt otherwise -to copy, modify, sublicense or distribute the Program is void, and will -automatically terminate your rights under this License. However, parties -who have received copies, or rights, from you under this License will -not have their licenses terminated so long as such parties remain in -full compliance. - -5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and all -its terms and conditions for copying, distributing or modifying the -Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further restrictions -on the recipients' exercise of the rights granted herein. You are not -responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot distribute -so as to satisfy simultaneously your obligations under this License and -any other pertinent obligations, then as a consequence you may not -distribute the Program at all. For example, if a patent license would -not permit royalty-free redistribution of the Program by all those who -receive copies directly or indirectly through you, then the only way you -could satisfy both it and this License would be to refrain entirely from -distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is implemented -by public license practices. Many people have made generous -contributions to the wide range of software distributed through that -system in reliance on consistent application of that system; it is up to -the author/donor to decide if he or she is willing to distribute -software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be -a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License may -add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among countries -not thus excluded. In such case, this License incorporates the -limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new -versions of the General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Program does not specify a version -number of this License, you may choose any version ever published by the -Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the -author to ask for permission. For software which is copyrighted by the -Free Software Foundation, write to the Free Software Foundation; we -sometimes make exceptions for this. Our decision will be guided by the -two goals of preserving the free status of all derivatives of our free -software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, -EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE -ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH -YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL -NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR -DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL -DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM -(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF -THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR -OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively convey -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type - `show w'. This is free software, and you are welcome to redistribute - it under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the commands -you use may be called something other than `show w' and `show c'; they -could even be mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (which makes passes at compilers) written by - James Hacker. - - signature of Ty Coon, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications -with the library. If this is what you want to do, use the GNU Library -General Public License instead of this License. - -# - -Certain source files distributed by Oracle America, Inc. and/or its -affiliates are subject to the following clarification and special -exception to the GPLv2, based on the GNU Project exception for its -Classpath libraries, known as the GNU Classpath Exception, but only -where Oracle has expressly included in the particular source file's -header the words "Oracle designates this particular file as subject to -the "Classpath" exception as provided by Oracle in the LICENSE file -that accompanied this code." - -You should also note that Oracle includes multiple, independent -programs in this software package. Some of those programs are provided -under licenses deemed incompatible with the GPLv2 by the Free Software -Foundation and others. For example, the package includes programs -licensed under the Apache License, Version 2.0. Such programs are -licensed to you under their original licenses. - -Oracle facilitates your further distribution of this package by adding -the Classpath Exception to the necessary parts of its GPLv2 code, which -permits you to use that code in combination with other independent -modules not licensed under the GPLv2. However, note that this would -not permit you to commingle code under an incompatible license with -Oracle's GPLv2 licensed code by, for example, cutting and pasting such -code into a file also containing Oracle's GPLv2 licensed code and then -distributing the result. Additionally, if you were to remove the -Classpath Exception from any of the files to which it applies and -distribute the result, you would likely be required to license some or -all of the other code in that distribution under the GPLv2 as well, and -since the GPLv2 is incompatible with the license terms of some items -included in the distribution by Oracle, removing the Classpath -Exception could therefore effectively compromise your ability to -further distribute the package. - -Proceed with caution and we recommend that you obtain the advice of a -lawyer skilled in open source matters before removing the Classpath -Exception or making modifications to this package which may -subsequently be redistributed and/or involve the use of third party -software. - -CLASSPATH EXCEPTION -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License version 2 cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from or -based on this library. If you modify this library, you may extend this -exception to your version of the library, but you are not obligated to -do so. If you do not wish to do so, delete this exception statement -from your version. diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..1c4d55e --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,761 @@ +--- +--- + +## COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1 + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that creates or + contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Software, prior Modifications used by a Contributor (if any), and + the Modifications made by that particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or (b) + Modifications, or (c) the combination of files containing Original + Software with files containing Modifications, in each case including + portions thereof. + + 1.4. "Executable" means the Covered Software in any form other than + Source Code. + + 1.5. "Initial Developer" means the individual or entity that first + makes Original Software available under this License. + + 1.6. "Larger Work" means a work which combines Covered Software or + portions thereof with code not governed by the terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable form of + any of the following: + + A. Any file that results from an addition to, deletion from or + modification of the contents of a file containing Original Software + or previous Modifications; + + B. Any new file that contains any part of the Original Software or + previous Modification; or + + C. Any new file that is contributed or otherwise made available + under the terms of this License. + + 1.10. "Original Software" means the Source Code and Executable form + of computer software code that is originally released under this + License. + + 1.11. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer software + code in which modifications are made and (b) associated + documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, + this License. For legal entities, "You" includes any entity which + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject + to third party intellectual property claims, the Initial Developer + hereby grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer, to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Software (or portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using or selling of + Original Software, to make, have made, use, practice, sell, and + offer for sale, and/or otherwise dispose of the Original Software + (or portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) are effective on + the date Initial Developer first distributes or otherwise makes the + Original Software available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: (1) for code that You delete from the Original Software, or + (2) for infringements caused by: (i) the modification of the + Original Software, or (ii) the combination of the Original Software + with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and subject + to third party intellectual property claims, each Contributor hereby + grants You a world-wide, royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as Covered Software + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling + of Modifications made by that Contributor either alone and/or in + combination with its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, have made, and/or + otherwise dispose of: (1) Modifications made by that Contributor (or + portions thereof); and (2) the combination of Modifications made by + that Contributor with its Contributor Version (or portions of such + combination). + + (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective + on the date Contributor first distributes or otherwise makes the + Modifications available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: (1) for any code that Contributor has deleted from the + Contributor Version; (2) for infringements caused by: (i) third + party modifications of Contributor Version, or (ii) the combination + of Modifications made by that Contributor with other software + (except as part of the Contributor Version) or other devices; or (3) + under Patent Claims infringed by Covered Software in the absence of + Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make available + in Executable form must also be made available in Source Code form + and that Source Code form must be distributed only under the terms + of this License. You must include a copy of this License with every + copy of the Source Code form of the Covered Software You distribute + or otherwise make available. You must inform recipients of any such + Covered Software in Executable form as to how they can obtain such + Covered Software in Source Code form in a reasonable manner on or + through a medium customarily used for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You contribute are + governed by the terms of this License. You represent that You + believe Your Modifications are Your original creation(s) and/or You + have sufficient rights to grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications that + identifies You as the Contributor of the Modification. You may not + remove or alter any copyright, patent or trademark notices contained + within the Covered Software, or any notices of licensing or any + descriptive text giving attribution to any Contributor or the + Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered Software in + Source Code form that alters or restricts the applicable version of + this License or the recipients' rights hereunder. You may choose to + offer, and to charge a fee for, warranty, support, indemnity or + liability obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on behalf of + the Initial Developer or any Contributor. You must make it + absolutely clear that any such warranty, support, indemnity or + liability obligation is offered by You alone, and You hereby agree + to indemnify the Initial Developer and every Contributor for any + liability incurred by the Initial Developer or such Contributor as a + result of warranty, support, indemnity or liability terms You offer. + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered Software under + the terms of this License or under the terms of a license of Your + choice, which may contain terms different from this License, + provided that You are in compliance with the terms of this License + and that the license for the Executable form does not attempt to + limit or alter the recipient's rights in the Source Code form from + the rights set forth in this License. If You distribute the Covered + Software in Executable form under a different license, You must make + it absolutely clear that any terms which differ from this License + are offered by You alone, not by the Initial Developer or + Contributor. You hereby agree to indemnify the Initial Developer and + every Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software with + other code not governed by the terms of this License and distribute + the Larger Work as a single product. In such a case, You must make + sure the requirements of this License are fulfilled for the Covered + Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Oracle is the initial license steward and may publish revised and/or + new versions of this License from time to time. Each version will be + given a distinguishing version number. Except as provided in Section + 4.3, no one other than the license steward has the right to modify + this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise make the + Covered Software available under the terms of the version of the + License under which You originally received the Covered Software. If + the Initial Developer includes a notice in the Original Software + prohibiting it from being distributed or otherwise made available + under any subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the version + of the License under which You originally received the Covered + Software. Otherwise, You may also choose to use, distribute or + otherwise make the Covered Software available under the terms of any + subsequent version of the License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a new + license for Your Original Software, You may create and use a + modified version of this License if You: (a) rename the license and + remove any references to the name of the license steward (except to + note that the license differs from this License); and (b) otherwise + make it clear that the license contains terms which differ from this + License. + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE + IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR + NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF + THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE + DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY + OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, + REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN + ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS + AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to + cure such breach within 30 days of becoming aware of the breach. + Provisions which, by their nature, must remain in effect beyond the + termination of this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or a + Contributor (the Initial Developer or Contributor against whom You + assert such claim is referred to as "Participant") alleging that the + Participant Software (meaning the Contributor Version where the + Participant is a Contributor or the Original Software where the + Participant is the Initial Developer) directly or indirectly + infringes any patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial Developer (if the + Initial Developer is not the Participant) and all Contributors under + Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice + from Participant terminate prospectively and automatically at the + expiration of such 60 day notice period, unless if within such 60 + day period You withdraw Your claim with respect to the Participant + Software against such Participant either unilaterally or pursuant to + a written agreement with Participant. + + 6.3. If You assert a patent infringement claim against Participant + alleging that the Participant Software directly or indirectly + infringes any patent where such claim is resolved (such as by + license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 6.4. In the event of termination under Sections 6.1 or 6.2 above, + all end user licenses that have been validly granted by You or any + distributor hereunder prior to termination (excluding licenses + granted to You by any distributor) shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE + TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER + FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR + LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE + POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT + APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH + PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH + LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR + LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION + AND LIMITATION MAY NOT APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is defined + in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" (as that term is defined at 48 C.F.R. § + 252.227-7014(a)(1)) and "commercial computer software documentation" + as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent + with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 + (June 1995), all U.S. Government End Users acquire Covered Software + with only those rights set forth herein. This U.S. Government Rights + clause is in lieu of, and supersedes, any other FAR, DFAR, or other + clause or provision that addresses Government rights in computer + software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + the law of the jurisdiction specified in a notice contained within + the Original Software (except to the extent applicable law, if any, + provides otherwise), excluding such jurisdiction's conflict-of-law + provisions. Any litigation relating to this License shall be subject + to the jurisdiction of the courts located in the jurisdiction and + venue specified in a notice contained within the Original Software, + with the losing party responsible for costs, including, without + limitation, court costs and reasonable attorneys' fees and expenses. + The application of the United Nations Convention on Contracts for + the International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall be + construed against the drafter shall not apply to this License. You + agree that You alone are responsible for compliance with the United + States export administration regulations (and the export control + laws and regulation of any other countries) when You use, distribute + or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +--- + +## NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) + + The code released under the CDDL shall be governed by the laws of the + State of California (excluding conflict-of-law provisions). Any + litigation relating to this License shall be subject to the jurisdiction + of the Federal Courts of the Northern District of California and the + state courts of the State of California, with venue lying in Santa Clara + County, California. + +--- + +## The GNU General Public License (GPL) Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1335 + USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your freedom to + share and change it. By contrast, the GNU General Public License is + intended to guarantee your freedom to share and change free software--to + make sure the software is free for all its users. This General Public + License applies to most of the Free Software Foundation's software and + to any other program whose authors commit to using it. (Some other Free + Software Foundation software is covered by the GNU Library General + Public License instead.) You can apply it to your programs, too. + + When we speak of free software, we are referring to freedom, not price. + Our General Public Licenses are designed to make sure that you have the + freedom to distribute copies of free software (and charge for this + service if you wish), that you receive source code or can get it if you + want it, that you can change the software or use pieces of it in new + free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid anyone + to deny you these rights or to ask you to surrender the rights. These + restrictions translate to certain responsibilities for you if you + distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether gratis + or for a fee, you must give the recipients all the rights that you have. + You must make sure that they, too, receive or can get the source code. + And you must show them these terms so they know their rights. + + We protect your rights with two steps: (1) copyright the software, and + (2) offer you this license which gives you legal permission to copy, + distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain + that everyone understands that there is no warranty for this free + software. If the software is modified by someone else and passed on, we + want its recipients to know that what they have is not the original, so + that any problems introduced by others will not reflect on the original + authors' reputations. + + Finally, any free program is threatened constantly by software patents. + We wish to avoid the danger that redistributors of a free program will + individually obtain patent licenses, in effect making the program + proprietary. To prevent this, we have made it clear that any patent must + be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and + modification follow. + + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains a + notice placed by the copyright holder saying it may be distributed under + the terms of this General Public License. The "Program", below, refers + to any such program or work, and a "work based on the Program" means + either the Program or any derivative work under copyright law: that is + to say, a work containing the Program or a portion of it, either + verbatim or with modifications and/or translated into another language. + (Hereinafter, translation is included without limitation in the term + "modification".) Each licensee is addressed as "you". + + Activities other than copying, distribution and modification are not + covered by this License; they are outside its scope. The act of running + the Program is not restricted, and the output from the Program is + covered only if its contents constitute a work based on the Program + (independent of having been made by running the Program). Whether that + is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's source + code as you receive it, in any medium, provided that you conspicuously + and appropriately publish on each copy an appropriate copyright notice + and disclaimer of warranty; keep intact all the notices that refer to + this License and to the absence of any warranty; and give any other + recipients of the Program a copy of this License along with the Program. + + You may charge a fee for the physical act of transferring a copy, and + you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion of + it, thus forming a work based on the Program, and copy and distribute + such modifications or work under the terms of Section 1 above, provided + that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any part + thereof, to be licensed as a whole at no charge to all third parties + under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a notice + that there is no warranty (or else, saying that you provide a + warranty) and that users may redistribute the program under these + conditions, and telling the user how to view a copy of this License. + (Exception: if the Program itself is interactive but does not + normally print such an announcement, your work based on the Program + is not required to print an announcement.) + + These requirements apply to the modified work as a whole. If + identifiable sections of that work are not derived from the Program, and + can be reasonably considered independent and separate works in + themselves, then this License, and its terms, do not apply to those + sections when you distribute them as separate works. But when you + distribute the same sections as part of a whole which is a work based on + the Program, the distribution of the whole must be on the terms of this + License, whose permissions for other licensees extend to the entire + whole, and thus to each and every part regardless of who wrote it. + + Thus, it is not the intent of this section to claim rights or contest + your rights to work written entirely by you; rather, the intent is to + exercise the right to control the distribution of derivative or + collective works based on the Program. + + In addition, mere aggregation of another work not based on the Program + with the Program (or with a work based on the Program) on a volume of a + storage or distribution medium does not bring the other work under the + scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, + under Section 2) in object code or executable form under the terms of + Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your cost + of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed + only for noncommercial distribution and only if you received the + program in object code or executable form with such an offer, in + accord with Subsection b above.) + + The source code for a work means the preferred form of the work for + making modifications to it. For an executable work, complete source code + means all the source code for all modules it contains, plus any + associated interface definition files, plus the scripts used to control + compilation and installation of the executable. However, as a special + exception, the source code distributed need not include anything that is + normally distributed (in either source or binary form) with the major + components (compiler, kernel, and so on) of the operating system on + which the executable runs, unless that component itself accompanies the + executable. + + If distribution of executable or object code is made by offering access + to copy from a designated place, then offering equivalent access to copy + the source code from the same place counts as distribution of the source + code, even though third parties are not compelled to copy the source + along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program + except as expressly provided under this License. Any attempt otherwise + to copy, modify, sublicense or distribute the Program is void, and will + automatically terminate your rights under this License. However, parties + who have received copies, or rights, from you under this License will + not have their licenses terminated so long as such parties remain in + full compliance. + + 5. You are not required to accept this License, since you have not + signed it. However, nothing else grants you permission to modify or + distribute the Program or its derivative works. These actions are + prohibited by law if you do not accept this License. Therefore, by + modifying or distributing the Program (or any work based on the + Program), you indicate your acceptance of this License to do so, and all + its terms and conditions for copying, distributing or modifying the + Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the + Program), the recipient automatically receives a license from the + original licensor to copy, distribute or modify the Program subject to + these terms and conditions. You may not impose any further restrictions + on the recipients' exercise of the rights granted herein. You are not + responsible for enforcing compliance by third parties to this License. + + 7. If, as a consequence of a court judgment or allegation of patent + infringement or for any other reason (not limited to patent issues), + conditions are imposed on you (whether by court order, agreement or + otherwise) that contradict the conditions of this License, they do not + excuse you from the conditions of this License. If you cannot distribute + so as to satisfy simultaneously your obligations under this License and + any other pertinent obligations, then as a consequence you may not + distribute the Program at all. For example, if a patent license would + not permit royalty-free redistribution of the Program by all those who + receive copies directly or indirectly through you, then the only way you + could satisfy both it and this License would be to refrain entirely from + distribution of the Program. + + If any portion of this section is held invalid or unenforceable under + any particular circumstance, the balance of the section is intended to + apply and the section as a whole is intended to apply in other + circumstances. + + It is not the purpose of this section to induce you to infringe any + patents or other property right claims or to contest validity of any + such claims; this section has the sole purpose of protecting the + integrity of the free software distribution system, which is implemented + by public license practices. Many people have made generous + contributions to the wide range of software distributed through that + system in reliance on consistent application of that system; it is up to + the author/donor to decide if he or she is willing to distribute + software through any other system and a licensee cannot impose that choice. + + This section is intended to make thoroughly clear what is believed to be + a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in + certain countries either by patents or by copyrighted interfaces, the + original copyright holder who places the Program under this License may + add an explicit geographical distribution limitation excluding those + countries, so that distribution is permitted only in or among countries + not thus excluded. In such case, this License incorporates the + limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new + versions of the General Public License from time to time. Such new + versions will be similar in spirit to the present version, but may + differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the Program + specifies a version number of this License which applies to it and "any + later version", you have the option of following the terms and + conditions either of that version or of any later version published by + the Free Software Foundation. If the Program does not specify a version + number of this License, you may choose any version ever published by the + Free Software Foundation. + + 10. If you wish to incorporate parts of the Program into other free + programs whose distribution conditions are different, write to the + author to ask for permission. For software which is copyrighted by the + Free Software Foundation, write to the Free Software Foundation; we + sometimes make exceptions for this. Our decision will be guided by the + two goals of preserving the free status of all derivatives of our free + software and of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO + WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. + EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR + OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, + EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE + ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH + YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL + NECESSARY SERVICING, REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN + WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY + AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR + DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL + DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM + (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED + INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF + THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR + OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest + possible use to the public, the best way to achieve this is to make it + free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest to + attach them to the start of each source file to most effectively convey + the exclusion of warranty; and each file should have at least the + "copyright" line and a pointer to where the full notice is found. + + One line to give the program's name and a brief idea of what it does. + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + + Also add information on how to contact you by electronic and paper mail. + + If the program is interactive, make it output a short notice like this + when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type + `show w'. This is free software, and you are welcome to redistribute + it under certain conditions; type `show c' for details. + + The hypothetical commands `show w' and `show c' should show the + appropriate parts of the General Public License. Of course, the commands + you use may be called something other than `show w' and `show c'; they + could even be mouse-clicks or menu items--whatever suits your program. + + You should also get your employer (if you work as a programmer) or your + school, if any, to sign a "copyright disclaimer" for the program, if + necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + program `Gnomovision' (which makes passes at compilers) written by + James Hacker. + + signature of Ty Coon, 1 April 1989 + Ty Coon, President of Vice + + This General Public License does not permit incorporating your program + into proprietary programs. If your program is a subroutine library, you + may consider it more useful to permit linking proprietary applications + with the library. If this is what you want to do, use the GNU Library + General Public License instead of this License. + +--- + + Certain source files distributed by Oracle America, Inc. and/or its + affiliates are subject to the following clarification and special + exception to the GPLv2, based on the GNU Project exception for its + Classpath libraries, known as the GNU Classpath Exception, but only + where Oracle has expressly included in the particular source file's + header the words "Oracle designates this particular file as subject to + the "Classpath" exception as provided by Oracle in the LICENSE file + that accompanied this code." + + You should also note that Oracle includes multiple, independent + programs in this software package. Some of those programs are provided + under licenses deemed incompatible with the GPLv2 by the Free Software + Foundation and others. For example, the package includes programs + licensed under the Apache License, Version 2.0. Such programs are + licensed to you under their original licenses. + + Oracle facilitates your further distribution of this package by adding + the Classpath Exception to the necessary parts of its GPLv2 code, which + permits you to use that code in combination with other independent + modules not licensed under the GPLv2. However, note that this would + not permit you to commingle code under an incompatible license with + Oracle's GPLv2 licensed code by, for example, cutting and pasting such + code into a file also containing Oracle's GPLv2 licensed code and then + distributing the result. Additionally, if you were to remove the + Classpath Exception from any of the files to which it applies and + distribute the result, you would likely be required to license some or + all of the other code in that distribution under the GPLv2 as well, and + since the GPLv2 is incompatible with the license terms of some items + included in the distribution by Oracle, removing the Classpath + Exception could therefore effectively compromise your ability to + further distribute the package. + + Proceed with caution and we recommend that you obtain the advice of a + lawyer skilled in open source matters before removing the Classpath + Exception or making modifications to this package which may + subsequently be redistributed and/or involve the use of third party + software. + + CLASSPATH EXCEPTION + Linking this library statically or dynamically with other modules is + making a combined work based on this library. Thus, the terms and + conditions of the GNU General Public License version 2 cover the whole + combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent + modules, and to copy and distribute the resulting executable under + terms of your choice, provided that you also meet, for each linked + independent module, the terms and conditions of the license of that + module. An independent module is a module which is not derived from or + based on this library. If you modify this library, you may extend this + exception to your version of the library, but you are not obligated to + do so. If you do not wish to do so, delete this exception statement + from your version. diff --git a/README.md b/README.md index fe77f85..15bf1ab 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ -#### :warning:This project is now part of the EE4J initiative. This repository has been archived as all activities are now happening in the [corresponding Eclipse repository](https://github.com/eclipse-ee4j/jsp-api). See [here](https://www.eclipse.org/ee4j/status.php) for the overall EE4J transition status. - ---- -# Prerequisites +# About + +Welcome to the javaee-jsp-api project. + + + +# IMPORTANT! + +* By contributing to this project, you are agreeing to the terms of use described in [CONTRIBUTING.md](./CONTRIBUTING.md) -Oracle JDK 1.7 diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..adb3ddb --- /dev/null +++ b/_config.yml @@ -0,0 +1,16 @@ +theme: jekyll-theme-architect + +title: [javaee-jsp-api] +description: [JavaServer Pages Implementation] + +# sidebar links url +links: + source: https://github.com/javaee/javaee-jsp-api + #download: + #mailinglist: + #javadocs: + #docs: + #faq: + #mailinglist: + #hide_issuetracker: true #set explicitly to 'true' if you don't want to have the issue tracker link displayed + diff --git a/_layouts/default.html b/_layouts/default.html new file mode 100644 index 0000000..f40ca4a --- /dev/null +++ b/_layouts/default.html @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + {{ site.title | default: site.github.repository_name }} + + + +
+
+
+ +

{{ site.title | default: site.github.repository_name }}

+
+

{{ site.description | default: site.github.project_tagline }}

+ {% if site.github.is_project_page %} + + {% endif %} +
+
+ +
+
+
+ {{ content }} + +
+ + +
+
+ + + +
+ + + + {% if site.google_analytics %} + + + {% endif %} + + diff --git a/api/pom.xml b/api/pom.xml deleted file mode 100644 index 293f45a..0000000 --- a/api/pom.xml +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - net.java - jvnet-parent - 5 - - - 4.0.0 - javax.servlet.jsp - javax.servlet.jsp-api - 2.3.4-SNAPSHOT - jar - JavaServer Pages(TM) API - - - 2.3 - javax.servlet.jsp - javax.servlet.jsp-api - Oracle Corporation - 2.5.2 - - High - - - - - kchung - Kin-man Chung - Oracle Corporation - - lead - - - - - https://javaee.github.io/javaee-jsp-api - - Oracle - http://www.oracle.com - - - - - CDDL + GPLv2 with classpath exception - ://oss.oracle.com/licenses/CDDL+GPL-1.1 - repo - A business-friendly OSS license - - - - github - https://github.com/javaee/javaee-jsp-api/issues/ - - - - JSP Developer - dev@jsp.java.net - - - - scm:git:https://github.com/javaee/javaee-jsp-api.git - scm:git:ssh://git@github.com/javaee/javaee-jsp-api.git - https://github.com/javaee/javaee-jsp-api - HEAD - - - - - - org.apache.felix - maven-bundle-plugin - 1.4.3 - - - jar - - - ${bundle.symbolicName} - <_include>-osgi.bundle - - - - - bundle-manifest - process-classes - - manifest - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.1.0 - - - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - ${extensionName} - - ${spec.version} - ${vendorName} - - ${project.version} - ${vendorName} - - - - - **/*.java - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.0 - - 1.7 - 1.7 - -Xlint:unchecked - - - - org.apache.maven.plugins - maven-source-plugin - 2.1 - - true - - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.1 - - - attach-javadocs - - jar - - - - - JavaServer Pages API Documentation - javax.servlet.jsp - - - -Oracle - and/or its affiliates. All Rights Reserved. - Use is subject to - license terms. -]]> - - - - - - - org.codehaus.mojo - findbugs-maven-plugin - ${findbugs.version} - - ${findbugs.threshold} - ${findbugs.exclude} - true - true - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.2 - - forked-path - false - @{project.version} - ${release.arguments} - - - - org.apache.maven.scm - maven-scm-provider-gitexe - 1.9.4 - - - - - - - src/main/java - - **/*.properties - - - - - - - - org.codehaus.mojo - findbugs-maven-plugin - ${findbugs.version} - - ${findbugs.threshold} - ${findbugs.exclude} - - - - - - - - javax.servlet - javax.servlet-api - 3.0.1 - provided - - - javax.el - javax.el-api - [3.0.1-b06,) - provided - - - diff --git a/api/src/main/java/javax/servlet/jsp/ErrorData.java b/api/src/main/java/javax/servlet/jsp/ErrorData.java deleted file mode 100644 index 0ea78ab..0000000 --- a/api/src/main/java/javax/servlet/jsp/ErrorData.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp; - -/** - * Contains information about an error, for error pages. - * The information contained in this instance is meaningless if not used - * in the context of an error page. To indicate a JSP is an error page, - * the page author must set the isErrorPage attribute of the page directive - * to "true". - * - * @see PageContext#getErrorData - * @since JSP 2.0 - */ - -public final class ErrorData { - - private Throwable throwable; - private int statusCode; - private String uri; - private String servletName; - - /** - * Creates a new ErrorData object. - * - * @param throwable The Throwable that is the cause of the error - * @param statusCode The status code of the error - * @param uri The request URI - * @param servletName The name of the servlet invoked - */ - public ErrorData( Throwable throwable, int statusCode, String uri, - String servletName ) - { - this.throwable = throwable; - this.statusCode = statusCode; - this.uri = uri; - this.servletName = servletName; - } - - /** - * Returns the Throwable that caused the error. - * - * @return The Throwable that caused the error - */ - public Throwable getThrowable() { - return this.throwable; - } - - /** - * Returns the status code of the error. - * - * @return The status code of the error - */ - public int getStatusCode() { - return this.statusCode; - } - - /** - * Returns the request URI. - * - * @return The request URI - */ - public String getRequestURI() { - return this.uri; - } - - /** - * Returns the name of the servlet invoked. - * - * @return The name of the servlet invoked - */ - public String getServletName() { - return this.servletName; - } -} diff --git a/api/src/main/java/javax/servlet/jsp/HttpJspPage.java b/api/src/main/java/javax/servlet/jsp/HttpJspPage.java deleted file mode 100644 index 8769169..0000000 --- a/api/src/main/java/javax/servlet/jsp/HttpJspPage.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp; - -import javax.servlet.*; -import javax.servlet.http.*; -import java.io.IOException; - -/** - * The HttpJspPage interface describes the interaction that a JSP Page - * Implementation Class must satisfy when using the HTTP protocol. - * - *

- * The behaviour is identical to that of the JspPage, except for the signature - * of the _jspService method, which is now expressible in the Java type - * system and included explicitly in the interface. - * - * @see JspPage - */ - -public interface HttpJspPage extends JspPage { - - /** The _jspService()method corresponds to the body of the JSP page. This - * method is defined automatically by the JSP container and should never - * be defined by the JSP page author. - *

- * If a superclass is specified using the extends attribute, that - * superclass may choose to perform some actions in its service() method - * before or after calling the _jspService() method. See using the extends - * attribute in the JSP_Engine chapter of the JSP specification. - * - * @param request Provides client request information to the JSP. - * @param response Assists the JSP in sending a response to the client. - * @throws ServletException Thrown if an error occurred during the - * processing of the JSP and that the container should take - * appropriate action to clean up the request. - * @throws IOException Thrown if an error occurred while writing the - * response for this page. - */ - public void _jspService(HttpServletRequest request, - HttpServletResponse response) - throws ServletException, IOException; -} diff --git a/api/src/main/java/javax/servlet/jsp/JspApplicationContext.java b/api/src/main/java/javax/servlet/jsp/JspApplicationContext.java deleted file mode 100644 index 3369048..0000000 --- a/api/src/main/java/javax/servlet/jsp/JspApplicationContext.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp; - -import javax.el.ELResolver; -import javax.el.ExpressionFactory; -import javax.el.ELContextListener; - -/** - * Stores application-scoped information relevant to JSP containers. - * - *

The JSP container must create a single instance of - * JspApplicationContext for each - * ServletContext instance.

- * - *

An instance of JspApplicationContext is obtained by - * invoking the static {@link JspFactory#getJspApplicationContext} method, - * passing the ServletContext of the corresponding web - * application.

- * - *

The JspApplicationContext provides the following services - * to JSP applications: - *

    - *
  • Allows registration of ELResolvers, which are used to - * resolve variables in EL expressions contained in JSP pages and - * tag files.
  • - *
  • Provides an instance of ExpressionFactory for those - * applications or frameworks that need to perform programmatic - * evaluation of EL expressions instead of allowing the JSP - * container to do it for them.
  • - *
  • Allows the attachment of ELContextListener instances - * for notification whenever a new ELContext is created. - * This is necessary when an application wishes to make custom - * context objects available to their pluggable - * ELResolvers.
  • - *
- *

- * - * @see javax.servlet.ServletContext - * @see JspFactory - * @see javax.el.ELResolver - * @see javax.el.ExpressionFactory - * @see javax.el.ELContextListener - * @since JSP 2.1 - */ -public interface JspApplicationContext { - - /** - * Adds an ELResolver to affect the way EL variables - * and properties are resolved for EL expressions appearing in JSP pages - * and tag files. - * - *

For example, in the EL expression ${employee.lastName}, an - * ELResolver determines what object "employee" - * references and how to find its "lastName" property.

- * - *

When evaluating an expression, the JSP container will consult a - * set of standard resolvers as well as any resolvers registered via - * this method. The set of resolvers are consulted in the following - * order: - *

    - *
  • {@link javax.servlet.jsp.el.ImplicitObjectELResolver}
  • - *
  • ELResolvers registered via this method, in the - * order in which they are registered.
  • - *
  • {@link javax.el.MapELResolver}
  • - *
  • {@link javax.el.ListELResolver}
  • - *
  • {@link javax.el.ArrayELResolver}
  • - *
  • {@link javax.el.BeanELResolver}
  • - *
  • {@link javax.servlet.jsp.el.ScopedAttributeELResolver}
  • - *

- * - *

It is illegal to register an ELResolver after the - * application has received any request from the client. If an - * attempt is made to register an ELResolver after that time, - * an IllegalStateException is thrown.

- * This restriction is - * in place to allow the JSP container to optimize for the common - * case where no additional ELResolvers are in the chain, - * aside from the standard ones. It is permissible to add - * ELResolvers before or after initialization to - * a CompositeELResolver that is already in the chain.

- * - *

It is not possible to remove an ELResolver registered - * with this method, once it has been registered.

- * - * @param resolver The new ELResolver - * @throws IllegalStateException if an attempt is made to - * call this method after all ServletContextListeners - * have had their contextInitialized methods invoked. - */ - public void addELResolver(ELResolver resolver); - - /** - * Returns a factory used to create ValueExpressions and - * MethodExpressions so that EL expressions can be - * parsed and evaluated. - * - * @return A concrete implementation of the - * an ExpressionFactory. - */ - public ExpressionFactory getExpressionFactory(); - - /** - * Registers a ELContextListeners so that context objects - * can be added whenever a new ELContext is created. - * - *

At a minimum, the ELContext objects created will - * contain a reference to the JspContext for this request, - * which is added by the JSP container. - * This is sufficient for all the - * default ELResolvers listed in {@link #addELResolver}. - * Note that JspContext.class is used as the key to ELContext.putContext() - * for the JspContext object reference.

- * - *

This method is generally used by frameworks and applications that - * register their own ELResolver that needs context other - * than JspContext. The listener will typically add the - * necessary context to the ELContext provided in the - * event object. Registering a listener that adds context allows the - * ELResolvers in the stack to access the context they - * need when they do a resolution.

- * - * @param listener The listener to be notified when a new - * ELContext is created. - */ - public void addELContextListener(ELContextListener listener); -} diff --git a/api/src/main/java/javax/servlet/jsp/JspContext.java b/api/src/main/java/javax/servlet/jsp/JspContext.java deleted file mode 100644 index 4b4aa65..0000000 --- a/api/src/main/java/javax/servlet/jsp/JspContext.java +++ /dev/null @@ -1,338 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp; - -import java.util.Enumeration; - -import javax.servlet.jsp.el.ExpressionEvaluator; -import javax.servlet.jsp.el.VariableResolver; - -import javax.el.ELContext; - -/** - *

- * JspContext serves as the base class for the - * PageContext class and abstracts all information that is not specific - * to servlets. This allows for Simple Tag Extensions to be used - * outside of the context of a request/response Servlet. - *

- * The JspContext provides a number of facilities to the - * page/component author and page implementor, including: - *

    - *
  • a single API to manage the various scoped namespaces - *
  • a mechanism to obtain the JspWriter for output - *
  • a mechanism to expose page directive attributes to the - * scripting environment - *
- * - *

Methods Intended for Container Generated Code - *

- * The following methods enable the management of nested JspWriter - * streams to implement Tag Extensions: pushBody() and - * popBody() - * - *

Methods Intended for JSP authors - *

- * Some methods provide uniform access to the diverse objects - * representing scopes. - * The implementation must use the underlying machinery - * corresponding to that scope, so information can be passed back and - * forth between the underlying environment (e.g. Servlets) and JSP pages. - * The methods are: - * setAttribute(), getAttribute(), - * findAttribute(), removeAttribute(), - * getAttributesScope() and - * getAttributeNamesInScope(). - * - *

- * The following methods provide convenient access to implicit objects: - * getOut() - * - *

- * The following methods provide programmatic access to the - * Expression Language evaluator: - * getExpressionEvaluator(), getVariableResolver() - * - * @since JSP 2.0 - */ - -public abstract class JspContext { - - /** - * Sole constructor. (For invocation by subclass constructors, - * typically implicit.) - */ - public JspContext() { - } - - /** - * Register the name and value specified with page scope semantics. - * If the value passed in is null, this has the same - * effect as calling - * removeAttribute( name, PageContext.PAGE_SCOPE ). - * - * @param name the name of the attribute to set - * @param value the value to associate with the name, or null if the - * attribute is to be removed from the page scope. - * @throws NullPointerException if the name is null - */ - - abstract public void setAttribute(String name, Object value); - - /** - * Register the name and value specified with appropriate - * scope semantics. If the value passed in is null, - * this has the same effect as calling - * removeAttribute( name, scope ). - * - * @param name the name of the attribute to set - * @param value the object to associate with the name, or null if - * the attribute is to be removed from the specified scope. - * @param scope the scope with which to associate the name/object - * - * @throws NullPointerException if the name is null - * @throws IllegalArgumentException if the scope is invalid - * @throws IllegalStateException if the scope is - * PageContext.SESSION_SCOPE but the page that was requested - * does not participate in a session or the session has been - * invalidated. - */ - - abstract public void setAttribute(String name, Object value, int scope); - - /** - * Returns the object associated with the name in the page scope or null - * if not found. - * - * @param name the name of the attribute to get - * @return the object associated with the name in the page scope - * or null if not found. - * - * @throws NullPointerException if the name is null - */ - - abstract public Object getAttribute(String name); - - /** - * Return the object associated with the name in the specified - * scope or null if not found. - * - * @param name the name of the attribute to set - * @param scope the scope with which to associate the name/object - * @return the object associated with the name in the specified - * scope or null if not found. - * - * @throws NullPointerException if the name is null - * @throws IllegalArgumentException if the scope is invalid - * @throws IllegalStateException if the scope is - * PageContext.SESSION_SCOPE but the page that was requested - * does not participate in a session or the session has been - * invalidated. - */ - - abstract public Object getAttribute(String name, int scope); - - /** - * Searches for the named attribute in page, request, session (if valid), - * and application scope(s) in order and returns the value associated or - * null. - * - * @param name the name of the attribute to search for - * @return the value associated or null - * @throws NullPointerException if the name is null - */ - - abstract public Object findAttribute(String name); - - /** - * Remove the object reference associated with the given name - * from all scopes. Does nothing if there is no such object. - * - * @param name The name of the object to remove. - * @throws NullPointerException if the name is null - */ - - abstract public void removeAttribute(String name); - - /** - * Remove the object reference associated with the specified name - * in the given scope. Does nothing if there is no such object. - * - * @param name The name of the object to remove. - * @param scope The scope where to look. - * @throws IllegalArgumentException if the scope is invalid - * @throws IllegalStateException if the scope is - * PageContext.SESSION_SCOPE but the page that was requested - * does not participate in a session or the session has been - * invalidated. - * @throws NullPointerException if the name is null - */ - - abstract public void removeAttribute(String name, int scope); - - /** - * Get the scope where a given attribute is defined. - * - * @param name the name of the attribute to return the scope for - * @return the scope of the object associated with the name specified or 0 - * @throws NullPointerException if the name is null - */ - - abstract public int getAttributesScope(String name); - - /** - * Enumerate all the attributes in a given scope. - * - * @param scope the scope to enumerate all the attributes for - * @return an enumeration of names (java.lang.String) of all the - * attributes the specified scope - * @throws IllegalArgumentException if the scope is invalid - * @throws IllegalStateException if the scope is - * PageContext.SESSION_SCOPE but the page that was requested - * does not participate in a session or the session has been - * invalidated. - */ - - abstract public Enumeration getAttributeNamesInScope(int scope); - - /** - * The current value of the out object (a JspWriter). - * - * @return the current JspWriter stream being used for client response - */ - abstract public JspWriter getOut(); - - /** - * Provides programmatic access to the ExpressionEvaluator. - * The JSP Container must return a valid instance of an - * ExpressionEvaluator that can parse EL expressions. - * - * @deprecated As of JSP 2.1, replaced by - * {@link JspApplicationContext#getExpressionFactory} - * @return A valid instance of an ExpressionEvaluator. - * @since JSP 2.0 - */ - public abstract ExpressionEvaluator getExpressionEvaluator(); - - /** - * Returns an instance of a VariableResolver that provides access to the - * implicit objects specified in the JSP specification using this JspContext - * as the context object. - * - * @deprecated As of JSP 2.1, replaced by {@link ELContext#getELResolver}, - * which can be obtained by - * jspContext.getELContext().getELResolver(). - * @return A valid instance of a VariableResolver. - * @since JSP 2.0 - */ - public abstract VariableResolver getVariableResolver(); - - /** - * Returns the ELContext associated with this - * JspContext. - * - *

The ELContext is created lazily and is reused if - * it already exists. There is a new ELContext for each - * JspContext.

- * - *

The ELContext must contain the ELResolver - * described in the JSP specification (and in the javadocs for - * {@link JspApplicationContext#addELResolver}).

- * - * @return The ELContext associated with this - * JspContext. - * @since JSP 2.1 - */ - public abstract ELContext getELContext(); - - /** - * Return a new JspWriter object that sends output to the - * provided Writer. Saves the current "out" JspWriter, - * and updates the value of the "out" attribute in the - * page scope attribute namespace of the JspContext. - *

The returned JspWriter must implement all methods and - * behave as though it were unbuffered. More specifically: - *

    - *
  • clear() must throw an IOException
  • - *
  • clearBuffer() does nothing
  • - *
  • getBufferSize() always returns 0
  • - *
  • getRemaining() always returns 0
  • - *
- *

- * - * @param writer The Writer for the returned JspWriter to send - * output to. - * @return a new JspWriter that writes to the given Writer. - * @since JSP 2.0 - */ - public JspWriter pushBody( java.io.Writer writer ) { - return null; // XXX to implement - } - - /** - * Return the previous JspWriter "out" saved by the matching - * pushBody(), and update the value of the "out" attribute in - * the page scope attribute namespace of the JspContext. - * - * @return the saved JspWriter. - */ - public JspWriter popBody() { - return null; // XXX to implement - } -} diff --git a/api/src/main/java/javax/servlet/jsp/JspEngineInfo.java b/api/src/main/java/javax/servlet/jsp/JspEngineInfo.java deleted file mode 100644 index 46106af..0000000 --- a/api/src/main/java/javax/servlet/jsp/JspEngineInfo.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp; - -/** - * The JspEngineInfo is an abstract class that provides information on the - * current JSP engine. - */ - -public abstract class JspEngineInfo { - - /** - * Sole constructor. (For invocation by subclass constructors, - * typically implicit.) - */ - public JspEngineInfo() { - } - - /** - * Return the version number of the JSP specification that is supported by - * this JSP engine. - *

- * Specification version numbers that consists of positive decimal integers - * separated by periods ".", for example, "2.0" or "1.2.3.4.5.6.7". - * This allows an extensible number to be used to - * represent major, minor, micro, etc versions. - * The version number must begin with a number. - *

- * - * @return the specification version, null is returned if it is not known - */ - - public abstract String getSpecificationVersion(); -} diff --git a/api/src/main/java/javax/servlet/jsp/JspException.java b/api/src/main/java/javax/servlet/jsp/JspException.java deleted file mode 100644 index d1ec280..0000000 --- a/api/src/main/java/javax/servlet/jsp/JspException.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp; - -/** - * A generic exception known to the JSP engine; uncaught - * JspExceptions will result in an invocation of the errorpage - * machinery. - */ - -public class JspException extends Exception { - - /** - * Construct a JspException. - */ - public JspException() { - } - - - /** - * Constructs a new JSP exception with the - * specified message. The message can be written - * to the server log and/or displayed for the user. - * - * @param msg a String - * specifying the text of - * the exception message - * - */ - public JspException(String msg) { - super(msg); - } - - - /** - * Constructs a new JspException with the specified detail - * message and cause. - * - * The cause is saved for later retrieval by the - * {@link #getCause()} and {@link #getRootCause()} methods. - * - * @see java.lang.Exception#Exception(String, Throwable) - */ - public JspException(String message, Throwable cause) { - super(message, cause); - } - - - /** - * Constructs a new JspException with the specified cause. - * - * The cause is saved for later retrieval by the - * {@link #getCause()} and {@link #getRootCause()} methods. - * - * @see java.lang.Exception#Exception(Throwable) - */ - public JspException(Throwable cause) { - super(cause); - } - - - /** - * Returns the exception that caused this JSP exception. - * - * @return the Throwable - * that caused this JSP exception - * - * @deprecated As of JSP 2.1, replaced by {@link #getCause()} - */ - - public Throwable getRootCause() { - return getCause(); - } -} diff --git a/api/src/main/java/javax/servlet/jsp/JspFactory.java b/api/src/main/java/javax/servlet/jsp/JspFactory.java deleted file mode 100644 index b666114..0000000 --- a/api/src/main/java/javax/servlet/jsp/JspFactory.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2011 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp; - -import javax.servlet.Servlet; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.ServletContext; -import javax.servlet.jsp.PageContext; - -/** - *

- * The JspFactory is an abstract class that defines a number of factory - * methods available to a JSP page at runtime for the purposes of creating - * instances of various interfaces and classes used to support the JSP - * implementation. - *

- * A conformant JSP Engine implementation will, during it's initialization - * instantiate an implementation dependent subclass of this class, and make - * it globally available for use by JSP implementation classes by registering - * the instance created with this class via the - * static setDefaultFactory() method. - *

- * The only implementation-dependent classes that can be created from the - * factory are: - * PageContext, - * JspEngineInfo, and - * JspApplicationContext. - *

- * With the exception of JspApplicationContext, - * JspFactory objects should not be used by JSP application developers. - */ - -public abstract class JspFactory { - - private static volatile JspFactory deflt = null; - - /** - * Sole constructor. (For invocation by subclass constructors, - * typically implicit.) - */ - public JspFactory() { - } - - /** - *

- * set the default factory for this implementation. It is illegal for - * any principal other than the JSP Engine runtime to call this method. - *

- * - * @param deflt The default factory implementation - */ - - public static void setDefaultFactory(JspFactory deflt) { - JspFactory.deflt = deflt; - } - - /** - * Returns the default factory for this implementation. - * - * @return the default factory for this implementation - */ - - public static JspFactory getDefaultFactory() { - return deflt; - } - - /** - *

- * obtains an instance of an implementation dependent - * javax.servlet.jsp.PageContext abstract class for the calling Servlet - * and currently pending request and response. - *

- * - *

- * This method is typically called early in the processing of the - * _jspService() method of a JSP implementation class in order to - * obtain a PageContext object for the request being processed. - *

- *

- * Invoking this method shall result in the PageContext.initialize() - * method being invoked. The PageContext returned is properly initialized. - *

- *

- * All PageContext objects obtained via this method shall be released - * by invoking releasePageContext(). - *

- * - * @param servlet the requesting servlet - * @param request the current request pending on the servlet - * @param response the current response pending on the servlet - * @param errorPageURL the URL of the error page for the requesting JSP, or null - * @param needsSession true if the JSP participates in a session - * @param buffer size of buffer in bytes, JspWriter.NO_BUFFER if no buffer, - * JspWriter.DEFAULT_BUFFER if implementation default. - * @param autoflush should the buffer autoflush to the output stream on buffer - * overflow, or throw an IOException? - * - * @return the page context - * - * @see javax.servlet.jsp.PageContext - */ - - public abstract PageContext getPageContext(Servlet servlet, - ServletRequest request, - ServletResponse response, - String errorPageURL, - boolean needsSession, - int buffer, - boolean autoflush); - - /** - *

- * called to release a previously allocated PageContext object. - * Results in PageContext.release() being invoked. - * This method should be invoked prior to returning from the _jspService() method of a JSP implementation - * class. - *

- * - * @param pc A PageContext previously obtained by getPageContext() - */ - - public abstract void releasePageContext(PageContext pc); - - /** - *

- * called to get implementation-specific information on the current JSP engine. - *

- * - * @return a JspEngineInfo object describing the current JSP engine - */ - - public abstract JspEngineInfo getEngineInfo(); - - /** - * Obtains the JspApplicationContext instance associated - * with the web application for the given ServletContext. - * - * @param context The ServletContext for the web - * application the desired JspApplicationContext is - * associated with. - * @return The JspApplicationContext associated with the - * web application. - * @since 2.1 - */ - public abstract JspApplicationContext getJspApplicationContext( - ServletContext context); -} diff --git a/api/src/main/java/javax/servlet/jsp/JspPage.java b/api/src/main/java/javax/servlet/jsp/JspPage.java deleted file mode 100644 index 93da4ee..0000000 --- a/api/src/main/java/javax/servlet/jsp/JspPage.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp; - -import javax.servlet.*; - -/** - * The JspPage interface describes the generic interaction that a JSP Page - * Implementation class must satisfy; pages that use the HTTP protocol - * are described by the HttpJspPage interface. - * - *

Two plus One Methods - *

- * The interface defines a protocol with 3 methods; only two of - * them: jspInit() and jspDestroy() are part of this interface as - * the signature of the third method: _jspService() depends on - * the specific protocol used and cannot be expressed in a generic - * way in Java. - *

- * A class implementing this interface is responsible for invoking - * the above methods at the appropriate time based on the - * corresponding Servlet-based method invocations. - *

- * The jspInit() and jspDestroy() methods can be defined by a JSP - * author, but the _jspService() method is defined automatically - * by the JSP processor based on the contents of the JSP page. - * - *

_jspService() - *

- * The _jspService()method corresponds to the body of the JSP page. This - * method is defined automatically by the JSP container and should never - * be defined by the JSP page author. - *

- * If a superclass is specified using the extends attribute, that - * superclass may choose to perform some actions in its service() method - * before or after calling the _jspService() method. See using the extends - * attribute in the JSP_Engine chapter of the JSP specification. - *

- * The specific signature depends on the protocol supported by the JSP page. - * - *

- * public void _jspService(ServletRequestSubtype request,
- *                             ServletResponseSubtype response)
- *        throws ServletException, IOException;
- * 
- */ - - -public interface JspPage extends Servlet { - - /** - * The jspInit() method is invoked when the JSP page is initialized. It - * is the responsibility of the JSP implementation (and of the class - * mentioned by the extends attribute, if present) that at this point - * invocations to the getServletConfig() method will return the desired - * value. - * - * A JSP page can override this method by including a definition for it - * in a declaration element. - * - * A JSP page should redefine the init() method from Servlet. - */ - public void jspInit(); - - /** - * The jspDestroy() method is invoked when the JSP page is about to be - * destroyed. - * - * A JSP page can override this method by including a definition for it - * in a declaration element. - * - * A JSP page should redefine the destroy() method from Servlet. - */ - public void jspDestroy(); - -} diff --git a/api/src/main/java/javax/servlet/jsp/JspTagException.java b/api/src/main/java/javax/servlet/jsp/JspTagException.java deleted file mode 100644 index f017445..0000000 --- a/api/src/main/java/javax/servlet/jsp/JspTagException.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp; - -/** - * Exception to be used by a Tag Handler to indicate some unrecoverable - * error. - * This error is to be caught by the top level of the JSP page and will result - * in an error page. - */ - -public class JspTagException extends JspException { - /** - * Constructs a new JspTagException with the specified message. - * The message can be written to the server log and/or displayed - * for the user. - * - * @param msg a String specifying the text of - * the exception message - */ - public JspTagException(String msg) { - super( msg ); - } - - /** - * Constructs a new JspTagException with no message. - */ - public JspTagException() { - super(); - } - - /** - * Constructs a new JspTagException when the JSP Tag - * needs to throw an exception and include a message - * about the "root cause" exception that interfered with its - * normal operation, including a description message. - * - * - * @param message a String containing - * the text of the exception message - * - * @param rootCause the Throwable exception - * that interfered with the JSP Tag's - * normal operation, making this JSP Tag - * exception necessary - * - * @since JSP 2.0 - */ - public JspTagException(String message, Throwable rootCause) { - super( message, rootCause ); - } - - - /** - * Constructs a new JSP Tag exception when the JSP Tag - * needs to throw an exception and include a message - * about the "root cause" exception that interfered with its - * normal operation. The exception's message is based on the localized - * message of the underlying exception. - * - *

This method calls the getLocalizedMessage method - * on the Throwable exception to get a localized exception - * message. When subclassing JspTagException, - * this method can be overridden to create an exception message - * designed for a specific locale. - * - * @param rootCause the Throwable exception - * that interfered with the JSP Tag's - * normal operation, making the JSP Tag - * exception necessary - * - * @since JSP 2.0 - */ - - public JspTagException(Throwable rootCause) { - super( rootCause ); - } - -} diff --git a/api/src/main/java/javax/servlet/jsp/JspWriter.java b/api/src/main/java/javax/servlet/jsp/JspWriter.java deleted file mode 100644 index d43ab89..0000000 --- a/api/src/main/java/javax/servlet/jsp/JspWriter.java +++ /dev/null @@ -1,484 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp; - -import java.io.IOException; - -/** - *

- * The actions and template data in a JSP page is written using the - * JspWriter object that is referenced by the implicit variable out which - * is initialized automatically using methods in the PageContext object. - *

- * This abstract class emulates some of the functionality found in the - * java.io.BufferedWriter and java.io.PrintWriter classes, - * however it differs in that it throws java.io.IOException from the print - * methods while PrintWriter does not. - *

Buffering - *

- * The initial JspWriter object is associated with the PrintWriter object - * of the ServletResponse in a way that depends on whether the page is or - * is not buffered. If the page is not buffered, output written to this - * JspWriter object will be written through to the PrintWriter directly, - * which will be created if necessary by invoking the getWriter() method - * on the response object. But if the page is buffered, the PrintWriter - * object will not be created until the buffer is flushed and - * operations like setContentType() are legal. Since this flexibility - * simplifies programming substantially, buffering is the default for JSP - * pages. - *

- * Buffering raises the issue of what to do when the buffer is - * exceeded. Two approaches can be taken: - *

    - *
  • - * Exceeding the buffer is not a fatal error; when the buffer is - * exceeded, just flush the output. - *
  • - * Exceeding the buffer is a fatal error; when the buffer is exceeded, - * raise an exception. - *
- *

- * Both approaches are valid, and thus both are supported in the JSP - * technology. The behavior of a page is controlled by the autoFlush - * attribute, which defaults to true. In general, JSP pages that need to - * be sure that correct and complete data has been sent to their client - * may want to set autoFlush to false, with a typical case being that - * where the client is an application itself. On the other hand, JSP - * pages that send data that is meaningful even when partially - * constructed may want to set autoFlush to true; such as when the - * data is sent for immediate display through a browser. Each application - * will need to consider their specific needs. - *

- * An alternative considered was to make the buffer size unbounded; but, - * this had the disadvantage that runaway computations would consume an - * unbounded amount of resources. - *

- * The "out" implicit variable of a JSP implementation class is of this type. - * If the page directive selects autoflush="true" then all the I/O operations - * on this class shall automatically flush the contents of the buffer if an - * overflow condition would result if the current operation were performed - * without a flush. If autoflush="false" then all the I/O operations on this - * class shall throw an IOException if performing the current operation would - * result in a buffer overflow condition. - * - * @see java.io.Writer - * @see java.io.BufferedWriter - * @see java.io.PrintWriter - */ - -abstract public class JspWriter extends java.io.Writer { - - /** - * Constant indicating that the Writer is not buffering output. - */ - - public static final int NO_BUFFER = 0; - - /** - * Constant indicating that the Writer is buffered and is using the - * implementation default buffer size. - */ - - public static final int DEFAULT_BUFFER = -1; - - /** - * Constant indicating that the Writer is buffered and is unbounded; this - * is used in BodyContent. - */ - - public static final int UNBOUNDED_BUFFER = -2; - - /** - * Protected constructor. - * - * @param bufferSize the size of the buffer to be used by the JspWriter - * @param autoFlush whether the JspWriter should be autoflushing - */ - - protected JspWriter(int bufferSize, boolean autoFlush) { - this.bufferSize = bufferSize; - this.autoFlush = autoFlush; - } - - /** - * Write a line separator. The line separator string is defined by the - * system property line.separator, and is not necessarily a single - * newline ('\n') character. - * - * @exception IOException If an I/O error occurs - */ - - abstract public void newLine() throws IOException; - - /** - * Print a boolean value. The string produced by {@link - * java.lang.String#valueOf(boolean)} is written to the - * JspWriter's buffer or, if no buffer is used, directly to the - * underlying writer. - * - * @param b The boolean to be printed - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void print(boolean b) throws IOException; - - /** - * Print a character. The character is written to the - * JspWriter's buffer or, if no buffer is used, directly to the - * underlying writer. - * - * @param c The char to be printed - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void print(char c) throws IOException; - - /** - * Print an integer. The string produced by {@link - * java.lang.String#valueOf(int)} is written to the - * JspWriter's buffer or, if no buffer is used, directly to the - * underlying writer. - * - * @param i The int to be printed - * @see java.lang.Integer#toString(int) - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void print(int i) throws IOException; - - /** - * Print a long integer. The string produced by {@link - * java.lang.String#valueOf(long)} is written to the - * JspWriter's buffer or, if no buffer is used, directly to the - * underlying writer. - * - * @param l The long to be printed - * @see java.lang.Long#toString(long) - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void print(long l) throws IOException; - - /** - * Print a floating-point number. The string produced by {@link - * java.lang.String#valueOf(float)} is written to the - * JspWriter's buffer or, if no buffer is used, directly to the - * underlying writer. - * - * @param f The float to be printed - * @see java.lang.Float#toString(float) - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void print(float f) throws IOException; - - /** - * Print a double-precision floating-point number. The string produced by - * {@link java.lang.String#valueOf(double)} is written to - * the JspWriter's buffer or, if no buffer is used, directly to the - * underlying writer. - * - * @param d The double to be printed - * @see java.lang.Double#toString(double) - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void print(double d) throws IOException; - - /** - * Print an array of characters. The characters are written to the - * JspWriter's buffer or, if no buffer is used, directly to the - * underlying writer. - * - * @param s The array of chars to be printed - * - * @throws NullPointerException If s is null - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void print(char s[]) throws IOException; - - /** - * Print a string. If the argument is null then the string - * "null" is printed. Otherwise, the string's characters are - * written to the JspWriter's buffer or, if no buffer is used, directly - * to the underlying writer. - * - * @param s The String to be printed - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void print(String s) throws IOException; - - /** - * Print an object. The string produced by the {@link - * java.lang.String#valueOf(Object)} method is written to the - * JspWriter's buffer or, if no buffer is used, directly to the - * underlying writer. - * - * @param obj The Object to be printed - * @see java.lang.Object#toString() - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void print(Object obj) throws IOException; - - /** - * Terminate the current line by writing the line separator string. The - * line separator string is defined by the system property - * line.separator, and is not necessarily a single newline - * character ('\n'). - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void println() throws IOException; - - /** - * Print a boolean value and then terminate the line. This method behaves - * as though it invokes {@link #print(boolean)} and then - * {@link #println()}. - * - * @param x the boolean to write - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void println(boolean x) throws IOException; - - /** - * Print a character and then terminate the line. This method behaves as - * though it invokes {@link #print(char)} and then {@link - * #println()}. - * - * @param x the char to write - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void println(char x) throws IOException; - - /** - * Print an integer and then terminate the line. This method behaves as - * though it invokes {@link #print(int)} and then {@link - * #println()}. - * - * @param x the int to write - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void println(int x) throws IOException; - - /** - * Print a long integer and then terminate the line. This method behaves - * as though it invokes {@link #print(long)} and then - * {@link #println()}. - * - * @param x the long to write - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void println(long x) throws IOException; - - /** - * Print a floating-point number and then terminate the line. This method - * behaves as though it invokes {@link #print(float)} and then - * {@link #println()}. - * - * @param x the float to write - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void println(float x) throws IOException; - - /** - * Print a double-precision floating-point number and then terminate the - * line. This method behaves as though it invokes {@link - * #print(double)} and then {@link #println()}. - * - * @param x the double to write - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void println(double x) throws IOException; - - /** - * Print an array of characters and then terminate the line. This method - * behaves as though it invokes print(char[]) and then - * println(). - * - * @param x the char[] to write - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void println(char x[]) throws IOException; - - /** - * Print a String and then terminate the line. This method behaves as - * though it invokes {@link #print(String)} and then - * {@link #println()}. - * - * @param x the String to write - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void println(String x) throws IOException; - - /** - * Print an Object and then terminate the line. This method behaves as - * though it invokes {@link #print(Object)} and then - * {@link #println()}. - * - * @param x the Object to write - * @throws java.io.IOException If an error occured while writing - */ - - abstract public void println(Object x) throws IOException; - - - /** - * Clear the contents of the buffer. If the buffer has been already - * been flushed then the clear operation shall throw an IOException - * to signal the fact that some data has already been irrevocably - * written to the client response stream. - * - * @throws IOException If an I/O error occurs - */ - - abstract public void clear() throws IOException; - - /** - * Clears the current contents of the buffer. Unlike clear(), this - * method will not throw an IOException if the buffer has already been - * flushed. It merely clears the current content of the buffer and - * returns. - * - * @throws IOException If an I/O error occurs - */ - - abstract public void clearBuffer() throws IOException; - - /** - * Flush the stream. If the stream has saved any characters from the - * various write() methods in a buffer, write them immediately to their - * intended destination. Then, if that destination is another character or - * byte stream, flush it. Thus one flush() invocation will flush all the - * buffers in a chain of Writers and OutputStreams. - *

- * The method may be invoked indirectly if the buffer size is exceeded. - *

- * Once a stream has been closed, - * further write() or flush() invocations will cause an IOException to be - * thrown. - * - * @exception IOException If an I/O error occurs - */ - - abstract public void flush() throws IOException; - - /** - * Close the stream, flushing it first. - *

- * This method needs not be invoked explicitly for the initial JspWriter - * as the code generated by the JSP container will automatically - * include a call to close(). - *

- * Closing a previously-closed stream, unlike flush(), has no effect. - * - * @exception IOException If an I/O error occurs - */ - - abstract public void close() throws IOException; - - /** - * This method returns the size of the buffer used by the JspWriter. - * - * @return the size of the buffer in bytes, or 0 is unbuffered. - */ - - public int getBufferSize() { return bufferSize; } - - /** - * This method returns the number of unused bytes in the buffer. - * - * @return the number of bytes unused in the buffer - */ - - abstract public int getRemaining(); - - /** - * This method indicates whether the JspWriter is autoFlushing. - * - * @return if this JspWriter is auto flushing or throwing IOExceptions - * on buffer overflow conditions - */ - - public boolean isAutoFlush() { return autoFlush; } - - /* - * fields - */ - - /** - * The size of the buffer used by the JspWriter. - */ - protected int bufferSize; - - /** - * Whether the JspWriter is autoflushing. - */ - protected boolean autoFlush; -} diff --git a/api/src/main/java/javax/servlet/jsp/PageContext.java b/api/src/main/java/javax/servlet/jsp/PageContext.java deleted file mode 100644 index e29d32d..0000000 --- a/api/src/main/java/javax/servlet/jsp/PageContext.java +++ /dev/null @@ -1,564 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp; - -import java.io.IOException; - -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; - -import javax.servlet.http.HttpSession; - -import javax.servlet.jsp.tagext.BodyContent; - -/** - *

- * PageContext extends JspContext to provide useful context information for - * when JSP technology is used in a Servlet environment. - *

- * A PageContext instance provides access to all the namespaces associated - * with a JSP page, provides access to several page attributes, as well as - * a layer above the implementation details. Implicit objects are added - * to the pageContext automatically. - * - *

The PageContext class is an abstract class, designed to be - * extended to provide implementation dependent implementations thereof, by - * conformant JSP engine runtime environments. A PageContext instance is - * obtained by a JSP implementation class by calling the - * JspFactory.getPageContext() method, and is released by calling - * JspFactory.releasePageContext(). - * - *

An example of how PageContext, JspFactory, and other classes can be - * used within a JSP Page Implementation object is given elsewhere. - * - *

- * The PageContext provides a number of facilities to the page/component - * author and page implementor, including: - *

    - *
  • a single API to manage the various scoped namespaces - *
  • a number of convenience API's to access various public objects - *
  • a mechanism to obtain the JspWriter for output - *
  • a mechanism to manage session usage by the page - *
  • a mechanism to expose page directive attributes to the scripting - * environment - *
  • mechanisms to forward or include the current request to other active - * components in the application - *
  • a mechanism to handle errorpage exception processing - *
- * - *

Methods Intended for Container Generated Code - *

Some methods are intended to be used by the code generated by the - * container, not by code written by JSP page authors, or JSP tag library - * authors. - *

The methods supporting lifecycle are initialize() - * and release() - * - *

- * The following methods enable the management of nested JspWriter - * streams to implement Tag Extensions: pushBody() - * - *

Methods Intended for JSP authors - *

- * The following methods provide convenient access to implicit objects: - * getException(), getPage() - * getRequest(), getResponse(), - * getSession(), getServletConfig() - * and getServletContext(). - * - *

- * The following methods provide support for forwarding, inclusion - * and error handling: - * forward(), include(), - * and handlePageException(). - */ - -abstract public class PageContext - extends JspContext -{ - - /** - * Sole constructor. (For invocation by subclass constructors, - * typically implicit.) - */ - public PageContext() { - } - - /** - * Page scope: (this is the default) the named reference remains available - * in this PageContext until the return from the current Servlet.service() - * invocation. - */ - - public static final int PAGE_SCOPE = 1; - - /** - * Request scope: the named reference remains available from the - * ServletRequest associated with the Servlet until the current request - * is completed. - */ - - public static final int REQUEST_SCOPE = 2; - - /** - * Session scope (only valid if this page participates in a session): - * the named reference remains available from the HttpSession (if any) - * associated with the Servlet until the HttpSession is invalidated. - */ - - public static final int SESSION_SCOPE = 3; - - /** - * Application scope: named reference remains available in the - * ServletContext until it is reclaimed. - */ - - public static final int APPLICATION_SCOPE = 4; - - /** - * Name used to store the Servlet in this PageContext's nametables. - */ - - public static final String PAGE = "javax.servlet.jsp.jspPage"; - - /** - * Name used to store this PageContext in it's own name table. - */ - - public static final String PAGECONTEXT = "javax.servlet.jsp.jspPageContext"; - - /** - * Name used to store ServletRequest in PageContext name table. - */ - - public static final String REQUEST = "javax.servlet.jsp.jspRequest"; - - /** - * Name used to store ServletResponse in PageContext name table. - */ - - public static final String RESPONSE = "javax.servlet.jsp.jspResponse"; - - /** - * Name used to store ServletConfig in PageContext name table. - */ - - public static final String CONFIG = "javax.servlet.jsp.jspConfig"; - - /** - * Name used to store HttpSession in PageContext name table. - */ - - public static final String SESSION = "javax.servlet.jsp.jspSession"; - /** - * Name used to store current JspWriter in PageContext name table. - */ - - public static final String OUT = "javax.servlet.jsp.jspOut"; - - /** - * Name used to store ServletContext in PageContext name table. - */ - - public static final String APPLICATION = "javax.servlet.jsp.jspApplication"; - - /** - * Name used to store uncaught exception in ServletRequest attribute - * list and PageContext name table. - */ - - public static final String EXCEPTION = "javax.servlet.jsp.jspException"; - - /** - *

- * The initialize method is called to initialize an uninitialized PageContext - * so that it may be used by a JSP Implementation class to service an - * incoming request and response within it's _jspService() method. - * - *

- * This method is typically called from JspFactory.getPageContext() in - * order to initialize state. - * - *

- * This method is required to create an initial JspWriter, and associate - * the "out" name in page scope with this newly created object. - * - *

- * This method should not be used by page or tag library authors. - * - * @param servlet The Servlet that is associated with this PageContext - * @param request The currently pending request for this Servlet - * @param response The currently pending response for this Servlet - * @param errorPageURL The value of the errorpage attribute from the page - * directive or null - * @param needsSession The value of the session attribute from the - * page directive - * @param bufferSize The value of the buffer attribute from the page - * directive - * @param autoFlush The value of the autoflush attribute from the page - * directive - * - * @throws IOException during creation of JspWriter - * @throws IllegalStateException if out not correctly initialized - * @throws IllegalArgumentException If one of the given parameters - * is invalid - */ - - abstract public void initialize(Servlet servlet, ServletRequest request, - ServletResponse response, String errorPageURL, boolean needsSession, - int bufferSize, boolean autoFlush) - throws IOException, IllegalStateException, IllegalArgumentException; - - /** - *

- * This method shall "reset" the internal state of a PageContext, releasing - * all internal references, and preparing the PageContext for potential - * reuse by a later invocation of initialize(). This method is typically - * called from JspFactory.releasePageContext(). - * - *

- * Subclasses shall envelope this method. - * - *

- * This method should not be used by page or tag library authors. - * - */ - - abstract public void release(); - - /** - * The current value of the session object (an HttpSession). - * - * @return the HttpSession for this PageContext or null - */ - - abstract public HttpSession getSession(); - - /** - * The current value of the page object (In a Servlet environment, - * this is an instance of javax.servlet.Servlet). - * - * @return the Page implementation class instance associated - * with this PageContext - */ - - abstract public Object getPage(); - - - /** - * The current value of the request object (a ServletRequest). - * - * @return The ServletRequest for this PageContext - */ - - abstract public ServletRequest getRequest(); - - /** - * The current value of the response object (a ServletResponse). - * - * @return the ServletResponse for this PageContext - */ - - abstract public ServletResponse getResponse(); - - /** - * The current value of the exception object (an Exception). - * - * @return any exception passed to this as an errorpage - */ - - abstract public Exception getException(); - - /** - * The ServletConfig instance. - * - * @return the ServletConfig for this PageContext - */ - - abstract public ServletConfig getServletConfig(); - - /** - * The ServletContext instance. - * - * @return the ServletContext for this PageContext - */ - - abstract public ServletContext getServletContext(); - - /** - *

- * This method is used to re-direct, or "forward" the current - * ServletRequest and ServletResponse to another active component in - * the application. - *

- *

- * If the relativeUrlPath begins with a "/" then the URL specified - * is calculated relative to the DOCROOT of the ServletContext - * for this JSP. If the path does not begin with a "/" then the URL - * specified is calculated relative to the URL of the request that was - * mapped to the calling JSP. - *

- *

- * It is only valid to call this method from a Thread - * executing within a _jspService(...) method of a JSP. - *

- *

- * Once this method has been called successfully, it is illegal for the - * calling Thread to attempt to modify the - * ServletResponse object. Any such attempt to do so, shall result - * in undefined behavior. Typically, callers immediately return from - * _jspService(...) after calling this method. - *

- * - * @param relativeUrlPath specifies the relative URL path to the target - * resource as described above - * - * @throws IllegalStateException if ServletResponse is not - * in a state where a forward can be performed - * @throws ServletException if the page that was forwarded to throws - * a ServletException - * @throws IOException if an I/O error occurred while forwarding - */ - - abstract public void forward(String relativeUrlPath) - throws ServletException, IOException; - - /** - *

- * Causes the resource specified to be processed as part of the current - * ServletRequest and ServletResponse being processed by the calling Thread. - * The output of the target resources processing of the request is written - * directly to the ServletResponse output stream. - *

- *

- * The current JspWriter "out" for this JSP is flushed as a side-effect - * of this call, prior to processing the include. - *

- *

- * If the relativeUrlPath begins with a "/" then the URL specified - * is calculated relative to the DOCROOT of the ServletContext - * for this JSP. If the path does not begin with a "/" then the URL - * specified is calculated relative to the URL of the request that was - * mapped to the calling JSP. - *

- *

- * It is only valid to call this method from a Thread - * executing within a _jspService(...) method of a JSP. - *

- * - * @param relativeUrlPath specifies the relative URL path to the target - * resource to be included - * - * @throws ServletException if the page that was forwarded to throws - * a ServletException - * @throws IOException if an I/O error occurred while forwarding - */ - abstract public void include(String relativeUrlPath) - throws ServletException, IOException; - - /** - *

- * Causes the resource specified to be processed as part of the current - * ServletRequest and ServletResponse being processed by the calling Thread. - * The output of the target resources processing of the request is written - * directly to the current JspWriter returned by a call to getOut(). - *

- *

- * If flush is true, The current JspWriter "out" for this JSP - * is flushed as a side-effect of this call, prior to processing - * the include. Otherwise, the JspWriter "out" is not flushed. - *

- *

- * If the relativeUrlPath begins with a "/" then the URL specified - * is calculated relative to the DOCROOT of the ServletContext - * for this JSP. If the path does not begin with a "/" then the URL - * specified is calculated relative to the URL of the request that was - * mapped to the calling JSP. - *

- *

- * It is only valid to call this method from a Thread - * executing within a _jspService(...) method of a JSP. - *

- * - * @param relativeUrlPath specifies the relative URL path to the - * target resource to be included - * @param flush True if the JspWriter is to be flushed before the include, - * or false if not. - * - * @throws ServletException if the page that was forwarded to throws - * a ServletException - * @throws IOException if an I/O error occurred while forwarding - * @since JSP 2.0 - */ - abstract public void include(String relativeUrlPath, boolean flush) - throws ServletException, IOException; - - /** - *

- * This method is intended to process an unhandled 'page' level - * exception by forwarding the exception to the specified - * error page for this JSP. If forwarding is not possible (for - * example because the response has already been committed), an - * implementation dependent mechanism should be used to invoke - * the error page (e.g. "including" the error page instead). - * - *

- * If no error page is defined in the page, the exception should - * be rethrown so that the standard servlet error handling - * takes over. - * - *

- * A JSP implementation class shall typically clean up any local state - * prior to invoking this and will return immediately thereafter. It is - * illegal to generate any output to the client, or to modify any - * ServletResponse state after invoking this call. - * - *

- * This method is kept for backwards compatiblity reasons. Newly - * generated code should use PageContext.handlePageException(Throwable). - * - * @param e the exception to be handled - * - * @throws ServletException if an error occurs while invoking the error page - * @throws IOException if an I/O error occurred while invoking the error - * page - * @throws NullPointerException if the exception is null - * - * @see #handlePageException(Throwable) - */ - - abstract public void handlePageException(Exception e) - throws ServletException, IOException; - - /** - *

- * This method is intended to process an unhandled 'page' level - * exception by forwarding the exception to the specified - * error page for this JSP. If forwarding is not possible (for - * example because the response has already been committed), an - * implementation dependent mechanism should be used to invoke - * the error page (e.g. "including" the error page instead). - * - *

- * If no error page is defined in the page, the exception should - * be rethrown so that the standard servlet error handling - * takes over. - * - *

- * This method is intended to process an unhandled "page" level exception - * by redirecting the exception to either the specified error page for this - * JSP, or if none was specified, to perform some implementation dependent - * action. - * - *

- * A JSP implementation class shall typically clean up any local state - * prior to invoking this and will return immediately thereafter. It is - * illegal to generate any output to the client, or to modify any - * ServletResponse state after invoking this call. - * - * @param t the throwable to be handled - * - * @throws ServletException if an error occurs while invoking the error page - * @throws IOException if an I/O error occurred while invoking the error - * page - * @throws NullPointerException if the exception is null - * - * @see #handlePageException(Exception) - */ - - abstract public void handlePageException(Throwable t) - throws ServletException, IOException; - - /** - * Return a new BodyContent object, save the current "out" JspWriter, - * and update the value of the "out" attribute in the page scope - * attribute namespace of the PageContext. - * - * @return the new BodyContent - */ - - public BodyContent pushBody() { - return null; // XXX to implement - } - - - /** - * Provides convenient access to error information. - * - * @return an ErrorData instance containing information about the - * error, as obtained from the request attributes, as per the - * Servlet specification. If this is not an error page (that is, - * if the isErrorPage attribute of the page directive is not set - * to "true"), the information is meaningless. - * - * @since JSP 2.0 - */ - public ErrorData getErrorData() { - return new ErrorData( - (Throwable)getRequest().getAttribute( "javax.servlet.error.exception" ), - ((Integer)getRequest().getAttribute( - "javax.servlet.error.status_code" )).intValue(), - (String)getRequest().getAttribute( "javax.servlet.error.request_uri" ), - (String)getRequest().getAttribute( "javax.servlet.error.servlet_name" ) ); - } - -} diff --git a/api/src/main/java/javax/servlet/jsp/SkipPageException.java b/api/src/main/java/javax/servlet/jsp/SkipPageException.java deleted file mode 100644 index ef72f02..0000000 --- a/api/src/main/java/javax/servlet/jsp/SkipPageException.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp; - -/** - * Exception to indicate the calling page must cease evaluation. - * Thrown by a simple tag handler to indicate that the remainder of - * the page must not be evaluated. The result is propagated back to - * the pagein the case where one tag invokes another (as can be - * the case with tag files). The effect is similar to that of a - * Classic Tag Handler returning Tag.SKIP_PAGE from doEndTag(). - * Jsp Fragments may also throw this exception. This exception - * should not be thrown manually in a JSP page or tag file - the behavior is - * undefined. The exception is intended to be thrown inside - * SimpleTag handlers and in JSP fragments. - * - * @see javax.servlet.jsp.tagext.SimpleTag#doTag - * @see javax.servlet.jsp.tagext.JspFragment#invoke - * @see javax.servlet.jsp.tagext.Tag#doEndTag - * @since JSP 2.0 - */ -public class SkipPageException - extends JspException -{ - /** - * Creates a SkipPageException with no message. - */ - public SkipPageException() { - super(); - } - - /** - * Creates a SkipPageException with the provided message. - * - * @param message the detail message - */ - public SkipPageException( String message ) { - super( message ); - } - - /** - * Creates a SkipPageException with the provided message and root cause. - * - * @param message the detail message - * @param rootCause the originating cause of this exception - */ - public SkipPageException( String message, Throwable rootCause ) { - super( message, rootCause ); - } - - /** - * Creates a SkipPageException with the provided root cause. - * - * @param rootCause the originating cause of this exception - */ - public SkipPageException( Throwable rootCause ) { - super( rootCause ); - } - -} - - diff --git a/api/src/main/java/javax/servlet/jsp/el/ELException.java b/api/src/main/java/javax/servlet/jsp/el/ELException.java deleted file mode 100644 index 71199e5..0000000 --- a/api/src/main/java/javax/servlet/jsp/el/ELException.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.el; - - -/** - * Represents any of the exception conditions that arise during the - * operation evaluation of the evaluator. - * - * @deprecated As of JSP 2.1, replaced by {@link javax.el.ELException} - * @since JSP 2.0 - */ -public class ELException - extends Exception -{ - //------------------------------------- - // Member variables - //------------------------------------- - - private Throwable mRootCause; - - //------------------------------------- - /** - * Creates an ELException with no detail message. - **/ - public ELException () - { - super (); - } - - //------------------------------------- - /** - * Creates an ELException with the provided detail message. - * - * @param pMessage the detail message - **/ - public ELException (String pMessage) - { - super (pMessage); - } - - //------------------------------------- - /** - * Creates an ELException with the given root cause. - * - * @param pRootCause the originating cause of this exception - **/ - public ELException (Throwable pRootCause) - { - super( pRootCause.getLocalizedMessage() ); - mRootCause = pRootCause; - } - - //------------------------------------- - /** - * Creates an ELException with the given detail message and root cause. - * - * @param pMessage the detail message - * @param pRootCause the originating cause of this exception - **/ - public ELException (String pMessage, - Throwable pRootCause) - { - super (pMessage); - mRootCause = pRootCause; - } - - //------------------------------------- - /** - * Returns the root cause. - * - * @return the root cause of this exception - */ - public Throwable getRootCause () - { - return mRootCause; - } -} diff --git a/api/src/main/java/javax/servlet/jsp/el/ELParseException.java b/api/src/main/java/javax/servlet/jsp/el/ELParseException.java deleted file mode 100644 index 78b7348..0000000 --- a/api/src/main/java/javax/servlet/jsp/el/ELParseException.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.el; - - -/** - * Represents a parsing error encountered while parsing an EL expression. - * - * @deprecated As of JSP 2.1, replaced by {@link javax.el.ELException} - * @since JSP 2.0 - */ - -public class ELParseException extends ELException { - - //------------------------------------- - /** - * Creates an ELParseException with no detail message. - */ - public ELParseException () - { - super (); - } - - //------------------------------------- - /** - * Creates an ELParseException with the provided detail message. - * - * @param pMessage the detail message - **/ - public ELParseException (String pMessage) - { - super (pMessage); - } - - //------------------------------------- -} diff --git a/api/src/main/java/javax/servlet/jsp/el/Expression.java b/api/src/main/java/javax/servlet/jsp/el/Expression.java deleted file mode 100644 index 69e77b0..0000000 --- a/api/src/main/java/javax/servlet/jsp/el/Expression.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.el; - - -/** - *

The abstract class for a prepared expression.

- * - *

An instance of an Expression can be obtained via from an - * ExpressionEvaluator instance.

- * - *

An Expression may or not have done a syntactic parse of the expression. - * A client invoking the evaluate() method should be ready for the case - * where ELParseException exceptions are raised.

- * - * @deprecated As of JSP 2.1, replaced by {@link javax.el.ValueExpression} - * @since JSP 2.0 - */ -public abstract class Expression { - - /** - * Evaluates an expression that was previously prepared. In some - * implementations preparing an expression involves full syntactic - * validation, but others may not do so. Evaluating the expression may - * raise an ELParseException as well as other ELExceptions due to - * run-time evaluation. - * - * @param vResolver A VariableResolver instance that can be used at - * runtime to resolve the name of implicit objects into Objects. - * @return The result of the expression evaluation. - * - * @exception ELException Thrown if the expression evaluation failed. - */ - public abstract Object evaluate( VariableResolver vResolver ) - throws ELException; -} - diff --git a/api/src/main/java/javax/servlet/jsp/el/ExpressionEvaluator.java b/api/src/main/java/javax/servlet/jsp/el/ExpressionEvaluator.java deleted file mode 100644 index 4bec784..0000000 --- a/api/src/main/java/javax/servlet/jsp/el/ExpressionEvaluator.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.el; - - -/** - *

The abstract base class for an expression-language evaluator. - * Classes that implement an expression language expose their functionality - * via this abstract class.

- * - *

An instance of the ExpressionEvaluator can be obtained via the - * JspContext / PageContext

- * - *

The parseExpression() and evaluate() methods must be thread-safe. - * That is, multiple threads may call these methods on the same - * ExpressionEvaluator object simultaneously. Implementations should - * synchronize access if they depend on transient state. Implementations - * should not, however, assume that only one object of each - * ExpressionEvaluator type will be instantiated; global caching should - * therefore be static.

- * - *

Only a single EL expression, starting with '${' and ending with - * '}', can be parsed or evaluated at a time. EL expressions - * cannot be mixed with static text. For example, attempting to - * parse or evaluate "abc${1+1}def${1+1}ghi" or even - * "${1+1}${1+1}" will cause an ELException to - * be thrown.

- * - *

The following are examples of syntactically legal EL expressions: - * - *

    - *
  • ${person.lastName}
  • - *
  • ${8 * 8}
  • - *
  • ${my:reverse('hello')}
  • - *
- *

- * - * @deprecated As of JSP 2.1, replaced by {@link javax.el.ExpressionFactory} - * @since JSP 2.0 - */ -public abstract class ExpressionEvaluator { - - /** - * Prepare an expression for later evaluation. This method should perform - * syntactic validation of the expression; if in doing so it detects - * errors, it should raise an ELParseException. - * - * @param expression The expression to be evaluated. - * @param expectedType The expected type of the result of the evaluation - * @param fMapper A FunctionMapper to resolve functions found in - * the expression. It can be null, in which case no functions - * are supported for this invocation. The ExpressionEvaluator - * must not hold on to the FunctionMapper reference after - * returning from parseExpression(). The - * Expression object returned must invoke the same - * functions regardless of whether the mappings in the - * provided FunctionMapper instance change between - * calling ExpressionEvaluator.parseExpression() - * and Expression.evaluate(). - * @return The Expression object encapsulating the arguments. - * - * @exception ELException Thrown if parsing errors were found. - */ - public abstract Expression parseExpression( String expression, - Class expectedType, - FunctionMapper fMapper ) - throws ELException; - - - /** - * Evaluates an expression. This method may perform some syntactic - * validation and, if so, it should raise an ELParseException error if - * it encounters syntactic errors. EL evaluation errors should cause - * an ELException to be raised. - * - * @param expression The expression to be evaluated. - * @param expectedType The expected type of the result of the evaluation - * @param vResolver A VariableResolver instance that can be used at - * runtime to resolve the name of implicit objects into Objects. - * @param fMapper A FunctionMapper to resolve functions found in - * the expression. It can be null, in which case no functions - * are supported for this invocation. - * @return The result of the expression evaluation. - * - * @exception ELException Thrown if the expression evaluation failed. - */ - public abstract Object evaluate( String expression, - Class expectedType, - VariableResolver vResolver, - FunctionMapper fMapper ) - throws ELException; -} - diff --git a/api/src/main/java/javax/servlet/jsp/el/FunctionMapper.java b/api/src/main/java/javax/servlet/jsp/el/FunctionMapper.java deleted file mode 100644 index 8abae06..0000000 --- a/api/src/main/java/javax/servlet/jsp/el/FunctionMapper.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.el; - -/** - *

The interface to a map between EL function names and methods.

- * - *

Classes implementing this interface may, for instance, consult tag library - * information to resolve the map.

- * - * @deprecated As of JSP 2.1, replaced by {@link javax.el.FunctionMapper} - * @since JSP 2.0 - */ -public interface FunctionMapper { - /** - * Resolves the specified local name and prefix into a Java.lang.Method. - * Returns null if the prefix and local name are not found. - * - * @param prefix the prefix of the function, or "" if no prefix. - * @param localName the short name of the function - * @return the result of the method mapping. Null means no entry found. - **/ - public java.lang.reflect.Method resolveFunction(String prefix, - String localName); -} diff --git a/api/src/main/java/javax/servlet/jsp/el/ImplicitObjectELResolver.java b/api/src/main/java/javax/servlet/jsp/el/ImplicitObjectELResolver.java deleted file mode 100644 index a4d2ac8..0000000 --- a/api/src/main/java/javax/servlet/jsp/el/ImplicitObjectELResolver.java +++ /dev/null @@ -1,1266 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.el; - -import java.beans.FeatureDescriptor; -import java.util.Iterator; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.servlet.ServletContext; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.jsp.PageContext; -import javax.servlet.jsp.JspContext; - -import javax.el.PropertyNotWritableException; -import javax.el.ELContext; -import javax.el.ELResolver; - -/** - * Defines variable resolution behavior for the EL implicit objects - * defined in the JSP specification. - * - *

The following variables are resolved by this ELResolver, - * as per the JSP specification: - *

    - *
  • pageContext - the PageContext object.
  • - *
  • pageScope - a Map that maps page-scoped - * attribute names to their values.
  • - *
  • requestScope - a Map that maps - * request-scoped attribute names to their values.
  • - *
  • sessionScope - a Map that maps - * session-scoped attribute names to their values.
  • - *
  • applicationScope - a Map that maps - * application-scoped attribute names to their values.
  • - *
  • param - a Map that maps parameter - * names to a single String parameter value (obtained by calling - * ServletRequest.getParameter(String name)).
  • - *
  • paramValues - a Map that maps parameter - * names to a String[] of all values for that - * parameter (obtained by calling - * ServletRequest.getParameterValues(String name)).
  • - *
  • header - a Map that maps header names - * to a single String header value (obtained by calling - * HttpServletRequest.getHeader(String name)).
  • - *
  • headerValues - a Map that maps header - * names to a String[] of all values for that header - * (obtained by calling - * HttpServletRequest.getHeaders(String)).
  • - *
  • cookie - a Map that maps cookie names - * to a single Cookie object. Cookies are retrieved - * according to the semantics of - * HttpServletRequest.getCookies(). If the same name - * is shared by multiple cookies, an implementation must use the - * first one encountered in the array of Cookie objects - * returned by the getCookies() method. However, users - * of the cookie implicit object must be aware that the ordering - * of cookies is currently unspecified in the servlet - * specification.
  • - *
  • initParam - a Map that maps context - * initialization parameter names to their String parameter - * value (obtained by calling - * ServletContext.getInitParameter(String name)).
  • - *

- * - * @see javax.el.ELResolver - * @since JSP 2.1 - */ -public class ImplicitObjectELResolver extends ELResolver { - - /** - * If the base object is null, and the property matches - * the name of a JSP implicit object, returns the implicit object. - * - *

The propertyResolved property of the - * ELContext object must be set to true by - * this resolver before returning if an implicit object is matched. If - * this property is not true after this method is called, - * the caller should ignore the return value.

- * - * @param context The context of this evaluation. - * @param base Only null is handled by this resolver. - * Other values will result in an immediate return. - * @param property The name of the implicit object to resolve. - * @return If the propertyResolved property of - * ELContext was set to true, then - * the implicit object; otherwise undefined. - * @throws NullPointerException if context is null - * @throws ELException if an exception was thrown while performing - * the property or variable resolution. The thrown exception - * must be included as the cause property of this exception, if - * available. - */ - public Object getValue(ELContext context, - Object base, - Object property) { - - if (context == null) { - throw new NullPointerException(); - } - - if (base != null) { - return null; - } - - PageContext ctxt = (PageContext)context.getContext(JspContext.class); - - if ("pageContext".equals(property)) { - context.setPropertyResolved(true); - return ctxt; - } - ImplicitObjects implicitObjects = - ImplicitObjects.getImplicitObjects(ctxt); - if ("pageScope".equals(property)) { - context.setPropertyResolved(true); - return implicitObjects.getPageScopeMap(); - } - if ("requestScope".equals(property)) { - context.setPropertyResolved(true); - return implicitObjects.getRequestScopeMap(); - } - if ("sessionScope".equals(property)) { - context.setPropertyResolved(true); - return implicitObjects.getSessionScopeMap(); - } - if ("applicationScope".equals (property)) { - context.setPropertyResolved(true); - return implicitObjects.getApplicationScopeMap (); - } - if ("param".equals (property)) { - context.setPropertyResolved(true); - return implicitObjects.getParamMap(); - } - if ("paramValues".equals (property)) { - context.setPropertyResolved(true); - return implicitObjects.getParamsMap(); - } - if ("header".equals (property)) { - context.setPropertyResolved(true); - return implicitObjects.getHeaderMap(); - } - if ("headerValues".equals (property)) { - context.setPropertyResolved(true); - return implicitObjects.getHeadersMap(); - } - if ("initParam".equals (property)) { - context.setPropertyResolved(true); - return implicitObjects.getInitParamMap (); - } - if ("cookie".equals (property)) { - context.setPropertyResolved(true); - return implicitObjects.getCookieMap (); - } - return null; - } - - /** - * If the base object is null, and the property matches - * the name of a JSP implicit object, returns null to - * indicate that no types are ever accepted to setValue(). - * - *

The propertyResolved property of the - * ELContext object must be set to true by - * this resolver before returning if an implicit object is matched. If - * this property is not true after this method is called, - * the caller should ignore the return value.

- * - * @param context The context of this evaluation. - * @param base Only null is handled by this resolver. - * Other values will result in an immediate return. - * @param property The name of the implicit object to resolve. - * @return If the propertyResolved property of - * ELContext was set to true, then - * null; otherwise undefined. - * @throws NullPointerException if context is null - * @throws ELException if an exception was thrown while performing - * the property or variable resolution. The thrown exception - * must be included as the cause property of this exception, if - * available. - */ - public Class getType(ELContext context, - Object base, - Object property) { - - if (context == null) { - throw new NullPointerException(); - } - - if ((base == null) && ("pageContext".equals(property) || - "pageScope".equals(property)) || - "requestScope".equals(property) || - "sessionScope".equals(property) || - "applicationScope".equals (property) || - "param".equals (property) || - "paramValues".equals (property) || - "header".equals (property) || - "headerValues".equals (property) || - "initParam".equals (property) || - "cookie".equals (property)) { - context.setPropertyResolved(true); - } - return null; - } - - /** - * If the base object is null, and the property matches - * the name of a JSP implicit object, throws - * PropertyNotWritableException to indicate that implicit - * objects cannot be overwritten. - * - *

The propertyResolved property of the - * ELContext object must be set to true by - * this resolver before returning if an implicit object is matched. If - * this property is not true after this method is called, - * the caller should ignore the return value.

- * - * @param context The context of this evaluation. - * @param base Only null is handled by this resolver. - * Other values will result in an immediate return. - * @param property The name of the implicit object. - * @param val The value to be associated with the implicit object. - * @throws NullPointerException if context is null. - * @throws PropertyNotWritableException always thrown, if the - * implicit object name is recognized by this resolver. - * @throws ELException if an exception was thrown while performing - * the property or variable resolution. The thrown exception - * must be included as the cause property of this exception, if - * available. - */ - public void setValue(ELContext context, - Object base, - Object property, - Object val) { - - if (context == null) { - throw new NullPointerException(); - } - - if ((base == null) && ("pageContext".equals(property) || - "pageScope".equals(property)) || - "requestScope".equals(property) || - "sessionScope".equals(property) || - "applicationScope".equals (property) || - "param".equals (property) || - "paramValues".equals (property) || - "header".equals (property) || - "headerValues".equals (property) || - "initParam".equals (property) || - "cookie".equals (property)) { - throw new PropertyNotWritableException(); - } - } - - /** - * If the base object is null, and the property matches - * the name of a JSP implicit object, returns true - * to indicate that implicit objects cannot be overwritten. - * - *

The propertyResolved property of the - * ELContext object must be set to true by - * this resolver before returning if an implicit object is matched. If - * this property is not true after this method is called, - * the caller should ignore the return value.

- * - * @param context The context of this evaluation. - * @param base Only null is handled by this resolver. - * Other values will result in an immediate return. - * @param property The name of the implicit object. - * @return If the propertyResolved property of - * ELContext was set to true, then - * true; otherwise undefined. - * @throws NullPointerException if context is null. - * @throws ELException if an exception was thrown while performing - * the property or variable resolution. The thrown exception - * must be included as the cause property of this exception, if - * available. - */ - public boolean isReadOnly(ELContext context, - Object base, - Object property) { - if (context == null) { - throw new NullPointerException(); - } - - if ((base == null) && ("pageContext".equals(property) || - "pageScope".equals(property)) || - "requestScope".equals(property) || - "sessionScope".equals(property) || - "applicationScope".equals (property) || - "param".equals (property) || - "paramValues".equals (property) || - "header".equals (property) || - "headerValues".equals (property) || - "initParam".equals (property) || - "cookie".equals (property)) { - context.setPropertyResolved(true); - return true; - } - return false; // Doesn't matter - } - - /** - * If the base object is null, and the property matches - * the name of a JSP implicit object, returns an Iterator - * containing FeatureDescriptor objects with information - * about each JSP implicit object resolved by this resolver. Otherwise, - * returns null. - * - *

The Iterator returned must contain one instance of - * {@link java.beans.FeatureDescriptor} for each of the EL implicit objects - * defined by the JSP spec. Each info object contains information about - * a single implicit object, and is initialized as follows: - *

- *
  • displayName - The name of the implicit object.
  • - *
  • name - Same as displayName property.
  • - *
  • shortDescription - A suitable description for the implicit - * object. Will vary by implementation.
  • - *
  • expert - false
  • - *
  • hidden - false
  • - *
  • preferred - true
  • - *
    - * In addition, the following named attributes must be set in the - * returned FeatureDescriptors: - *
    - *
  • {@link ELResolver#TYPE} - The runtime type of the implicit object.
  • - *
  • {@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - true.
  • - *

    - * - * @param context The context of this evaluation. - * @param base Only null is handled by this resolver. - * Other values will result in a null return value. - * @return An Iterator containing one - * FeatureDescriptor object for each implicit object, or - * null if base is not null. - */ - public Iterator getFeatureDescriptors( - ELContext context, - Object base) { - ArrayList list = - new ArrayList(11); - - // pageContext - FeatureDescriptor descriptor = new FeatureDescriptor(); - descriptor.setName("pageContext"); - descriptor.setDisplayName("pageContext"); - //descriptor.setShortDescription(""); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setValue("type", javax.servlet.jsp.PageContext.class); - descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); - list.add(descriptor); - - // pageScope - descriptor = new FeatureDescriptor(); - descriptor.setName("pageScope"); - descriptor.setDisplayName("pageScope"); - //descriptor.setShortDescription(""); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setValue("type", Map.class); - descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); - list.add(descriptor); - - // requestScope - descriptor = new FeatureDescriptor(); - descriptor.setName("requestScope"); - descriptor.setDisplayName("requestScope"); - //descriptor.setShortDescription(""); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setValue("type", Map.class); - descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); - list.add(descriptor); - - // sessionScope - descriptor = new FeatureDescriptor(); - descriptor.setName("sessionScope"); - descriptor.setDisplayName("sessionScope"); - //descriptor.setShortDescription(""); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setValue("type", Map.class); - descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); - list.add(descriptor); - - // applicationScope - descriptor = new FeatureDescriptor(); - descriptor.setName("applicationScope"); - descriptor.setDisplayName("applicationScope"); - //descriptor.setShortDescription(""); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setValue("type", Map.class); - descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); - list.add(descriptor); - - // param - descriptor = new FeatureDescriptor(); - descriptor.setName("param"); - descriptor.setDisplayName("param"); - //descriptor.setShortDescription(""); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setValue("type", Map.class); - descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); - list.add(descriptor); - - // paramValues - descriptor = new FeatureDescriptor(); - descriptor.setName("paramValues"); - descriptor.setDisplayName("paramValues"); - //descriptor.setShortDescription(""); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setValue("type", Map.class); - descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); - list.add(descriptor); - - // header - descriptor = new FeatureDescriptor(); - descriptor.setName("header"); - descriptor.setDisplayName("header"); - //descriptor.setShortDescription(""); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setValue("type", Map.class); - descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); - list.add(descriptor); - - // headerValues - descriptor = new FeatureDescriptor(); - descriptor.setName("headerValues"); - descriptor.setDisplayName("headerValues"); - //descriptor.setShortDescription(""); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setValue("type", Map.class); - descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); - list.add(descriptor); - - // cookie - descriptor = new FeatureDescriptor(); - descriptor.setName("cookie"); - descriptor.setDisplayName("cookie"); - //descriptor.setShortDescription(""); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setValue("type", Map.class); - descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); - list.add(descriptor); - - // initParam - descriptor = new FeatureDescriptor(); - descriptor.setName("initParam"); - descriptor.setDisplayName("initParam"); - //descriptor.setShortDescription(""); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setValue("type", Map.class); - descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); - list.add(descriptor); - - return list.iterator(); - } - - /** - * If the base object is null, returns - * String.class. Otherwise, returns null. - * - * @param context The context of this evaluation. - * @param base Only null is handled by this resolver. - * Other values will result in a null return value. - * @return null if base is not null; otherwise - * String.class. - */ - public Class getCommonPropertyType(ELContext context, - Object base) { - if (base == null) { - return String.class; - } - return null; - } - - // XXX - I moved this class from commons-el to an inner class here - // so that we do not have a dependency from the JSP APIs into commons-el. - // There might be a better way to do this. - /** - *

    This class is used to generate the implicit Map and List objects - * that wrap various elements of the PageContext. It also returns the - * correct implicit object for a given implicit object name. - * - * @author Nathan Abramson - Art Technology Group - **/ - private static class ImplicitObjects - { - //------------------------------------- - // Constants - //------------------------------------- - - - // XXX - This probably needs to change, now that this is in a - // standard pkg. - static final String sAttributeName = - "org.apache.taglibs.standard.ImplicitObjects"; - - //------------------------------------- - // Member variables - //------------------------------------- - - PageContext mContext; - Map mPage; - Map mRequest; - Map mSession; - Map mApplication; - Map mParam; - Map mParams; - Map mHeader; - Map mHeaders; - Map mInitParam; - Map mCookie; - - //------------------------------------- - /** - * - * Constructor - **/ - public ImplicitObjects (PageContext pContext) - { - mContext = pContext; - } - - //------------------------------------- - /** - * - * Finds the ImplicitObjects associated with the PageContext, - * creating it if it doesn't yet exist. - **/ - public static ImplicitObjects getImplicitObjects (PageContext pContext) - { - ImplicitObjects objs = - (ImplicitObjects) - pContext.getAttribute (sAttributeName, - PageContext.PAGE_SCOPE); - if (objs == null) { - objs = new ImplicitObjects (pContext); - pContext.setAttribute (sAttributeName, - objs, - PageContext.PAGE_SCOPE); - } - return objs; - } - - //------------------------------------- - /** - * - * Returns the Map that "wraps" page-scoped attributes - **/ - public Map getPageScopeMap () - { - if (mPage == null) { - mPage = createPageScopeMap (mContext); - } - return mPage; - } - - //------------------------------------- - /** - * - * Returns the Map that "wraps" request-scoped attributes - **/ - public Map getRequestScopeMap () - { - if (mRequest == null) { - mRequest = createRequestScopeMap (mContext); - } - return mRequest; - } - - //------------------------------------- - /** - * - * Returns the Map that "wraps" session-scoped attributes - **/ - public Map getSessionScopeMap () - { - if (mSession == null) { - mSession = createSessionScopeMap (mContext); - } - return mSession; - } - - //------------------------------------- - /** - * - * Returns the Map that "wraps" application-scoped attributes - **/ - public Map getApplicationScopeMap () - { - if (mApplication == null) { - mApplication = createApplicationScopeMap (mContext); - } - return mApplication; - } - - //------------------------------------- - /** - * - * Returns the Map that maps parameter name to a single parameter - * values. - **/ - public Map getParamMap () - { - if (mParam == null) { - mParam = createParamMap (mContext); - } - return mParam; - } - - //------------------------------------- - /** - * - * Returns the Map that maps parameter name to an array of parameter - * values. - **/ - public Map getParamsMap () - { - if (mParams == null) { - mParams = createParamsMap (mContext); - } - return mParams; - } - - //------------------------------------- - /** - * - * Returns the Map that maps header name to a single header - * values. - **/ - public Map getHeaderMap () - { - if (mHeader == null) { - mHeader = createHeaderMap (mContext); - } - return mHeader; - } - - //------------------------------------- - /** - * - * Returns the Map that maps header name to an array of header - * values. - **/ - public Map getHeadersMap () - { - if (mHeaders == null) { - mHeaders = createHeadersMap (mContext); - } - return mHeaders; - } - - //------------------------------------- - /** - * - * Returns the Map that maps init parameter name to a single init - * parameter values. - **/ - public Map getInitParamMap () - { - if (mInitParam == null) { - mInitParam = createInitParamMap (mContext); - } - return mInitParam; - } - - //------------------------------------- - /** - * - * Returns the Map that maps cookie name to the first matching - * Cookie in request.getCookies(). - **/ - public Map getCookieMap () - { - if (mCookie == null) { - mCookie = createCookieMap (mContext); - } - return mCookie; - } - - //------------------------------------- - // Methods for generating wrapper maps - //------------------------------------- - /** - * - * Creates the Map that "wraps" page-scoped attributes - **/ - public static Map createPageScopeMap(PageContext pContext) - { - final PageContext context = pContext; - return new EnumeratedMap () - { - public Enumeration enumerateKeys () - { - return context.getAttributeNamesInScope - (PageContext.PAGE_SCOPE); - } - - public Object getValue (Object pKey) - { - if (pKey instanceof String) { - return context.getAttribute - ((String) pKey, - PageContext.PAGE_SCOPE); - } - else { - return null; - } - } - - public boolean isMutable () - { - return true; - } - }; - } - - //------------------------------------- - /** - * - * Creates the Map that "wraps" request-scoped attributes - **/ - public static Map createRequestScopeMap (PageContext pContext) - { - final PageContext context = pContext; - return new EnumeratedMap () - { - public Enumeration enumerateKeys () - { - return context.getAttributeNamesInScope - (PageContext.REQUEST_SCOPE); - } - - public Object getValue (Object pKey) - { - if (pKey instanceof String) { - return context.getAttribute - ((String) pKey, - PageContext.REQUEST_SCOPE); - } - else { - return null; - } - } - - public boolean isMutable () - { - return true; - } - }; - } - - //------------------------------------- - /** - * - * Creates the Map that "wraps" session-scoped attributes - **/ - public static Map createSessionScopeMap (PageContext pContext) - { - final PageContext context = pContext; - return new EnumeratedMap () - { - public Enumeration enumerateKeys () - { - return context.getAttributeNamesInScope - (PageContext.SESSION_SCOPE); - } - - public Object getValue (Object pKey) - { - if (pKey instanceof String) { - return context.getAttribute - ((String) pKey, - PageContext.SESSION_SCOPE); - } - else { - return null; - } - } - - public boolean isMutable () - { - return true; - } - }; - } - - //------------------------------------- - /** - * - * Creates the Map that "wraps" application-scoped attributes - **/ - public static Map createApplicationScopeMap (PageContext pContext) - { - final PageContext context = pContext; - return new EnumeratedMap () - { - public Enumeration enumerateKeys () - { - return context.getAttributeNamesInScope - (PageContext.APPLICATION_SCOPE); - } - - public Object getValue (Object pKey) - { - if (pKey instanceof String) { - return context.getAttribute - ((String) pKey, - PageContext.APPLICATION_SCOPE); - } - else { - return null; - } - } - - public boolean isMutable () - { - return true; - } - }; - } - - //------------------------------------- - /** - * - * Creates the Map that maps parameter name to single parameter - * value. - **/ - public static Map createParamMap (PageContext pContext) - { - final HttpServletRequest request = - (HttpServletRequest) pContext.getRequest (); - return new EnumeratedMap () - { - public Enumeration enumerateKeys () - { - return request.getParameterNames (); - } - - public String getValue (Object pKey) - { - if (pKey instanceof String) { - return request.getParameter ((String) pKey); - } - else { - return null; - } - } - - public boolean isMutable () - { - return false; - } - }; - } - - //------------------------------------- - /** - * - * Creates the Map that maps parameter name to an array of parameter - * values. - **/ - public static Map createParamsMap (PageContext pContext) - { - final HttpServletRequest request = - (HttpServletRequest) pContext.getRequest (); - return new EnumeratedMap () - { - public Enumeration enumerateKeys () - { - return request.getParameterNames (); - } - - public String[] getValue (Object pKey) - { - if (pKey instanceof String) { - return request.getParameterValues ((String) pKey); - } - else { - return null; - } - } - - public boolean isMutable () - { - return false; - } - }; - } - - //------------------------------------- - /** - * - * Creates the Map that maps header name to single header - * value. - **/ - public static Map createHeaderMap (PageContext pContext) - { - final HttpServletRequest request = - (HttpServletRequest) pContext.getRequest (); - return new EnumeratedMap () - { - public Enumeration enumerateKeys () - { - return request.getHeaderNames (); - } - - public String getValue (Object pKey) - { - if (pKey instanceof String) { - return request.getHeader ((String) pKey); - } - else { - return null; - } - } - - public boolean isMutable () - { - return false; - } - }; - } - - //------------------------------------- - /** - * - * Creates the Map that maps header name to an array of header - * values. - **/ - public static Map createHeadersMap (PageContext pContext) - { - final HttpServletRequest request = - (HttpServletRequest) pContext.getRequest (); - return new EnumeratedMap () - { - public Enumeration enumerateKeys () - { - return request.getHeaderNames (); - } - - public String[] getValue (Object pKey) - { - if (pKey instanceof String) { - // Drain the header enumeration - List l = new ArrayList (); - Enumeration e = request.getHeaders ((String) pKey); - if (e != null) { - while (e.hasMoreElements ()) { - l.add (e.nextElement ()); - } - } - return l.toArray (new String [l.size ()]); - } - else { - return null; - } - } - - public boolean isMutable () - { - return false; - } - }; - } - - //------------------------------------- - /** - * - * Creates the Map that maps init parameter name to single init - * parameter value. - **/ - public static Map createInitParamMap(PageContext pContext) - { - final ServletContext context = pContext.getServletContext (); - return new EnumeratedMap () - { - public Enumeration enumerateKeys () - { - return context.getInitParameterNames (); - } - - public String getValue (Object pKey) - { - if (pKey instanceof String) { - return context.getInitParameter ((String) pKey); - } - else { - return null; - } - } - - public boolean isMutable () - { - return false; - } - }; - } - - //------------------------------------- - /** - * - * Creates the Map that maps cookie name to the first matching - * Cookie in request.getCookies(). - **/ - public static Map createCookieMap (PageContext pContext) - { - // Read all the cookies and construct the entire map - HttpServletRequest request = (HttpServletRequest) pContext.getRequest (); - Cookie [] cookies = request.getCookies (); - Map ret = new HashMap (); - for (int i = 0; cookies != null && i < cookies.length; i++) { - Cookie cookie = cookies [i]; - if (cookie != null) { - String name = cookie.getName (); - if (!ret.containsKey (name)) { - ret.put (name, cookie); - } - } - } - return ret; - } - - //------------------------------------- - } - - // XXX - I moved this class from commons-el to an inner class here - // so that we do not have a dependency from the JSP APIs into commons-el. - // There might be a better way to do this. - /** - *

    This is a Map implementation driven by a data source that only - * provides an enumeration of keys and a getValue(key) method. This - * class must be subclassed to implement those methods. - * - *

    Some of the methods may incur a performance penalty that - * involves enumerating the entire data source. In these cases, the - * Map will try to save the results of that enumeration, but only if - * the underlying data source is immutable. - * - * @author Nathan Abramson - Art Technology Group - **/ - private static abstract class EnumeratedMap - implements Map - { - //------------------------------------- - // Member variables - //------------------------------------- - - Map mMap; - - //------------------------------------- - public void clear () - { - throw new UnsupportedOperationException (); - } - - //------------------------------------- - public boolean containsKey (Object pKey) - { - return getValue (pKey) != null; - } - - //------------------------------------- - public boolean containsValue (Object pValue) - { - return getAsMap ().containsValue (pValue); - } - - //------------------------------------- - public Set> entrySet () - { - return getAsMap ().entrySet (); - } - - //------------------------------------- - public V get (Object pKey) - { - return getValue (pKey); - } - - //------------------------------------- - public boolean isEmpty () - { - return !enumerateKeys ().hasMoreElements (); - } - - //------------------------------------- - public Set keySet () - { - return getAsMap ().keySet (); - } - - //------------------------------------- - public V put (K pKey, V pValue) - { - throw new UnsupportedOperationException (); - } - - //------------------------------------- - public void putAll (Map pMap) - { - throw new UnsupportedOperationException (); - } - - //------------------------------------- - public V remove (Object pKey) - { - throw new UnsupportedOperationException (); - } - - //------------------------------------- - public int size () - { - return getAsMap ().size (); - } - - //------------------------------------- - public Collection values () - { - return getAsMap ().values (); - } - - //------------------------------------- - // Abstract methods - //------------------------------------- - /** - * - * Returns an enumeration of the keys - **/ - public abstract Enumeration enumerateKeys (); - - //------------------------------------- - /** - * - * Returns true if it is possible for this data source to change - **/ - public abstract boolean isMutable (); - - //------------------------------------- - /** - * - * Returns the value associated with the given key, or null if not - * found. - **/ - public abstract V getValue (Object pKey); - - //------------------------------------- - /** - * - * Converts the MapSource to a Map. If the map is not mutable, this - * is cached - **/ - public Map getAsMap () - { - if (mMap != null) { - return mMap; - } - else { - Map m = convertToMap (); - if (!isMutable ()) { - mMap = m; - } - return m; - } - } - - //------------------------------------- - /** - * - * Converts to a Map - **/ - Map convertToMap () - { - Map ret = new HashMap (); - for (Enumeration e = enumerateKeys (); e.hasMoreElements (); ) { - K key = e.nextElement (); - V value = getValue (key); - ret.put (key, value); - } - return ret; - } - - //------------------------------------- - } -} - diff --git a/api/src/main/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java b/api/src/main/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java deleted file mode 100644 index ed5ead4..0000000 --- a/api/src/main/java/javax/servlet/jsp/el/ScopedAttributeELResolver.java +++ /dev/null @@ -1,412 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.el; - -import java.beans.FeatureDescriptor; -import java.util.Iterator; -import java.util.ArrayList; -import java.util.Enumeration; - -import javax.servlet.jsp.PageContext; -import javax.servlet.jsp.JspContext; - -import javax.el.ELContext; -import javax.el.ELClass; -import javax.el.ELResolver; -import javax.el.ELException; - -/** - * Defines variable resolution behavior for scoped attributes. - * - *

    This resolver handles all variable resolutions (where base - * is null. It searches PageContext.findAttribute() - * for a matching attribute. If not found, it will return null, - * or in the case of setValue it will create a new attribute - * in the page scope with the given name.

    - * - * @see javax.el.ELResolver - * @since JSP 2.1 - */ - -public class ScopedAttributeELResolver extends ELResolver { - - /** - * If the base object is null, searches the page, - * request, session and application scopes for an attribute with - * the given name and returns it, or null if no - * attribute exists with the current name. - * - *

    The propertyResolved property of the - * ELContext object must be set to true by - * this resolver before returning if base is null. If - * this property is not true after this method is called, - * the caller should ignore the return value.

    - * - * @param context The context of this evaluation. - * @param base Only null is handled by this resolver. - * Other values will result in an immediate return. - * @param property The name of the scoped attribute to resolve. - * @return If the propertyResolved property of - * ELContext was set to true, then - * the scoped attribute; otherwise undefined. - * @throws NullPointerException if context is null - * @throws ELException if an exception was thrown while performing - * the property or variable resolution. The thrown exception - * must be included as the cause property of this exception, if - * available. - */ - public Object getValue(ELContext context, - Object base, - Object property) { - - if (context == null) { - throw new NullPointerException(); - } - - if (base == null) { - context.setPropertyResolved(true); - if (property instanceof String) { - String attribute = (String) property; - PageContext ctxt = (PageContext) - context.getContext(JspContext.class); - Object value = ctxt.findAttribute(attribute); - // To support reference of static fields for imported class in - // EL 3.0, if a scoped attribute returns null, this attribute - // is further checked to see if it is the name of an imported - // class. If so, an ELClass instance is returned. - // Note: the JSP spec needs to be updated for this behavior. Note - // also that this behavior is not backward compatible with JSP 2.2 - // and a runtime switch may be needed to force backward - // compatility. - if (value == null) { - // check to see if the property is an imported class - if (context.getImportHandler() != null) { - Class c = context.getImportHandler().resolveClass(attribute); - if (c != null) { - value = new ELClass(c); - // A possible optimization is to set the ELClass - // instance in an attribute map. - } - } - } - return value; - } - } - return null; - } - - /** - * If the base object is null, returns - * Object.class to indicate that any type is valid to - * set for a scoped attribute. - * - *

    The propertyResolved property of the - * ELContext object must be set to true by - * this resolver before returning if base is null. If - * this property is not true after this method is called, - * the caller should ignore the return value.

    - * - * @param context The context of this evaluation. - * @param base Only null is handled by this resolver. - * Other values will result in an immediate return. - * @param property The name of the scoped attribute to resolve. - * @return If the propertyResolved property of - * ELContext was set to true, then - * Object.class; otherwise undefined. - * @throws NullPointerException if context is null - * @throws ELException if an exception was thrown while performing - * the property or variable resolution. The thrown exception - * must be included as the cause property of this exception, if - * available. - */ - public Class getType(ELContext context, - Object base, - Object property) { - - if (context == null) { - throw new NullPointerException(); - } - - if (base == null) { - context.setPropertyResolved(true); - return Object.class; - } - return null; - } - - - /** - * If the base object is null, sets an existing scoped - * attribute to the new value, or creates a new scoped attribute if one - * does not exist by this name. - * - *

    If the provided attribute name matches the key of an attribute - * in page scope, request scope, session scope, or application scope, the - * corresponding attribute value will be replaced by the provided value. - * Otherwise, a new page scope attribute will be created with the - * given name and value.

    - * - *

    The propertyResolved property of the - * ELContext object must be set to true by - * this resolver before returning if base is null. If - * this property is not true after this method is called, - * the caller should ignore the return value.

    - * - * @param context The context of this evaluation. - * @param base Only null is handled by this resolver. - * Other values will result in an immediate return. - * @param property The name of the scoped attribute to set. - * @param val The value for the scoped attribute. - * @throws NullPointerException if context is null. - * @throws ELException if an exception was thrown while performing - * the property or variable resolution. The thrown exception - * must be included as the cause property of this exception, if - * available. - */ - public void setValue(ELContext context, - Object base, - Object property, - Object val) { - if (context == null) { - throw new NullPointerException(); - } - - if (base == null) { - context.setPropertyResolved(true); - if (property instanceof String) { - PageContext ctxt = (PageContext) - context.getContext(JspContext.class); - String attr = (String) property; - if (ctxt.getAttribute(attr, PageContext.REQUEST_SCOPE) != null) - ctxt.setAttribute(attr, val, PageContext.REQUEST_SCOPE); - else if (ctxt.getAttribute(attr, PageContext.SESSION_SCOPE) != null) - ctxt.setAttribute(attr, val, PageContext.SESSION_SCOPE); - else if (ctxt.getAttribute(attr, PageContext.APPLICATION_SCOPE) != null) - ctxt.setAttribute(attr, val, PageContext.APPLICATION_SCOPE); - else { - ctxt.setAttribute(attr, val, PageContext.PAGE_SCOPE); - } - } - } - } - - /** - * If the base object is null, returns false - * to indicate that scoped attributes are never read-only. - * - *

    The propertyResolved property of the - * ELContext object must be set to true by - * this resolver before returning if base is null. If - * this property is not true after this method is called, - * the caller should ignore the return value.

    - * - * @param context The context of this evaluation. - * @param base Only null is handled by this resolver. - * Other values will result in an immediate return. - * @param property The name of the scoped attribute. - * @return If the propertyResolved property of - * ELContext was set to true, then - * false; otherwise undefined. - * @throws NullPointerException if context is null. - * @throws ELException if an exception was thrown while performing - * the property or variable resolution. The thrown exception - * must be included as the cause property of this exception, if - * available. - */ - public boolean isReadOnly(ELContext context, - Object base, - Object property) { - if (context == null) { - throw new NullPointerException(); - } - - if (base == null) { - context.setPropertyResolved(true); - } - return false; - } - - /** - * If the base object is null, returns an - * Iterator containing FeatureDescriptor objects - * with information about each scoped attribute resolved by this - * resolver. Otherwise, returns null. - * - *

    The Iterator returned must contain one instance of - * {@link java.beans.FeatureDescriptor} for each scoped attribute found in - * any scope. Each info object contains information about - * a single scoped attribute, and is initialized as follows: - * - *

    - *
  • displayName - The name of the scoped attribute.
  • - *
  • name - Same as displayName property.
  • - *
  • shortDescription - A suitable description for the scoped - * attribute. Should include the attribute's current scope - * (page, request, session, application). Will vary by - * implementation.
  • - *
  • expert - false
  • - *
  • hidden - false
  • - *
  • preferred - true
  • - *
    - * In addition, the following named attributes must be set in the - * returned FeatureDescriptors: - *
    - *
  • {@link ELResolver#TYPE} - The current runtime type of the scoped attribute.
  • - *
  • {@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - true.
  • - *

    - * - * @param context The context of this evaluation. - * @param base Only null is handled by this resolver. - * Other values will result in a null return value. - * @return An Iterator containing one - * FeatureDescriptor object for each scoped attribute, or - * null if base is not null. - */ - public Iterator getFeatureDescriptors( - ELContext context, - Object base) { - Enumeration attrs; - ArrayList list = new ArrayList(); - PageContext ctxt = (PageContext) context.getContext(JspContext.class); - - attrs = ctxt.getAttributeNamesInScope(PageContext.PAGE_SCOPE); - while (attrs.hasMoreElements()) { - String name = (String) attrs.nextElement(); - Object value = ctxt.getAttribute(name, PageContext.PAGE_SCOPE); - FeatureDescriptor descriptor = new FeatureDescriptor(); - descriptor.setName(name); - descriptor.setDisplayName(name); - descriptor.setShortDescription("page scope attribute"); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setValue("type", value.getClass()); - descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); - list.add(descriptor); - } - - attrs = ctxt.getAttributeNamesInScope(PageContext.REQUEST_SCOPE); - while (attrs.hasMoreElements()) { - String name = (String) attrs.nextElement(); - Object value = ctxt.getAttribute(name, PageContext.REQUEST_SCOPE); - FeatureDescriptor descriptor = new FeatureDescriptor(); - descriptor.setName(name); - descriptor.setDisplayName(name); - descriptor.setShortDescription("request scope attribute"); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setValue("type", value.getClass()); - descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); - list.add(descriptor); - } - - attrs = ctxt.getAttributeNamesInScope(PageContext.SESSION_SCOPE); - while (attrs.hasMoreElements()) { - String name = (String) attrs.nextElement(); - Object value = ctxt.getAttribute(name, PageContext.SESSION_SCOPE); - FeatureDescriptor descriptor = new FeatureDescriptor(); - descriptor.setName(name); - descriptor.setDisplayName(name); - descriptor.setShortDescription("session scope attribute"); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setValue("type", value.getClass()); - descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); - list.add(descriptor); - } - - attrs = ctxt.getAttributeNamesInScope(PageContext.APPLICATION_SCOPE); - while (attrs.hasMoreElements()) { - String name = (String) attrs.nextElement(); - Object value = ctxt.getAttribute(name, PageContext.APPLICATION_SCOPE); - FeatureDescriptor descriptor = new FeatureDescriptor(); - descriptor.setName(name); - descriptor.setDisplayName(name); - descriptor.setShortDescription("application scope attribute"); - descriptor.setExpert(false); - descriptor.setHidden(false); - descriptor.setPreferred(true); - descriptor.setValue("type", value.getClass()); - descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); - list.add(descriptor); - } - return list.iterator(); - } - - /** - * If the base object is null, returns - * String.class. Otherwise, returns null. - * - * @param context The context of this evaluation. - * @param base Only null is handled by this resolver. - * Other values will result in a null return value. - * @return null if base is not null; otherwise - * String.class. - */ - public Class getCommonPropertyType(ELContext context, - Object base) { - if (base == null) { - return String.class; - } - return null; - } - -} diff --git a/api/src/main/java/javax/servlet/jsp/el/VariableResolver.java b/api/src/main/java/javax/servlet/jsp/el/VariableResolver.java deleted file mode 100644 index 4398e7e..0000000 --- a/api/src/main/java/javax/servlet/jsp/el/VariableResolver.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.el; - -/** - *

    This class is used to customize the way an ExpressionEvaluator resolves - * variable references at evaluation time. For example, instances of this class can - * implement their own variable lookup mechanisms, or introduce the - * notion of "implicit variables" which override any other variables. - * An instance of this class should be passed when evaluating - * an expression.

    - * - *

    An instance of this class includes the context against which resolution - * will happen

    - * - * @deprecated As of JSP 2.1, replaced by {@link javax.el.ELResolver} - * @since JSP 2.0 - */ -public interface VariableResolver -{ - //------------------------------------- - /** - * Resolves the specified variable. - * Returns null if the variable is not found. - * - * @param pName the name of the variable to resolve - * @return the result of the variable resolution - * - * @throws ELException if a failure occurred while trying to resolve - * the given variable - **/ - public Object resolveVariable (String pName) - throws ELException; - - //------------------------------------- -} diff --git a/api/src/main/java/javax/servlet/jsp/el/package.html b/api/src/main/java/javax/servlet/jsp/el/package.html deleted file mode 100644 index 7fea47b..0000000 --- a/api/src/main/java/javax/servlet/jsp/el/package.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - -Provides the ELResolver classes that define the -object resolution rules that must be supported by a JSP container -with the new unified Expression Language. -

    -The package also defines programmatic access to the old Expression Language -evaluator (pre JSP 2.1). -

    -Please note -that as of JSP 2.1, all classes and interfaces that were in package -javax.servlet.jsp.el have been deprecated in favor of the new unified -Expression Language APIs (javax.el). See the Expression Language -specification document for more details. -

    -

    -While a JSP container must still support the deprecated APIs defined -in javax.servlet.jsp.el, developers should only rely on the -new javax.el APIs -for new development work. -

    -

    -Two ELResolver classes have been added in JSP 2.1 to implement -object resolution rules that must be supported by a JSP container -with the new unified Expression Language: -{@link javax.servlet.jsp.el.ImplicitObjectELResolver} and -{@link javax.servlet.jsp.el.ScopedAttributeELResolver}. -

    - -

    Documentation on the old and deprecated API

    - -

    -The JavaServer Pages(tm) (JSP) 2.0 specification provides a portable -API for evaluating "EL Expressions". As of JSP 2.0, EL expressions can -be placed directly in the template text of JSP pages and tag files. -

    -This package contains a number of classes and interfaces that describe -and define programmatic access to the Expression Language evaluator. -This API can also be used by an implementation of JSP to evaluate the -expressions, but other implementations, like open-coding into Java -bytecodes, are allowed. This package is intended to have no dependencies -on other portions of the JSP 2.0 specification. - -

    Expression Evaluator

    - -Programmatic access to the EL Expression Evaluator is provided -through the following types: - -
      -
    • ExpressionEvaluator
    • -
    • Expression
    • -
    • FunctionMapper
    • -
    • VariableResolver
    • -
    - -

    An ExpressionEvaluator object can be obtained from a -JspContext object through the getExpressionEvaluator -method. An ExpressionEvaluator encapsulates the EL processor. An EL -expression provided as a String can then be evaluated directly, or it -can be parsed first into an Expression object. The parse -step, can be used to factor out the cost of parsing the expression, or -even the cost of optimizing the implementation.

    - -

    The parsing of an expression string is done against a target type, -a default prefix (that applies when a function has no prefix), and -a FunctionMapper. The FunctionMapper object -maps a prefix and a local name part into a -java.lang.reflect.Method object.

    - -

    The interpretation or evaluation of a parsed expression is done -using a VariableResolver object. This object resolves -top level object names into Objects. A VariableResolver -can be obtained from a JspContext object through the -getVariableResolver method.

    - -

    Exceptions

    - -

    -The ELException exception is used by the expression -language to denote any exception that may arise during the parsing or -evaluation of an expression. -The ELParseException exception is a subclass of -ELException that corresponds to parsing errors

    - -

    Parsing errors are conveyed as exceptions to simplify the API. It -is expected that many JSP containers will use additional mechanisms to -parse EL expressions and report their errors - a run-time API cannot -provide accurate line-error numbers without additional machinery.

    - -

    Code Fragment

    - -

    -Below is a non-normative code fragment outlining how the APIs can be used.

    - -
    -// Get an instance of an ExpressionEvaluator
    -
    -
    -ExpressionEvaluator ee = myJspContext.getExpressionEvaluator();
    -VariableResolver vr = myJspContext.getVariableResolver();
    -
    -FunctionMapper fm; // we don't have a portable implementation yet
    -
    -// Example of compiling an expression.  See [ISSUE-2]
    -// Errors detected this way may have higher quality than those
    -// found with a simple validate() invocation.
    -
    -ExpressionCompilation ce;
    -
    -try {
    -  ce = ee.prepareExpression(expr,
    -			    targetClass,
    -			    fm,
    -			    null // no prefixes
    -			    );
    -} catch (ELParseException e) {
    -	log (e.getMessage());
    -}
    -
    -try {
    -  ce.evaluate(vr);
    -} catch (ElException e) {
    -	log (e);
    -}
    -
    - - - - - diff --git a/api/src/main/java/javax/servlet/jsp/package.html b/api/src/main/java/javax/servlet/jsp/package.html deleted file mode 100644 index 5e759e5..0000000 --- a/api/src/main/java/javax/servlet/jsp/package.html +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - -Classes and interfaces for the Core JSP 2.3 API. -

    -The javax.servlet.jsp package contains a number of classes and -interfaces that describe and define the contracts between a JSP page -implementation class and the runtime environment provided for an -instance of such a class by a conforming JSP container. -

    - -

    JSP Page Implementation Object Contract

    -

    -This section describes the basic contract between a JSP Page -implementation object and its container. -

    -

    -The main contract is defined by the classes -{@link javax.servlet.jsp.JspPage} -and {@link javax.servlet.jsp.HttpJspPage}. -The {@link javax.servlet.jsp.JspFactory} class describes the mechanism to -portably instantiate all needed runtime objects, -and {@link javax.servlet.jsp.JspEngineInfo} provides basic information on -the current JSP container. Class {@link javax.servlet.jsp.JspApplicationContext} -stores application-scoped information relevant to JSP containers. -It was added in JSP 2.1 to support the integration of the unified -Expression Language. -

    -

    -None of these classes are intended to be used -by JSP page authors; an example of how these classes may be -used is included below. -

    - -

    Implicit Objects

    - -The {@link javax.servlet.jsp.PageContext} object and the -{@link javax.servlet.jsp.JspWriter} -are available by default as implicit objects. - -

    Exceptions

    - -

    -The {@link javax.servlet.jsp.JspException} class is the base class for all JSP -exceptions. The {@link javax.servlet.jsp.JspTagException} and -{@link javax.servlet.jsp.SkipPageException} exceptions are used by the -tag extension mechanism.

    -For JSP error pages, the {@link javax.servlet.jsp.ErrorData} class encapsulates information -about the error. - -

    - -

    An Implementation Example

    - -

    An instance of an implementation dependent subclass of the -{@link javax.servlet.jsp.PageContext} -abstract base class can be created by a JSP implementation class at -the beginning of it's _jspService() method via an -implementation default {@link javax.servlet.jsp.JspFactory}. - -

    Here is one example of how to use these classes - -

    - -

    - public class foo implements Servlet {
    -
    - // ...
    -
    -public void _jspService(HttpServletRequest request,
    -			HttpServletResponse response)
    -       throws IOException, ServletException {
    -
    -    JspFactory  factory     = JspFactory.getDefaultFactory();
    -    PageContext pageContext = factory.getPageContext(
    -					this,
    -					request,
    -					response,
    -					null,  // errorPageURL
    -					false, // needsSession
    -					JspWriter.DEFAULT_BUFFER,
    -					true   // autoFlush
    -			        );
    -
    -    // initialize implicit variables for scripting env ...
    -
    -    HttpSession session = pageContext.getSession();
    -    JspWriter   out     = pageContext.getOut();
    -    Object      page    = this;
    -
    -    try {
    -        // body of translated JSP here ...
    -    } catch (Exception e) {
    -        out.clear();
    -        pageContext.handlePageException(e);
    -    } finally {
    -        out.close();
    -	  factory.releasePageContext(pageContext);
    -    }
    -}
    -
    - - - - diff --git a/api/src/main/java/javax/servlet/jsp/tagext/BodyContent.java b/api/src/main/java/javax/servlet/jsp/tagext/BodyContent.java deleted file mode 100644 index a4c6550..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/BodyContent.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -import java.io.Reader; -import java.io.Writer; -import java.io.IOException; -import javax.servlet.jsp.*; - -/** - * An encapsulation of the evaluation of the body of an action so it is - * available to a tag handler. BodyContent is a subclass of JspWriter. - * - *

    - * Note that the content of BodyContent is the result of evaluation, so - * it will not contain actions and the like, but the result of their - * invocation. - * - *

    - * BodyContent has methods to convert its contents into - * a String, to read its contents, and to clear the contents. - * - *

    - * The buffer size of a BodyContent object is unbounded. A - * BodyContent object cannot be in autoFlush mode. It is not possible to - * invoke flush on a BodyContent object, as there is no backing stream. - * - *

    - * Instances of BodyContent are created by invoking the pushBody and - * popBody methods of the PageContext class. A BodyContent is enclosed - * within another JspWriter (maybe another BodyContent object) following - * the structure of their associated actions. - * - *

    - * A BodyContent is made available to a BodyTag through a setBodyContent() - * call. The tag handler can use the object until after the call to - * doEndTag(). - */ - -public abstract class BodyContent extends JspWriter { - - /** - * Protected constructor. - * - * Unbounded buffer, no autoflushing. - * - * @param e the enclosing JspWriter - */ - - protected BodyContent(JspWriter e) { - super(UNBOUNDED_BUFFER , false); - this.enclosingWriter = e; - } - - /** - * Redefined flush() so it is not legal. - * - *

    - * It is not valid to flush a BodyContent because there is no backing - * stream behind it. - * - * @throws IOException always thrown - */ - - public void flush() throws IOException { - throw new IOException("Illegal to flush within a custom tag"); - } - - /** - * Clear the body without throwing any exceptions. - */ - - public void clearBody() { - try { - this.clear(); - } catch (IOException ex) { - // TODO -- clean this one up. - throw new Error("internal error!;"); - } - } - - /** - * Return the value of this BodyContent as a Reader. - * - * @return the value of this BodyContent as a Reader - */ - public abstract Reader getReader(); - - - /** - * Return the value of the BodyContent as a String. - * - * @return the value of the BodyContent as a String - */ - public abstract String getString(); - - - /** - * Write the contents of this BodyContent into a Writer. - * Subclasses may optimize common invocation patterns. - * - * @param out The writer into which to place the contents of - * this body evaluation - * @throws IOException if an I/O error occurred while writing the - * contents of this BodyContent to the given Writer - */ - - public abstract void writeOut(Writer out) throws IOException; - - - /** - * Get the enclosing JspWriter. - * - * @return the enclosing JspWriter passed at construction time - */ - - public JspWriter getEnclosingWriter() { - return enclosingWriter; - } - - - // private fields - - private JspWriter enclosingWriter; - } diff --git a/api/src/main/java/javax/servlet/jsp/tagext/BodyTag.java b/api/src/main/java/javax/servlet/jsp/tagext/BodyTag.java deleted file mode 100644 index 4f12539..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/BodyTag.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -import javax.servlet.jsp.*; - -/** - * The BodyTag interface extends IterationTag by defining additional - * methods that let a tag handler manipulate the content of evaluating its body. - * - *

    - * It is the responsibility of the tag handler to manipulate the body - * content. For example the tag handler may take the body content, - * convert it into a String using the bodyContent.getString - * method and then use it. Or the tag handler may take the body - * content and write it out into its enclosing JspWriter using - * the bodyContent.writeOut method. - * - *

    A tag handler that implements BodyTag is treated as one that - * implements IterationTag, except that the doStartTag method can - * return SKIP_BODY, EVAL_BODY_INCLUDE or EVAL_BODY_BUFFERED. - * - *

    - * If EVAL_BODY_INCLUDE is returned, then evaluation happens - * as in IterationTag. - * - *

    - * If EVAL_BODY_BUFFERED is returned, then a BodyContent object will be - * created (by code generated by the JSP compiler) to capture the body - * evaluation. - * The code generated by the JSP compiler obtains the BodyContent object by - * calling the pushBody method of the current pageContext, which - * additionally has the effect of saving the previous out value. - * The page compiler returns this object by calling the popBody - * method of the PageContext class; - * the call also restores the value of out. - * - *

    - * The interface provides one new property with a setter method and one - * new action method. - * - *

    Properties - *

    There is a new property: bodyContent, to contain the BodyContent - * object, where the JSP Page implementation object will place the - * evaluation (and reevaluation, if appropriate) of the body. The setter - * method (setBodyContent) will only be invoked if doStartTag() returns - * EVAL_BODY_BUFFERED and the corresponding action element does not have - * an empty body. - * - *

    Methods - *

    In addition to the setter method for the bodyContent property, there - * is a new action method: doInitBody(), which is invoked right after - * setBodyContent() and before the body evaluation. This method is only - * invoked if doStartTag() returns EVAL_BODY_BUFFERED. - * - *

    Lifecycle - *

    Lifecycle details are described by the transition diagram below. - * Exceptions that are thrown during the computation of doStartTag(), - * setBodyContent(), doInitBody(), BODY, doAfterBody() interrupt the - * execution sequence and are propagated up the stack, unless the - * tag handler implements the TryCatchFinally interface; see that - * interface for details. - *

    - * Lifecycle Details Transition Diagram for BodyTag - * - *

    Empty and Non-Empty Action - *

    If the TagLibraryDescriptor file indicates that the action must - * always have an empty element body, by an <body-content> entry - * of "empty", then the doStartTag() method must return SKIP_BODY. - * Otherwise, the doStartTag() method may return SKIP_BODY, - * EVAL_BODY_INCLUDE, or EVAL_BODY_BUFFERED. - * - *

    Note that which methods are invoked after the doStartTag() depends on - * both the return value and on if the custom action element is empty - * or not in the JSP page, not how it's declared in the TLD. - * - *

    - * If SKIP_BODY is returned the body is not evaluated, and doEndTag() is - * invoked. - * - *

    - * If EVAL_BODY_INCLUDE is returned, and the custom action element is not - * empty, setBodyContent() is not invoked, - * doInitBody() is not invoked, the body is evaluated and - * "passed through" to the current out, doAfterBody() is invoked - * and then, after zero or more iterations, doEndTag() is invoked. - * If the custom action element is empty, only doStart() and - * doEndTag() are invoked. - * - *

    - * If EVAL_BODY_BUFFERED is returned, and the custom action element is not - * empty, setBodyContent() is invoked, - * doInitBody() is invoked, the body is evaluated, doAfterBody() is - * invoked, and then, after zero or more iterations, doEndTag() is invoked. - * If the custom action element is empty, only doStart() and doEndTag() - * are invoked. - */ - -public interface BodyTag extends IterationTag { - - /** - * Deprecated constant that has the same value as EVAL_BODY_BUFFERED - * and EVAL_BODY_AGAIN. This name has been marked as deprecated - * to encourage the use of the two different terms, which are much - * more descriptive. - * - * @deprecated As of Java JSP API 1.2, use BodyTag.EVAL_BODY_BUFFERED - * or IterationTag.EVAL_BODY_AGAIN. - */ - - public final static int EVAL_BODY_TAG = 2; - - /** - * Request the creation of new buffer, a BodyContent on which to - * evaluate the body of this tag. - * - * Returned from doStartTag when it implements BodyTag. - * This is an illegal return value for doStartTag when the class - * does not implement BodyTag. - */ - - public final static int EVAL_BODY_BUFFERED = 2; - - - /** - * Set the bodyContent property. - * This method is invoked by the JSP page implementation object at - * most once per action invocation. - * This method will be invoked before doInitBody. - * This method will not be invoked for empty tags or for non-empty - * tags whose doStartTag() method returns SKIP_BODY or EVAL_BODY_INCLUDE. - * - *

    - * When setBodyContent is invoked, the value of the implicit object out - * has already been changed in the pageContext object. The BodyContent - * object passed will have not data on it but may have been reused - * (and cleared) from some previous invocation. - * - *

    - * The BodyContent object is available and with the appropriate content - * until after the invocation of the doEndTag method, at which case it - * may be reused. - * - * @param b the BodyContent - * @see #doInitBody - * @see #doAfterBody - */ - - void setBodyContent(BodyContent b); - - - /** - * Prepare for evaluation of the body. - * This method is invoked by the JSP page implementation object - * after setBodyContent and before the first time - * the body is to be evaluated. - * This method will not be invoked for empty tags or for non-empty - * tags whose doStartTag() method returns SKIP_BODY or EVAL_BODY_INCLUDE. - * - *

    - * The JSP container will resynchronize the values of any AT_BEGIN and - * NESTED variables (defined by the associated TagExtraInfo or TLD) after - * the invocation of doInitBody(). - * - * @throws JspException if an error occurred while processing this tag - * @see #doAfterBody - */ - - void doInitBody() throws JspException; - -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/BodyTagSupport.java b/api/src/main/java/javax/servlet/jsp/tagext/BodyTagSupport.java deleted file mode 100644 index 5720ac5..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/BodyTagSupport.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.JspWriter; - -/** - * A base class for defining tag handlers implementing BodyTag. - * - *

    - * The BodyTagSupport class implements the BodyTag interface and adds - * additional convenience methods including getter methods for the - * bodyContent property and methods to get at the previous out JspWriter. - * - *

    - * Many tag handlers will extend BodyTagSupport and only redefine a - * few methods. - */ - -public class BodyTagSupport extends TagSupport implements BodyTag { - - /** - * Default constructor, all subclasses are required to only define - * a public constructor with the same signature, and to call the - * superclass constructor. - * - * This constructor is called by the code generated by the JSP - * translator. - */ - - public BodyTagSupport() { - super(); - } - - /** - * Default processing of the start tag returning EVAL_BODY_BUFFERED. - * - * @return EVAL_BODY_BUFFERED - * @throws JspException if an error occurred while processing this tag - * @see BodyTag#doStartTag - */ - - public int doStartTag() throws JspException { - return EVAL_BODY_BUFFERED; - } - - - /** - * Default processing of the end tag returning EVAL_PAGE. - * - * @return EVAL_PAGE - * @throws JspException if an error occurred while processing this tag - * @see Tag#doEndTag - */ - - public int doEndTag() throws JspException { - return super.doEndTag(); - } - - - // Actions related to body evaluation - - /** - * Prepare for evaluation of the body: stash the bodyContent away. - * - * @param b the BodyContent - * @see #doAfterBody - * @see #doInitBody() - * @see BodyTag#setBodyContent - */ - - public void setBodyContent(BodyContent b) { - this.bodyContent = b; - } - - - /** - * Prepare for evaluation of the body just before the first body evaluation: - * no action. - * - * @throws JspException if an error occurred while processing this tag - * @see #setBodyContent - * @see #doAfterBody - * @see BodyTag#doInitBody - */ - - public void doInitBody() throws JspException { - } - - - /** - * After the body evaluation: do not reevaluate and continue with the page. - * By default nothing is done with the bodyContent data (if any). - * - * @return SKIP_BODY - * @throws JspException if an error occurred while processing this tag - * @see #doInitBody - * @see BodyTag#doAfterBody - */ - - public int doAfterBody() throws JspException { - return SKIP_BODY; - } - - - /** - * Release state. - * - * @see Tag#release - */ - - public void release() { - bodyContent = null; - - super.release(); - } - - /** - * Get current bodyContent. - * - * @return the body content. - */ - - public BodyContent getBodyContent() { - return bodyContent; - } - - - /** - * Get surrounding out JspWriter. - * - * @return the enclosing JspWriter, from the bodyContent. - */ - - public JspWriter getPreviousOut() { - return bodyContent.getEnclosingWriter(); - } - - // protected fields - - /** - * The current BodyContent for this BodyTag. - */ - protected BodyContent bodyContent; -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/DynamicAttributes.java b/api/src/main/java/javax/servlet/jsp/tagext/DynamicAttributes.java deleted file mode 100644 index 5867699..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/DynamicAttributes.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -import javax.servlet.jsp.JspException; - -/** - * For a tag to declare that it accepts dynamic attributes, it must implement - * this interface. The entry for the tag in the Tag Library Descriptor must - * also be configured to indicate dynamic attributes are accepted. - *
    - * For any attribute that is not declared in the Tag Library Descriptor for - * this tag, instead of getting an error at translation time, the - * setDynamicAttribute() method is called, with the name and - * value of the attribute. It is the responsibility of the tag to - * remember the names and values of the dynamic attributes. - * - * @since JSP 2.0 - */ -public interface DynamicAttributes { - - /** - * Called when a tag declared to accept dynamic attributes is passed - * an attribute that is not declared in the Tag Library Descriptor. - * - * @param uri the namespace of the attribute, or null if in the default - * namespace. - * @param localName the name of the attribute being set. - * @param value the value of the attribute - * @throws JspException if the tag handler wishes to - * signal that it does not accept the given attribute. The - * container must not call doStartTag() or doTag() for this tag. - */ - public void setDynamicAttribute( - String uri, String localName, Object value ) - throws JspException; - -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/FunctionInfo.java b/api/src/main/java/javax/servlet/jsp/tagext/FunctionInfo.java deleted file mode 100644 index 6578465..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/FunctionInfo.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -/** - * Information for a function in a Tag Library. - * This class is instantiated from the Tag Library Descriptor file (TLD) - * and is available only at translation time. - * - * @since JSP 2.0 - */ -public class FunctionInfo { - - /** - * Constructor for FunctionInfo. - * - * @param name The name of the function - * @param klass The class of the function - * @param signature The signature of the function - */ - - public FunctionInfo(String name, String klass, String signature) { - - this.name = name; - this.functionClass = klass; - this.functionSignature = signature; - } - - /** - * The name of the function. - * - * @return The name of the function - */ - - public String getName() { - return name; - } - - /** - * The class of the function. - * - * @return The class of the function - */ - - public String getFunctionClass() { - return functionClass; - } - - /** - * The signature of the function. - * - * @return The signature of the function - */ - - public String getFunctionSignature() { - return functionSignature; - } - - /* - * fields - */ - - private String name; - private String functionClass; - private String functionSignature; -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/IterationTag.java b/api/src/main/java/javax/servlet/jsp/tagext/IterationTag.java deleted file mode 100644 index 1bb767f..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/IterationTag.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -import javax.servlet.jsp.*; - -/** - * The IterationTag interface extends Tag by defining one additional - * method that controls the reevaluation of its body. - * - *

    A tag handler that implements IterationTag is treated as one that - * implements Tag regarding the doStartTag() and doEndTag() methods. - * IterationTag provides a new method: doAfterBody(). - * - *

    The doAfterBody() method is invoked after every body evaluation - * to control whether the body will be reevaluated or not. If doAfterBody() - * returns IterationTag.EVAL_BODY_AGAIN, then the body will be reevaluated. - * If doAfterBody() returns Tag.SKIP_BODY, then the body will be skipped - * and doEndTag() will be evaluated instead. - * - *

    Properties - * There are no new properties in addition to those in Tag. - * - *

    Methods - * There is one new methods: doAfterBody(). - * - *

    Lifecycle - * - *

    Lifecycle details are described by the transition diagram - * below. Exceptions that are thrown during the computation of - * doStartTag(), BODY and doAfterBody() interrupt the execution - * sequence and are propagated up the stack, unless the tag handler - * implements the TryCatchFinally interface; see that interface for - * details. - * - *

    - * Lifecycle Details Transition Diagram for IterationTag - * - *

    Empty and Non-Empty Action - *

    If the TagLibraryDescriptor file indicates that the action must - * always have an empty element body, by a <body-content> entry of - * "empty", then the doStartTag() method must return SKIP_BODY. - * - *

    Note that which methods are invoked after the doStartTag() depends on - * both the return value and on if the custom action element is empty - * or not in the JSP page, not on how it's declared in the TLD. - * - *

    - * If SKIP_BODY is returned the body is not evaluated, and then doEndTag() - * is invoked. - * - *

    - * If EVAL_BODY_INCLUDE is returned, and the custom action element is not - * empty, the body is evaluated and "passed through" to the current out, - * then doAfterBody() is invoked and, after zero or more iterations, - * doEndTag() is invoked. - */ - -public interface IterationTag extends Tag { - - /** - * Request the reevaluation of some body. - * Returned from doAfterBody. - * - * For compatibility with JSP 1.1, the value is carefully selected - * to be the same as the, now deprecated, BodyTag.EVAL_BODY_TAG, - * - */ - - public final static int EVAL_BODY_AGAIN = 2; - - /** - * Process body (re)evaluation. This method is invoked by the - * JSP Page implementation object after every evaluation of - * the body into the BodyEvaluation object. The method is - * not invoked if there is no body evaluation. - * - *

    - * If doAfterBody returns EVAL_BODY_AGAIN, a new evaluation of the - * body will happen (followed by another invocation of doAfterBody). - * If doAfterBody returns SKIP_BODY, no more body evaluations will occur, - * and the doEndTag method will be invoked. - * - *

    - * If this tag handler implements BodyTag and doAfterBody returns - * SKIP_BODY, the value of out will be restored using the popBody - * method in pageContext prior to invoking doEndTag. - * - *

    - * The method re-invocations may be lead to different actions because - * there might have been some changes to shared state, or because - * of external computation. - * - *

    - * The JSP container will resynchronize the values of any AT_BEGIN and - * NESTED variables (defined by the associated TagExtraInfo or TLD) after - * the invocation of doAfterBody(). - * - * @return whether additional evaluations of the body are desired - * @throws JspException if an error occurred while processing this tag - */ - - int doAfterBody() throws JspException; -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/JspFragment.java b/api/src/main/java/javax/servlet/jsp/tagext/JspFragment.java deleted file mode 100644 index 3675c31..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/JspFragment.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -import java.io.IOException; -import java.io.Writer; -import javax.servlet.jsp.*; - -/** - * Encapsulates a portion of JSP code in an object that - * can be invoked as many times as needed. JSP Fragments are defined - * using JSP syntax as the body of a tag for an invocation to a SimpleTag - * handler, or as the body of a <jsp:attribute> standard action - * specifying the value of an attribute that is declared as a fragment, - * or to be of type JspFragment in the TLD. - *

    - * The definition of the JSP fragment must only contain template - * text and JSP action elements. In other words, it must not contain - * scriptlets or scriptlet expressions. At translation time, the - * container generates an implementation of the JspFragment abstract class - * capable of executing the defined fragment. - *

    - * A tag handler can invoke the fragment zero or more times, or - * pass it along to other tags, before returning. To communicate values - * to/from a JSP fragment, tag handlers store/retrieve values in - * the JspContext associated with the fragment. - *

    - * Note that tag library developers and page authors should not generate - * JspFragment implementations manually. - *

    - * Implementation Note: It is not necessary to generate a - * separate class for each fragment. One possible implementation is - * to generate a single helper class for each page that implements - * JspFragment. Upon construction, a discriminator can be passed to - * select which fragment that instance will execute. - * - * @since JSP 2.0 - */ -public abstract class JspFragment { - - /** - * Executes the fragment and directs all output to the given Writer, - * or the JspWriter returned by the getOut() method of the JspContext - * associated with the fragment if out is null. - * - * @param out The Writer to output the fragment to, or null if - * output should be sent to JspContext.getOut(). - * @throws javax.servlet.jsp.JspException Thrown if an error occured - * while invoking this fragment. - * @throws javax.servlet.jsp.SkipPageException Thrown if the page - * that (either directly or indirectly) invoked the tag handler that - * invoked this fragment is to cease evaluation. The container - * must throw this exception if a Classic Tag Handler returned - * Tag.SKIP_PAGE or if a Simple Tag Handler threw SkipPageException. - * @throws java.io.IOException If there was an error writing to the - * stream. - */ - public abstract void invoke( Writer out ) - throws JspException, IOException; - - /** - * Returns the JspContext that is bound to this JspFragment. - * - * @return The JspContext used by this fragment at invocation time. - */ - public abstract JspContext getJspContext(); - -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/JspIdConsumer.java b/api/src/main/java/javax/servlet/jsp/tagext/JspIdConsumer.java deleted file mode 100644 index 066afd6..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/JspIdConsumer.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -/** - *

    This interface indicates to the container that a tag handler - * wishes to be provided with a - * compiler generated ID.

    - *

    The container sets the jspId - * attribute - * of the tag handler with an identification string, as part of tag - * property initialization. Each tag in a JSP page has a unique - * jspId, and a given tag in a JSP page always has the same - * jspId, - * even for multiple requests to the page. - *

    - *

    - * Tag handler instances that implement JspIdConsumer - * cannot be reused. - *

    - *

    - * Even though the jspId attribute is similar in concept to - * the jsp:id - * attribute of an XML view (see Section JSP.10.1.13 of the spec), they are - * not related. - * The jsp:id attribute is available only at translation time, - * and the jspId - * attribute is avalable only at request time. - *

    - *

    - * The JSP container must provide a value for jspId that - * conforms to the following rules: - *

      - *
    • It must start with a letter (as defined by the Character.isLetter() - * method) or underscore ('_'). - *
    • Subsequent characters may be letters (as defined by the Character.isLetter() - * method), digits (as defined by the Character.isDigit() method), dashes ('-'), - * or underscores ('_') - *
    - *

    - *

    - * Note that the rules exclude colons ':' in a jspId, - * and that they are - * the same rules used for a component ID in JavaServer Faces. - *

    - * - * @since JSP 2.1 - */ - -public interface JspIdConsumer { - - /** - * Called by the container generated code to set a value for the - * jspId attribute. An unique identification string, relative to - * this page, is generated at translation time. - */ - public void setJspId(String id); -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/JspTag.java b/api/src/main/java/javax/servlet/jsp/tagext/JspTag.java deleted file mode 100644 index 9b33831..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/JspTag.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -/** - * Serves as a base class for Tag and SimpleTag. - * This is mostly for organizational and type-safety purposes. - * - * @since JSP 2.0 - */ -public interface JspTag { -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/PageData.java b/api/src/main/java/javax/servlet/jsp/tagext/PageData.java deleted file mode 100644 index 40c0631..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/PageData.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -import java.io.InputStream; - -/** - * Translation-time information on a JSP page. The information - * corresponds to the XML view of the JSP page. - * - *

    - * Objects of this type are generated by the JSP translator, e.g. - * when being pased to a TagLibraryValidator instance. - */ - -abstract public class PageData { - - /** - * Sole constructor. (For invocation by subclass constructors, - * typically implicit.) - */ - public PageData() { - } - - /** - * Returns an input stream on the XML view of a JSP page. - * The stream is encoded in UTF-8. Recall tht the XML view of a - * JSP page has the include directives expanded. - * - * @return An input stream on the document. - */ - abstract public InputStream getInputStream(); -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/SimpleTag.java b/api/src/main/java/javax/servlet/jsp/tagext/SimpleTag.java deleted file mode 100644 index 9b956b9..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/SimpleTag.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -import javax.servlet.jsp.JspContext; - -/** - * Interface for defining Simple Tag Handlers. - * - *

    Simple Tag Handlers differ from Classic Tag Handlers in that instead - * of supporting doStartTag() and doEndTag(), - * the SimpleTag interface provides a simple - * doTag() method, which is called once and only once for any - * given tag invocation. All tag logic, iteration, body evaluations, etc. - * are to be performed in this single method. Thus, simple tag handlers - * have the equivalent power of BodyTag, but with a much - * simpler lifecycle and interface.

    - * - *

    To support body content, the setJspBody() - * method is provided. The container invokes the setJspBody() - * method with a JspFragment object encapsulating the body of - * the tag. The tag handler implementation can call - * invoke() on that fragment to evaluate the body as - * many times as it needs.

    - * - *

    A SimpleTag handler must have a public no-args constructor. Most - * SimpleTag handlers should extend SimpleTagSupport.

    - * - *

    Lifecycle

    - * - *

    The following is a non-normative, brief overview of the - * SimpleTag lifecycle. Refer to the JSP Specification for details.

    - * - *
      - *
    1. A new tag handler instance is created each time by the container - * by calling the provided zero-args constructor. Unlike classic - * tag handlers, simple tag handlers are never cached and reused by - * the JSP container.
    2. - *
    3. The setJspContext() and setParent() - * methods are called by the container. The setParent() - * method is only called if the element is nested within another tag - * invocation.
    4. - *
    5. The setters for each attribute defined for this tag are called - * by the container.
    6. - *
    7. If a body exists, the setJspBody() method is called - * by the container to set the body of this tag, as a - * JspFragment. If the action element is empty in - * the page, this method is not called at all.
    8. - *
    9. The doTag() method is called by the container. All - * tag logic, iteration, body evaluations, etc. occur in this - * method.
    10. - *
    11. The doTag() method returns and all variables are - * synchronized.
    12. - *
    - * - * @see SimpleTagSupport - * @since JSP 2.0 - */ -public interface SimpleTag extends JspTag { - - /** - * Called by the container to invoke this tag. - * The implementation of this method is provided by the tag library - * developer, and handles all tag processing, body iteration, etc. - * - *

    - * The JSP container will resynchronize any AT_BEGIN and AT_END - * variables (defined by the associated tag file, TagExtraInfo, or TLD) - * after the invocation of doTag(). - * - * @throws javax.servlet.jsp.JspException If an error occurred - * while processing this tag. - * @throws javax.servlet.jsp.SkipPageException If the page that - * (either directly or indirectly) invoked this tag is to - * cease evaluation. A Simple Tag Handler generated from a - * tag file must throw this exception if an invoked Classic - * Tag Handler returned SKIP_PAGE or if an invoked Simple - * Tag Handler threw SkipPageException or if an invoked Jsp Fragment - * threw a SkipPageException. - * @throws java.io.IOException If there was an error writing to the - * output stream. - */ - public void doTag() - throws javax.servlet.jsp.JspException, java.io.IOException; - - /** - * Sets the parent of this tag, for collaboration purposes. - *

    - * The container invokes this method only if this tag invocation is - * nested within another tag invocation. - * - * @param parent the tag that encloses this tag - */ - public void setParent( JspTag parent ); - - /** - * Returns the parent of this tag, for collaboration purposes. - * - * @return the parent of this tag - */ - public JspTag getParent(); - - /** - * Called by the container to provide this tag handler with - * the JspContext for this invocation. - * An implementation should save this value. - * - * @param pc the page context for this invocation - * @see Tag#setPageContext - */ - public void setJspContext( JspContext pc ); - - /** - * Provides the body of this tag as a JspFragment object, able to be - * invoked zero or more times by the tag handler. - *

    - * This method is invoked by the JSP page implementation - * object prior to doTag(). If the action element is - * empty in the page, this method is not called at all. - * - * @param jspBody The fragment encapsulating the body of this tag. - */ - public void setJspBody( JspFragment jspBody ); - - -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/SimpleTagSupport.java b/api/src/main/java/javax/servlet/jsp/tagext/SimpleTagSupport.java deleted file mode 100644 index b614455..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/SimpleTagSupport.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -import javax.servlet.jsp.JspContext; -import javax.servlet.jsp.JspException; -import java.io.IOException; - -/** - * A base class for defining tag handlers implementing SimpleTag. - *

    - * The SimpleTagSupport class is a utility class intended to be used - * as the base class for new simple tag handlers. The SimpleTagSupport - * class implements the SimpleTag interface and adds additional - * convenience methods including getter methods for the properties in - * SimpleTag. - * - * @since JSP 2.0 - */ -public class SimpleTagSupport - implements SimpleTag -{ - /** Reference to the enclosing tag. */ - private JspTag parentTag; - - /** The JSP context for the upcoming tag invocation. */ - private JspContext jspContext; - - /** The body of the tag. */ - private JspFragment jspBody; - - /** - * Sole constructor. (For invocation by subclass constructors, - * typically implicit.) - */ - public SimpleTagSupport() { - } - - /** - * Default processing of the tag does nothing. - * - * @throws JspException Subclasses can throw JspException to indicate - * an error occurred while processing this tag. - * @throws javax.servlet.jsp.SkipPageException If the page that - * (either directly or indirectly) invoked this tag is to - * cease evaluation. A Simple Tag Handler generated from a - * tag file must throw this exception if an invoked Classic - * Tag Handler returned SKIP_PAGE or if an invoked Simple - * Tag Handler threw SkipPageException or if an invoked Jsp Fragment - * threw a SkipPageException. - * @throws IOException Subclasses can throw IOException if there was - * an error writing to the output stream - * @see SimpleTag#doTag() - */ - public void doTag() - throws JspException, IOException - { - } - - /** - * Sets the parent of this tag, for collaboration purposes. - *

    - * The container invokes this method only if this tag invocation is - * nested within another tag invocation. - * - * @param parent the tag that encloses this tag - */ - public void setParent( JspTag parent ) { - this.parentTag = parent; - } - - /** - * Returns the parent of this tag, for collaboration purposes. - * - * @return the parent of this tag - */ - public JspTag getParent() { - return this.parentTag; - } - - /** - * Stores the provided JSP context in the private jspContext field. - * Subclasses can access the JspContext via - * getJspContext(). - * - * @param pc the page context for this invocation - * @see SimpleTag#setJspContext - */ - public void setJspContext( JspContext pc ) { - this.jspContext = pc; - } - - /** - * Returns the page context passed in by the container via - * setJspContext. - * - * @return the page context for this invocation - */ - protected JspContext getJspContext() { - return this.jspContext; - } - - /** - * Stores the provided JspFragment. - * - * @param jspBody The fragment encapsulating the body of this tag. - * If the action element is empty in the page, this method is - * not called at all. - * @see SimpleTag#setJspBody - */ - public void setJspBody( JspFragment jspBody ) { - this.jspBody = jspBody; - } - - /** - * Returns the body passed in by the container via setJspBody. - * - * @return the fragment encapsulating the body of this tag, or - * null if the action element is empty in the page. - */ - protected JspFragment getJspBody() { - return this.jspBody; - } - - /** - * Find the instance of a given class type that is closest to a given - * instance. - * This method uses the getParent method from the Tag and/or SimpleTag - * interfaces. This method is used for coordination among - * cooperating tags. - * - *

    For every instance of TagAdapter - * encountered while traversing the ancestors, the tag handler returned by - * TagAdapter.getAdaptee() - instead of the TagAdpater itself - - * is compared to klass. If the tag handler matches, it - and - * not its TagAdapter - is returned. - * - *

    - * The current version of the specification only provides one formal - * way of indicating the observable type of a tag handler: its - * tag handler implementation class, described in the tag-class - * subelement of the tag element. This is extended in an - * informal manner by allowing the tag library author to - * indicate in the description subelement an observable type. - * The type should be a subtype of the tag handler implementation - * class or void. - * This addititional constraint can be exploited by a - * specialized container that knows about that specific tag library, - * as in the case of the JSP standard tag library. - * - *

    - * When a tag library author provides information on the - * observable type of a tag handler, client programmatic code - * should adhere to that constraint. Specifically, the Class - * passed to findAncestorWithClass should be a subtype of the - * observable type. - * - * - * @param from The instance from where to start looking. - * @param klass The subclass of JspTag or interface to be matched - * @return the nearest ancestor that implements the interface - * or is an instance of the class specified - */ - public static final JspTag findAncestorWithClass( - JspTag from, Class klass) - { - boolean isInterface = false; - - if (from == null || klass == null - || (!JspTag.class.isAssignableFrom(klass) - && !(isInterface = klass.isInterface()))) { - return null; - } - - for (;;) { - JspTag parent = null; - if( from instanceof SimpleTag ) { - parent = ((SimpleTag)from).getParent(); - } - else if( from instanceof Tag ) { - parent = ((Tag)from).getParent(); - } - if (parent == null) { - return null; - } - - if (parent instanceof TagAdapter) { - parent = ((TagAdapter) parent).getAdaptee(); - } - - if ((isInterface && klass.isInstance(parent)) - || klass.isAssignableFrom(parent.getClass())) { - return parent; - } - - from = parent; - } - } -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/Tag.java b/api/src/main/java/javax/servlet/jsp/tagext/Tag.java deleted file mode 100644 index 5f23e74..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/Tag.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -import javax.servlet.jsp.*; - - -/** - * The interface of a classic tag handler that does not want to manipulate - * its body. The Tag interface defines the basic protocol between a Tag - * handler and JSP page implementation class. It defines the life cycle - * and the methods to be invoked at start and end tag. - * - *

    Properties

    - * - *

    The Tag interface specifies the setter and getter methods for the core - * pageContext and parent properties.

    - * - *

    The JSP page implementation object invokes setPageContext and - * setParent, in that order, before invoking doStartTag() or doEndTag().

    - * - *

    Methods

    - * - *

    There are two main actions: doStartTag and doEndTag. Once all - * appropriate properties have been initialized, the doStartTag and - * doEndTag methods can be invoked on the tag handler. Between these - * invocations, the tag handler is assumed to hold a state that must - * be preserved. After the doEndTag invocation, the tag handler is - * available for further invocations (and it is expected to have - * retained its properties).

    - * - *

    Lifecycle

    - * - *

    Lifecycle details are described by the transition diagram below, - * with the following comments: - *

      - *
    • [1] This transition is intended to be for releasing long-term data. - * no guarantees are assumed on whether any properties have been retained - * or not. - *
    • [2] This transition happens if and only if the tag ends normally - * without raising an exception - *
    • [3] Some setters may be called again before a tag handler is - * reused. For instance, setParent() is called if it's - * reused within the same page but at a different level, - * setPageContext() is called if it's used in another page, - * and attribute setters are called if the values differ or are expressed - * as request-time attribute values. - *
    • Check the TryCatchFinally interface for additional details related - * to exception handling and resource management. - *

    - * - * Lifecycle Details Transition Diagram for Tag - * - *

    Once all invocations on the tag handler - * are completed, the release method is invoked on it. Once a release - * method is invoked all properties, including parent and - * pageContext, are assumed to have been reset to an unspecified value. - * The page compiler guarantees that release() will be invoked on the Tag - * handler before the handler is released to the GC.

    - * - *

    Empty and Non-Empty Action

    - *

    If the TagLibraryDescriptor file indicates that the action must - * always have an empty action, by an <body-content> entry of "empty", - * then the doStartTag() method must return SKIP_BODY.

    - * - *

    Otherwise, the doStartTag() method may return SKIP_BODY or - * EVAL_BODY_INCLUDE.

    - * - *

    If SKIP_BODY is returned the body, if present, is not evaluated.

    - * - *

    If EVAL_BODY_INCLUDE is returned, the body is evaluated and - * "passed through" to the current out.

    -*/ - -public interface Tag extends JspTag { - - /** - * Skip body evaluation. - * Valid return value for doStartTag and doAfterBody. - */ - - public final static int SKIP_BODY = 0; - - /** - * Evaluate body into existing out stream. - * Valid return value for doStartTag. - */ - - public final static int EVAL_BODY_INCLUDE = 1; - - /** - * Skip the rest of the page. - * Valid return value for doEndTag. - */ - - public final static int SKIP_PAGE = 5; - - /** - * Continue evaluating the page. - * Valid return value for doEndTag(). - */ - - public final static int EVAL_PAGE = 6; - - // Setters for Tag handler data - - - /** - * Set the current page context. - * This method is invoked by the JSP page implementation object - * prior to doStartTag(). - *

    - * This value is *not* reset by doEndTag() and must be explicitly reset - * by a page implementation if it changes between calls to doStartTag(). - * - * @param pc The page context for this tag handler. - */ - - void setPageContext(PageContext pc); - - - /** - * Set the parent (closest enclosing tag handler) of this tag handler. - * Invoked by the JSP page implementation object prior to doStartTag(). - *

    - * This value is *not* reset by doEndTag() and must be explicitly reset - * by a page implementation. - * - * @param t The parent tag, or null. - */ - - - void setParent(Tag t); - - - /** - * Get the parent (closest enclosing tag handler) for this tag handler. - * - *

    - * The getParent() method can be used to navigate the nested tag - * handler structure at runtime for cooperation among custom actions; - * for example, the findAncestorWithClass() method in TagSupport - * provides a convenient way of doing this. - * - *

    - * The current version of the specification only provides one formal - * way of indicating the observable type of a tag handler: its - * tag handler implementation class, described in the tag-class - * subelement of the tag element. This is extended in an - * informal manner by allowing the tag library author to - * indicate in the description subelement an observable type. - * The type should be a subtype of the tag handler implementation - * class or void. - * This addititional constraint can be exploited by a - * specialized container that knows about that specific tag library, - * as in the case of the JSP standard tag library. - * - * @return the current parent, or null if none. - * @see TagSupport#findAncestorWithClass - */ - - Tag getParent(); - - - // Actions for basic start/end processing. - - - /** - * Process the start tag for this instance. - * This method is invoked by the JSP page implementation object. - * - *

    - * The doStartTag method assumes that the properties pageContext and - * parent have been set. It also assumes that any properties exposed as - * attributes have been set too. When this method is invoked, the body - * has not yet been evaluated. - * - *

    - * This method returns Tag.EVAL_BODY_INCLUDE or - * BodyTag.EVAL_BODY_BUFFERED to indicate - * that the body of the action should be evaluated or SKIP_BODY to - * indicate otherwise. - * - *

    - * When a Tag returns EVAL_BODY_INCLUDE the result of evaluating - * the body (if any) is included into the current "out" JspWriter as it - * happens and then doEndTag() is invoked. - * - *

    - * BodyTag.EVAL_BODY_BUFFERED is only valid if the tag handler - * implements BodyTag. - * - *

    - * The JSP container will resynchronize the values of any AT_BEGIN and - * NESTED variables (defined by the associated TagExtraInfo or TLD) - * after the invocation of doStartTag(), except for a tag handler - * implementing BodyTag whose doStartTag() method returns - * BodyTag.EVAL_BODY_BUFFERED. - * - * @return EVAL_BODY_INCLUDE if the tag wants to process body, SKIP_BODY - * if it does not want to process it. - * @throws JspException if an error occurred while processing this tag - * @see BodyTag - */ - - int doStartTag() throws JspException; - - - /** - * Process the end tag for this instance. - * This method is invoked by the JSP page implementation object - * on all Tag handlers. - * - *

    - * This method will be called after returning from doStartTag. The - * body of the action may or may not have been evaluated, depending on - * the return value of doStartTag. - * - *

    - * If this method returns EVAL_PAGE, the rest of the page continues - * to be evaluated. If this method returns SKIP_PAGE, the rest of - * the page is not evaluated, the request is completed, and - * the doEndTag() methods of enclosing tags are not invoked. If this - * request was forwarded or included from another page (or Servlet), - * only the current page evaluation is stopped. - * - *

    - * The JSP container will resynchronize the values of any AT_BEGIN and - * AT_END variables (defined by the associated TagExtraInfo or TLD) - * after the invocation of doEndTag(). - * - * @return indication of whether to continue evaluating the JSP page. - * @throws JspException if an error occurred while processing this tag - */ - - int doEndTag() throws JspException; - - /** - * Called on a Tag handler to release state. - * The page compiler guarantees that JSP page implementation - * objects will invoke this method on all tag handlers, - * but there may be multiple invocations on doStartTag and doEndTag in between. - */ - - void release(); - -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/TagAdapter.java b/api/src/main/java/javax/servlet/jsp/tagext/TagAdapter.java deleted file mode 100644 index a432976..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/TagAdapter.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -import javax.servlet.jsp.*; - - -/** - * Wraps any SimpleTag and exposes it using a Tag interface. This is used - * to allow collaboration between classic Tag handlers and SimpleTag - * handlers. - *

    - * Because SimpleTag does not extend Tag, and because Tag.setParent() - * only accepts a Tag instance, a classic tag handler (one - * that implements Tag) cannot have a SimpleTag as its parent. To remedy - * this, a TagAdapter is created to wrap the SimpleTag parent, and the - * adapter is passed to setParent() instead. A classic Tag Handler can - * call getAdaptee() to retrieve the encapsulated SimpleTag instance. - * - * @since JSP 2.0 - */ -public class TagAdapter - implements Tag -{ - /** The simple tag that's being adapted. */ - private SimpleTag simpleTagAdaptee; - - /** The parent, of this tag, converted (if necessary) to be of type Tag. */ - private Tag parent; - - // Flag indicating whether we have already determined the parent - private boolean parentDetermined; - - /** - * Creates a new TagAdapter that wraps the given SimpleTag and - * returns the parent tag when getParent() is called. - * - * @param adaptee The SimpleTag being adapted as a Tag. - */ - public TagAdapter( SimpleTag adaptee ) { - if( adaptee == null ) { - // Cannot wrap a null adaptee. - throw new IllegalArgumentException(); - } - this.simpleTagAdaptee = adaptee; - } - - /** - * Must not be called. - * - * @param pc ignored. - * @throws UnsupportedOperationException Must not be called - */ - public void setPageContext(PageContext pc) { - throw new UnsupportedOperationException( - "Illegal to invoke setPageContext() on TagAdapter wrapper" ); - } - - - /** - * Must not be called. The parent of this tag is always - * getAdaptee().getParent(). - * - * @param parentTag ignored. - * @throws UnsupportedOperationException Must not be called. - */ - public void setParent( Tag parentTag ) { - throw new UnsupportedOperationException( - "Illegal to invoke setParent() on TagAdapter wrapper" ); - } - - - /** - * Returns the parent of this tag, which is always - * getAdaptee().getParent(). - * - * This will either be the enclosing Tag (if getAdaptee().getParent() - * implements Tag), or an adapter to the enclosing Tag (if - * getAdaptee().getParent() does not implement Tag). - * - * @return The parent of the tag being adapted. - */ - public Tag getParent() { - if (!parentDetermined) { - JspTag adapteeParent = simpleTagAdaptee.getParent(); - if (adapteeParent != null) { - if (adapteeParent instanceof Tag) { - this.parent = (Tag) adapteeParent; - } else { - // Must be SimpleTag - no other types defined. - this.parent = new TagAdapter((SimpleTag) adapteeParent); - } - } - parentDetermined = true; - } - - return this.parent; - } - - /** - * Gets the tag that is being adapted to the Tag interface. - * This should be an instance of SimpleTag in JSP 2.0, but room - * is left for other kinds of tags in future spec versions. - * - * @return the tag that is being adapted - */ - public JspTag getAdaptee() { - return this.simpleTagAdaptee; - } - - /** - * Must not be called. - * - * @return always throws UnsupportedOperationException - * @throws UnsupportedOperationException Must not be called - * @throws JspException never thrown - */ - public int doStartTag() throws JspException { - throw new UnsupportedOperationException( - "Illegal to invoke doStartTag() on TagAdapter wrapper" ); - } - - /** - * Must not be called. - * - * @return always throws UnsupportedOperationException - * @throws UnsupportedOperationException Must not be called - * @throws JspException never thrown - */ - public int doEndTag() throws JspException { - throw new UnsupportedOperationException( - "Illegal to invoke doEndTag() on TagAdapter wrapper" ); - } - - /** - * Must not be called. - * - * @throws UnsupportedOperationException Must not be called - */ - public void release() { - throw new UnsupportedOperationException( - "Illegal to invoke release() on TagAdapter wrapper" ); - } -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/TagAttributeInfo.java b/api/src/main/java/javax/servlet/jsp/tagext/TagAttributeInfo.java deleted file mode 100644 index ce6766c..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/TagAttributeInfo.java +++ /dev/null @@ -1,365 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -/** - * Information on the attributes of a Tag, available at translation time. - * This class is instantiated from the Tag Library Descriptor file (TLD). - *

    - * Only the information needed to generate code is included here. Other information - * like SCHEMA for validation belongs elsewhere. - *

    - * Note from the Expert Group:
    - * This should have been designed as an interface. Every time we change the TLD, - * we need to add a new constructor to this class (not good). - * This class should only be instantiated by container implementations - * (not by JSP developers). - */ - -public class TagAttributeInfo { - /** - * "id" is wired in to be ID. There is no real benefit in having it be something else - * IDREFs are not handled any differently. - */ - - public static final String ID = "id"; - - /** - * Constructor for TagAttributeInfo. - * This class is to be instantiated only from the - * TagLibrary code under request from some JSP code that is parsing a - * TLD (Tag Library Descriptor). - * - * @param name The name of the attribute. - * @param required If this attribute is required in tag instances. - * @param type The name of the type of the attribute. - * @param reqTime Whether this attribute holds a request-time Attribute. - */ - - public TagAttributeInfo(String name, boolean required, - String type, boolean reqTime) { - this.name = name; - this.required = required; - this.type = type; - this.reqTime = reqTime; - } - - /** - * JSP 2.0 Constructor for TagAttributeInfo. - * This class is to be instantiated only from the - * TagLibrary code under request from some JSP code that is parsing a - * TLD (Tag Library Descriptor). - * - * @param name The name of the attribute. - * @param required If this attribute is required in tag instances. - * @param type The name of the type of the attribute. - * @param reqTime Whether this attribute holds a request-time Attribute. - * @param fragment Whether this attribute is of type JspFragment - * - * @since JSP 2.0 - */ - public TagAttributeInfo(String name, boolean required, - String type, boolean reqTime, - boolean fragment) { - this( name, required, type, reqTime ); - this.fragment = fragment; - } - - /** - * JSP 2.1 Constructor for TagAttributeInfo. - * This class is to be instantiated only from the - * TagLibrary code under request from some JSP code that is parsing a - * TLD (Tag Library Descriptor). - * - * @param name The name of the attribute. - * @param required If this attribute is required in tag instances. - * @param type The name of the type of the attribute. - * @param reqTime Whether this attribute holds a request-time Attribute. - * @param fragment Whether this attribute is of type JspFragment - * @param description The description of the attribute. - * @param deferredValue Whether this attribute is a deferred value. - * @param deferredMethod Whether this attribute is a deferred method. - * rtexpr or deferred value. - * @param expectedTypeName The name of the expected type of this deferred - * value (or null if this is not a deferred value). - * @param methodSignature The expected method signature of this deferred - * method (or null if this is not a deferred method). - * - * @since JSP 2.1 - */ - public TagAttributeInfo(String name, - boolean required, - String type, - boolean reqTime, - boolean fragment, - String description, - boolean deferredValue, - boolean deferredMethod, - String expectedTypeName, - String methodSignature) - { - this( name, required, type, reqTime, fragment ); - this.description = description; - this.deferredValue = deferredValue; - this.deferredMethod = deferredMethod; - this.expectedTypeName = expectedTypeName; - this.methodSignature = methodSignature; - } - - /** - * The name of this attribute. - * - * @return the name of the attribute - */ - - public String getName() { - return name; - } - - /** - * The type (as a String) of this attribute. - * - *

    This method must return "javax.el.ValueExpression" - * if isDeferredValue() returns true and - * canBeRequestTime() returns false. It - * must return "javax.el.MethodExpression" if - * isDeferredMethod() returns true. - * It must return "java.lang.Object" if - * isDeferredValue() returns true and - * canBeRequestTime() returns true. - *

    - * - * @return the type of the attribute - */ - - public String getTypeName() { - return type; - } - - /** - * Whether this attribute has been specified in the TLD - * as rtexprvalue. If true, this means the attribute - * can hold a request-time value. - * - * @return true if the attribute has been specified in the TLD - * as rtexprvalue - */ - - public boolean canBeRequestTime() { - return reqTime; - } - - /** - * Whether this attribute is required. - * - * @return if the attribute is required. - */ - public boolean isRequired() { - return required; - } - - /** - * Convenience static method that goes through an array of TagAttributeInfo - * objects and looks for "id". - * - * @param a An array of TagAttributeInfo - * @return The TagAttributeInfo reference with name "id" - */ - public static TagAttributeInfo getIdAttribute(TagAttributeInfo a[]) { - for (int i=0; itrue if this attribute is to be passed a - * ValueExpression so that expression evaluation - * can be deferred. - * - *

    If this method returns true, then - * getTypeName() must return - * "javax.el.ValueExpression".

    - * - *

    The getExpectedType() method can be used to retrieve - * the expected type this value expression will be constructed with.

    - * - * @return true if this attribute accepts a deferred value; - * false otherwise. - * - * @since JSP 2.1 - */ - public boolean isDeferredValue() { - return deferredValue; - } - - /** - * Returns true if this attribute is to be passed a - * MethodExpression so that expression evaluation - * can be deferred. - * - *

    If this method returns true, then - * getTypeName() must return - * "javax.el.MethodExpression".

    - * - *

    The getMethodSignature() method can be used to retrieve - * the expected method signature this method expression will be - * constructed with.

    - * - * @return true if this attribute accepts a deferred method; - * false otherwise. - * - * @since JSP 2.1 - */ - public boolean isDeferredMethod() { - return deferredMethod; - } - - /** - * Returns the name of the expected type (as a String) of this - * deferred value attribute. - * - *

    This method returns null if - * isDeferredValue() returns false.

    - * - * @return the name of the expected type - * @since JSP 2.1 - */ - public String getExpectedTypeName() { - return expectedTypeName; - } - - /** - * Returns the expected method signature of this deferred method attribute. - * - *

    This method returns null if - * isDeferredMethod() returns false.

    - * - * @return the method signature - * @since JSP 2.1 - */ - public String getMethodSignature() { - return methodSignature; - } - - /** - * Returns a String representation of this TagAttributeInfo, suitable - * for debugging purposes. - * - * @return a String representation of this TagAttributeInfo - */ - public String toString() { - StringBuffer b = new StringBuffer(); - b.append("name = "+name+" "); - b.append("type = "+type+" "); - b.append("reqTime = "+reqTime+" "); - b.append("required = "+required+" "); - b.append("fragment = "+fragment+" "); - b.append("deferredValue = "+deferredValue+" "); - b.append("deferredMethod = "+deferredMethod+" "); - b.append("expectedTypeName = "+expectedTypeName+" "); - b.append("methodSignature = "+methodSignature+" "); - return b.toString(); - } - - /* - * private fields - */ - private String name; - private String type; - private boolean reqTime; - private boolean required; - - /* - * private fields for JSP 2.0 - */ - private boolean fragment; - - /* - * private fields for JSP 2.1 - */ - private boolean deferredValue; - private boolean deferredMethod; - private String expectedTypeName; - private String methodSignature; - private String description; -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/TagData.java b/api/src/main/java/javax/servlet/jsp/tagext/TagData.java deleted file mode 100644 index 85f6cee..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/TagData.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -import java.util.Hashtable; - -/** - * The (translation-time only) attribute/value information for a tag instance. - * - *

    - * TagData is only used as an argument to the isValid, validate, and - * getVariableInfo methods of TagExtraInfo, which are invoked at - * translation time. - */ - -public class TagData implements Cloneable { - - /** - * Distinguished value for an attribute to indicate its value - * is a request-time expression (which is not yet available because - * TagData instances are used at translation-time). - */ - - public static final Object REQUEST_TIME_VALUE = new Object(); - - - /** - * Constructor for TagData. - * - *

    - * A typical constructor may be - *

    -     * static final Object[][] att = {{"connection", "conn0"}, {"id", "query0"}};
    -     * static final TagData td = new TagData(att);
    -     * 
    - * - * All values must be Strings except for those holding the - * distinguished object REQUEST_TIME_VALUE. - - * @param atts the static attribute and values. May be null. - */ - public TagData(Object[] atts[]) { - if (atts == null) { - attributes = new Hashtable(); - } else { - attributes = new Hashtable(atts.length); - } - - if (atts != null) { - for (int i = 0; i < atts.length; i++) { - attributes.put((String)atts[i][0], atts[i][1]); - } - } - } - - /** - * Constructor for a TagData. - * - * If you already have the attributes in a hashtable, use this - * constructor. - * - * @param attrs A hashtable to get the values from. - */ - public TagData(Hashtable attrs) { - this.attributes = attrs; - } - - /** - * The value of the tag's id attribute. - * - * @return the value of the tag's id attribute, or null if no such - * attribute was specified. - */ - - public String getId() { - return getAttributeString(TagAttributeInfo.ID); - } - - /** - * The value of the attribute. - * If a static value is specified for an attribute that accepts a - * request-time attribute expression then that static value is returned, - * even if the value is provided in the body of a <jsp:attribute> action. - * The distinguished object REQUEST_TIME_VALUE is only returned if - * the value is specified as a request-time attribute expression - * or via the <jsp:attribute> action with a body that contains - * dynamic content (scriptlets, scripting expressions, EL expressions, - * standard actions, or custom actions). Returns null if the attribute - * is not set. - * - * @param attName the name of the attribute - * @return the attribute's value - */ - - public Object getAttribute(String attName) { - return attributes.get(attName); - } - - /** - * Set the value of an attribute. - * - * @param attName the name of the attribute - * @param value the value. - */ - public void setAttribute(String attName, - Object value) { - attributes.put(attName, value); - } - - /** - * Get the value for a given attribute. - * - * @param attName the name of the attribute - * @return the attribute value string - * @throws ClassCastException if attribute value is not a String - */ - - public String getAttributeString(String attName) { - Object o = attributes.get(attName); - if (o == null) { - return null; - } else { - return (String) o; - } - } - - /** - * Enumerates the attributes. - * - *@return An enumeration of the attributes in a TagData - */ - public java.util.Enumeration getAttributes() { - return attributes.keys(); - }; - - // private data - - private Hashtable attributes; // the tagname/value map -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/TagExtraInfo.java b/api/src/main/java/javax/servlet/jsp/tagext/TagExtraInfo.java deleted file mode 100644 index 22445f9..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/TagExtraInfo.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -/** - * Optional class provided by the tag library author to describe additional - * translation-time information not described in the TLD. - * The TagExtraInfo class is mentioned in the Tag Library Descriptor file (TLD). - * - *

    - * This class can be used: - *

      - *
    • to indicate that the tag defines scripting variables - *
    • to perform translation-time validation of the tag attributes. - *
    - * - *

    - * It is the responsibility of the JSP translator that the initial value - * to be returned by calls to getTagInfo() corresponds to a TagInfo - * object for the tag being translated. If an explicit call to - * setTagInfo() is done, then the object passed will be returned in - * subsequent calls to getTagInfo(). - * - *

    - * The only way to affect the value returned by getTagInfo() - * is through a setTagInfo() call, and thus, TagExtraInfo.setTagInfo() is - * to be called by the JSP translator, with a TagInfo object that - * corresponds to the tag being translated. The call should happen before - * any invocation on validate() and before any invocation on - * getVariableInfo(). - * - *

    - * NOTE: It is a (translation time) error for a tag definition - * in a TLD with one or more variable subelements to have an associated - * TagExtraInfo implementation that returns a VariableInfo array with - * one or more elements from a call to getVariableInfo(). - */ - -public abstract class TagExtraInfo { - - /** - * Sole constructor. (For invocation by subclass constructors, - * typically implicit.) - */ - public TagExtraInfo() { - } - - /** - * information on scripting variables defined by the tag associated with - * this TagExtraInfo instance. - * Request-time attributes are indicated as such in the TagData parameter. - * - * @param data The TagData instance. - * @return An array of VariableInfo data, or null or a zero length array - * if no scripting variables are to be defined. - */ - public VariableInfo[] getVariableInfo(TagData data) { - return ZERO_VARIABLE_INFO; - } - - /** - * Translation-time validation of the attributes. - * Request-time attributes are indicated as such in the TagData parameter. - * Note that the preferred way to do validation is with the validate() - * method, since it can return more detailed information. - * - * @param data The TagData instance. - * @return Whether this tag instance is valid. - * @see TagExtraInfo#validate - */ - - public boolean isValid(TagData data) { - return true; - } - - /** - * Translation-time validation of the attributes. - * Request-time attributes are indicated as such in the TagData parameter. - * Because of the higher quality validation messages possible, - * this is the preferred way to do validation (although isValid() - * still works). - * - *

    JSP 2.0 and higher containers call validate() instead of isValid(). - * The default implementation of this method is to call isValid(). If - * isValid() returns false, a generic ValidationMessage[] is returned - * indicating isValid() returned false.

    - * - * @param data The TagData instance. - * @return A null object, or zero length array if no errors, an - * array of ValidationMessages otherwise. - * @since JSP 2.0 - */ - public ValidationMessage[] validate( TagData data ) { - ValidationMessage[] result = null; - - if( !isValid( data ) ) { - result = new ValidationMessage[] { - new ValidationMessage( data.getId(), "isValid() == false" ) }; - } - - return result; - } - - /** - * Set the TagInfo for this class. - * - * @param tagInfo The TagInfo this instance is extending - */ - public final void setTagInfo(TagInfo tagInfo) { - this.tagInfo = tagInfo; - } - - /** - * Get the TagInfo for this class. - * - * @return the taginfo instance this instance is extending - */ - public final TagInfo getTagInfo() { - return tagInfo; - } - - // private data - private TagInfo tagInfo; - - // zero length VariableInfo array - private static final VariableInfo[] ZERO_VARIABLE_INFO = { }; -} - diff --git a/api/src/main/java/javax/servlet/jsp/tagext/TagFileInfo.java b/api/src/main/java/javax/servlet/jsp/tagext/TagFileInfo.java deleted file mode 100644 index 817b0ce..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/TagFileInfo.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -/** - * Tag information for a tag file in a Tag Library; - * This class is instantiated from the Tag Library Descriptor file (TLD) - * and is available only at translation time. - * - * @since JSP 2.0 - */ -public class TagFileInfo { - - /** - * Constructor for TagFileInfo from data in the JSP 2.0 format for TLD. - * This class is to be instantiated only from the TagLibrary code - * under request from some JSP code that is parsing a - * TLD (Tag Library Descriptor). - * - * Note that, since TagLibibraryInfo reflects both TLD information - * and taglib directive information, a TagFileInfo instance is - * dependent on a taglib directive. This is probably a - * design error, which may be fixed in the future. - * - * @param name The unique action name of this tag - * @param path Where to find the .tag file implementing this - * action, relative to the location of the TLD file. - * @param tagInfo The detailed information about this tag, as parsed - * from the directives in the tag file. - */ - public TagFileInfo( String name, String path, TagInfo tagInfo ) { - this.name = name; - this.path = path; - this.tagInfo = tagInfo; - } - - /** - * The unique action name of this tag. - * - * @return The (short) name of the tag. - */ - public String getName() { - return name; - } - - /** - * Where to find the .tag file implementing this action. - * - * @return The path of the tag file, relative to the TLD, or "." if - * the tag file was defined in an implicit tag file. - */ - public String getPath() { - return path; - } - - /** - * Returns information about this tag, parsed from the directives - * in the tag file. - * - * @return a TagInfo object containing information about this tag - */ - public TagInfo getTagInfo() { - return tagInfo; - } - - // private fields for 2.0 info - private String name; - private String path; - private TagInfo tagInfo; -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/TagInfo.java b/api/src/main/java/javax/servlet/jsp/tagext/TagInfo.java deleted file mode 100644 index 3d089c9..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/TagInfo.java +++ /dev/null @@ -1,487 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -/** - * Tag information for a tag in a Tag Library; - * This class is instantiated from the Tag Library Descriptor file (TLD) - * and is available only at translation time. - * - * -*/ - -public class TagInfo { - - /** - * Static constant for getBodyContent() when it is JSP. - */ - - public static final String BODY_CONTENT_JSP = "JSP"; - - /** - * Static constant for getBodyContent() when it is Tag dependent. - */ - - public static final String BODY_CONTENT_TAG_DEPENDENT = "tagdependent"; - - - /** - * Static constant for getBodyContent() when it is empty. - */ - - public static final String BODY_CONTENT_EMPTY = "empty"; - - /** - * Static constant for getBodyContent() when it is scriptless. - * - * @since JSP 2.0 - */ - public static final String BODY_CONTENT_SCRIPTLESS = "scriptless"; - - /** - * Constructor for TagInfo from data in the JSP 1.1 format for TLD. - * This class is to be instantiated only from the TagLibrary code - * under request from some JSP code that is parsing a - * TLD (Tag Library Descriptor). - * - * Note that, since TagLibibraryInfo reflects both TLD information - * and taglib directive information, a TagInfo instance is - * dependent on a taglib directive. This is probably a - * design error, which may be fixed in the future. - * - * @param tagName The name of this tag - * @param tagClassName The name of the tag handler class - * @param bodycontent Information on the body content of these tags - * @param infoString The (optional) string information for this tag - * @param taglib The instance of the tag library that contains us. - * @param tagExtraInfo The instance providing extra Tag info. May be null - * @param attributeInfo An array of AttributeInfo data from descriptor. - * May be null; - * - */ - public TagInfo(String tagName, - String tagClassName, - String bodycontent, - String infoString, - TagLibraryInfo taglib, - TagExtraInfo tagExtraInfo, - TagAttributeInfo[] attributeInfo) { - this.tagName = tagName; - this.tagClassName = tagClassName; - this.bodyContent = bodycontent; - this.infoString = infoString; - this.tagLibrary = taglib; - this.tagExtraInfo = tagExtraInfo; - this.attributeInfo = attributeInfo; - - if (tagExtraInfo != null) - tagExtraInfo.setTagInfo(this); - } - - /** - * Constructor for TagInfo from data in the JSP 1.2 format for TLD. - * This class is to be instantiated only from the TagLibrary code - * under request from some JSP code that is parsing a - * TLD (Tag Library Descriptor). - * - * Note that, since TagLibibraryInfo reflects both TLD information - * and taglib directive information, a TagInfo instance is - * dependent on a taglib directive. This is probably a - * design error, which may be fixed in the future. - * - * @param tagName The name of this tag - * @param tagClassName The name of the tag handler class - * @param bodycontent Information on the body content of these tags - * @param infoString The (optional) string information for this tag - * @param taglib The instance of the tag library that contains us. - * @param tagExtraInfo The instance providing extra Tag info. May be null - * @param attributeInfo An array of AttributeInfo data from descriptor. - * May be null; - * @param displayName A short name to be displayed by tools - * @param smallIcon Path to a small icon to be displayed by tools - * @param largeIcon Path to a large icon to be displayed by tools - * @param tvi An array of a TagVariableInfo (or null) - */ - public TagInfo(String tagName, - String tagClassName, - String bodycontent, - String infoString, - TagLibraryInfo taglib, - TagExtraInfo tagExtraInfo, - TagAttributeInfo[] attributeInfo, - String displayName, - String smallIcon, - String largeIcon, - TagVariableInfo[] tvi) { - this.tagName = tagName; - this.tagClassName = tagClassName; - this.bodyContent = bodycontent; - this.infoString = infoString; - this.tagLibrary = taglib; - this.tagExtraInfo = tagExtraInfo; - this.attributeInfo = attributeInfo; - this.displayName = displayName; - this.smallIcon = smallIcon; - this.largeIcon = largeIcon; - this.tagVariableInfo = tvi; - - if (tagExtraInfo != null) - tagExtraInfo.setTagInfo(this); - } - - /** - * Constructor for TagInfo from data in the JSP 2.0 format for TLD. - * This class is to be instantiated only from the TagLibrary code - * under request from some JSP code that is parsing a - * TLD (Tag Library Descriptor). - * - * Note that, since TagLibibraryInfo reflects both TLD information - * and taglib directive information, a TagInfo instance is - * dependent on a taglib directive. This is probably a - * design error, which may be fixed in the future. - * - * @param tagName The name of this tag - * @param tagClassName The name of the tag handler class - * @param bodycontent Information on the body content of these tags - * @param infoString The (optional) string information for this tag - * @param taglib The instance of the tag library that contains us. - * @param tagExtraInfo The instance providing extra Tag info. May be null - * @param attributeInfo An array of AttributeInfo data from descriptor. - * May be null; - * @param displayName A short name to be displayed by tools - * @param smallIcon Path to a small icon to be displayed by tools - * @param largeIcon Path to a large icon to be displayed by tools - * @param tvi An array of a TagVariableInfo (or null) - * @param dynamicAttributes True if supports dynamic attributes - * - * @since JSP 2.0 - */ - public TagInfo(String tagName, - String tagClassName, - String bodycontent, - String infoString, - TagLibraryInfo taglib, - TagExtraInfo tagExtraInfo, - TagAttributeInfo[] attributeInfo, - String displayName, - String smallIcon, - String largeIcon, - TagVariableInfo[] tvi, - boolean dynamicAttributes) { - this.tagName = tagName; - this.tagClassName = tagClassName; - this.bodyContent = bodycontent; - this.infoString = infoString; - this.tagLibrary = taglib; - this.tagExtraInfo = tagExtraInfo; - this.attributeInfo = attributeInfo; - this.displayName = displayName; - this.smallIcon = smallIcon; - this.largeIcon = largeIcon; - this.tagVariableInfo = tvi; - this.dynamicAttributes = dynamicAttributes; - - if (tagExtraInfo != null) - tagExtraInfo.setTagInfo(this); - } - - /** - * The name of the Tag. - * - * @return The (short) name of the tag. - */ - - public String getTagName() { - return tagName; - } - - /** - * Attribute information (in the TLD) on this tag. - * The return is an array describing the attributes of this tag, as - * indicated in the TLD. - * - * @return The array of TagAttributeInfo for this tag, or a - * zero-length array if the tag has no attributes. - */ - - public TagAttributeInfo[] getAttributes() { - return attributeInfo; - } - - /** - * Information on the scripting objects created by this tag at runtime. - * This is a convenience method on the associated TagExtraInfo class. - * - * @param data TagData describing this action. - * @return if a TagExtraInfo object is associated with this TagInfo, the - * result of getTagExtraInfo().getVariableInfo( data ), otherwise - * null. - */ - public VariableInfo[] getVariableInfo(TagData data) { - VariableInfo[] result = null; - TagExtraInfo tei = getTagExtraInfo(); - if (tei != null) { - result = tei.getVariableInfo( data ); - } - return result; - } - - /** - * Translation-time validation of the attributes. - * This is a convenience method on the associated TagExtraInfo class. - * - * @param data The translation-time TagData instance. - * @return Whether the data is valid. - */ - public boolean isValid(TagData data) { - TagExtraInfo tei = getTagExtraInfo(); - if (tei == null) { - return true; - } - return tei.isValid(data); - } - - /** - * Translation-time validation of the attributes. - * This is a convenience method on the associated TagExtraInfo class. - * - * @param data The translation-time TagData instance. - * @return A null object, or zero length array if no errors, an - * array of ValidationMessages otherwise. - * @since JSP 2.0 - */ - public ValidationMessage[] validate( TagData data ) { - TagExtraInfo tei = getTagExtraInfo(); - if( tei == null ) { - return null; - } - return tei.validate( data ); - } - - /** - * Set the instance for extra tag information. - * - * @param tei the TagExtraInfo instance - */ - public void setTagExtraInfo(TagExtraInfo tei) { - tagExtraInfo = tei; - } - - - /** - * The instance (if any) for extra tag information. - * - * @return The TagExtraInfo instance, if any. - */ - public TagExtraInfo getTagExtraInfo() { - return tagExtraInfo; - } - - - /** - * Name of the class that provides the handler for this tag. - * - * @return The name of the tag handler class. - */ - - public String getTagClassName() { - return tagClassName; - } - - - /** - * The bodycontent information for this tag. - * If the bodycontent is not defined for this - * tag, the default of JSP will be returned. - * - * @return the body content string. - */ - - public String getBodyContent() { - return bodyContent; - } - - - /** - * The information string for the tag. - * - * @return the info string, or null if - * not defined - */ - - public String getInfoString() { - return infoString; - } - - - /** - * Set the TagLibraryInfo property. - * - * Note that a TagLibraryInfo element is dependent - * not just on the TLD information but also on the - * specific taglib instance used. This means that - * a fair amount of work needs to be done to construct - * and initialize TagLib objects. - * - * If used carefully, this setter can be used to avoid having to - * create new TagInfo elements for each taglib directive. - * - * @param tl the TagLibraryInfo to assign - */ - - public void setTagLibrary(TagLibraryInfo tl) { - tagLibrary = tl; - } - - /** - * The instance of TabLibraryInfo we belong to. - * - * @return the tag library instance we belong to - */ - - public TagLibraryInfo getTagLibrary() { - return tagLibrary; - } - - - // ============== JSP 2.0 TLD Information ======== - - - /** - * Get the displayName. - * - * @return A short name to be displayed by tools, - * or null if not defined - */ - - public String getDisplayName() { - return displayName; - } - - /** - * Get the path to the small icon. - * - * @return Path to a small icon to be displayed by tools, - * or null if not defined - */ - - public String getSmallIcon() { - return smallIcon; - } - - /** - * Get the path to the large icon. - * - * @return Path to a large icon to be displayed by tools, - * or null if not defined - */ - - public String getLargeIcon() { - return largeIcon; - } - - /** - * Get TagVariableInfo objects associated with this TagInfo. - * - * @return Array of TagVariableInfo objects corresponding to - * variables declared by this tag, or a zero length - * array if no variables have been declared - */ - - public TagVariableInfo[] getTagVariableInfos() { - return tagVariableInfo; - } - - - // ============== JSP 2.0 TLD Information ======== - - /** - * Get dynamicAttributes associated with this TagInfo. - * - * @return True if tag handler supports dynamic attributes - * @since JSP 2.0 - */ - public boolean hasDynamicAttributes() { - return dynamicAttributes; - } - - /* - * private fields for 1.1 info - */ - private String tagName; // the name of the tag - private String tagClassName; - private String bodyContent; - private String infoString; - private TagLibraryInfo tagLibrary; - private TagExtraInfo tagExtraInfo; // instance of TagExtraInfo - private TagAttributeInfo[] attributeInfo; - - /* - * private fields for 1.2 info - */ - private String displayName; - private String smallIcon; - private String largeIcon; - private TagVariableInfo[] tagVariableInfo; - - /* - * Additional private fields for 2.0 info - */ - private boolean dynamicAttributes; -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/TagLibraryInfo.java b/api/src/main/java/javax/servlet/jsp/tagext/TagLibraryInfo.java deleted file mode 100644 index d1a3394..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/TagLibraryInfo.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -import javax.servlet.jsp.tagext.TagInfo; -import javax.servlet.jsp.tagext.TagFileInfo; - -/** - * Translation-time information associated with a taglib directive, and its - * underlying TLD file. - * - * Most of the information is directly from the TLD, except for - * the prefix and the uri values used in the taglib directive - */ - -abstract public class TagLibraryInfo { - - /** - * Constructor. - * - * @param prefix the prefix actually used by the taglib directive - * @param uri the URI actually used by the taglib directive - */ - protected TagLibraryInfo(String prefix, String uri) { - this.prefix = prefix; - this.uri = uri; - } - - // ==== methods accessing taglib information ======= - - /** - * The value of the uri attribute from the taglib directive for - * this library. - * - * @return the value of the uri attribute - */ - - public String getURI() { - return uri; - } - - /** - * The prefix assigned to this taglib from the taglib directive - * - * @return the prefix assigned to this taglib from the taglib directive - */ - - public String getPrefixString() { - return prefix; - } - - // ==== methods using the TLD data ======= - - /** - * The preferred short name (prefix) as indicated in the TLD. - * This may be used by authoring tools as the preferred prefix - * to use when creating an taglib directive for this library. - * - * @return the preferred short name for the library - */ - public String getShortName() { - return shortname; - } - - /** - * The "reliable" URN indicated in the TLD (the uri element). - * This may be used by authoring tools as a global identifier - * to use when creating a taglib directive for this library. - * - * @return a reliable URN to a TLD like this - */ - public String getReliableURN() { - return urn; - } - - - /** - * Information (documentation) for this TLD. - * - * @return the info string for this tag lib - */ - - public String getInfoString() { - return info; - } - - - /** - * A string describing the required version of the JSP container. - * - * @return the (minimal) required version of the JSP container. - * @see javax.servlet.jsp.JspEngineInfo - */ - - public String getRequiredVersion() { - return jspversion; - } - - - /** - * An array describing the tags that are defined in this tag library. - * - * @return the TagInfo objects corresponding to the tags defined by this - * tag library, or a zero length array if this tag library - * defines no tags - */ - public TagInfo[] getTags() { - return tags; - } - - /** - * An array describing the tag files that are defined in this tag library. - * - * @return the TagFileInfo objects corresponding to the tag files defined - * by this tag library, or a zero length array if this - * tag library defines no tags files - * @since JSP 2.0 - */ - public TagFileInfo[] getTagFiles() { - return tagFiles; - } - - - /** - * Get the TagInfo for a given tag name, looking through all the - * tags in this tag library. - * - * @param shortname The short name (no prefix) of the tag - * @return the TagInfo for the tag with the specified short name, or - * null if no such tag is found - */ - - public TagInfo getTag(String shortname) { - TagInfo tags[] = getTags(); - - if (tags == null || tags.length == 0) { - return null; - } - - for (int i=0; i < tags.length; i++) { - if (tags[i].getTagName().equals(shortname)) { - return tags[i]; - } - } - return null; - } - - /** - * Get the TagFileInfo for a given tag name, looking through all the - * tag files in this tag library. - * - * @param shortname The short name (no prefix) of the tag - * @return the TagFileInfo for the specified Tag file, or null - * if no Tag file is found - * @since JSP 2.0 - */ - public TagFileInfo getTagFile(String shortname) { - TagFileInfo tagFiles[] = getTagFiles(); - - if (tagFiles == null || tagFiles.length == 0) { - return null; - } - - for (int i=0; i < tagFiles.length; i++) { - if (tagFiles[i].getName().equals(shortname)) { - return tagFiles[i]; - } - } - return null; - } - - /** - * An array describing the functions that are defined in this tag library. - * - * @return the functions defined in this tag library, or a zero - * length array if the tag library defines no functions. - * @since JSP 2.0 - */ - public FunctionInfo[] getFunctions() { - return functions; - } - - - /** - * Get the FunctionInfo for a given function name, looking through all the - * functions in this tag library. - * - * @param name The name (no prefix) of the function - * @return the FunctionInfo for the function with the given name, or null - * if no such function exists - * @since JSP 2.0 - */ - public FunctionInfo getFunction(String name) { - - if (functions == null || functions.length == 0) { - System.err.println("No functions"); - return null; - } - - for (int i=0; i < functions.length; i++) { - if (functions[i].getName().equals(name)) { - return functions[i]; - } - } - return null; - } - - - /** - * Returns an array of TagLibraryInfo objects representing the entire set - * of tag libraries (including this TagLibraryInfo) imported by taglib - * directives in the translation unit that references this - * TagLibraryInfo. - * - * If a tag library is imported more than once and bound to different - * prefices, only the TagLibraryInfo bound to the first prefix must be - * included in the returned array. - * - * @return Array of TagLibraryInfo objects representing the entire set - * of tag libraries (including this TagLibraryInfo) imported by taglib - * directives in the translation unit that references this TagLibraryInfo. - * - * @since JSP 2.1 - */ - public abstract TagLibraryInfo[] getTagLibraryInfos(); - - - // Protected fields - - /** - * The prefix assigned to this taglib from the taglib directive. - */ - protected String prefix; - - /** - * The value of the uri attribute from the taglib directive for - * this library. - */ - protected String uri; - - /** - * An array describing the tags that are defined in this tag library. - */ - protected TagInfo[] tags; - - /** - * An array describing the tag files that are defined in this tag library. - * - * @since JSP 2.0 - */ - protected TagFileInfo[] tagFiles; - - /** - * An array describing the functions that are defined in this tag library. - * - * @since JSP 2.0 - */ - protected FunctionInfo[] functions; - - // Tag Library Data - - /** - * The version of the tag library. - */ - protected String tlibversion; // required - - /** - * The version of the JSP specification this tag library is written to. - */ - protected String jspversion; // required - - /** - * The preferred short name (prefix) as indicated in the TLD. - */ - protected String shortname; // required - - /** - * The "reliable" URN indicated in the TLD. - */ - protected String urn; // required - - /** - * Information (documentation) for this TLD. - */ - protected String info; // optional -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/TagLibraryValidator.java b/api/src/main/java/javax/servlet/jsp/tagext/TagLibraryValidator.java deleted file mode 100644 index 7c4926d..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/TagLibraryValidator.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -import java.util.Map; - -/** - * Translation-time validator class for a JSP page. - * A validator operates on the XML view associated with the JSP page. - * - *

    - * The TLD file associates a TagLibraryValidator class and some init - * arguments with a tag library. - * - *

    - * The JSP container is reponsible for locating an appropriate - * instance of the appropriate subclass by - * - *

      - *
    • new a fresh instance, or reuse an available one - *
    • invoke the setInitParams(Map) method on the instance - *
    - * - * once initialized, the validate(String, String, PageData) method will - * be invoked, where the first two arguments are the prefix - * and uri for this tag library in the XML View. The prefix is intended - * to make it easier to produce an error message. However, it is not - * always accurate. In the case where a single URI is mapped to more - * than one prefix in the XML view, the prefix of the first URI is provided. - * Therefore, to provide high quality error messages in cases where the - * tag elements themselves are checked, the prefix parameter should be - * ignored and the actual prefix of the element should be used instead. - * TagLibraryValidators should always use the uri to identify elements - * as beloning to the tag library, not the prefix. - * - *

    - * A TagLibraryValidator instance - * may create auxiliary objects internally to perform - * the validation (e.g. an XSchema validator) and may reuse it for all - * the pages in a given translation run. - * - *

    - * The JSP container is not guaranteed to serialize invocations of - * validate() method, and TagLibraryValidators should perform any - * synchronization they may require. - * - *

    - * As of JSP 2.0, a JSP container must provide a jsp:id attribute to - * provide higher quality validation errors. - * The container will track the JSP pages - * as passed to the container, and will assign to each element - * a unique "id", which is passed as the value of the jsp:id - * attribute. Each XML element in the XML view available will - * be extended with this attribute. The TagLibraryValidator - * can then use the attribute in one or more ValidationMessage - * objects. The container then, in turn, can use these - * values to provide more precise information on the location - * of an error. - * - *

    - * The actual prefix of the id attribute may or may not be - * jsp but it will always map to the namespace - * http://java.sun.com/JSP/Page. A TagLibraryValidator - * implementation must rely on the uri, not the prefix, of the id - * attribute. - */ - -abstract public class TagLibraryValidator { - - /** - * Sole constructor. (For invocation by subclass constructors, - * typically implicit.) - */ - public TagLibraryValidator() { - } - - /** - * Set the init data in the TLD for this validator. - * Parameter names are keys, and parameter values are the values. - * - * @param map A Map describing the init parameters - */ - public void setInitParameters(Map map) { - initParameters = map; - } - - - /** - * Get the init parameters data as an immutable Map. - * Parameter names are keys, and parameter values are the values. - * - * @return The init parameters as an immutable map. - */ - public Map getInitParameters() { - return initParameters; - } - - /** - * Validate a JSP page. - * This will get invoked once per unique tag library URI in the - * XML view. This method will return null if the page is valid; otherwise - * the method should return an array of ValidationMessage objects. - * An array of length zero is also interpreted as no errors. - * - * @param prefix the first prefix with which the tag library is - * associated, in the XML view. Note that some tags may use - * a different prefix if the namespace is redefined. - * @param uri the tag library's unique identifier - * @param page the JspData page object - * @return A null object, or zero length array if no errors, an array - * of ValidationMessages otherwise. - */ - public ValidationMessage[] validate(String prefix, String uri, - PageData page) - { - return null; - } - - /** - * Release any data kept by this instance for validation purposes. - */ - public void release() { - } - - // Private data - private Map initParameters; - -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/TagSupport.java b/api/src/main/java/javax/servlet/jsp/tagext/TagSupport.java deleted file mode 100644 index 2ec522a..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/TagSupport.java +++ /dev/null @@ -1,340 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -import java.io.Serializable; -import java.util.Enumeration; -import java.util.Hashtable; - -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.PageContext; - -/** - * A base class for defining new tag handlers implementing Tag. - * - *

    The TagSupport class is a utility class intended to be used as - * the base class for new tag handlers. The TagSupport class - * implements the Tag and IterationTag interfaces and adds additional - * convenience methods including getter methods for the properties in - * Tag. TagSupport has one static method that is included to - * facilitate coordination among cooperating tags. - * - *

    Many tag handlers will extend TagSupport and only redefine a - * few methods. - */ - -public class TagSupport implements IterationTag, Serializable { - - /** - * Find the instance of a given class type that is closest to a given - * instance. - * This method uses the getParent method from the Tag - * interface. - * This method is used for coordination among cooperating tags. - * - *

    - * The current version of the specification only provides one formal - * way of indicating the observable type of a tag handler: its - * tag handler implementation class, described in the tag-class - * subelement of the tag element. This is extended in an - * informal manner by allowing the tag library author to - * indicate in the description subelement an observable type. - * The type should be a subtype of the tag handler implementation - * class or void. - * This addititional constraint can be exploited by a - * specialized container that knows about that specific tag library, - * as in the case of the JSP standard tag library. - * - *

    - * When a tag library author provides information on the - * observable type of a tag handler, client programmatic code - * should adhere to that constraint. Specifically, the Class - * passed to findAncestorWithClass should be a subtype of the - * observable type. - * - * - * @param from The instance from where to start looking. - * @param klass The subclass of Tag or interface to be matched - * @return the nearest ancestor that implements the interface - * or is an instance of the class specified - */ - - // The type for klass should be Class. Unfortunately, fixing that is - // a change in the API signature, which cannot be modified without a spec - // change - @SuppressWarnings("unchecked") - public static final Tag findAncestorWithClass(Tag from, Class klass) { - boolean isInterface = false; - - if (from == null || - klass == null || - (!Tag.class.isAssignableFrom(klass) && - !(isInterface = klass.isInterface()))) { - return null; - } - - for (;;) { - Tag tag = from.getParent(); - - if (tag == null) { - return null; - } - - if ((isInterface && klass.isInstance(tag)) || - klass.isAssignableFrom(tag.getClass())) - return tag; - else - from = tag; - } - } - - /** - * Default constructor, all subclasses are required to define only - * a public constructor with the same signature, and to call the - * superclass constructor. - * - * This constructor is called by the code generated by the JSP - * translator. - */ - - public TagSupport() { } - - /** - * Default processing of the start tag, returning SKIP_BODY. - * - * @return SKIP_BODY - * @throws JspException if an error occurs while processing this tag - * - * @see Tag#doStartTag() - */ - - public int doStartTag() throws JspException { - return SKIP_BODY; - } - - /** - * Default processing of the end tag returning EVAL_PAGE. - * - * @return EVAL_PAGE - * @throws JspException if an error occurs while processing this tag - * - * @see Tag#doEndTag() - */ - - public int doEndTag() throws JspException { - return EVAL_PAGE; - } - - - /** - * Default processing for a body. - * - * @return SKIP_BODY - * @throws JspException if an error occurs while processing this tag - * - * @see IterationTag#doAfterBody() - */ - - public int doAfterBody() throws JspException { - return SKIP_BODY; - } - - // Actions related to body evaluation - - - /** - * Release state. - * - * @see Tag#release() - */ - - public void release() { - parent = null; - id = null; - if( values != null ) { - values.clear(); - } - values = null; - } - - /** - * Set the nesting tag of this tag. - * - * @param t The parent Tag. - * @see Tag#setParent(Tag) - */ - - public void setParent(Tag t) { - parent = t; - } - - /** - * The Tag instance most closely enclosing this tag instance. - * @see Tag#getParent() - * - * @return the parent tag instance or null - */ - - public Tag getParent() { - return parent; - } - - /** - * Set the id attribute for this tag. - * - * @param id The String for the id. - */ - - public void setId(String id) { - this.id = id; - } - - /** - * The value of the id attribute of this tag; or null. - * - * @return the value of the id attribute, or null - */ - - public String getId() { - return id; - } - - /** - * Set the page context. - * - * @param pageContext The PageContext. - * @see Tag#setPageContext - */ - - public void setPageContext(PageContext pageContext) { - this.pageContext = pageContext; - } - - /** - * Associate a value with a String key. - * - * @param k The key String. - * @param o The value to associate. - */ - - public void setValue(String k, Object o) { - if (values == null) { - values = new Hashtable(); - } - values.put(k, o); - } - - /** - * Get a the value associated with a key. - * - * @param k The string key. - * @return The value associated with the key, or null. - */ - - public Object getValue(String k) { - if (values == null) { - return null; - } else { - return values.get(k); - } - } - - /** - * Remove a value associated with a key. - * - * @param k The string key. - */ - - public void removeValue(String k) { - if (values != null) { - values.remove(k); - } - } - - /** - * Enumerate the keys for the values kept by this tag handler. - * - * @return An enumeration of all the keys for the values set, - * or null or an empty Enumeration if no values have been set. - */ - - public Enumeration getValues() { - if (values == null) { - return null; - } - return values.keys(); - } - - // private fields - - private Tag parent; - private Hashtable values; - /** - * The value of the id attribute of this tag; or null. - */ - protected String id; - - // protected fields - - /** - * The PageContext. - */ - protected PageContext pageContext; -} - diff --git a/api/src/main/java/javax/servlet/jsp/tagext/TagVariableInfo.java b/api/src/main/java/javax/servlet/jsp/tagext/TagVariableInfo.java deleted file mode 100644 index 4b27772..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/TagVariableInfo.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -/** - * Variable information for a tag in a Tag Library; - * This class is instantiated from the Tag Library Descriptor file (TLD) - * and is available only at translation time. - * - * This object should be immutable. - * - * This information is only available in JSP 1.2 format TLDs or above. - */ - -public class TagVariableInfo { - - /** - * Constructor for TagVariableInfo. - * - * @param nameGiven value of <name-given> - * @param nameFromAttribute value of <name-from-attribute> - * @param className value of <variable-class> - * @param declare value of <declare> - * @param scope value of <scope> - */ - public TagVariableInfo( - String nameGiven, - String nameFromAttribute, - String className, - boolean declare, - int scope) { - this.nameGiven = nameGiven; - this.nameFromAttribute = nameFromAttribute; - this.className = className; - this.declare = declare; - this.scope = scope; - } - - /** - * The body of the <name-given> element. - * - * @return The variable name as a constant - */ - - public String getNameGiven() { - return nameGiven; - } - - /** - * The body of the <name-from-attribute> element. - * This is the name of an attribute whose (translation-time) - * value will give the name of the variable. One of - * <name-given> or <name-from-attribute> is required. - * - * @return The attribute whose value defines the variable name - */ - - public String getNameFromAttribute() { - return nameFromAttribute; - } - - /** - * The body of the <variable-class> element. - * - * @return The name of the class of the variable or - * 'java.lang.String' if not defined in the TLD. - */ - - public String getClassName() { - return className; - } - - /** - * The body of the <declare> element. - * - * @return Whether the variable is to be declared or not. - * If not defined in the TLD, 'true' will be returned. - */ - - public boolean getDeclare() { - return declare; - } - - /** - * The body of the <scope> element. - * - * @return The scope to give the variable. NESTED - * scope will be returned if not defined in - * the TLD. - */ - - public int getScope() { - return scope; - } - - - /* - * private fields - */ - private String nameGiven; // - private String nameFromAttribute; // - private String className; // - private boolean declare; // - private int scope; // -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/TryCatchFinally.java b/api/src/main/java/javax/servlet/jsp/tagext/TryCatchFinally.java deleted file mode 100644 index a49f0b2..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/TryCatchFinally.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - - - -/** - * The auxiliary interface of a Tag, IterationTag or BodyTag tag - * handler that wants additional hooks for managing resources. - * - *

    This interface provides two new methods: doCatch(Throwable) - * and doFinally(). The prototypical invocation is as follows: - * - *

    - * h = get a Tag();  // get a tag handler, perhaps from pool
    - *
    - * h.setPageContext(pc);  // initialize as desired
    - * h.setParent(null);
    - * h.setFoo("foo");
    - * 
    - * // tag invocation protocol; see Tag.java
    - * try {
    - *   doStartTag()...
    - *   ....
    - *   doEndTag()...
    - * } catch (Throwable t) {
    - *   // react to exceptional condition
    - *   h.doCatch(t);
    - * } finally {
    - *   // restore data invariants and release per-invocation resources
    - *   h.doFinally();
    - * }
    - * 
    - * ... other invocations perhaps with some new setters
    - * ...
    - * h.release();  // release long-term resources
    - * 
    - */ - -public interface TryCatchFinally { - - /** - * Invoked if a Throwable occurs while evaluating the BODY - * inside a tag or in any of the following methods: - * Tag.doStartTag(), Tag.doEndTag(), - * IterationTag.doAfterBody() and BodyTag.doInitBody(). - * - *

    This method is not invoked if the Throwable occurs during - * one of the setter methods. - * - *

    This method may throw an exception (the same or a new one) - * that will be propagated further up the nest chain. If an exception - * is thrown, doFinally() will be invoked. - * - *

    This method is intended to be used to respond to an exceptional - * condition. - * - * @param t The throwable exception navigating through this tag. - * @throws Throwable if the exception is to be rethrown further up - * the nest chain. - */ - - void doCatch(Throwable t) throws Throwable; - - /** - * Invoked in all cases after doEndTag() for any class implementing - * Tag, IterationTag or BodyTag. This method is invoked even if - * an exception has occurred in the BODY of the tag, - * or in any of the following methods: - * Tag.doStartTag(), Tag.doEndTag(), - * IterationTag.doAfterBody() and BodyTag.doInitBody(). - * - *

    This method is not invoked if the Throwable occurs during - * one of the setter methods. - * - *

    This method should not throw an Exception. - * - *

    This method is intended to maintain per-invocation data - * integrity and resource management actions. - */ - - void doFinally(); -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/ValidationMessage.java b/api/src/main/java/javax/servlet/jsp/tagext/ValidationMessage.java deleted file mode 100644 index 4ca1bbb..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/ValidationMessage.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - - -/** - * A validation message from either TagLibraryValidator or TagExtraInfo. - *

    - * As of JSP 2.0, a JSP container must support a jsp:id attribute - * to provide higher quality validation errors. - * The container will track the JSP pages - * as passed to the container, and will assign to each element - * a unique "id", which is passed as the value of the jsp:id - * attribute. Each XML element in the XML view available will - * be extended with this attribute. The TagLibraryValidator - * can then use the attribute in one or more ValidationMessage - * objects. The container then, in turn, can use these - * values to provide more precise information on the location - * of an error. - * - *

    - * The actual prefix of the id attribute may or may not be - * jsp but it will always map to the namespace - * http://java.sun.com/JSP/Page. A TagLibraryValidator - * implementation must rely on the uri, not the prefix, of the id - * attribute. - */ - -public class ValidationMessage { - - /** - * Create a ValidationMessage. The message String should be - * non-null. The value of id may be null, if the message - * is not specific to any XML element, or if no jsp:id - * attributes were passed on. If non-null, the value of - * id must be the value of a jsp:id attribute for the PageData - * passed into the validate() method. - * - * @param id Either null, or the value of a jsp:id attribute. - * @param message A localized validation message. - */ - public ValidationMessage(String id, String message) { - this.id = id; - this.message = message; - } - - - /** - * Get the jsp:id. - * Null means that there is no information available. - * - * @return The jsp:id information. - */ - public String getId() { - return id; - } - - /** - * Get the localized validation message. - * - * @return A validation message - */ - public String getMessage(){ - return message; - } - - // Private data - private String id; - private String message; -} diff --git a/api/src/main/java/javax/servlet/jsp/tagext/VariableInfo.java b/api/src/main/java/javax/servlet/jsp/tagext/VariableInfo.java deleted file mode 100644 index dcb7720..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/VariableInfo.java +++ /dev/null @@ -1,322 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package javax.servlet.jsp.tagext; - -/** - * Information on the scripting variables that are created/modified by - * a tag (at run-time). This information is provided by TagExtraInfo - * classes and it is used by the translation phase of JSP. - * - *

    - * Scripting variables generated by a custom action have an associated - * scope of either AT_BEGIN, NESTED, or AT_END. - * - *

    - * The class name (VariableInfo.getClassName) in the returned objects - * is used to determine the types of the scripting variables. - * Note that because scripting variables are assigned their values - * from scoped attributes which cannot be of primitive types, - * "boxed" types such as java.lang.Integer must - * be used instead of primitives. - * - *

    - * The class name may be a Fully Qualified Class Name, or a short - * class name. - * - *

    - * If a Fully Qualified Class Name is provided, it should refer to a - * class that should be in the CLASSPATH for the Web Application (see - * Servlet 2.4 specification - essentially it is WEB-INF/lib and - * WEB-INF/classes). Failure to be so will lead to a translation-time - * error. - * - *

    - * If a short class name is given in the VariableInfo objects, then - * the class name must be that of a public class in the context of the - * import directives of the page where the custom action appears. - * The class must also be in the CLASSPATH for the Web Application - * (see Servlet 2.4 specification - essentially it is WEB-INF/lib and - * WEB-INF/classes). Failure to be so will lead to a translation-time - * error. - * - *

    Usage Comments - *

    - * Frequently a fully qualified class name will refer to a class that - * is known to the tag library and thus, delivered in the same JAR - * file as the tag handlers. In most other remaining cases it will - * refer to a class that is in the platform on which the JSP processor - * is built (like Java EE). Using fully qualified class names in this - * manner makes the usage relatively resistant to configuration - * errors. - * - *

    - * A short name is usually generated by the tag library based on some - * attributes passed through from the custom action user (the author), - * and it is thus less robust: for instance a missing import directive - * in the referring JSP page will lead to an invalid short name class - * and a translation error. - * - *

    Synchronization Protocol - * - *

    - * The result of the invocation on getVariableInfo is an array of - * VariableInfo objects. Each such object describes a scripting - * variable by providing its name, its type, whether the variable is - * new or not, and what its scope is. Scope is best described through - * a picture: - * - *

    - * NESTED, AT_BEGIN and AT_END Variable Scopes - * - *

    - * The JSP 2.0 specification defines the interpretation of 3 values: - * - *

      - *
    • NESTED, if the scripting variable is available between - * the start tag and the end tag of the action that defines it. - *
    • - * AT_BEGIN, if the scripting variable is available from the start tag - * of the action that defines it until the end of the scope. - *
    • AT_END, if the scripting variable is available after the end tag - * of the action that defines it until the end of the scope. - *
    - * - * The scope value for a variable implies what methods may affect its - * value and thus where synchronization is needed as illustrated by - * the table below. Note: the synchronization of the variable(s) - * will occur after the respective method has been called. - * - *
    - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    Variable Synchronization - * Points
    - *
     doStartTag()doInitBody()doAfterBody()doEndTag()doTag()
    Tag
    - *
    AT_BEGIN, NESTED
    - *

    - *

    - *
    AT_BEGIN, AT_END
    - *

    - *
    IterationTag
    - *
    AT_BEGIN, NESTED
    - *

    - *
    AT_BEGIN, NESTED
    - *
    AT_BEGIN, AT_END
    - *

    - *
    BodyTag
    - *
    AT_BEGIN, NESTED1
    - *
    AT_BEGIN, NESTED1
    - *
    AT_BEGIN, NESTED
    - *
    AT_BEGIN, AT_END
    - *

    - *
    SimpleTag
    - *

    - *

    - *

    - *

    - *
    AT_BEGIN, AT_END
    - *
    - * 1 Called after doStartTag() if - * EVAL_BODY_INCLUDE is returned, or after - * doInitBody() otherwise. - *
    - * - *

    Variable Information in the TLD - *

    - * Scripting variable information can also be encoded directly for most cases - * into the Tag Library Descriptor using the <variable> subelement of the - * <tag> element. See the JSP specification. - */ - -public class VariableInfo { - - /** - * Scope information that scripting variable is visible only within the - * start/end tags. - */ - public static final int NESTED = 0; - - /** - * Scope information that scripting variable is visible after start tag. - */ - public static final int AT_BEGIN = 1; - - /** - * Scope information that scripting variable is visible after end tag. - */ - public static final int AT_END = 2; - - - /** - * Constructor - * These objects can be created (at translation time) by the TagExtraInfo - * instances. - * - * @param varName The name of the scripting variable - * @param className The type of this variable - * @param declare If true, it is a new variable (in some languages this will - * require a declaration) - * @param scope Indication on the lexical scope of the variable - */ - - public VariableInfo(String varName, - String className, - boolean declare, - int scope) { - this.varName = varName; - this.className = className; - this.declare = declare; - this.scope = scope; - } - - // Accessor methods - - /** - * Returns the name of the scripting variable. - * - * @return the name of the scripting variable - */ - public String getVarName() { - return varName; - } - - /** - * Returns the type of this variable. - * - * @return the type of this variable - */ - public String getClassName() { - return className; - } - - /** - * Returns whether this is a new variable. - * If so, in some languages this will require a declaration. - * - * @return whether this is a new variable. - */ - public boolean getDeclare() { - return declare; - } - - /** - * Returns the lexical scope of the variable. - * - * @return the lexical scope of the variable, either AT_BEGIN, AT_END, - * or NESTED. - * @see #AT_BEGIN - * @see #AT_END - * @see #NESTED - */ - public int getScope() { - return scope; - } - - - // == private data - private String varName; - private String className; - private boolean declare; - private int scope; -} - diff --git a/api/src/main/java/javax/servlet/jsp/tagext/doc-files/BodyTagProtocol.gif b/api/src/main/java/javax/servlet/jsp/tagext/doc-files/BodyTagProtocol.gif deleted file mode 100644 index a61e82b..0000000 Binary files a/api/src/main/java/javax/servlet/jsp/tagext/doc-files/BodyTagProtocol.gif and /dev/null differ diff --git a/api/src/main/java/javax/servlet/jsp/tagext/doc-files/IterationTagProtocol.gif b/api/src/main/java/javax/servlet/jsp/tagext/doc-files/IterationTagProtocol.gif deleted file mode 100644 index c262341..0000000 Binary files a/api/src/main/java/javax/servlet/jsp/tagext/doc-files/IterationTagProtocol.gif and /dev/null differ diff --git a/api/src/main/java/javax/servlet/jsp/tagext/doc-files/TagProtocol.gif b/api/src/main/java/javax/servlet/jsp/tagext/doc-files/TagProtocol.gif deleted file mode 100644 index 9a1880e..0000000 Binary files a/api/src/main/java/javax/servlet/jsp/tagext/doc-files/TagProtocol.gif and /dev/null differ diff --git a/api/src/main/java/javax/servlet/jsp/tagext/doc-files/VariableInfo-1.gif b/api/src/main/java/javax/servlet/jsp/tagext/doc-files/VariableInfo-1.gif deleted file mode 100644 index 32eabeb..0000000 Binary files a/api/src/main/java/javax/servlet/jsp/tagext/doc-files/VariableInfo-1.gif and /dev/null differ diff --git a/api/src/main/java/javax/servlet/jsp/tagext/package.html b/api/src/main/java/javax/servlet/jsp/tagext/package.html deleted file mode 100644 index c149313..0000000 --- a/api/src/main/java/javax/servlet/jsp/tagext/package.html +++ /dev/null @@ -1,1460 +0,0 @@ - - - - - - - - -Classes and interfaces for the definition of JavaServer Pages Tag Libraries. - -

    Custom actions can be used by JSP authors and authoring tools to -simplify writing JSP pages. A custom action can be either an empty -or a non-empty action. - -

    -An empty tag has no body. There are two equivalent syntaxes, one -with separate start and end tags, and one where the start and -end tags are combined. The two following examples are identical: -

    -
    - -
    -<x:foo att="myObject"></foo>
    -<x:foo att="myObject"/>
    -
    -
    -
    - -

    -A non-empty tag has a start tag, a body, and an end tag. A -prototypical example is of the form: -

    -
    - -
    -<x:foo att="myObject" >
    -  BODY
    -</x:foo/>
    -
    -
    -
    - - -

    -The JavaServer Pages(tm) (JSP) specification provides a portable -mechanism for the description of tag libraries. -

    -A JSP tag library contains -

      -
    • A Tag Library Descriptor
    • -
    • A number of Tag Files or Tag handler classes defining - request-time behavior
    • -
    • Additional classes and resources used at runtime
    • -
    • Possibly some additional classes to provide extra translation - information
    • -
    - -

    This API is described in the following sections: -

      -
    1. Classic Tag Handlers
    2. -
    3. Tag Handlers that want to access their Body Content
    4. -
    5. Dynamic Attributes
    6. -
    7. Annotated Tag Handler Management Example
    8. -
    9. Cooperating Actions
    10. -
    11. Simple Tag Handlers
    12. -
    13. JSP Fragments
    14. -
    15. Example Simple Tag Handler Scenario
    16. -
    17. Translation-time Classes
    18. -
    - - -

    1. Classic Tag Handlers

    -
    -This section introduces the notion of a tag handler and describes the -classic types of tag handler. - -

    JSP 2.0 introduces a new type of Tag Handler called a Simple -Tag Handler, which is described in a later section. -The protocol for Simple Tag handlers is much more straightforward. - -

    Tag Handler

    - -

    A tag handler is a run-time, container-managed object that -evaluates custom actions during the execution of a JSP page. A tag -handler supports a protocol that allows the JSP container to provide -good integration of the server-side actions within a JSP page. - -

    A tag handler is created initially using a zero argument -constructor on its corresponding class; the method -java.beans.Beans.instantiate() is not used. - -

    A tag handler has some properties that are exposed to the page as -attributes on an action; these properties are managed by the JSP -container (via generated code). The setter methods used to set -the properties are discovered using the JavaBeans introspector -machinery. - -

    The protocol supported by a tag handler provides for passing of -parameters, the evaluation and reevaluation of the body of the action, -and for getting access to objects and other tag handlers in the -JSP page. - -

    A tag handler instance is responsible for processing one request -at a time. It is the responsability of the JSP container to enforce -this. - -

    Additional translation time information associated with the action -indicates the name of any scripting variables it may introduce, their -types and their scope. At specific moments, the JSP container will -automatically synchronize the {@link javax.servlet.jsp.PageContext} - information with variables -in the scripting language so they can be made available directly -through the scripting elements. - - -

    Properties

    - - -

    A tag handler has some properties. All tag handlers have a -pageContext property for the JSP page where the tag is -located, and a parent property for the tag handler to the -closest enclosing action. Specific tag handler classes may have -additional properties. - -

    All attributes of a custom action must be JavaBeans component -properties, although some properties may not be exposed as attributes. -The attributes that are visible to the JSP translator are exactly -those listed in the Tag Library Descriptor (TLD). - -

    All properties of a tag handler instance exposed as attributes -will be initialized by the container using the appropriate setter -methods before the instance can be used to perform the action methods. -It is the responsibility of the JSP container to invoke the -appropriate setter methods to initialize these properties. It is the -responsability of user code, be it scriptlets, JavaBeans code, or code -inside custom tags, to not invoke these setter methods, as doing -otherwise would interfere with the container knowledge. - -

    The setter methods that should be used when assigning a value to -an attribute of a custom action are determined by using the JavaBeans -introspector on the tag handler class, then use the setter method -associated with the property that has the same name as the attribute -in question. An implication (unclear in the JavaBeans specification) -is that there is only one setter per property. - -

    Unspecified attributes/properties should not be set (using a -setter method). - -

    Once properly set, all properties are expected to be persistent, -so that if the JSP container ascertains that a property has already -been set on a given tag handler instance, it must not set it -again. - -

    The JSP container may reuse classic tag handler instances for multiple -occurrences of the corresponding custom action, in the same page or in -different pages, but only if the same set of attributes are used for all -occurrences. If a tag handler is used for more than one occurence, the -container must reset all attributes where the values differ between the -custom action occurrences. Attributes with the same value in all -occurrences must not be reset. If an attribute value is set as a -request-time attribute value (using a scripting or an EL expression), -the container must reset the attribute between all reuses of the tag -handler instance. To prevent confusion, a tag handler with an empty body -must not reuse any previous tag handler with a non-empty body. - -

    User code can access property information and access and modify -tag handler internal state starting with the first action method (doStartTag) -up until the last action method (doEndTag or doFinally for tag handlers -implementing TryCatchFinally). - - -

    Tag Handler as a Container-Managed Object

    - -

    Since a tag handler is a container managed object, the container -needs to maintain its references; specifically, user code should not -keep references to a tag handler except between the start of the first -action method (doStartTag()) and the end of the last action method -(doEndTag() or doFinally() for those tags that implement TryCatchFinally). - -

    The restrictions on references to tag handler objects and -on modifying attribute properties gives the JSP container substantial -freedom in effectively managing tag handler objects to achieve different -goals. For example, a container may implementing different pooling strategies -to minimize creation cost, or may hoist setting of properties to reduce -cost when a tag handler is inside another iterative tag. - - -

    Conversions

    - -

    A tag handler implements an action; the JSP container must follow -the type conversions described in Section 2.13.2 when assigning values -to the attributes of an action. - -

    Empty and Non-Empty Actions

    - -An empty action has no body; it may use one of two syntaxes: either -<foo/> or <foo></foo>. Since empty actions have no -body the methods related to body manipulation are not invoked. -There is a mechanism in the Tag Library Descriptor to indicate -that a tag can only be used to write empty actions; when used, -non-empty actions using that tag will produce a translation error. - -

    -A non-empty action has a body. - - -

    The Tag Interface

    - - -

    A Tag handler that does not want to process its body can implement -just the Tag interface. A tag handler may not want to process its -body because it is an empty tag or because the body is just to -be "passed through". - -

    The Tag interface includes methods to provide page context -information to the Tag Handler instance, methods to handle the -life-cycle of tag handlers, and two main methods for performing -actions on a tag: doStartTag() and -doEndTag(). The method doStartTag() is -invoked when encountering the start tag and its return value indicates -whether the body (if there is any) should be skipped, or evaluated and -passed through to the current response stream. The method -doEndTag() is invoked when encountering the end tag; its -return value indicates whether the rest of the page should continue to -be evaluated or not. - -

    If an exception is encountered during the evaluation of the -body of a tag, its doEndTag method will not be evaluated. See the -TryCatchFinally tag for methods that are guaranteed to be evaluated. - - -

    The IterationTag Interface

    - - -

    The IterationTag interface is used to repeatedly reevaluate -the body of a custom action. The interface has one method: -doAfterBody() which is invoked after each evaluation -of the body to determine whether to reevaluate or not. - -

    Reevaluation is requested with the value 2, which in JSP 1.1 is -defined to be BodyTag.EVAL_BODY_TAG. That constant value is still -kept in JSP 1.2 (for full backwards compatibility) but, to improve -clarity, a new name is also available: IterationTag.EVAL_BODY_AGAIN. -To stop iterating, the returned value should be 0, which is -Tag.SKIP_BODY. - -

    The JspIdConsumer Interface

    -This interface indicates to the container that a tag handler wishes -to be provided with a compiler generated ID that is unique -within the page. - -

    The TagSupport Base Class

    - -

    The TagSupport class is a base class that can be used when -implementing the Tag or IterationTag interfaces. - - - -

    2. Tag Handlers that want Access to their Body Content

    - - -

    The evaluation of a body is delivered into a BodyContent -object. This is then made available to tag handlers that implement -the BodyTag interface. The BodyTagSupport -class provides a useful base class to simplify writing these handlers. - - -

    If a Tag handler wants to have access to the content of its body -then it must implement the BodyTag interface. - -This interface extends IterationTag, provides two additional methods -setBodyContent(BodyContent) and -doInitBody() -and refers to an object of type BodyContent. - -

    A BodyContent is a subclass of JspWriter that has a -few additional methods to convert its contents into a String, insert -the contents into another JspWriter, to get a Reader into its -contents, and to clear the contents. Its semantics also assure that -buffer size will never be exceeded. - -

    The JSP page implementation will create a BodyContent if the -doStartTag() method returns a EVAL_BODY_BUFFERED. This object will be -passed to doInitBody(); then the body of the tag will be evaluated, -and during that evaluation out will be bound to the -BodyContent just passed to the BodyTag handler. Then -doAfterBody() will be evaluated. If that method returns SKIP_BODY, no -more evaluations of the body will be done; if the method returns -EVAL_BODY_AGAIN, then the body will be evaluated, and doAfterBody() will -be invoked again. - -

    The content of a BodyContent instance remains available until after -the invocation of its associated doEndTag() method. - -

    A common use of the BodyContent is to extract its contents into a -String and then use the String as a value for some operation. Another -common use is to take its contents and push it into the out Stream -that was valid when the start tag was encountered (that is available -from the PageContext object passed to the handler in setPageContext). - - - -

    3. Dynamic Attributes

    - - -

    Any tag handler can optionally extend the DynamicAttributes -interface to indicate that it supports dynamic attributes. In addition -to implementing the DynamicAttributes interface, tag -handlers that support dynamic attributes must declare that they do so in -the Tag Library Descriptor.

    - -

    The TLD is what ultimately determines whether a tag handler accepts -dynamic attributes or not. If a tag handler declares that it supports -dynamic attributes in the TLD but it does not implement the -DynamicAttributes interface, the tag handler must be -considered invalid by the container.

    - -

    If the dynamic-attributes element for a tag being invoked contains -the value "true", the following requirements apply:

    - -
      -
    • For each attribute specified in the tag invocation that does not - have a corresponding attribute element in the TLD for this tag, - a call must be made to setDynamicAttribute(), - passing in the namespace of the attribute (or null if the attribute - does not have a namespace or prefix), the name of the attribute without - the namespace prefix, and the final value of the attribute.
    • - -
    • Dynamic attributes must be considered to accept request-time - expression values as well as deferred expressions.
    • - -
    • Dynamic attributes must be treated as though they were of type - java.lang.Object. If a ValueExpression - is passed as a dynamic attribute, the default value for the expected - return type is assumed to be java.lang.Object. If a - MethodExpression is passed as a dynamic - attribute, the default method signature is assumed to be void - method().
    • - -
    • Note that passing a String literal as a dynamic attribute will never - be considered as a deferred expression.
    • - -
    • The JSP container must recognize dynamic attributes that are - passed to the tag handler using the <jsp:attribute> standard - action.
    • - -
    • If the setDynamicAttribute() method throws - JspException, the doStartTag() or - doTag() method is not invoked for this tag, and the - exception must be treated in the same manner as if it came from - a regular attribute setter method.
    • - -
    • For a JSP document in either standard or XML syntax, If a - dynamic attribute has a prefix that doesn't map to a - namespace, a translation error must occur. In standard - syntax, only namespaces defined using taglib directives are - recognized.
    • - -
    - -

    In the following example, assume attributes a and b are declared -using the attribute element in the TLD, attributes d1 and d2 are not -declared, and the dynamic-attributes element is set to "true". -The attributes are set using the calls: -

      -
    • setA( "1" ),
    • -
    • setDynamicAttribute( null, "d1", "2" ),
    • -
    • setDynamicAttribute( "http://www.foo.com/jsp/taglib/mytag.tld", "d2", "3" ),
    • -
    • setB( "4" ),
    • -
    • setDynamicAttribute( null, "d3", "5" ), and
    • -
    • setDynamicAttribute( "http://www.foo.com/jsp/taglib/mytag.tld", "d4", "6" ).
    • -
    - -
    -<jsp:root xmlns:mytag="http://www.foo.com/jsp/taglib/mytag.tld" version="2.0">
    -  <mytag:invokeDynamic a="1" d1="2" mytag:d2="3">
    -    <jsp:attribute name="b">4</jsp:attribute>
    -    <jsp:attribute name="d3">5</jsp:attribute>
    -    <jsp:attribute name="mytag:d4">6</jsp:attribute>
    -  </mytag:invokeDynamic>
    -</jsp:root>
    -
    - - -

    4. Annotated Tag Handler Management Example

    -
    - -Below is a somewhat complete example of the way one JSP container -could choose to do some tag handler management. There are many -other strategies that could be followed, with different pay offs. - -

    In this example, we are assuming that -x:iterate is an iterative tag, while x:doit and x:foobar are simple -tag. We will also assume that x:iterate and x:foobar implement the -TryCatchFinally interface, while x:doit does not. - -

    -<x:iterate src="foo">
    -  <x:doit att1="one" att2="<%= 1 + 1 %>" />
    -  <x:foobar />
    -  <x:doit att1="one" att2="<%= 2 + 2 %>" />
    -</x:iterate>
    -<x:doit att1="one" att2="<%= 3 + 3 %>" />
    -
    - -

    The particular code shown below assumes there is some pool of tag -handlers that are managed (details not described, although pool -managing is simpler when there are no optional attributes), and -attemps to reuse tag handlers if possible. The code also "hoists" -setting of properties to reduce the cost when appropriate, e.g. inside -an iteration. - -

    -
    -boolean b1, b2;
    -IterationTag i; // for x:iterate
    -Tag d; // for x:doit
    -Tag d; // for x:foobar
    -
    -page: // label to end of page...
    -
    -
    -// initialize iteration tag
    -i = get tag from pool or new();
    -
    -i.setPageContext(pc);
    -i.setParent(null);
    -i.setSrc("foo");
    -
    -// x:iterate implements TryCatchFinally
    -try {
    -    if ((b1 = i.doStartTag()) == EVAL_BODY_INCLUDE) {
    -
    -        // initialize doit tag
    -        // code has been moved out of the loop for show
    -        d = get tag from pool or new();
    -
    -        d.setPageContext(pc);
    -        d.setParent(i);
    -        d.setAtt1("one");
    -
    -    loop:
    -        while (1) do {
    -            // I'm ignoring newlines...
    -
    -            // two invocations, fused together
    -
    -            // first invocation of x:doit
    -            d.setAtt2(1+1);
    -            if ((b2 = d.doStartTag()) == EVAL_BODY_INCLUDE) {
    -                // nothing
    -            } else if (b2 != SKIP_BODY) {
    -                // Q? protocol error ...
    -            }
    -            if ((b2 = d.doEndTag()) == SKIP_PAGE) {
    -                break page;  // be done with it.
    -            } else if (b2 != EVAL_PAGE) {
    -                // Q? protocol error
    -            }
    -
    -	    // x:foobar invocation
    -            f = get tag from pool or new();
    -            f.setPageContext(pc);
    -            f.setParent(i);
    -
    -            // x:foobar implements TryCatchFinally
    -            try {
    -        
    -                if ((b2 = f.doStartTag()) == EVAL_BODY_INCLUDE) {
    -                    // nothing
    -                } else if (b2 != SKIP_BODY) {
    -                    // Q? protocol error
    -                }
    -                if ((b2 = f.doEndTag()) == SKIP_PAGE) {
    -                    break page;  // be done with it.
    -                } else if (b2 != EVAL_PAGE) {
    -                    // Q? protocol error
    -                }
    -            } catch (Throwable t) {
    -                f.doCatch(t); // caught, may been rethrown!
    -            } finally {
    -                f.doFinally();
    -            }
    -
    -            // put f back to pool
    -        
    -            // second invocation of x:doit
    -            d.setAtt2(2+2);
    -            if ((b2 = d.doStartTag()) == EVAL_BODY_INCLUDE) {
    -                // nothing
    -            } else if (b2 != SKIP_BODY) {
    -                // Q? protocol error
    -            }
    -            if ((b2 = d.doEndTag()) == SKIP_PAGE) {
    -                break page;  // be done with it.
    -            } else if (b2 != EVAL_PAGE) {
    -                // Q? protocol error
    -            }
    -
    -            if ((b2 = i.doAfterBody()) == EVAL_BODY_AGAIN) {
    -                break loop;
    -            } else if (b2 != SKIP_BODY) {
    -                // Q? protocol error
    -            }
    -        // loop
    -        }
    -
    -    } else if (b1 != SKIP_BODY) {
    -        // Q? protocol error
    -    }
    -
    -    // tail end of the IteratorTag ...
    -
    -    if ((b1 = i.doEndTag()) == SKIP_PAGE) {
    -        break page;   // be done with it.
    -    } else if (b1 != EVAL_PAGE) {
    -        // Q? protocol error
    -    }
    -    
    -    // third invocation
    -    // this tag handler could be reused from the previous ones.
    -    d = get tag from pool or new();
    -
    -    d.setPageContext(pc);
    -    d.setParent(null);
    -    d.setAtt1("one");
    -    d.setAtt2(3+3);
    -
    -    if ((b1 = d.doStartTag()) == EVAL_BODY_INCLUDE) {
    -        // nothing
    -    } else if (b1 != SKIP_BODY) {
    -        // Q? protocol error
    -    }
    -    if ((b1 = d.doEndTag()) == SKIP_PAGE) {
    -        break page;  // be done with it.
    -    } else if (b1 != EVAL_PAGE) {
    -        // Q? protocol error
    -    }
    -
    -} catch (Throwable t) {
    -    i.doCatch(t); // caught, may been rethrown!
    -} finally {
    -    i.doFinally();
    -}
    -
    - - -

    5. Cooperating Actions

    -
    - -Actions can cooperate with other actions and with scripting code -in a number of ways. - -

    PageContext

    -

    - -Often two actions in a JSP page will want to cooperate, -perhaps by one action creating some server-side object that -needs to be accessed by another. -One mechanism for doing this is by giving the object a name -within the JSP page; the first action will create the object -and associate the name to it while the second action -will use the name to retrieve the object. - -

    -For example, in the following JSP segment the foo -action might create a server-side object and give it the -name "myObject". -Then the bar -action might access that server-side object and take some action. - -

    - -
    -<x:foo id="myObject" />
    -<x:bar ref="myObjet" />
    -
    -
    -
    - -

    - -In a JSP implementation, the mapping "name"->value is kept by the -implicit object -pageContext. - -This object is passed around through the Tag handler instances -so it can be used to communicate information: all it is needed -is to know the name under which the information is stored into -the pageContext. - -

    The Runtime Stack

    -

    - -An alternative to explicit communication of information through -a named object is implicit coordination based on syntactic scoping. - -

    -For example, in the following JSP segment the foo -action might create a server-side object; -later the nested bar action might access that server-side object. -The object is not named within the pageContext: -it is found because the specific foo element is the -closest enclosing instance of a known element type. - -

    - -
    -<foo>
    -   <bar/>
    -</foo>
    -
    -
    -
    - -

    -This functionality is supported through the -TagSupport.findAncestorWithClass(Tag, Class), -which uses a reference to parent tag kept by each Tag instance, -which effectively provides a run-time execution stack. - - -

    6. Simple Tag Handlers

    - - -

    This section presents the API to implement Simple Tag Handlers. -Simple Tag Handlers present a much simpler invocation -protocol than do Classic Tag Handlers.

    - -

    The Tag Library Descriptor maps tag library declarations to their -physical underlying implementations. A Simple Tag Handler is -represented in Java by a class which implements the -SimpleTag interface.

    - -

    Unlike classic tag handlers, the SimpleTag interface does not -extend Tag. Instead of supporting doStartTag() and -doEndTag(), the SimpleTag interface provides -a simple doTag() method, which is called once and only once -for any given tag invocation. All tag logic, iteration, body -evaluations, etc. are to be performed in this single method. Thus, -simple tag handlers have the equivalent power of BodyTag, -but with a much simpler lifecycle and interface.

    - -

    To support body content, the setJspBody() -method is provided. The container invokes the setJspBody() -method with a JspFragment object encapsulating the body -of the tag. The tag handler implementation can call -invoke() on that fragment to evaluate the body. The -SimpleTagSupport convenience class provides -getJspBody() and other useful methods to make this even -easier.

    - -

    Lifecycle of Simple Tag Handlers

    -

    This section describes the lifecycle of simple tag handlers, from -creation to invocation. For all semantics left unspecified by this -section, the semantics default to that of a classic tag handler.

    - -

    When a simple tag handler is invoked, the following steps occur -(in order):

    - -
      -
    1. Simple tag handlers are created initially using a zero - argument constructor on the corresponding implementation class. - Unlike classic tag handlers, this instance must never be pooled by - the container. A new instance must be created for each tag invocation.
    2. - -
    3. The setJspContext() and setParent() - methods are invoked on the tag handler. The setParent() - method need not be called if the value being passed in is - null. In the case of tag files, a JspContext - wrapper is created so that the tag file can appear to have its own page - scope. Calling getJspContext() must return the wrapped - JspContext.
    4. - -
    5. The attributes specified as XML element attributes (if any) - are evaluated next, in the order in which they are declared, according - to the following rules (referred to as "evaluating an XML element - attribute" below). The appropriate bean property setter is invoked - for each. If no setter is defined for the specified attribute but - the tag accepts dynamic attributes, the setDynamicAttribute() - method is invoked as the setter. -
        -
      • If the attribute is a scripting expression (e.g. "<%= 1+1 %>" - in JSP syntax, or "%= 1+1 %" in XML syntax), the expression is - evaluated, and the result is converted as per the rules in - "Type Conversions", and passed to the setter.
      • - -
      • Otherwise, if the attribute contains any Expression Language - expressions (e.g. "Hello ${name}"), the expression is evaluated, and - the result is converted and passed to the setter.
      • - -
      • Otherwise, the attribute value is taken verbatim, converted, - and passed to the setter.
      • -
      -
    6. - -
    7. The value for each <jsp:attribute> element is evaluated, - and the corresponding bean property setter methods are invoked for - each, in the order in which they appear in the body of the tag. If no - setter is defined for the specified attribute but the tag - accepts dynamic attributes, the setDynamicAttribute() - method is invoked as the setter. -
        -
      • Otherwise, if the attribute is not of type - JspFragment, the container evaluates the body of - the <jsp:attribute> element. This evaluation can be done - in a container-specific manner. Container implementors should - note that in the process of evaluating this body, other custom - actions may be invoked.
      • - -
      • Otherwise, if the attribute is of type JspFragment, - an instance of a JspFragment object is created and - passed in.
      • -
      -
    8. - -
    9. The value for the body of the tag is determined, and if - a body exists the setJspBody() method is called on the - tag handler. -
        -
      • If the tag is declared to have a body-content - of "empty" or no body or an empty body is passed - for this invocation, then setJspBody() is not - called.
      • - -
      • Otherwise, the body of the tag is either the body of - the <jsp:body> element, or the body of the custom action - invocation if no <jsp:body> or <jsp:attribute> - elements are present. In this case, an instance of a - JspFragment object is created as per the lifecycle - described in the JSP Fragments section and it is passed to the - setter. If the tag is declared to have a body-content - of "tagdependent" the JspFragment must - echo the body's contents verbatim. Otherwise, if the tag is - declared to have a body-content of type - "scriptless", the JspFragment must - evaluate the body's contents as a JSP scriptless body.
      • -
      -
    10. - -
    11. The doTag() method is invoked.
    12. - -
    13. The implementation of doTag() performs its - function, potentially calling other tag handlers (if the tag - handler is implemented as a tag file) and invoking fragments.
    14. - -
    15. The doTag() method returns, and the tag handler - instance is discarded. If SkipPageException is thrown, - the rest of the page is not evaluated and the request is completed. - If this request was forwarded or included from another page (or Servlet), - only the current page evaluation stops.
    16. - -
    17. For each tag scripting variable declared with scopes - AT_BEGIN or AT_END, the appropriate - scripting variables and scoped attributes are declared, as with - classic tag handlers.
    18. -
    - - -

    7. JSP Fragments

    -
    - -

    JSP Fragments are represented in Java by an instance of the -javax.servlet.jsp.tagext.JspFragment abstract class. -Pieces of JSP code are translated into JSP fragments in the context -of a tag invocation. JSP Fragments are created when providing the body of a -<jsp:attribute> standard action for an attribute that is defined -as a fragment or of type JspFragment, or when providing the body of a -tag invocation handled by a Simple Tag Handler.

    - -

    Before being passed to a tag handler, the JspFragment -instance is associated with the JspContext of the -surrounding page in an implementation-dependent manner. In addition, - -it is associated with the parent Tag or SimpleTag -instance for collaboration purposes, so that when a custom action is -invoked from within the fragment, setParent() can be called -with the appropriate value. The fragment implementation must keep -these associations for the duration of the tag invocation in which it -is used.

    - -

    The invoke() method executes the body and directs -all output to either the passed in java.io.Writer or -the JspWriter returned by the getOut() method -of the JspContext associated with the fragment.

    - -

    The implementation of each method can optionally throw a -JspException, which must be handled by the invoker. Note -that tag library developers and page authors should not generate -JspFragment implementations manually.

    - -

    The following sections specify the creation and invocation -lifecycles of a JSP Fragment in detail, from the JSP Container's -perspective.

    - - -

    Creation of a JSP Fragment

    - -

    When a JSP fragment is created, the following steps occur (in order): - -

      -
    1. An instance of a class implementing the JspFragment - abstract class is obtained (may either be created or can optionally be cached) - each time the tag is invoked. This instance must be configured to - produce the contents of the body of the fragment when invoked. If the - fragment is defining the body of a <jsp:attribute>, the fragment - must evaluate the body each time it is invoked. Otherwise, if the - fragment is defining the body of a simple tag, the behavior of the - fragment when invoked varies depending on the body-content - declared for the tag: -
        -
      • If the body-content is "tagdependent", - then the fragment must echo the contents of the body verbatim - when invoked.
      • - -
      • If the body-content is "scriptless", - then the fragment must evaluate the body each time it is invoked.
      • -
      -
    2. - -
    3. The JspFragment instance is passed a reference to - the current JspContext. Whenever the fragment invokes - a tag handler, it must use this value when calling - setJspContext().
    4. - -
    5. The JspFragment instance is associated with an - instance of the tag handler of the nearest enclosing tag - invocation, or with null if there is no enclosing tag. - Whenever the fragment invokes a tag handler, the fragment must - use this value when calling setParent().
    6. -
    - - -

    Invocation of a JSP Fragment

    - -

    After a JSP fragment is created, it is passed to a tag handler for -later invocation. JSP fragments can be invoked either programmatically -from a tag handler written in Java, or from a tag file using the -<jsp:invoke> or <jsp:doBody> standard action.

    - -

    JSP fragments are passed to tag handlers using a bean property -of type JspFragment. These fragments can be invoked by -calling the invoke() method in the JspFragment -abstract class. Note that it is legal (and possible) for a fragment to -recursively invoke itself, indirectly.

    - -

    The following steps are followed when invoking a JSP fragment:

    - -
      -
    1. The tag handler invoking the fragment is responsible for - setting the values of all declared AT_BEGIN and - NESTED variables in the JspContext of the - calling page/tag, before invoking the fragment. Note that this is - not always the same as the JspContext of the fragment - being invoked, as fragments can be passed from one tag to another. - In the case of tag files, for each variable declared - in scope AT_BEGIN or NESTED, if a page - scoped attribute exists with the provided name in the tag file, the - JSP container must generate code to create/update the page scoped - attribute of the provided name in the calling page/tag. If a page - scoped attribute with the provided name does not exist in the tag - file, and a page scoped attribute of the provided name is present in - the calling page, the scoped attribute is removed from the calling - page's page scope. See the chapter on Tag Files for details.
    2. - -
    3. If <jsp:invoke> or <jsp:doBody> is being used to - invoke a fragment, if the var attribute is specified, - a custom java.io.Writer is created that can expose - the result of the invocation as a java.lang.String - object. If the varReader attribute is - specified, a custom java.io.Writer object is created - that can expose the resulting invocation as a - java.io.Reader object.
    4. - -
    5. The invoke() method of the fragment is invoked, - passing in an optional Writer.
    6. - -
    7. Before executing the body of the fragment, if a non-null value - is provided for the writer parameter, then the value of - JspContext.getOut() and the implicit "out" object must - be updated to send output to that writer. To accomplish - this, the container must call pushBody( writer ) on the - current JspContext, where writer is the - instance of java.io.Writer passed to the fragment upon - invocation.
    8. - -
    9. The body of the fragment is then evaluated by executing - the generated code. The body of the fragment may execute other standard - or custom actions. If a classic Custom Tag Handler is invoked and - returns SKIP_PAGE, or if a Simple Tag Handler is invoked - and throws SkipPageException, the - JspFragment must throw SkipPageException to - signal that the calling page is to be skipped.
    10. - -
    11. Once the fragment has completed its evaluation, even if an exception - is thrown, the value of JspContext.getOut() must be - restored via a call to popBody() on the current - JspContext.
    12. - -
    13. The fragment returns from invoke()
    14. - -
    15. If <jsp:invoke> or <jsp:doBody> is being used to - invoke a fragment, if the var or varReader - attribute is specified, a scoped variable with a name equal to the - value of the var or varReader attribute - is created (or modified) in the page scope, and the value is set - to a java.lang.String or java.io.Reader - respectively that can produce the results of the fragment - invocation.
    16. - -
    17. The invoke() method can be called again, zero or more - times. When the tag invocation defining the fragment is complete, - the tag must discard the fragment instance since it might be reused - by the container.
    18. - -
    - - -

    8. Example Simple Tag Handler Scenario

    -
    - -

    The following non-normative example is intended to help solidify -some of the concepts relating to Tag Files, JSP Fragments and Simple -Tag Handlers. In the first section, two sample input files are -presented, a JSP (my.jsp), and a simple tag handler implemented using -a tag file (simpletag.tag). One possible output of the translation -process is presented in the second section.

    - -

    Although short, the example shows all concepts, including -the variable directive. In practice most uses of tags will be much simpler, -but probably longer.

    - -

    The sample generated code is annotated with comments that point -to lifecycle steps presented in various sections. The notation is as -follows:

    - -
      -
    • "Step T.x" = Annotated step x from "Lifecycle of Simple Tag - Handlers" earlier in this Chapter.
    • -
    • "Step C.x" = Annotated step x from "Creation of a JSP Fragment" - earlier in this Chapter.
    • -
    • "Step F.x" = Annotated step x from "Invocation of a JSP Fragment" - earlier in this Chapter.
    • -
    - - -

    Sample Source Files

    - -

    This section presents the sample source files in this scenario, -from which the output files are generated.

    - -

    Original JSP (my.jsp)

    -
    -<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %>
    -
    -<my:simpleTag x="10">
    -    <jsp:attribute name="y">20</jsp:attribute>
    -    <jsp:attribute name="nonfragment">
    -        Nonfragment Template Text
    -    </jsp:attribute>
    -    <jsp:attribute name="frag">
    -        Fragment Template Text ${var1}
    -    </jsp:attribute>
    -    <jsp:body>
    -        Body of tag that defines an AT_BEGIN
    -        scripting variable ${var1}.
    -    </jsp:body>
    -</my:simpleTag>
    -
    - -

    Original Tag File (/WEB-INF/tags/simpletag.tag)

    -
    -<%-- /WEB-INF/tags/simpletag.tag --%>
    -<%@ attribute name="x" %>
    -<%@ attribute name="y" %>
    -<%@ attribute name="nonfragment" %>
    -<%@ attribute name="frag" fragment="true" %>
    -<%@ variable name-given="var1" scope="AT_BEGIN" %>
    -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    -
    -Some template text.
    -<c:set var="var1" value="${x+y}"/>
    -<jsp:invoke fragment="frag" varReader="var1"/>
    -
    -Invoke the body:
    -<jsp:doBody/>
    -
    - - -

    Sample Generated Files

    -

    This section presents sample output files that might be generated -by a JSP compiler, from the source files presented in the -previous section.

    - -

    Helper class for JspFragment (JspFragmentBase.java)

    -
    -public abstract class JspFragmentBase
    -    implements javax.servlet.jsp.tagext.JspFragment
    -{
    -    protected javax.servlet.jsp.JspContext jspContext;
    -    protected javax.servlet.jsp.tagext.JspTag parentTag;
    -    public void JspFragmentBase(
    -        javax.servlet.jsp.JspContext jspContext,
    -        javax.servlet.jsp.tagext.JspTag parentTag )
    -    {
    -        this.jspContext = jspContext;
    -        this.parentTag = parentTag;
    -    }
    -}
    -
    -

    Relevant Portion of JSP Service Method

    -
    -// Step T.1 - Initial creation
    -MySimpleTag _jsp_mySimpleTag = new MySimpleTag();
    -// Step T.2 - Set page context and parent (since parent is null,
    -// no need to call setParent() in this case)
    -_jsp_mySimpleTag.setJspContext( jspContext );
    -// Step T.3 - XML element attributes evaluated and set
    -_jsp.mySimpleTag.setX( "10" );
    -// Step T.4 - <jsp:attribute> elements evaluated and set
    -//   - parameter y
    -// (using PageContext.pushBody() is one possible implementation - 
    -// one limitation is that this code will only work for Servlet-based code).
    -out = ((PageContext)jspContext).pushBody();
    -out.write( "20" );
    -_jsp_mySimpleTag.setY( 
    -    ((javax.servlet.jsp.tagext.BodyContent)out).getString() );
    -out = jspContext.popBody();
    -//   - parameter nonfragment
    -// (using PageContext.pushBody() is one possible implementation - 
    -// one limitation is that this code will only work for Servlet-based code).
    -// Note that trim is enabled by default, else we would have "\n    Non..."
    -out = ((PageContext)jspContext).pushBody();
    -out.write( "Nonfragment Template Text" );
    -_jsp_mySimpleTag.setNonfragment( 
    -    ((javax.servlet.jsp.tagext.BodyContent)out).getString() );
    -out = jspContext.popBody();
    -//   - parameter frag
    -_jsp_mySimpleTag.setFrag(
    -    // Step C.1 - New instance of fragment created
    -    // Step C.2 - Store jspContext
    -    // Step C.3 - Association with nearest enclosing Tag instance
    -    new JspFragmentBase( jspContext, _jsp_mySimpleTag ) {
    -        public void invoke( java.io.Writer writer ) {
    -	    javax.servlet.jsp.JspWriter out;
    -            // Step F.1-F.3 done in tag file (see following example)
    -	    // Step F.4 - If writer provided, push body:
    -	    if( out == null ) {
    -		out = this.jspContext.getOut();
    -	    }
    -	    else {
    -		out = this.jspContext.pushBody( writer );
    -	    }
    -	    // Step F.5 - Evaluate body of fragment:
    -            try {
    -                out.write( "Fragment Template Text " );
    -                out.write( jspContext.getExpressionEvaluator().evaluate(
    -		    "${var1}",
    -		    java.lang.String.class,
    -		    vResolver, fMapper, "my" ) );
    -            }
    -            finally {
    -                // Step F.6 - Restore value of JspContext.getOut()
    -		if( writer != null ) {
    -		    this.jspContext.popBody();
    -		}
    -            }
    -
    -            // Step F.7-F.9 done in tag file (see following example)
    -        }
    -    } );
    -// Step T.5 - Determine and set body of the tag
    -// - body of tag
    -_jsp_mySimpleTag.setJspBody(
    -    // Step C.1 - New instance of fragment created
    -    // Step C.2 - Store jspContext
    -    // Step C.3 - Association with nearest enclosing Tag instance
    -    new JspFragmentBase( jspContext, _jsp_mySimpleTag ) {
    -        public void invoke( java.io.Writer writer ) {
    -	    javax.servlet.jsp.JspWriter out;
    -            // Step F.1-F.3 done in tag file (see following example)
    -	    // Step F.4 - If writer provided, push body:
    -	    if( writer == null ) {
    -		out = this.jspContext.getOut();
    -	    }
    -	    else {
    -		out = this.jspContext.pushBody( writer );
    -	    }
    -	    // Step F.5 - Evaluate body of fragment:
    -            try {
    -                out.write(
    -                    "Body of tag that defines an AT_BEGIN\n" +
    -                    " scripting variable " );
    -                out.write( jspContext.getExpressionEvaluator().evaluate(
    -		    "${var1}",
    -		    java.lang.String.class,
    -		    vResolver, fMapper, "my" ) );
    -                out.write( ".\n" );
    -            }
    -            finally {
    -                // Step F.6 - Restore value of JspContext.getOut()
    -		if( writer != null ) {
    -		    this.jspContext.popBody();
    -		}
    -            }
    -
    -            // Step F.7-F.9 done in tag file (see following example)
    -        }
    -    } );
    -// Step T.6 - Inovke doTag
    -// Step T.7 occurs in the tag file (see following example)
    -// Step T.8 - doTag returns - page will catch SkipPageException.
    -_jsp_mySimpleTag.doTag();
    -// Step T.9 - Declare AT_BEGIN and AT_END scripting variables
    -String var1 = (String)jspContext.findAttribute( "var1" );
    -
    - -

    Generated Simple Tag Handler (MySimpleTag.java)

    -
    -public class MySimpleTag
    -    extends javax.servlet.jsp.tagext.SimpleTagSupport
    -{
    -    // Attributes:
    -    private String x;
    -    private String y;
    -    private String nonfragment;
    -    private javax.servlet.jsp.tagext.JspFragment frag;
    -    // Setters and getters for attributes:
    -    public void setX( Stirng x ) {
    -        this.x = x; 
    -    }
    -    public String getX() {
    -        return this.x; 
    -    }
    -    public void setY( String y ) { 
    -        this.y = y; 
    -    }
    -    public String getY() { 
    -        return this.y; 
    -    }
    -    public void setNonfragment( String nonfragment ) {
    -        this.nonfragment = nonfragment; 
    -    }
    -    public String getNonfragment() {
    -        return this.nonfragment;
    -    }
    -    public void setFrag( javax.servlet.jsp.tagext.JspFragment frag ) {
    -        this.frag = frag;
    -    }
    -    public javax.servlet.jsp.tagext.JspFragment getFrag() {
    -        return this.frag;
    -    }
    -
    -    protected JspContext jspContext;
    -    public void setJspContext( JspContext ctx ) {
    -	super.setJspContext( ctx );
    -	// Step T.2 - A JspContext wrapper is created.
    -	// (Implementation of wrapper not shown).
    -	this.jspContext = new utils.JspContextWrapper( ctx );
    -    }
    -    public JspContext getJspContext() {
    -	// Step T.2 - Calling getJspContext() must return the 
    -	// wrapped JspContext.
    -	return this.jspContext;
    -    }
    -
    -    public void doTag() throws JspException {
    -	java.lang.Object jspValue;
    -	JspContext jspContext = getJspContext();
    -	JspContext _jsp_parentContext = 
    -	    SimpleTagSupport.this.getJspContext();
    -	try {
    -	    javax.servlet.jsp.JspWriter out = jspContext.getOut();
    -
    -	    // Create page-scope attributes for each tag attribute:
    -	    this.jspContext.setAttribute( "x", getX() );
    -	    this.jspContext.setAttribute( "y", getY() );
    -	    this.jspContext.setAttribute( "nonfragment", getNonfragment() );
    -	    this.jspContext.setAttribute( "frag", getFrag() );
    -
    -	    // Synchronize AT_BEGIN variables from calling page
    -	    if( (jspValue = _jsp_parentContext.getAttribute( 
    -		    "var1" )) != null ) 
    -	    {
    -		jspContext.setAttribute( "var1", value );
    -	    }
    -	    else {
    -		jspContext.removeAttribute( "var1", 
    -		    JspContext.PAGE_SCOPE );
    -	    }
    -
    -	    // Tag template text:
    -	    out.write( "\n\n\n\n\n\n\n\nSome template text.\n" );
    -
    -	    // Invoke c:set - recognized tag handler from JSTL:
    -	    jspContext.setAttribute( "var1", 
    -		jspContext.getExpressionEvaluator().evaluate(
    -		    "${x+y}",
    -		    java.lang.String.class,
    -		    jspContext,
    -		    prefixMap, functionMap, "my" ) );
    -
    -	    // Invoke the "frag" fragment:
    -	    // Step F.1 - Set values of AT_BEGIN and NESTED variables
    -	    //     in calling page context.
    -	    if( (jspValue = jspContext.getAttribute( "var1" )) != null ) {
    -		_jsp_parentContext.setAttribute( "var1", value );
    -	    }
    -	    else {
    -		_jsp_parentContext.removeAttribute( "var1", 
    -		    JspContext.PAGE_SCOPE );
    -	    }
    -
    -	    // Step F.2 - varReader is specified, generate a writer.
    -	    java.io.Writer _jsp_sout = new java.io.StringWriter();
    -
    -	    // Step F.3 - Invoke fragment with writer
    -	    getFrag().invoke( _jsp_sout );
    -
    -	    // Step F.4 - F.6 occur in the fragment (see above)
    -	    // Step F.7 - fragment returns
    -
    -	    // Step F.8 - varReader specified, so save to var
    -	    jspContext.setAttribute(
    -		"var1", new StringReader( _jsp_sout.toString() ) );
    -
    -	    // Step F.9 - Done!
    -
    -
    -	    out.write( "\n\nInvoke the body:\n" );
    -
    -	    // Invoke the body of the tag:
    -	    // Step F.1 - Set values of AT_BEGIN and NESTED variables
    -	    //     in calling page context.
    -	    if( (jspValue = jspContext.getAttribute( "var1" )) != null ) {
    -		_jsp_parentContext.setAttribute( "var1", value );
    -	    }
    -	    else {
    -		_jsp_parentContext.removeAttribute( "var1", 
    -		    JspContext.PAGE_SCOPE);
    -	    }
    -
    -	    // Step F.2 - varReader is not specified - does not apply.
    -
    -	    try {
    -		// Step F.3 - Invoke body, passing optional writer
    -		getJspBody().invoke( null );
    -	    }
    -	    finally {
    -		// Steps F.4 - F.6 occur in the fragment (see above)
    -		// Step F.7 - fragment returns
    -	    }
    -
    -	    // Step F.8 does not apply.
    -	    // Step F.9 - Done!
    -	}
    -	finally {
    -	    // Tag handlers generate code to synchronize AT_BEGIN with
    -	    // calling page, regardless of whether an error occurs.
    -	    if( (jspValue = jspContext.getAttribute( "var1" )) != null ) {
    -		_jsp_parentContext.setAttribute( "var1", value );
    -	    }
    -	    else {
    -		_jsp_parentContext.removeAttribute( "var1", 
    -		    JspContext.PAGE_SCOPE );
    -	    }
    -	}
    -    }
    -}
    -
    -
    - - -

    9. Translation-time Classes

    -
    - -The following classes are used at translation time. - -

    Tag mapping, Tag name

    - -

    A taglib directive introduces a tag library and associates a -prefix to it. The TLD associated with the library associates Tag -handler classes (plus other information) with tag names. This -information is used to associate a Tag class, a prefix, and a name -with each custom action element appearing in a JSP page. - -

    At execution time the implementation of a JSP page will use an -available Tag instance with the appropriate property settings and then -follow the protocol described by the interfaces Tag, IterationTag, -BodyTag, SimpleTag, and TryCatchFinally. The implementation guarantees -that all tag handler instances are initialized and all are released, -but the implementation can assume that previous settings are preserved -by a tag handler, to reduce run-time costs. - - -

    Scripting Variables

    - -

    JSP supports scripting variables that can be declared within a -scriptlet and can be used in another. JSP actions also can be used to -define scripting variables so they can used in scripting elements, or -in other actions. This is very useful in some cases; for example, the -jsp:useBean standard action may define an object which -can later be used through a scripting variable. - -

    In some cases the information on scripting variables can be -described directly into the TLD using elements. A special case is typical -interpretation of the "id" attribute. -In other cases the logic that decides whether an action instance -will define a scripting variable may be quite complex and the name of -a TagExtraInfo class is instead given in the TLD. The -getVariableInfo method of this class is used at -translation time to obtain information on each variable that will be -created at request time when this action is executed. The method is -passed a TagData instance that contains the -translation-time attribute values. - -

    Validation

    - -

    The TLD file contains several pieces of information that is used -to do syntactic validation at translation-time. It also contains two -extensible validation mechanisms: a TagLibraryValidator -class can be used to validate a complete JSP page, and a -TagExtraInfo class can be used to validate a specific -action. In some cases, additional request-time validation will be done -dynamically within the methods in the Tag instance. If an error is -discovered, an instance of JspTagException can be thrown. -If uncaught, this object will invoke the errorpage mechanism of JSP. - -

    The TagLibraryValidator is an addition to the JSP 1.2 -specification and is very open ended, being strictly more powerful -than the TagExtraInfo mechanism. A JSP page is presented via the -PageData object, which abstracts the XML view of the JSP -page. - -

    A PageData instance will provides an InputStream (read-only) on the -page. Later specifications may add other views on the page (DOM, SAX, -JDOM are all candidates), for now these views can be generated from -the InputStream and perhaps can be cached for improved performance -(recall the view of the page is just read-only). - -

    As of JSP 2.0, the JSP container must support a jsp:id attribute to -provide higher quality validation errors. The -container will track the JSP pages as passed to the container, and -will assign to each element a unique "id", which is passed as the -value of the jsp:id attribute. Each XML element in the XML view -will be extended with this attribute. The -TagLibraryValidator can use the attribute in one or more -ValidationMessage objects. The container then, in turn, can use these -values to provide more precise information on the location of an -error. - -

    The prefix for the id attribute need not be "jsp" -but it must map to the namespace http://java.sun.com/JSP/Page. -In the case where the user has redefined the jsp prefix, an -alternative prefix must be used by the container. - - -

    Validation Details

    - -

    In detail, validation is done as follows: - -

    First, the JSP page is parsed using the information in the TLD. -At this stage valid mandatory and optional attributes are checked. - -

    Second, for each unique tag library in the page as determined -by the tag library URI, and in the lexical order in which they appear, -their associated validator class (if any) is invoked. This involves -several substeps. - -

    The first substep is to obtain an initialized validator instance by -either: - -

      -
    • construct a new instance and invoke setInitParameters() on it, or -
    • obtain an existing instance that is not being used, invoke release() on it, and then invoke setInitParameters() on it, or -
    • locate an existing instance that is not being used on which the desired setInitParameters() has already been invoked -
    - -

    The class name is as indicated in the <validator-class> element, -and the Map passed through setInitParameters() is as described in the -<init-params> element. -All TagLibraryValidator classes are supposed to keep their initParameters -until new ones are set, or until release() is invoked on them. - -

    The second substep is to perform the actual validation. This is done -by invoking the validate() method with a prefix, uri, and PageData that -correspond to the taglib directive instance being validated and the -PageData representing the page. In the case where a single URI is mapped -to more than one prefix, the prefix of the first URI must be used. - -

    The last substep is to invoke the release() method on the validator tag -when it is no longer needed. This method releases all resources. - -

    Finally, after checking all the tag library validator classes, the -TagExtraInfo classes for all tags will be consulted by invoking their -validate method. The order of invocation of this methods -is undefined. - - - - - diff --git a/api/src/main/javadoc/doc-files/final-spec-license.html b/api/src/main/javadoc/doc-files/final-spec-license.html deleted file mode 100644 index de94b82..0000000 --- a/api/src/main/javadoc/doc-files/final-spec-license.html +++ /dev/null @@ -1,215 +0,0 @@ - - -Specification License - - -Specification: JSR-245 JavaServer Pages ("Specification") -
    -Version: 2.3 -
    -Status: Maintenance Release 3 -
    -Specification Lead: Oracle America, Inc. ("Specification Lead") -
    -Release: May 31, 2013 -
    - -
    -Copyright © 2013 Oracle America, Inc. -
    -All rights reserved. -
    -

    -LIMITED LICENSE GRANTS -
    -1. License for Evaluation Purposes. Specification Lead hereby grants -you a fully-paid, non-exclusive, non-transferable, worldwide, limited -license (without the right to sublicense), under Specification Lead's -applicable intellectual property rights to view, download, use and -reproduce the Specification only for the purpose of internal -evaluation. This includes (i) developing applications intended to run -on an implementation of the Specification, provided that such -applications do not themselves implement any portion(s) of the -Specification, and (ii) discussing the Specification with any third -party; and (iii) excerpting brief portions of the Specification in oral -or written communications which discuss the Specification provided that -such excerpts do not in the aggregate constitute a significant portion -of the Specification. -

    -

    -2. License for the Distribution of Compliant Implementations. -Specification Lead also grants you a perpetual, non-exclusive, -non-transferable, worldwide, fully paid-up, royalty free, limited -license (without the right to sublicense) under any applicable -copyrights or, subject to the provisions of subsection 4 below, patent -rights it may have covering the Specification to create and/or -distribute an Independent Implementation of the Specification that: (a) -fully implements the Specification including all its required -interfaces and functionality; (b) does not modify, subset, superset or -otherwise extend the Licensor Name Space, or include any public or -protected packages, classes, Java interfaces, fields or methods within -the Licensor Name Space other than those required/authorized by the -Specification or Specifications being implemented; and (c) passes the -Technology Compatibility Kit (including satisfying the requirements of -the applicable TCK Users Guide) for such Specification ("Compliant -Implementation"). In addition, the foregoing license is expressly -conditioned on your not acting outside its scope. No license is -granted hereunder for any other purpose (including, for example, -modifying the Specification, other than to the extent of your fair use -rights, or distributing the Specification to third parties). Also, no -right, title, or interest in or to any trademarks, service marks, or -trade names of Specification Lead or Specification Lead's licensors is -granted hereunder. Java, and Java-related logos, marks and names are -trademarks or registered trademarks of Oracle America, Inc. in the U.S. -and other countries. -

    -

    -3. Pass-through Conditions. You need not include limitations (a)-(c) -from the previous paragraph or any other particular "pass through" -requirements in any license You grant concerning the use of your -Independent Implementation or products derived from it. However, -except with respect to Independent Implementations (and products -derived from them) that satisfy limitations (a)-(c) from the previous -paragraph, You may neither: (a) grant or otherwise pass through to -your licensees any licenses under Specification Lead's applicable -intellectual property rights; nor (b) authorize your licensees to make -any claims concerning their implementation's compliance with the -Specification in question. -

    -

    -4. Reciprocity Concerning Patent Licenses. -
    -a. With respect to any patent claims covered by the license granted -under subparagraph 2 above that would be infringed by all technically -feasible implementations of the Specification, such license is -conditioned upon your offering on fair, reasonable and -non-discriminatory terms, to any party seeking it from You, a -perpetual, non-exclusive, non-transferable, worldwide license under -Your patent rights which are or would be infringed by all technically -feasible implementations of the Specification to develop, distribute -and use a Compliant Implementation. -
    -b. With respect to any patent claims owned by Specification Lead and -covered by the license granted under subparagraph 2, whether or not -their infringement can be avoided in a technically feasible manner when -implementing the Specification, such license shall terminate with -respect to such claims if You initiate a claim against Specification -Lead that it has, in the course of performing its responsibilities as -the Specification Lead, induced any other entity to infringe Your -patent rights. -
    -c. Also with respect to any patent claims owned by Specification Lead -and covered by the license granted under subparagraph 2 above, where -the infringement of such claims can be avoided in a technically -feasible manner when implementing the Specification such license, with -respect to such claims, shall terminate if You initiate a claim against -Specification Lead that its making, having made, using, offering to -sell, selling or importing a Compliant Implementation infringes Your -patent rights. -

    -

    -5. Definitions. For the purposes of this Agreement: "Independent -Implementation" shall mean an implementation of the Specification that -neither derives from any of Specification Lead's source code or binary -code materials nor, except with an appropriate and separate license -from Specification Lead, includes any of Specification Lead's source -code or binary code materials; "Licensor Name Space" shall mean the -public class or interface declarations whose names begin with "java", -"javax", "com.sun" and "com.oracle" or their equivalents in any -subsequent naming convention adopted by Oracle America, Inc. through -the Java Community Process, or any recognized successors or -replacements thereof; and "Technology Compatibility Kit" or "TCK" shall -mean the test suite and accompanying TCK User's Guide provided by -Specification Lead which corresponds to the Specification and that was -available either (i) from Specification Lead's 120 days before the -first release of Your Independent Implementation that allows its use -for commercial purposes, or (ii) more recently than 120 days from such -release but against which You elect to test Your implementation of the -Specification. -

    -

    -This Agreement will terminate immediately without notice from -Specification Lead if you breach the Agreement or act outside the scope -of the licenses granted above. -

    -

    -DISCLAIMER OF WARRANTIES -
    -THE SPECIFICATION IS PROVIDED "AS IS". SPECIFICATION LEAD MAKES NO -REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT -NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -PURPOSE, NON-INFRINGEMENT (INCLUDING AS A CONSEQUENCE OF ANY PRACTICE -OR IMPLEMENTATION OF THE SPECIFICATION), OR THAT THE CONTENTS OF THE -SPECIFICATION ARE SUITABLE FOR ANY PURPOSE. This document does not -represent any commitment to release or implement any portion of the -Specification in any product. In addition, the Specification could -include technical inaccuracies or typographical errors. -

    -

    -LIMITATION OF LIABILITY -
    -TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL SPECIFICATION -LEAD OR ITS LICENSORS BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT -LIMITATION, LOST REVENUE, PROFITS OR DATA, OR FOR SPECIAL, INDIRECT, -CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND -REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED IN ANY -WAY TO YOUR HAVING, IMPELEMENTING OR OTHERWISE USING USING THE -SPECIFICATION, EVEN IF SPECIFICATION LEAD AND/OR ITS LICENSORS HAVE -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. You will indemnify, -hold harmless, and defend Specification Lead and its licensors from any -claims arising or resulting from: (i) your use of the Specification; -(ii) the use or distribution of your Java application, applet and/or -implementation; and/or (iii) any claims that later versions or releases -of any Specification furnished to you are incompatible with the -Specification provided to you under this license. -

    -

    -RESTRICTED RIGHTS LEGEND -
    -U.S. Government: If this Specification is being acquired by or on -behalf of the U.S. Government or by a U.S. Government prime contractor -or subcontractor (at any tier), then the Government's rights in the -Software and accompanying documentation shall be only as set forth in -this license; this is in accordance with 48 C.F.R. 227.7201 through -227.7202-4 (for Department of Defense (DoD) acquisitions) and with 48 -C.F.R. 2.101 and 12.212 (for non-DoD acquisitions). -

    -

    -REPORT -
    -If you provide Specification Lead with any comments or suggestions -concerning the Specification ("Feedback"), you hereby: (i) agree that -such Feedback is provided on a non-proprietary and non-confidential -basis, and (ii) grant Specification Lead a perpetual, non-exclusive, -worldwide, fully paid-up, irrevocable license, with the right to -sublicense through multiple levels of sublicensees, to incorporate, -disclose, and use without limitation the Feedback for any purpose. -

    -

    -GENERAL TERMS -
    -Any action related to this Agreement will be governed by California law -and controlling U.S. federal law. The U.N. Convention for the -International Sale of Goods and the choice of law rules of any -jurisdiction will not apply. -

    -

    -The Specification is subject to U.S. export control laws and may be -subject to export or import regulations in other countries. Licensee -agrees to comply strictly with all such laws and regulations and -acknowledges that it has the responsibility to obtain such licenses to -export, re-export or import as may be required after delivery to -Licensee. -

    -

    -This Agreement is the parties' entire agreement relating to its subject -matter. It supersedes all prior or contemporaneous oral or written -communications, proposals, conditions, representations and warranties -and prevails over any conflicting or additional terms of any quote, -order, acknowledgment, or other communication between the parties -relating to its subject matter during the term of this Agreement. No -modification to this Agreement will be binding, unless in writing and -signed by an authorized representative of each party. -

    - - diff --git a/assets/css/print.scss b/assets/css/print.scss new file mode 100644 index 0000000..6115d8d --- /dev/null +++ b/assets/css/print.scss @@ -0,0 +1,8 @@ +--- +--- + +@import "{{ site.theme }}"; +h1 { + font-size: 1.8em; +} + diff --git a/assets/css/style.scss b/assets/css/style.scss new file mode 100644 index 0000000..8ebc377 --- /dev/null +++ b/assets/css/style.scss @@ -0,0 +1,267 @@ +--- +--- + +@import "{{ site.theme }}"; + +header { + padding-top: 16px; + padding-bottom: 40px; + font-family: 'Mukta Vaani', 'Open Sans', 'Helvetica Neue', Helvetica, Arial, serif; + background: url(../images/header-bkg.jpg) 0 0 repeat-x; + border-bottom: solid 1px #E0E0E0; +} + +header h1 { + padding-top: 14px; + font-size: 2em; + font-weight: 200; + line-height: 1.4; + color: #FFFFFF; + letter-spacing: 0px; + border-bottom: 0px; +} + +header h2 { + font-size: 1.2em; + margin-top: 0; + margin-bottom: 0; + font-weight: 200; + line-height: .8; + color: #ec7D11; // orange + //color: #2879d0; // blue + letter-spacing: 0; +} + +header a.button { + background: transparent url(../images/logo.png) 0 0 no-repeat; + padding-left: 32px; +} + +header a:hover { + text-decoration: none; +} + +a { + font-weight: 300; + color: #2879d0; +} + +a:hover { + text-decoration: underline; +} + +#sidebar p { + font-size: 1em; + margin-bottom: 1em; +} + +.highlight { + background-color: #ffffff; +} + +.sponsor { + float: left; + padding-top: 20px; + padding-left: 18px; +} + +.moveright30{ + padding-left: 30px; +} + +.moveright{ + padding-left: 40px; +} + +.moveright50{ + padding-left: 50px; +} + +a.oraclelogo { + position: absolute; + background: transparent url(../images/Oracle-logo.png) 0 0 no-repeat; + background-position: 2px -2px; + background-size: 100% ; + width: 96px; + height: 62px; + padding-top: 2px; + padding-right: 20px; +} + +aside#sidebar { + padding-top: 40px; + line-height: 1.2; +} + +hr { + border:none; + height: 10px; + width: 75%; + height: 50px; + margin-top: 0; + border-bottom: 1px solid #cccccc; + box-shadow: 0 20px 20px -20px #aaa; + margin: -48px auto 10px; +} + +table { + margin-bottom: 20px; +} + +th, td { + padding: .2em; +} + +td { + font-weight: 400; +} + +ul { + font-size: 1em; + margin-left: 12px; +} + +ol { + list-style-position: inside; + list-style: decimal; + margin-left: 26px; +} + +blockquote { + padding: 0 0 0 10px; + margin-left: 14px; + margin-bottom: 2px; + font-size: 1em; + border-left: 4px solid #ddd; +} + +#main-content h1 { + padding-top: .6em; + font-family: 'Mukta Vaani', 'Open Sans', 'Helvetica Neue', Helvetica, Arial, serif; + font-size: 1.6em; + font-weight: 500; + color : #666; + text-indent: 16px; + letter-spacing: 0px; + border-bottom:1px solid #cccccc; + padding-bottom:1px; + line-height: 1.2; + //margin: .6em 0; + margin-bottom: .6em; +} + +#main-content h1:before { + //padding-right: 0.3em; + margin-left: -1em; + content: ""; +} + +#main-content h2 { + margin-bottom: 8px; + font-family: 'Mukta Vaani', 'Open Sans', 'Helvetica Neue', Helvetica, Arial, serif; + font-size: 1.4em; + font-weight: 400; + //color: #474747; + color: #3c657b; // blue + text-indent: 4px; +} + +#main-content h2:before { + padding-right: 1.3em; + margin-left: -1.5em; + content: ""; + font-weight: 700; +} + +#main-content h3 { + text-indent: 24px; + margin-bottom: 8px; + font-family: 'Mukta Vaani', 'Open Sans', 'Helvetica Neue', Helvetica, Arial, serif; + font-size: 1.2em; + font-weight: 500; + color: #3c657b; + text-indent: 4px; +} + +#main-content h3:before { + content: ""; + margin-left: -0.3em; + padding-right: 0.1em; +} + +#main-content h4 { + margin-bottom: 8px; + font-family: 'Mukta Vaani', 'Open Sans', 'Helvetica Neue', Helvetica, Arial, serif; + font-size: 1.2em; + font-weight: 500; + color: #3c657b; + text-indent: 4px; +} + +#main-content h4:before { + content: ""; + margin-left: -0.3em; + padding-right: 0.1em; +} + +#main-content p { + font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, serif; + font-weight: normal; + font-size: 1em; + margin-bottom: 2px; +} + +.footer { + position: relative; + bottom: 18px; + left: 0; + right: 0; + height: 6px; + background-color: #f0f0f0; + //padding: 1rem; + padding-top: 4px; + padding-bottom: 14px; + font-size: 0.8em; + text-align: center; +} + +.oracle { + color: #666; + font-weight: 400; +} + +.oracle:hover { + text-decoration: none; + color: #FF0000; +} + +.fullpage { + //float: center; + color: FF0000; + width: 900px; +} + +#archive-footer { + position: fixed; + bottom: 0; + width: 100%; +} + +#archive-footer { + background: #B45252; + line-height: 1.3; + text-align: center; + color: #FFF; + font-size: 15px; + font-family: sans-serif; + font-weight: 100; + text-shadow: 2px 2px 2px #8D0614; + box-shadow: 0 0 12px #424242; +} + +#archive-footer a:link { color: white; font-weight: 700; } +#archive-footer a:visited { color: white; font-weight: 700;} +#archive-footer a:hover { color: white; font-weight: 700; text-decoration: underline;} +#archive-footer a:active { color: white; font-weight: 700; text-decoration: underline;} + + diff --git a/assets/images/Oracle-logo.png b/assets/images/Oracle-logo.png new file mode 100644 index 0000000..5b21196 Binary files /dev/null and b/assets/images/Oracle-logo.png differ diff --git a/assets/images/header-bkg.jpg b/assets/images/header-bkg.jpg new file mode 100644 index 0000000..481faa5 Binary files /dev/null and b/assets/images/header-bkg.jpg differ diff --git a/assets/images/logo.png b/assets/images/logo.png new file mode 100644 index 0000000..af471e3 Binary files /dev/null and b/assets/images/logo.png differ diff --git a/impl/jspimpl.iml b/impl/jspimpl.iml deleted file mode 100644 index de15235..0000000 --- a/impl/jspimpl.iml +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/impl/jspimpl.ipr b/impl/jspimpl.ipr deleted file mode 100644 index 7b333d1..0000000 --- a/impl/jspimpl.ipr +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/impl/jspimpl.iws b/impl/jspimpl.iws deleted file mode 100644 index 3ad9406..0000000 --- a/impl/jspimpl.iws +++ /dev/null @@ -1,411 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - localhost - 5050 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/impl/pom.xml b/impl/pom.xml deleted file mode 100644 index dbed715..0000000 --- a/impl/pom.xml +++ /dev/null @@ -1,340 +0,0 @@ - - - - - net.java - jvnet-parent - 5 - - - 4.0.0 - org.glassfish.web - javax.servlet.jsp - 2.3.5-SNAPSHOT - jar - JSP implementation - - - 2.3 - javax.servlet.jsp - org.glassfish.web.javax.servlet.jsp - Oracle Corporation - 2.5.2 - - High - - - - - kchung - Kin-man Chung - Oracle Corporation - - lead - - - - - https://javaee.github.io/javaee-jsp-api - - Oracle - http://www.oracle.com - - - - - CDDL + GPLv2 with classpath exception - ://oss.oracle.com/licenses/CDDL+GPL-1.1 - repo - A business-friendly OSS license - - - - github - https://github.com/javaee/javaee-jsp-api/issues/ - - - - JSP Developer - dev@jsp.java.net - - - - scm:git:https://github.com/javaee/javaee-jsp-api.git - scm:git:ssh://git@github.com/javaee/javaee-jsp-api.git - https://github.com/javaee/javaee-jsp-api - HEAD - - - - - - org.apache.felix - maven-bundle-plugin - 1.4.3 - - - jar - - - ${bundle.symbolicName} - <_include>-osgi.bundle - - - - - bundle-manifest - process-classes - - manifest - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.0 - - 1.7 - 1.7 - -Xlint:unchecked - - - org/apache/jasper/compiler/JDTJavaCompiler.java - - - org/apache/jasper/compiler/AntJavaCompiler.java - - - - org/apache/jasper/util/SystemLogHandler.java - - - - org/apache/jasper/runtime/PerThreadTagHandlerPool.java - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.1.0 - - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - ${extensionName} - - ${spec.version} - ${vendorName} - - ${project.version} - ${vendorName} - - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.1 - - true - - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.1 - - - attach-javadocs - - jar - - - - - JavaServer Pages API Documentation - javax.servlet.jsp - - - Copyright (c) 1999-2012 Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms. - - - - - - org.codehaus.mojo - findbugs-maven-plugin - ${findbugs.version} - - ${findbugs.threshold} - ${findbugs.exclude} - true - true - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.2 - - forked-path - false - ${release.arguments} - - - - org.apache.maven.scm - maven-scm-provider-gitexe - 1.9.4 - - - - - - - src/main/java - - **/*.properties - **/*.xml - - - - src/main/resources - - javax.servlet.ServletContainerInitializer - - META-INF/services - - - - - - - org.codehaus.mojo - findbugs-maven-plugin - ${findbugs.version} - - ${findbugs.threshold} - ${findbugs.exclude} - - - - - - - - - true - never - warn - - - false - never - warn - - java.net.Releases - Java.net Releases - https://maven.java.net/content/repositories/releases - - - - - - javax.servlet - javax.servlet-api - 3.0.1 - provided - - - org.glassfish - javax.el - [3.0.1-b10,) - - - javax.servlet.jsp - javax.servlet.jsp-api - 2.3.3 - - - - - diff --git a/impl/src/main/java/org/apache/jasper/Constants.java b/impl/src/main/java/org/apache/jasper/Constants.java deleted file mode 100644 index 7dbe4f1..0000000 --- a/impl/src/main/java/org/apache/jasper/Constants.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper; - -import java.util.ResourceBundle; -import java.util.MissingResourceException; -import java.text.MessageFormat; - -/** - * Some constants and other global data that are used by the compiler and the runtime. - * - * @author Anil K. Vijendran - * @author Harish Prabandham - * @author Shawn Bayern - * @author Mark Roth - */ -public class Constants { - /** - * The base class of the generated servlets. - */ - public static final String JSP_SERVLET_BASE = "org.apache.jasper.runtime.HttpJspBase"; - - /** - * _jspService is the name of the method that is called by - * HttpJspBase.service(). This is where most of the code generated - * from JSPs go. - */ - public static final String SERVICE_METHOD_NAME = "_jspService"; - - /** - * Default servlet content type. - */ - public static final String SERVLET_CONTENT_TYPE = "text/html"; - - /** - * FIXME - * ServletContext attribute for classpath. This is tomcat specific. - * Other servlet engines may choose to support this attribute if they - * want to have this JSP engine running on them. - */ - public static final String SERVLET_CLASSPATH = "org.apache.catalina.jsp_classpath"; - - /** - * FIXME - * Request attribute for <jsp-file> element of a - * servlet definition. If present on a request, this overrides the - * value returned by request.getServletPath() to select - * the JSP page to be executed. - */ - public static final String JSP_FILE = "org.apache.catalina.jsp_file"; - - - /** - * FIXME - * ServletContext attribute for class loader. This is tomcat specific. - * Other servlet engines can choose to have this attribute if they - * want to have this JSP engine running on them. - */ - //public static final String SERVLET_CLASS_LOADER = "org.apache.tomcat.classloader"; - public static final String SERVLET_CLASS_LOADER = "org.apache.catalina.classloader"; - - /** - * Default size of the JSP buffer. - */ - public static final int K = 1024; - public static final int DEFAULT_BUFFER_SIZE = 8*K; - - /** - * Default size for the tag buffers. - */ - public static final int DEFAULT_TAG_BUFFER_SIZE = 512; - - /** - * Default tag handler pool size. - */ - public static final int MAX_POOL_SIZE = 5; - - /** - * The query parameter that causes the JSP engine to just - * pregenerated the servlet but not invoke it. - */ - public static final String PRECOMPILE = "jsp_precompile"; - - /** - * The default package name for compiled jsp pages. - */ - public static final String JSP_PACKAGE_NAME = "org.apache.jsp"; - - /** - * The default package name for tag handlers generated from tag files - */ - public static final String TAG_FILE_PACKAGE_NAME = "org.apache.jsp.tag"; - - /** - * Servlet context and request attributes that the JSP engine - * uses. - */ - public static final String INC_REQUEST_URI = "javax.servlet.include.request_uri"; - public static final String INC_SERVLET_PATH = "javax.servlet.include.servlet_path"; - public static final String TMP_DIR = "javax.servlet.context.tempdir"; - public static final String FORWARD_SEEN = "javax.servlet.forward.seen"; - public static final String FIRST_REQUEST_SEEN = "jspx.1st.request"; - - // Must be kept in sync with org/apache/catalina/Globals.java - public static final String ALT_DD_ATTR = "org.apache.catalina.deploy.alt_dd"; - - /** - * Public Id and the Resource path (of the cached copy) - * of the DTDs and schemas for tag library descriptors. - */ - public static final String TAGLIB_DTD_PUBLIC_ID_11 = - "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"; - public static final String TAGLIB_DTD_RESOURCE_PATH_11 = - "/javax/servlet/jsp/resources/web-jsptaglibrary_1_1.dtd"; - public static final String TAGLIB_DTD_PUBLIC_ID_12 = - "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"; - public static final String TAGLIB_DTD_RESOURCE_PATH_12 = - "/javax/servlet/jsp/resources/web-jsptaglibrary_1_2.dtd"; - public static final String TAGLIB_SCHEMA_PUBLIC_ID_20 = - "web-jsptaglibrary_2_0.xsd"; - public static final String TAGLIB_SCHEMA_RESOURCE_PATH_20 = - "/javax/servlet/jsp/resources/web-jsptaglibrary_2_0.xsd"; - public static final String TAGLIB_SCHEMA_PUBLIC_ID_21 = - "web-jsptaglibrary_2_1.xsd"; - public static final String TAGLIB_SCHEMA_RESOURCE_PATH_21 = - "/javax/servlet/jsp/resources/web-jsptaglibrary_2_1.xsd"; - public static final String SCHEMA_LOCATION_JSP_20 - = "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"; - public static final String SCHEMA_LOCATION_JSP_21 - = "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"; - - /** - * Public Id and the Resource path (of the cached copy) - * of the DTDs and schemas for web application deployment descriptors - */ - public static final String WEBAPP_DTD_PUBLIC_ID_22 = - "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"; - public static final String WEBAPP_DTD_RESOURCE_PATH_22 = - "/javax/servlet/resources/web-app_2_2.dtd"; - public static final String WEBAPP_DTD_PUBLIC_ID_23 = - "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"; - public static final String WEBAPP_DTD_RESOURCE_PATH_23 = - "/javax/servlet/resources/web-app_2_3.dtd"; - public static final String WEBAPP_SCHEMA_PUBLIC_ID_24 = - "web-app_2_4.xsd"; - public static final String WEBAPP_SCHEMA_RESOURCE_PATH_24 = - "/javax/servlet/resources/web-app_2_4.xsd"; - public static final String WEBAPP_SCHEMA_PUBLIC_ID_25 = - "web-app_2_5.xsd"; - public static final String WEBAPP_SCHEMA_RESOURCE_PATH_25 = - "/javax/servlet/resources/web-app_2_5.xsd"; - public static final String SCHEMA_LOCATION_WEBAPP_24 - = "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; - public static final String SCHEMA_LOCATION_WEBAPP_25 - = "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; - - /* PWC 6386258 - public static final String[] CACHED_DTD_RESOURCE_PATHS = { - TAGLIB_DTD_RESOURCE_PATH_11, - TAGLIB_DTD_RESOURCE_PATH_12, - WEBAPP_DTD_RESOURCE_PATH_22, - WEBAPP_DTD_RESOURCE_PATH_23, - }; - */ - - /** - * Default URLs to download the pluging for Netscape and IE. - */ - public static final String NS_PLUGIN_URL = - "http://java.sun.com/products/plugin/"; - - public static final String IE_PLUGIN_URL = - "http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0"; - - /** - * Prefix to use for generated temporary variable names - */ - public static final String TEMP_VARIABLE_NAME_PREFIX = - "_jspx_temp"; - - /** - * A replacement char for "\$". - * XXX This is a hack to avoid changing EL interpreter to recognize "\$" - */ - public static final char ESC='\u001b'; - public static final String ESCStr="'\\u001b'"; - - public static final Double JSP_VERSION_2_0 = Double.valueOf("2.0"); - public static final Double JSP_VERSION_2_1 = Double.valueOf("2.1"); - - // START SJSWS - /* - * Default initial capacity of HashMap which maps JSPs to their - * corresponding servlets - */ - public static final int DEFAULT_INITIAL_CAPACITY = 32; - // END SJSWS - - // START GlassFish 750 - public static final String JSP_TAGLIBRARY_CACHE = "com.sun.jsp.taglibraryCache"; - public static final String JSP_TAGFILE_JAR_URLS_CACHE = - "com.sun.jsp.tagFileJarUrlsCache"; - // END GlassFish 750 - - // START GlassFish 740 - // Must be kept in sync with org.apache.catalina.Globals - public static final String JSP_PROPERTY_GROUPS_CONTEXT_ATTRIBUTE = - "com.sun.jsp.propertyGroups"; - - public static final String WEB_XML_VERSION_CONTEXT_ATTRIBUTE = - "com.sun.servlet.webxml.version"; - // END GlassFish 740 - - // START GlassFish 747 - // Must be kept in sync with org.apache.catalina.Globals - public static final String JSP_TLD_URI_TO_LOCATION_MAP = - "com.sun.jsp.tldUriToLocationMap"; - // END GlassFish 747 - - public static final String JSP_RESOURCE_INJECTOR_CONTEXT_ATTRIBUTE = - "com.sun.appserv.jsp.resource.injector"; - - // a request attribute to indicate that the jsp error is already handled - // The constant value (instead of the constant name) is being referenced from - // other modules, and therefore requires special caution whenever it is changed. - public static final String JSP_ERROR_HANDLED = "org.glassfish.jsp.error_handled"; - - /** - * Has security been turned on? - */ - public static final boolean IS_SECURITY_ENABLED = - (System.getSecurityManager() != null); - - /** - * The name of the JSP engine. Used for X-Powered-By identification in - * the response header - */ - public static final String JSP_NAME = "JSP/2.3"; - - /** - * Name of the ServletContext init-param that determines if the XML parsers - * will block the resolution of external entities. - */ - public static final String XML_BLOCK_EXTERNAL_INIT_PARAM = - "org.apache.jasper.XML_BLOCK_EXTERNAL"; - -} - diff --git a/impl/src/main/java/org/apache/jasper/EmbeddedServletOptions.java b/impl/src/main/java/org/apache/jasper/EmbeddedServletOptions.java deleted file mode 100644 index d0622d7..0000000 --- a/impl/src/main/java/org/apache/jasper/EmbeddedServletOptions.java +++ /dev/null @@ -1,773 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2014 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper; - -import java.io.File; -import java.util.*; -import java.util.logging.Logger; -import java.util.logging.Level; -import java.text.MessageFormat; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; - -import org.apache.jasper.runtime.TldScanner; -import org.apache.jasper.compiler.JspConfig; -import org.apache.jasper.compiler.TagPluginManager; -import org.apache.jasper.compiler.Localizer; -import org.apache.jasper.xmlparser.ParserUtils; - -/** - * A class to hold all init parameters specific to the JSP engine. - * - * @author Anil K. Vijendran - * @author Hans Bergsten - * @author Pierre Delisle - */ -public final class EmbeddedServletOptions implements Options { - - // Logger - private static Logger log = - Logger.getLogger(EmbeddedServletOptions.class.getName()); - - private Properties settings = new Properties(); - - /** - * Is Jasper being used in development mode? - */ - private boolean development = true; - - /** - * Should Ant fork its java compiles of JSP pages. - */ - public boolean fork = true; - - /** - * Do you want to keep the generated Java files around? - */ - private boolean keepGenerated; - - /** - * If class files are generated as byte arrays, should they be saved to - * disk at the end of compilations? - */ - private boolean saveBytecode = false; - - /** - * Should white spaces between directives or actions be trimmed? - */ - private boolean trimSpaces = false; - - /** - * Determines whether tag handler pooling is enabled. - */ - private boolean isPoolingEnabled = true; - - /** - * Do you want support for "mapped" files? This will generate - * servlet that has a print statement per line of the JSP file. - * This seems like a really nice feature to have for debugging. - */ - private boolean mappedFile = true; - - /** - * Do you want stack traces and such displayed in the client's - * browser? If this is false, such messages go to the standard - * error or a log file if the standard error is redirected. - */ - private boolean sendErrorToClient = false; - - /** - * Do we want to include debugging information in the class file? - */ - private boolean classDebugInfo = true; - - /** - * Background compile thread check interval in seconds. - */ - private int checkInterval = 0; - - /** - * Is the generation of SMAP info for JSR45 debuggin suppressed? - */ - private boolean isSmapSuppressed = false; - - /** - * Should SMAP info for JSR45 debugging be dumped to a file? - */ - private boolean isSmapDumped = false; - - /** - * Are Text strings to be generated as char arrays? - */ - private boolean genStringAsCharArray = false; - - private boolean genStringAsByteArray = true; - - private boolean defaultBufferNone = false; - - private boolean errorOnUseBeanInvalidClassAttribute = false; - - /** - * I want to see my generated servlets. Which directory are they - * in? - */ - private File scratchDir; - - /** - * Need to have this as is for versions 4 and 5 of IE. Can be set from - * the initParams so if it changes in the future all that is needed is - * to have a jsp initParam of type ieClassId="" - */ - private String ieClassId = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"; - - /** - * What classpath should I use while compiling generated servlets? - */ - private String classpath = null; - - // START PWC 1.2 6311155 - private String sysClassPath = null; - // END PWC 1.2 6311155 - - /** - * Compiler to use. - */ - private String compiler = null; - - /** - * Compiler target VM. - */ - private String compilerTargetVM = "1.5"; - - /** - * The compiler source VM. - */ - private String compilerSourceVM = "1.5"; - - /** - * The compiler class name. - */ - private String compilerClassName = null; - - /** - * Cache for the TLD locations - */ - private TldScanner tldScanner = null; - - /** - * Jsp config information - */ - private JspConfig jspConfig = null; - - /** - * TagPluginManager - */ - private TagPluginManager tagPluginManager = null; - - /** - * Java platform encoding to generate the JSP - * page servlet. - */ - private String javaEncoding = "UTF8"; - - /** - * Modification test interval. - */ - private int modificationTestInterval = 0; - - /** - * Is generation of X-Powered-By response header enabled/disabled? - */ - private boolean xpoweredBy; - - // BEGIN S1AS 6181923 - private boolean usePrecompiled; - // END S1AS 6181923 - - // START SJSAS 6384538 - private boolean isValidationEnabled; - // END SJSAS 6384538 - - // START SJSWS - /* - * Initial capacity of HashMap which maps JSPs to their corresponding - * servlets - */ - private int initialCapacity = Constants.DEFAULT_INITIAL_CAPACITY; - // END SJSWS - - public String getProperty(String name ) { - return settings.getProperty( name ); - } - - public void setProperty(String name, String value ) { - if (name != null && value != null){ - settings.setProperty( name, value ); - } - } - - /** - * Are we keeping generated code around? - */ - public boolean getKeepGenerated() { - return keepGenerated; - } - - public boolean getSaveBytecode() { - return this.saveBytecode; - } - - /** - * Should white spaces between directives or actions be trimmed? - */ - public boolean getTrimSpaces() { - return trimSpaces; - } - - public boolean isPoolingEnabled() { - return isPoolingEnabled; - } - - /** - * Are we supporting HTML mapped servlets? - */ - public boolean getMappedFile() { - return mappedFile; - } - - /** - * Should errors be sent to client or thrown into stderr? - */ - public boolean getSendErrorToClient() { - return sendErrorToClient; - } - - /** - * Should class files be compiled with debug information? - */ - public boolean getClassDebugInfo() { - return classDebugInfo; - } - - /** - * Background JSP compile thread check intervall - */ - public int getCheckInterval() { - return checkInterval; - } - - /** - * Modification test interval. - */ - public int getModificationTestInterval() { - return modificationTestInterval; - } - - /** - * Is Jasper being used in development mode? - */ - public boolean getDevelopment() { - return development; - } - - /** - * Is the generation of SMAP info for JSR45 debuggin suppressed? - */ - public boolean isSmapSuppressed() { - return isSmapSuppressed; - } - - /** - * Should SMAP info for JSR45 debugging be dumped to a file? - */ - public boolean isSmapDumped() { - return isSmapDumped; - } - - /** - * Are Text strings to be generated as char arrays? - */ - public boolean genStringAsCharArray() { - return this.genStringAsCharArray; - } - - public boolean genStringAsByteArray() { - return this.genStringAsByteArray; - } - - public boolean isDefaultBufferNone() { - return defaultBufferNone; - } - - /** - * Class ID for use in the plugin tag when the browser is IE. - */ - public String getIeClassId() { - return ieClassId; - } - - /** - * What is my scratch dir? - */ - public File getScratchDir() { - return scratchDir; - } - - /** - * What classpath should I use while compiling the servlets - * generated from JSP files? - */ - public String getClassPath() { - return classpath; - } - - // START PWC 1.2 6311155 - /** - * Gets the system class path. - * - * @return The system class path - */ - public String getSystemClassPath() { - return sysClassPath; - } - // END PWC 1.2 6311155 - - /** - * Is generation of X-Powered-By response header enabled/disabled? - */ - public boolean isXpoweredBy() { - return xpoweredBy; - } - - /** - * Compiler to use. - */ - public String getCompiler() { - return compiler; - } - - /** - * @see Options#getCompilerTargetVM - */ - public String getCompilerTargetVM() { - return compilerTargetVM; - } - - /** - * @see Options#getCompilerSourceVM - */ - public String getCompilerSourceVM() { - return compilerSourceVM; - } - - /** - * @see Options#getCompilerName - */ - public String getCompilerClassName() { - return compilerClassName; - } - - - public boolean getErrorOnUseBeanInvalidClassAttribute() { - return errorOnUseBeanInvalidClassAttribute; - } - - public void setErrorOnUseBeanInvalidClassAttribute(boolean b) { - errorOnUseBeanInvalidClassAttribute = b; - } - - public TldScanner getTldScanner() { - return tldScanner; - } - - public String getJavaEncoding() { - return javaEncoding; - } - - public boolean getFork() { - return fork; - } - - public JspConfig getJspConfig() { - return jspConfig; - } - - public TagPluginManager getTagPluginManager() { - return tagPluginManager; - } - - // START SJSWS - /** - * Gets initial capacity of HashMap which maps JSPs to their corresponding - * servlets. - */ - public int getInitialCapacity() { - return initialCapacity; - } - // END SJSWS - - // BEGIN S1AS 6181923 - /** - * Returns the value of the usePrecompiled (or use-precompiled) init - * param. - */ - public boolean getUsePrecompiled() { - return usePrecompiled; - } - // END S1AS 6181923 - - - // START SJSAS 6384538 - public boolean isValidationEnabled() { - return isValidationEnabled; - } - // END SJSAS 6384538 - - /** - * Create an EmbeddedServletOptions object using data available from - * ServletConfig and ServletContext. - */ - public EmbeddedServletOptions(ServletConfig config, - ServletContext context) { - - // JVM version numbers - try { - if (Float.parseFloat(System.getProperty("java.specification.version")) > 1.4) { - compilerSourceVM = compilerTargetVM = "1.5"; - } else { - compilerSourceVM = compilerTargetVM = "1.4"; - } - } catch (NumberFormatException e) { - // Ignore - } - - Enumeration enumeration=config.getInitParameterNames(); - while( enumeration.hasMoreElements() ) { - String k=(String)enumeration.nextElement(); - String v=config.getInitParameter( k ); - setProperty( k, v); - } - - /* SJSAS 6384538 - // quick hack - String validating=config.getInitParameter( "validating"); - if( "false".equals( validating )) ParserUtils.validating=false; - */ - // START SJSAS 6384538 - String validating=config.getInitParameter("validating"); - if ("true".equals(validating)) { - isValidationEnabled = true; - } - validating = config.getInitParameter("enableTldValidation"); - if ("true".equals(validating)) { - isValidationEnabled = true; - } - // END SJSAS 6384538 - - // keepgenerated default is false for JDK6 for later, true otherwise - keepGenerated = getBoolean(config, ! isJDK6(), "keepgenerated"); - saveBytecode = getBoolean(config, saveBytecode, "saveBytecode"); - trimSpaces = getBoolean(config, trimSpaces, "trimSpaces"); - isPoolingEnabled = getBoolean(config, isPoolingEnabled, "enablePooling"); - mappedFile = getBoolean(config, mappedFile, "mappedfile"); - sendErrorToClient = getBoolean(config, sendErrorToClient, "sendErrToClient"); - classDebugInfo = getBoolean(config, classDebugInfo, "classdebuginfo"); - development = getBoolean(config, development, "development"); - isSmapSuppressed = getBoolean(config, isSmapSuppressed, "suppressSmap"); - isSmapDumped = getBoolean(config, isSmapDumped, "dumpSmap"); - genStringAsCharArray = getBoolean(config, genStringAsCharArray, "genStrAsCharArray"); - genStringAsByteArray = getBoolean(config, genStringAsByteArray, "genStrAsByteArray"); - defaultBufferNone = getBoolean(config, defaultBufferNone, "defaultBufferNone"); - errorOnUseBeanInvalidClassAttribute = getBoolean(config, errorOnUseBeanInvalidClassAttribute, "errorOnUseBeanInvalidClassAttribute"); - fork = getBoolean(config, fork, "fork"); - xpoweredBy = getBoolean(config, xpoweredBy, "xpoweredBy"); - - String checkIntervalStr = config.getInitParameter("checkInterval"); - if (checkIntervalStr != null) { - parseCheckInterval(checkIntervalStr); - } - - String modificationTestIntervalStr = - config.getInitParameter("modificationTestInterval"); - if (modificationTestIntervalStr != null) { - parseModificationTestInterval(modificationTestIntervalStr); - } - - String ieClassId = config.getInitParameter("ieClassId"); - if (ieClassId != null) - this.ieClassId = ieClassId; - - String classpath = config.getInitParameter("classpath"); - if (classpath != null) - this.classpath = classpath; - - // START PWC 1.2 6311155 - String sysClassPath = config.getInitParameter( - "com.sun.appserv.jsp.classpath"); - if (sysClassPath != null) - this.sysClassPath = sysClassPath; - // END PWC 1.2 6311155 - - /* - * scratchdir - */ - String dir = config.getInitParameter("scratchdir"); - if (dir != null) { - scratchDir = new File(dir); - } else { - // First try the Servlet 2.2 javax.servlet.context.tempdir property - scratchDir = (File) context.getAttribute(Constants.TMP_DIR); - if (scratchDir == null) { - // Not running in a Servlet 2.2 container. - // Try to get the JDK 1.2 java.io.tmpdir property - dir = System.getProperty("java.io.tmpdir"); - if (dir != null) - scratchDir = new File(dir); - } - } - if (this.scratchDir == null) { - log.severe(Localizer.getMessage("jsp.error.no.scratch.dir")); - return; - } - - if (scratchDir.exists() && !(scratchDir.canRead() && - scratchDir.canWrite() && scratchDir.isDirectory())) - log.severe(Localizer.getMessage("jsp.error.bad.scratch.dir", - scratchDir.getAbsolutePath())); - - this.compiler = config.getInitParameter("compiler"); - - String compilerTargetVM = config.getInitParameter("compilerTargetVM"); - if(compilerTargetVM != null) { - this.compilerTargetVM = compilerTargetVM; - } - - String compilerSourceVM = config.getInitParameter("compilerSourceVM"); - if(compilerSourceVM != null) { - this.compilerSourceVM = compilerSourceVM; - } - - String javaEncoding = config.getInitParameter("javaEncoding"); - if (javaEncoding != null) { - this.javaEncoding = javaEncoding; - } - - String compilerClassName = config.getInitParameter("compilerClassName"); - if (compilerClassName != null) { - this.compilerClassName = compilerClassName; - } - - String reloadIntervalString = - config.getInitParameter("reload-interval"); - if (reloadIntervalString != null) { - int reloadInterval = 0; - try { - reloadInterval = Integer.parseInt(reloadIntervalString); - } catch (NumberFormatException e) { - if (log.isLoggable(Level.WARNING)) { - log.warning( - Localizer.getMessage("jsp.warning.reloadInterval")); - } - } - if (reloadInterval == -1) { - // Never check JSPs for modifications, and disable - // recompilation - this.development = false; - this.checkInterval = 0; - } else { - // Check JSPs for modifications at specified interval in - // both (development and non-development) modes - parseCheckInterval(reloadIntervalString); - parseModificationTestInterval(reloadIntervalString); - } - } - - // BEGIN S1AS 6181923 - String usePrecompiled = config.getInitParameter("usePrecompiled"); - if (usePrecompiled == null) { - usePrecompiled = config.getInitParameter("use-precompiled"); - } - if (usePrecompiled != null) { - if (usePrecompiled.equalsIgnoreCase("true")) { - this.usePrecompiled = true; - } else if (usePrecompiled.equalsIgnoreCase("false")) { - this.usePrecompiled = false; - } else { - if (log.isLoggable(Level.WARNING)) { - log.warning( - Localizer.getMessage("jsp.warning.usePrecompiled")); - } - } - } - // END S1AS 6181923 - - // START SJSWS - String capacity = config.getInitParameter("initialCapacity"); - if (capacity == null) { - capacity = config.getInitParameter("initial-capacity"); - } - if (capacity != null) { - try { - initialCapacity = Integer.parseInt(capacity); - // Find a value that is power of 2 and >= the specified - // initial capacity, in order to make Hashtable indexing - // more efficient. - int value = Constants.DEFAULT_INITIAL_CAPACITY; - while (value < initialCapacity) { - value *= 2; - } - initialCapacity = value; - } catch (NumberFormatException nfe) { - if (log.isLoggable(Level.WARNING)) { - String msg = Localizer.getMessage( - "jsp.warning.initialcapacity"); - msg = MessageFormat.format( - msg, - new Object[] { - capacity, - Integer.valueOf(Constants.DEFAULT_INITIAL_CAPACITY)}); - log.warning(msg); - } - } - } - - String jspCompilerPlugin = config.getInitParameter("javaCompilerPlugin"); - if (jspCompilerPlugin != null) { - if ("org.apache.jasper.compiler.JikesJavaCompiler".equals( - jspCompilerPlugin)) { - this.compiler = "jikes"; - } else if ("org.apache.jasper.compiler.SunJava14Compiler".equals( - jspCompilerPlugin)) { - // use default, do nothing - } else { - // use default, issue warning - if (log.isLoggable(Level.WARNING)) { - String msg = Localizer.getMessage( - "jsp.warning.unsupportedJavaCompiler"); - msg = MessageFormat.format(msg, - new Object[] - { jspCompilerPlugin }); - log.warning(msg); - } - } - } - // END SJSWS - - // Setup the global Tag Libraries location cache for this - // web-application. - tldScanner = new TldScanner(context, isValidationEnabled); - - // Setup the jsp config info for this web app. - jspConfig = new JspConfig(context); - - // Create a Tag plugin instance - tagPluginManager = new TagPluginManager(context); - } - - - private void parseCheckInterval(String param) { - try { - this.checkInterval = Integer.parseInt(param); - } catch(NumberFormatException ex) { - if (log.isLoggable(Level.WARNING)) { - log.warning(Localizer.getMessage("jsp.warning.checkInterval")); - } - } - } - - - private void parseModificationTestInterval(String param) { - try { - this.modificationTestInterval = Integer.parseInt(param); - } catch(NumberFormatException ex) { - if (log.isLoggable(Level.WARNING)) { - log.warning( - Localizer.getMessage("jsp.warning.modificationTestInterval")); - } - } - } - - private boolean getBoolean(ServletConfig config, - boolean init, String param) { - - String sParam = config.getInitParameter(param); - if (sParam != null) { - if (sParam.equalsIgnoreCase("true")) { - return true; - } - if (sParam.equalsIgnoreCase("false")) { - return false; - } - if (log.isLoggable(Level.WARNING)) { - log.warning(Localizer.getMessage("jsp.warning.boolean", param, - (init? "true": "false"))); - } - } - return init; - } - - /* - * returns true if running with JDK 6 or later. - */ - private boolean isJDK6() { - return "1.6".equals(System.getProperty("java.specification.version")); - } -} - diff --git a/impl/src/main/java/org/apache/jasper/JasperException.java b/impl/src/main/java/org/apache/jasper/JasperException.java deleted file mode 100644 index 370cdaa..0000000 --- a/impl/src/main/java/org/apache/jasper/JasperException.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper; - -/** - * Base class for all exceptions generated by the JSP engine. Makes it - * convienient to catch just this at the top-level. - * - * @author Anil K. Vijendran - */ -public class JasperException extends javax.servlet.ServletException { - - public JasperException(String reason) { - super(reason); - } - - /** - * Creates a JasperException with the embedded exception and the reason for - * throwing a JasperException - */ - public JasperException (String reason, Throwable exception) { - super(reason, exception); - } - - /** - * Creates a JasperException with the embedded exception - */ - public JasperException (Throwable exception) { - super(exception); - } -} diff --git a/impl/src/main/java/org/apache/jasper/JspC.java b/impl/src/main/java/org/apache/jasper/JspC.java deleted file mode 100644 index 58787e4..0000000 --- a/impl/src/main/java/org/apache/jasper/JspC.java +++ /dev/null @@ -1,1679 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2011 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper; - -import java.io.BufferedReader; -import java.io.CharArrayWriter; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.Writer; -import java.io.UnsupportedEncodingException; -// START GlassFish 750 -import java.util.concurrent.ConcurrentHashMap; -// END GlassFish 750 -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.*; -import java.util.logging.Logger; -import java.util.logging.Level; - -// START GlassFish 750 -import javax.servlet.jsp.tagext.TagLibraryInfo; -// END GlassFish 750 - -import org.apache.jasper.compiler.Compiler; -import org.apache.jasper.compiler.JspConfig; -import org.apache.jasper.compiler.JspRuntimeContext; -import org.apache.jasper.compiler.Localizer; -import org.apache.jasper.compiler.PageInfo; -import org.apache.jasper.compiler.TagPluginManager; -import org.apache.jasper.runtime.TldScanner; -import org.apache.jasper.servlet.JspCServletContext; -// START PWC 6386258 -import org.apache.jasper.xmlparser.ParserUtils; -// END PWC 6386258 - -// START SJSAS 6258619 -// XXX Remove the dependency on glassfish.webtier for now -// import com.sun.appserv.ClassLoaderUtil; -// END SJSAS 6258619 - -/** - * Shell for the jspc compiler. Handles all options associated with the - * command line and creates compilation contexts which it then compiles - * according to the specified options. - * - * This version can process files from a _single_ webapp at once, i.e. - * a single docbase can be specified. - * - * It can be used as an Ant task using: - *
    - *   <taskdef classname="org.apache.jasper.JspC" name="jasper2" >
    - *      <classpath>
    - *          <pathelement location="${java.home}/../lib/tools.jar"/>
    - *          <fileset dir="${ENV.CATALINA_HOME}/server/lib">
    - *              <include name="*.jar"/>
    - *          </fileset>
    - *          <fileset dir="${ENV.CATALINA_HOME}/common/lib">
    - *              <include name="*.jar"/>
    - *          </fileset>
    - *          <path refid="myjars"/>
    - *       </classpath>
    - *  </taskdef>
    - *
    - *  <jasper2 verbose="0"
    - *           package="my.package"
    - *           uriroot="${webapps.dir}/${webapp.name}"
    - *           webXmlFragment="${build.dir}/generated_web.xml"
    - *           outputDir="${webapp.dir}/${webapp.name}/WEB-INF/src/my/package" />
    - * 
    - * - * @author Danno Ferrin - * @author Pierre Delisle - * @author Costin Manolache - */ -public class JspC implements Options { - - public static final String DEFAULT_IE_CLASS_ID = - "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"; - - // START SJSAS 6402545 - private static final String JAVA_1_0 = "1.0"; - private static final String JAVA_1_1 = "1.1"; - private static final String JAVA_1_2 = "1.2"; - private static final String JAVA_1_3 = "1.3"; - private static final String JAVA_1_4 = "1.4"; - private static final String JAVA_1_5 = "1.5"; - private static final String JAVA_1_6 = "1.6"; - private static final String JAVA_1_7 = "1.7"; - private static final String JAVA_1_8 = "1.8"; - private static final String JAVA_5 = "5"; - private static final String JAVA_6 = "6"; - private static final String JAVA_7 = "7"; - private static final String JAVA_8 = "8"; - // END SJSAS 6402545 - - // Logger - private static Logger log = Logger.getLogger(JspC.class.getName()); - - private static final String SWITCH_VERBOSE = "-v"; - private static final String SWITCH_HELP = "-help"; - private static final String SWITCH_QUIET = "-q"; - private static final String SWITCH_OUTPUT_DIR = "-d"; - private static final String SWITCH_IE_CLASS_ID = "-ieplugin"; - private static final String SWITCH_PACKAGE_NAME = "-p"; - private static final String SWITCH_CLASS_NAME = "-c"; - private static final String SWITCH_FULL_STOP = "--"; - private static final String SWITCH_COMPILE = "-compile"; - private static final String SWITCH_SOURCE = "-compilerSourceVM"; - private static final String SWITCH_TARGET = "-compilerTargetVM"; - private static final String SWITCH_URI_BASE = "-uribase"; - private static final String SWITCH_URI_ROOT = "-uriroot"; - private static final String SWITCH_FILE_WEBAPP = "-webapp"; - private static final String SWITCH_WEBAPP_INC = "-webinc"; - private static final String SWITCH_WEBAPP_XML = "-webxml"; - private static final String SWITCH_MAPPED = "-mapped"; - private static final String SWITCH_XPOWERED_BY = "-xpoweredBy"; - private static final String SWITCH_TRIM_SPACES = "-trimSpaces"; - private static final String SWITCH_CLASSPATH = "-classpath"; - private static final String SWITCH_SYSCLASSPATH = "-sysClasspath"; - private static final String SWITCH_DIE = "-die"; - private static final String SWITCH_SMAP = "-smap"; - private static final String SWITCH_DUMP_SMAP = "-dumpsmap"; - // START PWC 6386258 - private static final String SWITCH_SCHEMAS_PREFIX = "-schemas"; - private static final String SWITCH_DTDS_PREFIX = "-dtds"; - // END PWC 6386258 - // START IASRI 4660687 - private static final String SWITCH_GENERATE_CLASSES = "-genclass"; - // END IASRI 4660687 - // START PWC 6385018 - private static final String SWITCH_VALIDATE = "-validate"; - // END PWC 6385018 - // START SJSAS 6393940 - private static final String SWITCH_IGNORE_JSP_FRAGMENTS - = "-ignoreJspFragmentErrors"; - // END SJSAS 6393940 - private static final String SWITCH_DISABLE_POOLING = "-disablePooling"; - - private static final String SHOW_SUCCESS ="-s"; - private static final String LIST_ERRORS = "-l"; - private static final int NO_WEBXML = 0; - private static final int INC_WEBXML = 10; - private static final int ALL_WEBXML = 20; - private static final int DEFAULT_DIE_LEVEL = 1; - private static final int NO_DIE_LEVEL = 0; - - private static final String[] insertBefore = - { "", "", "", - "", "", "", "", - "", "", "", - "", "", "", "", - "" }; - - private int dieLevel; - private String classPath = null; - // START PWC 1.2 6311155 - private String sysClassPath = null; - // END PWC 1.2 6311155 - private URLClassLoader loader = null; - private boolean trimSpaces = false; - private boolean genStringAsCharArray = false; - private boolean genStringAsByteArray = true; - private boolean defaultBufferNone = false; - private boolean xpoweredBy; - private boolean mappedFile = false; - private boolean poolingEnabled = true; - private File scratchDir; - private String ieClassId = DEFAULT_IE_CLASS_ID; - private String targetPackage; - private String targetClassName; - private String uriBase; - private String uriRoot; - private boolean helpNeeded = false; - private boolean compile = false; - private boolean smapSuppressed = true; - private boolean smapDumped = false; - - private String compiler = null; - - private String compilerTargetVM = JAVA_1_5; - private String compilerSourceVM = JAVA_1_5; - - private boolean classDebugInfo = true; - - /** - * Throw an exception if there's a compilation error, or swallow it. - * Default is true to preserve old behavior. - */ - private boolean failOnError = true; - - private ArrayList extensions; - private ArrayList pages = new ArrayList(); - private boolean errorOnUseBeanInvalidClassAttribute = false; - - /** - * The java file encoding. Default - * is UTF-8. Added per bugzilla 19622. - */ - private String javaEncoding = "UTF-8"; - - // Generation of web.xml fragments - private String webxmlFile; - private int webxmlLevel; - private boolean addWebXmlMappings = false; - - private Writer mapout; - private CharArrayWriter servletout; - private CharArrayWriter mappingout; - - private JspCServletContext context; - - // Maintain a dummy JspRuntimeContext for compiling tag files - private JspRuntimeContext rctxt; - - /** - * Cache for the TLD locations - */ - private TldScanner tldScanner = null; - - private JspConfig jspConfig = null; - private TagPluginManager tagPluginManager = null; - - private boolean verbose = false; - private boolean listErrors = false; - private boolean showSuccess = false; - private int argPos; - private boolean fullstop = false; - private String args[]; - - // START SJSAS 6384538 - private boolean isValidationEnabled; - // END SJSAS 6384538 - - // START SJSAS 6329723 - private HashMap jspErrors - = new HashMap(); - // END SJSAS 6329723 - - // START SJSAS 6403017 - private static String myJavaVersion = - System.getProperty("java.specification.version"); - // END SJSAS 6403017 - - // START SJSAS 6393940 - private boolean ignoreJspFragmentErrors = false; - private Set dependents = new HashSet(); - // END SJSAS 6393940 - - // START GlassFish 750 - private ConcurrentHashMap taglibs; - private ConcurrentHashMap tagFileJarUrls; - // END GlassFish 750 - - public static void main(String arg[]) { - if (arg.length == 0) { - System.out.println(Localizer.getMessage("jspc.usage")); - } else { - JspC jspc = new JspC(); - try { - jspc.setArgs(arg); - if (jspc.helpNeeded) { - System.out.println(Localizer.getMessage("jspc.usage")); - } else { - jspc.execute(); - } - } catch (JasperException je) { - System.err.println(je); - //System.err.println(je.getMessage()); - if (jspc.getDieLevel() != NO_DIE_LEVEL) { - System.exit(jspc.getDieLevel()); - } - } - } - } - - public void setArgs(String[] arg) throws JasperException { - args = arg; - String tok; - - dieLevel = NO_DIE_LEVEL; - - while ((tok = nextArg()) != null) { - if (tok.equals(SWITCH_VERBOSE)) { - verbose = true; - showSuccess = true; - listErrors = true; - } else if (tok.equals(SWITCH_OUTPUT_DIR)) { - tok = nextArg(); - setOutputDir( tok ); - } else if (tok.equals(SWITCH_PACKAGE_NAME)) { - targetPackage = nextArg(); - } else if (tok.equals(SWITCH_COMPILE)) { - compile=true; - } else if (tok.equals(SWITCH_CLASS_NAME)) { - targetClassName = nextArg(); - } else if (tok.equals(SWITCH_URI_BASE)) { - uriBase=nextArg(); - } else if (tok.equals(SWITCH_URI_ROOT)) { - setUriroot( nextArg()); - // START IASRI 4660687 - } else if (tok.equals(SWITCH_GENERATE_CLASSES)) { - compile = true; - // END IASRI 4660687 - } else if (tok.equals(SWITCH_FILE_WEBAPP)) { - setUriroot( nextArg()); - } else if ( tok.equals( SHOW_SUCCESS ) ) { - showSuccess = true; - } else if ( tok.equals( LIST_ERRORS ) ) { - listErrors = true; - } else if (tok.equals(SWITCH_WEBAPP_INC)) { - webxmlFile = nextArg(); - if (webxmlFile != null) { - webxmlLevel = INC_WEBXML; - } - } else if (tok.equals(SWITCH_WEBAPP_XML)) { - webxmlFile = nextArg(); - if (webxmlFile != null) { - webxmlLevel = ALL_WEBXML; - } - } else if (tok.equals(SWITCH_MAPPED)) { - mappedFile = true; - } else if (tok.equals(SWITCH_XPOWERED_BY)) { - xpoweredBy = true; - } else if (tok.equals(SWITCH_TRIM_SPACES)) { - setTrimSpaces(true); - } else if (tok.equals(SWITCH_CLASSPATH)) { - setClassPath(nextArg()); - } else if (tok.equals(SWITCH_SYSCLASSPATH)) { - setSystemClassPath(nextArg()); - } else if (tok.startsWith(SWITCH_DIE)) { - try { - dieLevel = Integer.parseInt( - tok.substring(SWITCH_DIE.length())); - } catch (NumberFormatException nfe) { - dieLevel = DEFAULT_DIE_LEVEL; - } - } else if (tok.equals(SWITCH_HELP)) { - helpNeeded = true; - } else if (tok.equals(SWITCH_SOURCE)) { - setCompilerSourceVM(nextArg()); - } else if (tok.equals(SWITCH_TARGET)) { - setCompilerTargetVM(nextArg()); - } else if (tok.equals(SWITCH_SMAP)) { - smapSuppressed = false; - } else if (tok.equals(SWITCH_DUMP_SMAP)) { - smapDumped = true; - smapSuppressed = false; - // START PWC 6386258 - } else if (tok.equals(SWITCH_SCHEMAS_PREFIX)) { - setSchemaResourcePrefix(nextArg()); - } else if (tok.equals(SWITCH_DTDS_PREFIX)) { - setDtdResourcePrefix(nextArg()); - // END PWC 6386258 - // START PWC 6385018 - } else if (tok.equals(SWITCH_VALIDATE)) { - setValidateXml(true); - // END PWC 6385018 - // START SJSAS 6393940 - } else if (tok.equals(SWITCH_IGNORE_JSP_FRAGMENTS)) { - setIgnoreJspFragmentErrors(true); - // END SJSAS 6393940 - } else if (tok.equals(SWITCH_DISABLE_POOLING)) { - setPoolingEnabled(false); - } else { - if (tok.startsWith("-")) { - throw new JasperException("Unrecognized option: " + tok + - ". Use -help for help."); - } - if (!fullstop) { - argPos--; - } - // Start treating the rest as JSP Pages - break; - } - } - - // Add all extra arguments to the list of files - while( true ) { - String file = nextFile(); - if( file==null ) break; - pages.add( file ); - } - } - - public int getDieLevel() { - return dieLevel; - } - - public boolean getKeepGenerated() { - // isn't this why we are running jspc? - return true; - } - - public boolean getSaveBytecode() { - return true; - } - - public boolean getTrimSpaces() { - return trimSpaces; - } - - public void setTrimSpaces(boolean ts) { - this.trimSpaces = ts; - } - - public boolean isPoolingEnabled() { - return poolingEnabled; - } - - public void setPoolingEnabled(boolean poolingEnabled) { - this.poolingEnabled = poolingEnabled; - } - - public boolean isXpoweredBy() { - return xpoweredBy; - } - - public void setXpoweredBy(boolean xpoweredBy) { - this.xpoweredBy = xpoweredBy; - } - - public boolean getErrorOnUseBeanInvalidClassAttribute() { - return errorOnUseBeanInvalidClassAttribute; - } - - public void setErrorOnUseBeanInvalidClassAttribute(boolean b) { - errorOnUseBeanInvalidClassAttribute = b; - } - - public int getTagPoolSize() { - return Constants.MAX_POOL_SIZE; - } - - // START SJSWS - /** - * Gets initial capacity of HashMap which maps JSPs to their corresponding - * servlets. - */ - public int getInitialCapacity() { - return Constants.DEFAULT_INITIAL_CAPACITY; - } - // END SJSWS - - /** - * Are we supporting HTML mapped servlets? - */ - public boolean getMappedFile() { - return mappedFile; - } - - // Off-line compiler, no need for security manager - public Object getProtectionDomain() { - return null; - } - - public boolean getSendErrorToClient() { - // implied send to System.err - return true; - } - - public void setClassDebugInfo( boolean b ) { - classDebugInfo=b; - } - - public boolean getClassDebugInfo() { - // compile with debug info - return classDebugInfo; - } - - /** - * Background compilation check intervals in seconds - */ - public int getCheckInterval() { - return 0; - } - - /** - * Modification test interval. - */ - public int getModificationTestInterval() { - return 0; - } - - /** - * Is Jasper being used in development mode? - */ - public boolean getDevelopment() { - return false; - } - - // BEGIN S1AS 6181923 - public boolean getUsePrecompiled() { - return false; - } - // END S1AS 6181923 - - /** - * Is the generation of SMAP info for JSR45 debugging suppressed? - */ - public boolean isSmapSuppressed() { - return smapSuppressed; - } - - /** - * Set smapSuppressed flag. - */ - public void setSmapSuppressed(boolean smapSuppressed) { - this.smapSuppressed = smapSuppressed; - } - - /** - * Should SMAP info for JSR45 debugging be dumped to a file? - */ - public boolean isSmapDumped() { - return smapDumped; - } - - /** - * Set smapSuppressed flag. - */ - public void setSmapDumped(boolean smapDumped) { - this.smapDumped = smapDumped; - } - - /** - * Determines whether text strings are to be generated as char arrays, - * which improves performance in some cases. - * - * @param genStringAsCharArray true if text strings are to be generated as - * char arrays, false otherwise - */ - public void setGenStringAsCharArray(boolean genStringAsCharArray) { - this.genStringAsCharArray = genStringAsCharArray; - } - - /** - * Indicates whether text strings are to be generated as char arrays. - * - * @return true if text strings are to be generated as char arrays, false - * otherwise - */ - public boolean genStringAsCharArray() { - return genStringAsCharArray; - } - - public void setGenStringAsByteArray(boolean genStringAsByteArray) { - this.genStringAsByteArray = genStringAsByteArray; - } - - public boolean genStringAsByteArray() { - return genStringAsByteArray; - } - - public boolean isDefaultBufferNone() { - return defaultBufferNone; - } - - public void setDefaultBufferNone(boolean defaultBufferNone) { - this.defaultBufferNone = defaultBufferNone; - } - - /** - * Sets the class-id value to be sent to Internet Explorer when using - * tags. - * - * @param ieClassId Class-id value - */ - public void setIeClassId(String ieClassId) { - this.ieClassId = ieClassId; - } - - /** - * Gets the class-id value that is sent to Internet Explorer when using - * tags. - * - * @return Class-id value - */ - public String getIeClassId() { - return ieClassId; - } - - public File getScratchDir() { - return scratchDir; - } - - public Class getJspCompilerPlugin() { - // we don't compile, so this is meanlingless - return null; - } - - public String getJspCompilerPath() { - // we don't compile, so this is meanlingless - return null; - } - - /** - * Compiler to use. - */ - public String getCompiler() { - return compiler; - } - - public void setCompiler(String c) { - compiler=c; - } - - /** - * @see Options#getCompilerTargetVM - */ - public String getCompilerTargetVM() { - return compilerTargetVM; - } - - public void setCompilerTargetVM(String vm) { - // START SJSAS 6402545 - String tvm = vm; - if (JAVA_5.equals(vm)) { - vm = JAVA_1_5; - } else if (JAVA_6.equals(vm)) { - vm = JAVA_1_6; - } else if (JAVA_7.equals(vm)) { - vm = JAVA_1_7; - } else if (JAVA_8.equals(vm)) { - vm = JAVA_1_8; - } - if (!JAVA_1_1.equals(vm) && !JAVA_1_2.equals(vm) - && !JAVA_1_3.equals(vm) && !JAVA_1_4.equals(vm) - && !JAVA_1_5.equals(vm) && !JAVA_1_6.equals(vm) - && !JAVA_1_7.equals(vm) && !JAVA_1_8.equals(vm)){ - throw new IllegalArgumentException( - Localizer.getMessage("jspc.illegalCompilerTargetVM", tvm)); - } - // END SJSAS 6402545 - // START SJSAS 6403017 - Double targetVersion = Double.valueOf(vm); - if (targetVersion.compareTo(Double.valueOf(myJavaVersion)) > 0) { - throw new IllegalArgumentException( - Localizer.getMessage("jspc.compilerTargetVMTooHigh", vm)); - } - // END SJSAS 6403017 - compilerTargetVM = vm; - } - - /** - * @see Options#getCompilerSourceVM. - */ - public String getCompilerSourceVM() { - return compilerSourceVM; - } - - /** - * @see Options#getCompilerSourceVM. - */ - public void setCompilerSourceVM(String vm) { - // START SJSAS 6402545 - if (!JAVA_1_3.equals(vm) && !JAVA_1_4.equals(vm) - && !JAVA_1_5.equals(vm) && !JAVA_5.equals(vm) - && !JAVA_1_6.equals(vm) && !JAVA_6.equals(vm) - && !JAVA_1_7.equals(vm) && !JAVA_7.equals(vm) - && !JAVA_1_8.equals(vm) && !JAVA_8.equals(vm)) { - throw new IllegalArgumentException( - Localizer.getMessage("jspc.illegalCompilerSourceVM", vm)); - } - // END SJSAS 6402545 - compilerSourceVM = vm; - } - - /** - * @see Options#getCompilerClassName. - */ - public String getCompilerClassName() { - return null; - } - - public TldScanner getTldScanner() { - return tldScanner; - } - - /** - * Returns the encoding to use for - * java files. The default is UTF-8. - * - * @return String The encoding - */ - public String getJavaEncoding() { - return javaEncoding; - } - - /** - * Sets the encoding to use for - * java files. - * - * @param encodingName The name, e.g. "UTF-8" - */ - public void setJavaEncoding(String encodingName) { - javaEncoding = encodingName; - } - - public boolean getFork() { - return false; - } - - public String getClassPath() { - if( classPath != null ) - return classPath; - /* PWC 1.2 6311155 - return System.getProperty("java.class.path"); - */ - // START PWC 1.2 6311155 - return ""; - // END PWC 1.2 6311155 - } - - public void setClassPath(String s) { - classPath=s; - } - - // START PWC 1.2 6311155 - /** - * Gets the system class path. - * - * @return The system class path - */ - public String getSystemClassPath() { - if (sysClassPath != null) { - return sysClassPath; - } else { - return System.getProperty("java.class.path"); - } - } - - /** - * Sets the system class path. - * - * @param s The system class path to use - */ - public void setSystemClassPath(String s) { - sysClassPath = s; - } - // END PWC 1.2 6311155 - - /** - * Base dir for the webapp. Used to generate class names and resolve - * includes - */ - public void setUriroot( String s ) { - uriRoot = s; - if (s != null) { - try { - uriRoot=new File( s ).getCanonicalPath(); - } catch( Exception ex ) { - uriRoot=s; - } - } - } - - // START PWC 6386258 - /** - * Sets the path prefix for .xsd resources - */ - public static void setSchemaResourcePrefix(String prefix) { - ParserUtils.setSchemaResourcePrefix(prefix); - } - - /** - * Sets the path prefix for .dtd resources - */ - public static void setDtdResourcePrefix(String prefix) { - ParserUtils.setDtdResourcePrefix(prefix); - } - // END PWC 6386258 - - /* - * Parses comma-separated list of JSP files to be processed. - * - *

    Each file is interpreted relative to uriroot, unless it is absolute, - * in which case it must start with uriroot. - * - * @param jspFiles Comma-separated list of JSP files to be processed - */ - public void setJspFiles(String jspFiles) { - StringTokenizer tok = new StringTokenizer(jspFiles, " ,"); - while (tok.hasMoreTokens()) { - pages.add(tok.nextToken()); - } - } - - public void setCompile( boolean b ) { - compile=b; - } - - public void setVerbose( int level ) { - if (level > 0) { - verbose = true; - showSuccess = true; - listErrors = true; - } - } - - public void setValidateXml( boolean b ) { - /* SJSAS 6384538 - org.apache.jasper.xmlparser.ParserUtils.validating=b; - */ - // START SJSAS 6384538 - setIsValidationEnabled(b); - // END SJSAS 6384538 - } - - // START SJSAS 6384538 - public void setIsValidationEnabled(boolean b) { - isValidationEnabled = b; - } - - public boolean isValidationEnabled() { - return isValidationEnabled; - } - // END SJSAS 6384538 - - public void setListErrors( boolean b ) { - listErrors = b; - } - - public void setOutputDir( String s ) { - if( s!= null ) { - scratchDir = new File(s).getAbsoluteFile(); - } else { - scratchDir=null; - } - } - - public void setPackage( String p ) { - targetPackage=p; - } - - /** - * Class name of the generated file ( without package ). - * Can only be used if a single file is converted. - * XXX Do we need this feature ? - */ - public void setClassName( String p ) { - targetClassName=p; - } - - /** - * File where we generate a web.xml fragment with the class definitions. - */ - public void setWebXmlFragment( String s ) { - webxmlFile=s; - webxmlLevel=INC_WEBXML; - } - - /** - * File where we generate a complete web.xml with the class definitions. - */ - public void setWebXml( String s ) { - webxmlFile=s; - webxmlLevel=ALL_WEBXML; - } - - public void setAddWebXmlMappings(boolean b) { - addWebXmlMappings = b; - } - - /** - * Set the option that throws an exception in case of a compilation - * error. - */ - public void setFailOnError(final boolean b) { - failOnError = b; - } - - public boolean getFailOnError() { - return failOnError; - } - - // START SJSAS 6393940 - public void setIgnoreJspFragmentErrors(boolean ignore) { - ignoreJspFragmentErrors = ignore; - } - // END SJSAS 6393940 - - /** - * Obtain JSP configuration informantion specified in web.xml. - */ - public JspConfig getJspConfig() { - return jspConfig; - } - - public TagPluginManager getTagPluginManager() { - return tagPluginManager; - } - - public void generateWebMapping( String file, JspCompilationContext clctxt ) - throws IOException - { - String className = clctxt.getServletClassName(); - String packageName = clctxt.getServletPackageName(); - - String thisServletName; - if ("".equals(packageName)) { - thisServletName = className; - } else { - thisServletName = packageName + '.' + className; - } - - if (servletout != null) { - servletout.write("\n \n "); - servletout.write(thisServletName); - servletout.write("\n "); - servletout.write(thisServletName); - servletout.write("\n \n"); - } - if (mappingout != null) { - mappingout.write("\n \n "); - mappingout.write(thisServletName); - mappingout.write("\n "); - mappingout.write(file.replace('\\', '/')); - mappingout.write("\n \n"); - - } - } - - - // START SJSAS 6329723 - /** - * Gets the list of JSP compilation errors caught during the most recent - * invocation of this instance's execute method when - * failOnError has been set to FALSE. - * - * Each error error in the list is represented by an instance of - * org.apache.jasper.JasperException. - * - * @return List of JSP compilation errors caught during most recent - * invocation of this instance's execute method, or an empty - * list if no errors were encountered or this instance's failOnError - * property was set to TRUE - */ - public List getJSPCompilationErrors() { - - ArrayList ret = null; - - Collection c = jspErrors.values(); - if (c != null) { - ret = new ArrayList(); - Iterator it = c.iterator(); - while (it.hasNext()) { - ret.add(it.next()); - } - } - - return ret; - } - // END SJSAS 6329723 - - - /** - * Include the generated web.xml inside the webapp's web.xml. - */ - protected void mergeIntoWebXml() throws IOException { - - File webappBase = new File(uriRoot); - File webXml = new File(webappBase, "WEB-INF/web.xml"); - File webXml2 = new File(webappBase, "WEB-INF/web2.xml"); - String insertStartMarker = - Localizer.getMessage("jspc.webinc.insertStart"); - String insertEndMarker = - Localizer.getMessage("jspc.webinc.insertEnd"); - - BufferedReader reader = new BufferedReader( - new InputStreamReader(new FileInputStream(webXml),"UTF-8")); - BufferedReader fragmentReader = new BufferedReader( - new InputStreamReader(new FileInputStream(webxmlFile),"UTF-8")); - PrintWriter writer = new PrintWriter( - new OutputStreamWriter(new FileOutputStream(webXml2),"UTF-8")); - - // Insert the and declarations - int pos = -1; - String line = null; - while (true) { - line = reader.readLine(); - if (line == null) { - break; - } - // Skip anything previously generated by JSPC - if (line.indexOf(insertStartMarker) >= 0) { - while (true) { - line = reader.readLine(); - if (line == null) { - return; - } - if (line.indexOf(insertEndMarker) >= 0) { - line = reader.readLine(); - if (line == null) { - return; - } - break; - } - } - } - for (int i = 0; i < insertBefore.length; i++) { - pos = line.indexOf(insertBefore[i]); - if (pos >= 0) - break; - } - if (pos >= 0) { - writer.println(line.substring(0, pos)); - break; - } else { - writer.println(line); - } - } - - writer.println(insertStartMarker); - while (true) { - String line2 = fragmentReader.readLine(); - if (line2 == null) { - writer.println(); - break; - } - writer.println(line2); - } - writer.println(insertEndMarker); - writer.println(); - - for (int i = 0; i < pos; i++) { - writer.print(" "); - } - if (line != null) { - writer.println(line.substring(pos)); - } - - while (true) { - line = reader.readLine(); - if (line == null) { - break; - } - writer.println(line); - } - writer.close(); - - reader.close(); - fragmentReader.close(); - - FileInputStream fis = new FileInputStream(webXml2); - FileOutputStream fos = new FileOutputStream(webXml); - - byte buf[] = new byte[512]; - - try { - while (true) { - int n = fis.read(buf); - if (n < 0) { - break; - } - fos.write(buf, 0, n); - } - } finally { - if (fis != null) { - fis.close(); - } - if (fos != null) { - fos.close(); - } - } - - webXml2.delete(); - (new File(webxmlFile)).delete(); - - } - - private void processFile(String file) - throws JasperException - { - ClassLoader originalClassLoader = null; - String jspUri=file.replace('\\','/'); - - try { - // set up a scratch/output dir if none is provided - if (scratchDir == null) { - String temp = System.getProperty("java.io.tmpdir"); - if (temp == null) { - temp = ""; - } - scratchDir = new File(new File(temp).getAbsolutePath()); - } - - JspCompilationContext clctxt = new JspCompilationContext - ( jspUri, false, this, context, null, rctxt ); - - /* Override the defaults */ - if ((targetClassName != null) && (targetClassName.length() > 0)) { - clctxt.setServletClassName(targetClassName); - targetClassName = null; - } - if (targetPackage != null) { - clctxt.setServletPackageName(targetPackage); - } - - originalClassLoader = Thread.currentThread().getContextClassLoader(); - if( loader==null ) { - initClassLoader( clctxt ); - } - Thread.currentThread().setContextClassLoader(loader); - - clctxt.setClassLoader(loader); - clctxt.setClassPath(classPath); - - Compiler clc = clctxt.createCompiler(true); - - // If compile is set, generate both .java and .class, if - // .jsp file is newer than .class file; - // Otherwise only generate .java, if .jsp file is newer than - // the .java file - if( clc.isOutDated(compile) ) { - clc.compile(compile); - } - - // START SJSAS 6393940 - if (ignoreJspFragmentErrors) { - PageInfo pi = clc.getPageInfo(); - if (pi != null) { - List deps = pi.getDependants(); - if (deps != null) { - Iterator it = deps.iterator(); - if (it != null) { - while (it.hasNext()) { - dependents.add(it.next()); - } - } - } - clc.setPageInfo(null); - } - } - // END SJSAS 6393940 - - // Generate mapping - generateWebMapping( file, clctxt ); - if ( showSuccess ) { - log.info( "Built File: " + file ); - } - - } catch (JasperException je) { - Throwable rootCause = je; - while (rootCause instanceof JasperException - && ((JasperException) rootCause).getRootCause() != null) { - rootCause = ((JasperException) rootCause).getRootCause(); - } - if (listErrors && rootCause != je) { - log.log(Level.SEVERE, - Localizer.getMessage("jspc.error.generalException", file), - rootCause); - } - - // Bugzilla 35114. - if (getFailOnError() && !ignoreJspFragmentErrors) { - throw je; - } else { - if (listErrors && !ignoreJspFragmentErrors) { - log.severe(je.getMessage()); - } - // START SJAS 6329723 - jspErrors.put(jspUri, je); - // END SJSAS 6329723 - } - - } catch (Exception e) { - if ((e instanceof FileNotFoundException) && - log.isLoggable(Level.WARNING)) { - log.warning(Localizer.getMessage("jspc.error.fileDoesNotExist", - e.getMessage())); - } - throw new JasperException(e); - } finally { - if(originalClassLoader != null) { - Thread.currentThread().setContextClassLoader(originalClassLoader); - } - } - - } - - /** - * Locate all jsp files in the webapp. Used if no explicit - * jsps are specified. - */ - public void scanFiles( File base ) throws JasperException { - Stack dirs = new Stack(); - dirs.push(base.toString()); - if (extensions == null) { - extensions = new ArrayList(); - extensions.add("jsp"); - extensions.add("jspx"); - } - while (!dirs.isEmpty()) { - String s = dirs.pop(); - File f = new File(s); - if (f.exists() && f.isDirectory()) { - String[] files = f.list(); - String ext; - for (int i = 0; (files != null) && i < files.length; i++) { - File f2 = new File(s, files[i]); - if (f2.isDirectory()) { - dirs.push(f2.getPath()); - } else { - String path = f2.getPath(); - String uri = path.substring(uriRoot.length()); - ext = files[i].substring(files[i].lastIndexOf('.') +1); - if (extensions.contains(ext) || - jspConfig.isJspPage(uri)) { - pages.add(path); - } - } - } - } - } - } - - public void execute() throws JasperException { - - // START SJSAS 6329723 - jspErrors.clear(); - // END SJSAS 6329723 - // START SJSAS 6393940 - dependents.clear(); - // END SJSAS 6393940 - - try { - if (uriRoot == null) { - if( pages.size() == 0 ) { - throw new JasperException( - Localizer.getMessage("jsp.error.jspc.missingTarget")); - } - String firstJsp=pages.get( 0 ); - File firstJspF = new File( firstJsp ); - if (!firstJspF.exists()) { - throw new JasperException( - Localizer.getMessage("jspc.error.fileDoesNotExist", - firstJsp)); - } - locateUriRoot( firstJspF ); - } - - if (uriRoot == null) { - throw new JasperException( - Localizer.getMessage("jsp.error.jspc.no_uriroot")); - } - - if( context==null ) - initServletContext(); - - // No explicit pages, we'll process all .jsp in the webapp - if (pages.size() == 0) { - scanFiles( new File( uriRoot )); - } - - File uriRootF = new File(uriRoot); - if (!uriRootF.exists() || !uriRootF.isDirectory()) { - throw new JasperException( - Localizer.getMessage("jsp.error.jspc.uriroot_not_dir")); - } - - initWebXml(); - - for (String nextjsp: pages) { - File fjsp = new File(nextjsp); - if (!fjsp.isAbsolute()) { - fjsp = new File(uriRootF, nextjsp); - } - if (!fjsp.exists()) { - if (log.isLoggable(Level.WARNING)) { - log.warning(Localizer.getMessage - ("jspc.error.fileDoesNotExist", fjsp.toString())); - } - continue; - } - String s = fjsp.getAbsolutePath(); - if (s.startsWith(uriRoot)) { - nextjsp = s.substring(uriRoot.length()); - } - if (nextjsp.startsWith("." + File.separatorChar)) { - nextjsp = nextjsp.substring(2); - } - processFile(nextjsp); - } - - // START SJSAS 6393940 - if (ignoreJspFragmentErrors) { - purgeJspFragmentErrors(); - } - if (getFailOnError() && !jspErrors.isEmpty()) { - throw jspErrors.values().iterator().next(); - } - // END SJJAS 6393940 - - completeWebXml(); - - if (addWebXmlMappings) { - mergeIntoWebXml(); - } - - } catch (IOException ioe) { - throw new JasperException(ioe); - - } catch (JasperException je) { - Throwable rootCause = je; - while (rootCause instanceof JasperException - && ((JasperException) rootCause).getRootCause() != null) { - rootCause = ((JasperException) rootCause).getRootCause(); - } - if (rootCause != je) { - rootCause.printStackTrace(); - } - throw je; - } finally { - // START S1AS 5032338 - if (loader != null) { - // XXX APACHE-COMMONS-LOGGING-PATCH - // LogFactory.release(loader); - // START SJSAS 6258619 - // ClassLoaderUtil.releaseLoader(loader); - // END SJSAS 6258619 - } - // END S1AS 5032338 - // START SJSAS 6356052 - if (rctxt != null) { - rctxt.destroy(); - } - // END SJSAS 6356052 - - // START GlassFish 750 - if (taglibs != null) { - taglibs.clear(); - } - if (tagFileJarUrls != null) { - tagFileJarUrls.clear(); - } - // END GlassFish 750 - } - } - - - // ==================== Private utility methods ==================== - - private String nextArg() { - if ((argPos >= args.length) - || (fullstop = SWITCH_FULL_STOP.equals(args[argPos]))) { - return null; - } else { - return args[argPos++]; - } - } - - private String nextFile() { - if (fullstop) argPos++; - if (argPos >= args.length) { - return null; - } else { - return args[argPos++]; - } - } - - private void initWebXml() { - try { - if (webxmlLevel >= INC_WEBXML) { - File fmapings = new File(webxmlFile); - mapout = new OutputStreamWriter(new FileOutputStream(fmapings),"UTF-8"); - servletout = new CharArrayWriter(); - mappingout = new CharArrayWriter(); - } else { - mapout = null; - servletout = null; - mappingout = null; - } - if (webxmlLevel >= ALL_WEBXML) { - mapout.write(Localizer.getMessage("jspc.webxml.header")); - mapout.flush(); - } else if ((webxmlLevel>= INC_WEBXML) && !addWebXmlMappings) { - mapout.write(Localizer.getMessage("jspc.webinc.header")); - mapout.flush(); - } - } catch (IOException ioe) { - mapout = null; - servletout = null; - mappingout = null; - } - } - - private void completeWebXml() { - if (mapout != null) { - try { - servletout.writeTo(mapout); - mappingout.writeTo(mapout); - if (webxmlLevel >= ALL_WEBXML) { - mapout.write(Localizer.getMessage("jspc.webxml.footer")); - } else if ((webxmlLevel >= INC_WEBXML) && !addWebXmlMappings) { - mapout.write(Localizer.getMessage("jspc.webinc.footer")); - } - mapout.close(); - } catch (IOException ioe) { - // noting to do if it fails since we are done with it - } - } - } - - private void initServletContext() { - try { - context =new JspCServletContext - (new PrintWriter(new OutputStreamWriter(System.out, "UTF-8")), - - new URL("file:" + uriRoot.replace('\\','/') + '/')); - tldScanner = new TldScanner(context, isValidationEnabled); - - // START GlassFish 750 - taglibs = new ConcurrentHashMap(); - context.setAttribute(Constants.JSP_TAGLIBRARY_CACHE, taglibs); - - tagFileJarUrls = new ConcurrentHashMap(); - context.setAttribute(Constants.JSP_TAGFILE_JAR_URLS_CACHE, - tagFileJarUrls); - // END GlassFish 750 - } catch (MalformedURLException me) { - System.out.println("**" + me); - } catch (UnsupportedEncodingException ex) { - } - rctxt = new JspRuntimeContext(context, this); - jspConfig = new JspConfig(context); - tagPluginManager = new TagPluginManager(context); - } - - /** - * Initializes the classloader as/if needed for the given - * compilation context. - * - * @param clctxt The compilation context - * @throws IOException If an error occurs - */ - private void initClassLoader(JspCompilationContext clctxt) - throws IOException { - - classPath = getClassPath(); - - ClassLoader jspcLoader = getClass().getClassLoader(); - - // Turn the classPath into URLs - ArrayList urls = new ArrayList(); - StringTokenizer tokenizer = new StringTokenizer(classPath, - File.pathSeparator); - while (tokenizer.hasMoreTokens()) { - String path = tokenizer.nextToken(); - try { - File libFile = new File(path); - urls.add(libFile.toURL()); - } catch (IOException ioe) { - // Failing a toCanonicalPath on a file that - // exists() should be a JVM regression test, - // therefore we have permission to freak uot - throw new RuntimeException(ioe.toString()); - } - } - - File webappBase = new File(uriRoot); - if (webappBase.exists()) { - File classes = new File(webappBase, "/WEB-INF/classes"); - try { - if (classes.exists()) { - classPath = classPath + File.pathSeparator - + classes.getCanonicalPath(); - urls.add(classes.getCanonicalFile().toURL()); - } - } catch (IOException ioe) { - // failing a toCanonicalPath on a file that - // exists() should be a JVM regression test, - // therefore we have permission to freak out - throw new RuntimeException(ioe.toString()); - } - File lib = new File(webappBase, "/WEB-INF/lib"); - if (lib.exists() && lib.isDirectory()) { - String[] libs = lib.list(); - for (int i = 0; i < libs.length; i++) { - if( libs[i].length() <5 ) continue; - String ext=libs[i].substring( libs[i].length() - 4 ); - if (! ".jar".equalsIgnoreCase(ext)) { - if (".tld".equalsIgnoreCase(ext)) { - log.warning( - "TLD files should not be placed in /WEB-INF/lib"); - } - continue; - } - try { - File libFile = new File(lib, libs[i]); - classPath = classPath + File.pathSeparator - + libFile.getCanonicalPath(); - urls.add(libFile.getCanonicalFile().toURL()); - } catch (IOException ioe) { - // failing a toCanonicalPath on a file that - // exists() should be a JVM regression test, - // therefore we have permission to freak out - throw new RuntimeException(ioe.toString()); - } - } - } - } - - // What is this ?? - urls.add(new File(clctxt.getRealPath("/")).getCanonicalFile().toURL()); - - URL urlsA[]=new URL[urls.size()]; - urls.toArray(urlsA); - - /* SJSAS 6327357 - loader = new URLClassLoader(urlsA, this.getClass().getClassLoader()); - */ - // START SJSAS 6327357 - ClassLoader sysClassLoader = initSystemClassLoader(); - if (sysClassLoader != null) { - loader = new URLClassLoader(urlsA, sysClassLoader); - } else { - loader = new URLClassLoader(urlsA, this.getClass().getClassLoader()); - } - // END SJSAS 6327357 - } - - /** - * Find the WEB-INF dir by looking up in the directory tree. - * This is used if no explicit docbase is set, but only files. - * XXX Maybe we should require the docbase. - */ - private void locateUriRoot( File f ) { - String tUriBase = uriBase; - if (tUriBase == null) { - tUriBase = "/"; - } - try { - if (f.exists()) { - f = new File(f.getCanonicalPath()); - while (f != null) { - File g = new File(f, "WEB-INF"); - if (g.exists() && g.isDirectory()) { - uriRoot = f.getCanonicalPath(); - uriBase = tUriBase; - if (log.isLoggable(Level.INFO)) { - log.info( - Localizer.getMessage("jspc.implicit.uriRoot", - uriRoot)); - } - break; - } - if (f.exists() && f.isDirectory()) { - tUriBase = "/" + f.getName() + "/" + tUriBase; - } - - String fParent = f.getParent(); - if (fParent == null) { - break; - } else { - f = new File(fParent); - } - - // If there is no acceptible candidate, uriRoot will - // remain null to indicate to the CompilerContext to - // use the current working/user dir. - } - - if (uriRoot != null) { - File froot = new File(uriRoot); - uriRoot = froot.getCanonicalPath(); - } - } - } catch (IOException ioe) { - // since this is an optional default and a null value - // for uriRoot has a non-error meaning, we can just - // pass straight through - } - } - - - // START SJSAS 6327357 - private ClassLoader initSystemClassLoader() throws IOException { - - String sysClassPath = getSystemClassPath(); - if (sysClassPath == null) { - return null; - } - - ArrayList urls = new ArrayList(); - StringTokenizer tokenizer = new StringTokenizer(sysClassPath, - File.pathSeparator); - while (tokenizer.hasMoreTokens()) { - urls.add(new File(tokenizer.nextToken()).toURL()); - } - - if (urls.size() == 0) { - return null; - } - - URL urlsArray[] = new URL[urls.size()]; - urls.toArray(urlsArray); - - return new URLClassLoader(urlsArray, this.getClass().getClassLoader()); - } - // END SJAS 6327357 - - - // START SJSAS 6393940 - /* - * Purges all compilation errors related to JSP fragments. - */ - private void purgeJspFragmentErrors() { - Iterator it = dependents.iterator(); - if (it != null) { - while (it.hasNext()) { - jspErrors.remove(it.next()); - } - } - } - // END SJSAS 6393940 -} diff --git a/impl/src/main/java/org/apache/jasper/JspCompilationContext.java b/impl/src/main/java/org/apache/jasper/JspCompilationContext.java deleted file mode 100644 index a9a49f4..0000000 --- a/impl/src/main/java/org/apache/jasper/JspCompilationContext.java +++ /dev/null @@ -1,786 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper; - -import java.io.File; -import java.io.FileNotFoundException; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.concurrent.ConcurrentHashMap; -import java.util.Set; - -import javax.servlet.ServletContext; -import javax.servlet.jsp.tagext.TagInfo; -import javax.servlet.jsp.tagext.TagLibraryInfo; - -import org.apache.jasper.compiler.Compiler; -import org.apache.jasper.compiler.JspRuntimeContext; -import org.apache.jasper.compiler.JspUtil; -import org.apache.jasper.compiler.Localizer; -import org.apache.jasper.compiler.ServletWriter; -import org.apache.jasper.compiler.TagLibraryInfoImpl; -import org.apache.jasper.servlet.JasperLoader; -import org.apache.jasper.servlet.JspServletWrapper; - -/** - * A place holder for various things that are used through out the JSP - * engine. This is a per-request/per-context data structure. Some of - * the instance variables are set at different points. - * - * Most of the path-related stuff is here - mangling names, versions, dirs, - * loading resources and dealing with uris. - * - * @author Anil K. Vijendran - * @author Harish Prabandham - * @author Pierre Delisle - * @author Costin Manolache - * @author Kin-man Chung - */ -public class JspCompilationContext { - - private String className; - private String jspUri; - private boolean isErrPage; - private String basePackageName; - private String derivedPackageName; - private String servletJavaFileName; - private String javaPath; - private String classFileName; - private String contentType; - private ServletWriter writer; - private Options options; - private JspServletWrapper jsw; - private Compiler jspCompiler; - private String classPath; - - private String baseURI; - private String outputDir; - private ServletContext context; - private ClassLoader loader; - - private JspRuntimeContext rctxt; - - private int removed = 0; - - private URL baseUrl; - private Class servletClass; - - private boolean isTagFile; - private boolean protoTypeMode; - private TagInfo tagInfo; - private URL tagFileJarUrl; - private ConcurrentHashMap taglibs; - private ConcurrentHashMap tagFileJarUrls; - - // jspURI _must_ be relative to the context - public JspCompilationContext(String jspUri, - boolean isErrPage, - Options options, - ServletContext context, - JspServletWrapper jsw, - JspRuntimeContext rctxt) - throws JasperException { - - this.jspUri = canonicalURI(jspUri); - this.isErrPage = isErrPage; - this.options = options; - this.jsw = jsw; - this.context = context; - - this.baseURI = jspUri.substring(0, jspUri.lastIndexOf('/') + 1); - // hack fix for resolveRelativeURI - if (baseURI == null) { - baseURI = "/"; - } else if (baseURI.charAt(0) != '/') { - // strip the basde slash since it will be combined with the - // uriBase to generate a file - baseURI = "/" + baseURI; - } - if (baseURI.charAt(baseURI.length() - 1) != '/') { - baseURI += '/'; - } - - this.rctxt = rctxt; - this.basePackageName = Constants.JSP_PACKAGE_NAME; - - taglibs = cast(context.getAttribute(Constants.JSP_TAGLIBRARY_CACHE)); - tagFileJarUrls = cast(context.getAttribute(Constants.JSP_TAGFILE_JAR_URLS_CACHE)); - } - - @SuppressWarnings("unchecked") - private static T cast(Object x) { - return (T) x; - } - - public JspCompilationContext(String tagfile, - TagInfo tagInfo, - Options options, - ServletContext context, - JspServletWrapper jsw, - JspRuntimeContext rctxt, - URL tagFileJarUrl) - throws JasperException { - this(tagfile, false, options, context, jsw, rctxt); - this.isTagFile = true; - this.tagInfo = tagInfo; - this.tagFileJarUrl = tagFileJarUrl; - } - - /* ==================== Methods to override ==================== */ - - - /** - * Adds the given tag library with the given URI to the context-wide - * tag library cache. - * - * @param uri The tag library URI - * @param taglib The tag library to add - */ - public void addTaglib(String uri, TagLibraryInfoImpl taglib) { - taglibs.put(uri, taglib); - } - - /** - * Gets the context-wide tag library cache. - * - * @return The context-wide tag library cache - */ - public ConcurrentHashMap getTaglibs() { - return taglibs; - } - - /** - * Clears the context-wide tag library cache. - */ - public void clearTaglibs() { - taglibs.clear(); - } - - /** - * Clears the context-wide mappings from JAR packaged tag file paths to - * their corresponding URLs. - */ - public void clearTagFileJarUrls() { - tagFileJarUrls.clear(); - } - - - /** ---------- Class path and loader ---------- */ - - /** - * The classpath that is passed off to the Java compiler. - */ - public String getClassPath() { - if( classPath != null ) - return classPath; - return rctxt.getClassPath(); - } - - /** - * The classpath that is passed off to the Java compiler. - */ - public void setClassPath(String classPath) { - this.classPath = classPath; - } - - /** - * What class loader to use for loading classes while compiling - * this JSP? - */ - public ClassLoader getClassLoader() { - if( loader == null ) - loader = rctxt.getParentClassLoader(); - return loader; - } - - public void setClassLoader(URLClassLoader loader) { - this.loader = loader; - } - - /** ---------- Input/Output ---------- */ - - /** - * The output directory to generate code into. The output directory - * is make up of the scratch directory, which is provide in Options, - * plus the directory derived from the package name. - */ - public String getOutputDir() { - if (outputDir == null) { - createOutputDir(); - } - - return outputDir; - } - - /** - * Create a compiler object for parsing only. - */ - public Compiler createParser() throws JasperException { - jspCompiler = new Compiler(this, jsw); - return jspCompiler; - } - - /** - * Create a "Compiler" object. - */ - public Compiler createCompiler(boolean jspcMode) throws JasperException { - if (jspCompiler != null ) { - return jspCompiler; - } - - jspCompiler = new Compiler(this, jsw, jspcMode); - return jspCompiler; - } - - public Compiler getCompiler() { - return jspCompiler; - } - - /** ---------- Access resources in the webapp ---------- */ - - /** - * Get the full value of a URI relative to this compilations context - * uses current file as the base. - */ - public String resolveRelativeUri(String uri) { - // sometimes we get uri's massaged from File(String), so check for - // a root directory deperator char - if (uri.startsWith("/") || uri.startsWith(File.separator)) { - return uri; - } else { - return baseURI + uri; - } - } - - /** - * Gets a resource as a stream, relative to the meanings of this - * context's implementation. - * @return a null if the resource cannot be found or represented - * as an InputStream. - */ - public java.io.InputStream getResourceAsStream(String res) - throws JasperException { - return context.getResourceAsStream(canonicalURI(res)); - } - - public URL getResource(String res) throws MalformedURLException { - URL result = null; - - if (res.startsWith("/META-INF/")) { - // This is a tag file packaged in a jar that is being compiled - URL jarUrl = tagFileJarUrls.get(res); - if (jarUrl == null) { - jarUrl = tagFileJarUrl; - } - if (jarUrl != null) { - result = new URL(jarUrl.toExternalForm() + res.substring(1)); - } - } else if (res.startsWith("jar:file:")) { - // This is a tag file packaged in a jar that is being checked - // for a dependency - result = new URL(res); - } else { - try { - result = context.getResource(canonicalURI(res)); - } catch (JasperException ex) { - throw new MalformedURLException(ex.getMessage()); - } - } - return result; - } - - public Set getResourcePaths(String path) - throws JasperException { - return context.getResourcePaths(canonicalURI(path)); - } - - /** - * Gets the actual path of a URI relative to the context of - * the compilation. - */ - public String getRealPath(String path) { - if (context != null) { - return context.getRealPath(path); - } - return path; - } - - /** - * Gets the context-wide mappings from JAR packaged tag file paths to - * their corresponfing URLs. - */ - public ConcurrentHashMap getTagFileJarUrls() { - return this.tagFileJarUrls; - } - - /** - * Returns the JAR file in which the tag file for which this - * JspCompilationContext was created is packaged, or null if this - * JspCompilationContext does not correspond to a tag file, or if the - * corresponding tag file is not packaged in a JAR. - */ - public URL getTagFileJarUrl() { - return this.tagFileJarUrl; - } - - /* ==================== Common implementation ==================== */ - - /** - * Just the class name (does not include package name) of the - * generated class. - */ - public String getServletClassName() { - - if (className != null) { - return className; - } - - if (isTagFile) { - className = tagInfo.getTagClassName(); - int lastIndex = className.lastIndexOf('.'); - if (lastIndex != -1) { - className = className.substring(lastIndex + 1); - } - } else { - int iSep = jspUri.lastIndexOf('/') + 1; - className = JspUtil.makeJavaIdentifier(jspUri.substring(iSep)); - } - return className; - } - - public void setServletClassName(String className) { - this.className = className; - } - - /** - * Path of the JSP URI. Note that this is not a file name. This is - * the context rooted URI of the JSP file. - */ - public String getJspFile() { - return jspUri; - } - - /** - * Are we processing something that has been declared as an - * errorpage? - */ - public boolean isErrorPage() { - return isErrPage; - } - - public void setErrorPage(boolean isErrPage) { - this.isErrPage = isErrPage; - } - - public boolean isTagFile() { - return isTagFile; - } - - public TagInfo getTagInfo() { - return tagInfo; - } - - public void setTagInfo(TagInfo tagi) { - tagInfo = tagi; - } - - /** - * True if we are compiling a tag file in prototype mode. - * ie we only generate codes with class for the tag handler with empty - * method bodies. - */ - public boolean isPrototypeMode() { - return protoTypeMode; - } - - public void setPrototypeMode(boolean pm) { - protoTypeMode = pm; - } - - /** - * Package name for the generated class is make up of the base package - * name, which is user settable, and the derived package name. The - * derived package name directly mirrors the file heirachy of the JSP page. - */ - public String getServletPackageName() { - if (isTagFile()) { - String className = tagInfo.getTagClassName(); - int lastIndex = className.lastIndexOf('.'); - String pkgName = ""; - if (lastIndex != -1) { - pkgName = className.substring(0, lastIndex); - } - return pkgName; - } else { - String dPackageName = getDerivedPackageName(); - if (dPackageName.length() == 0) { - return basePackageName; - } - return basePackageName + '.' + getDerivedPackageName(); - } - } - - private String getDerivedPackageName() { - if (derivedPackageName == null) { - int iSep = jspUri.lastIndexOf('/'); - derivedPackageName = (iSep > 0) ? - JspUtil.makeJavaPackage(jspUri.substring(1,iSep)) : ""; - } - return derivedPackageName; - } - - /** - * The package name into which the servlet class is generated. - */ - public void setServletPackageName(String servletPackageName) { - this.basePackageName = servletPackageName; - } - - /** - * Full path name of the Java file into which the servlet is being - * generated. - */ - public String getServletJavaFileName() { - - if (servletJavaFileName == null) { - servletJavaFileName = - getOutputDir() + getServletClassName() + ".java"; - } - return servletJavaFileName; - } - - /** - * Get hold of the Options object for this context. - */ - public Options getOptions() { - return options; - } - - public ServletContext getServletContext() { - return context; - } - - public JspRuntimeContext getRuntimeContext() { - return rctxt; - } - - /** - * Full class name - */ - public String getFullClassName() { - if (isTagFile()) { - return tagInfo.getTagClassName(); - } - return getServletPackageName() + '.' + getServletClassName(); - } - - /** - * Path of the Java file relative to the work directory. - */ - public String getJavaPath() { - - if (javaPath != null) { - return javaPath; - } - - javaPath = getFullClassName().replace('.','/') + ".java"; - return javaPath; - } - - public String getClassFileName() { - - if (classFileName == null) { - classFileName = getOutputDir() + getServletClassName() + ".class"; - } - return classFileName; - } - - /** - * Get the content type of this JSP. - * - * Content type includes content type and encoding. - */ - public String getContentType() { - return contentType; - } - - public void setContentType(String contentType) { - this.contentType = contentType; - } - - /** - * Where is the servlet being generated? - */ - public ServletWriter getWriter() { - return writer; - } - - public void setWriter(ServletWriter writer) { - this.writer = writer; - } - - /** - * Gets the 'location' of the TLD associated with the given taglib 'uri'. - * - * @return An array of two Strings: The first element denotes the real - * path to the TLD. If the path to the TLD points to a jar file, then the - * second element denotes the name of the TLD entry in the jar file. - * Returns null if the given uri is not associated with any tag library - * 'exposed' in the web application. - */ - public String[] getTldLocation(String uri) throws JasperException { - String[] location = - getOptions().getTldScanner().getLocation(uri); - return location; - } - - /** - * Are we keeping generated code around? - */ - public boolean keepGenerated() { - return getOptions().getKeepGenerated(); - } - - // ==================== Removal ==================== - - public void incrementRemoved() { - if (removed > 1) { - if(jspCompiler != null) { - jspCompiler.removeGeneratedFiles(); - } - if( rctxt != null ) - rctxt.removeWrapper(jspUri); - } - removed++; - } - - public boolean isRemoved() { - if (removed > 1 ) { - return true; - } - return false; - } - - // ==================== Compile and reload ==================== - - public void compile() throws JasperException, FileNotFoundException { - createCompiler(false); - if (jspCompiler.isOutDated()) { - try { - jspCompiler.compile(true); - jsw.setReload(true); - jsw.setCompilationException(null); - } catch (JasperException ex) { - // Cache compilation exception - jsw.setCompilationException(ex); - throw ex; - } catch (Exception ex) { - ex.printStackTrace(); - JasperException je = new JasperException( - Localizer.getMessage("jsp.error.unable.compile"), - ex); - // Cache compilation exception - jsw.setCompilationException(je); - throw je; - } - } - } - - // ==================== Manipulating the class ==================== - - public Class load() - throws JasperException, ClassNotFoundException - { - try { - - String name = getFullClassName(); - - if (options.getUsePrecompiled()) { - servletClass = getClassLoader().loadClass(name); - } else { - servletClass = getJspLoader().loadClass(name); - } - } catch (ClassNotFoundException cex) { - // Do not wrapper this in JasperException if use-precompiled is set, - // because this is really a 404. - if (options.getUsePrecompiled()) { - throw cex; - } - throw new JasperException( - Localizer.getMessage("jsp.error.unable.load"), cex); - } catch (Exception ex) { - throw new JasperException( - Localizer.getMessage("jsp.error.unable.compile"), ex); - } - removed = 0; - return servletClass; - } - - - public ClassLoader getJspLoader() { - return new JasperLoader(new URL[] {baseUrl}, - getClassLoader(), - rctxt.getPermissionCollection(), - rctxt.getCodeSource(), - rctxt.getBytecodes()); - } - - public void makeOutputDir(String outdir) { - synchronized(outputDirLock) { - File outDirFile = new File(outdir); - outDirFile.mkdirs(); - outputDir = outdir; - } - } - - // ==================== Private methods ==================== - - static Object outputDirLock = new Object(); - - private void createOutputDir() { - String path = null; - if (isTagFile()) { - String tagName = tagInfo.getTagClassName(); - path = tagName.replace('.', '/'); - path = path.substring(0, path.lastIndexOf('/')); - } else { - path = getServletPackageName().replace('.', '/'); - } - - try { - // Append servlet or tag handler path to scratch dir - File f = new File( options.getScratchDir(), path ); - makeOutputDir(f.getPath() + File.separator); - baseUrl = options.getScratchDir().toURL(); - } catch (Exception e) { - throw new IllegalStateException("No output directory: " + - e.getMessage()); - } - } - - private static final boolean isPathSeparator(char c) { - return (c == '/' || c == '\\'); - } - - private static final String canonicalURI(String s) - throws JasperException { - if (s == null) return null; - StringBuilder result = new StringBuilder(); - final int len = s.length(); - int pos = 0; - while (pos < len) { - char c = s.charAt(pos); - if ( isPathSeparator(c) ) { - /* - * multiple path separators. - * 'foo///bar' -> 'foo/bar' - */ - while (pos+1 < len && isPathSeparator(s.charAt(pos+1))) { - ++pos; - } - - if (pos+1 < len && s.charAt(pos+1) == '.') { - /* - * a single dot at the end of the path - we are done. - */ - if (pos+2 >= len) break; - - switch (s.charAt(pos+2)) { - /* - * self directory in path - * foo/./bar -> foo/bar - */ - case '/': - case '\\': - pos += 2; - continue; - - /* - * two dots in a path: go back one hierarchy. - * foo/bar/../baz -> foo/baz - */ - case '.': - // only if we have exactly _two_ dots. - if (pos+3 < len && isPathSeparator(s.charAt(pos+3))) { - pos += 3; - int separatorPos = result.length()-1; - if (separatorPos < 0) { - throw new JasperException( - Localizer.getMessage("jsp.error.badpath",s)); - } - while (separatorPos >= 0 && - ! isPathSeparator(result - .charAt(separatorPos))) { - --separatorPos; - } - if (separatorPos >= 0) - result.setLength(separatorPos); - continue; - } - } - } - } - result.append(c); - ++pos; - } - return result.toString(); - } -} - diff --git a/impl/src/main/java/org/apache/jasper/Options.java b/impl/src/main/java/org/apache/jasper/Options.java deleted file mode 100644 index 69bd246..0000000 --- a/impl/src/main/java/org/apache/jasper/Options.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2014 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper; - -import java.io.File; - -import org.apache.jasper.compiler.JspConfig; -import org.apache.jasper.compiler.TagPluginManager; -import org.apache.jasper.runtime.TldScanner; - -/** - * A class to hold all init parameters specific to the JSP engine. - * - * @author Anil K. Vijendran - * @author Hans Bergsten - * @author Pierre Delisle - */ -public interface Options { - - /** - * Returns true if Jasper issues a compilation error instead of a runtime - * Instantiation error if the class attribute specified in useBean action - * is invalid. - */ - public boolean getErrorOnUseBeanInvalidClassAttribute(); - - /** - * Are we keeping generated code around? - */ - public boolean getKeepGenerated(); - - /** - * Returns true if tag handler pooling is enabled, false otherwise. - */ - public boolean isPoolingEnabled(); - - /** - * Are we supporting HTML mapped servlets? - */ - public boolean getMappedFile(); - - /** - * Should errors be sent to client or thrown into stderr? - */ - public boolean getSendErrorToClient(); - - /** - * Should we include debug information in compiled class? - */ - public boolean getClassDebugInfo(); - - /** - * Background compile thread check interval in seconds - */ - public int getCheckInterval(); - - /** - * Is Jasper being used in development mode? - */ - public boolean getDevelopment(); - - /** - * Is the generation of SMAP info for JSR45 debugging suppressed? - */ - public boolean isSmapSuppressed(); - - /** - * Indicates whether SMAP info for JSR45 debugging should be dumped to a - * file. - * Ignored is suppressSmap() is true - */ - public boolean isSmapDumped(); - - /** - * Should white spaces between directives or actions be trimmed? - */ - public boolean getTrimSpaces(); - - /** - * Class ID for use in the plugin tag when the browser is IE. - */ - public String getIeClassId(); - - /** - * What is my scratch dir? - */ - public File getScratchDir(); - - /** - * What classpath should I use while compiling the servlets - * generated from JSP files? - */ - public String getClassPath(); - - // START PWC 1.2 6311155 - /** - * Gets the system class path. - * - * @return The system class path - */ - public String getSystemClassPath(); - // END PWC 1.2 6311155 - - /** - * Compiler to use. - */ - public String getCompiler(); - - /** - * The compiler target VM, e.g. 1.1, 1.2, 1.3, 1.4, or 1.5. - */ - public String getCompilerTargetVM(); - - /** - * Compiler source VM, e.g. 1.3, 1.4, or 1.5. - */ - public String getCompilerSourceVM(); - - /** - * The name of class that implements JavaCompiler, used for Java compilations. - */ - public String getCompilerClassName(); - - /** - * The cache for the location of the TLD's - * for the various tag libraries 'exposed' - * by the web application. - * A tag library is 'exposed' either explicitely in - * web.xml or implicitely via the uri tag in the TLD - * of a taglib deployed in a jar file (WEB-INF/lib). - * - * @return the instance of the TldScanner - * for the web-application. - */ - public TldScanner getTldScanner(); - - /** - * Java platform encoding to generate the JSP - * page servlet. - */ - public String getJavaEncoding(); - - /** - * boolean flag to tell Ant whether to fork JSP page compilations. - */ - public boolean getFork(); - - /** - * Obtain JSP configuration informantion specified in web.xml. - */ - public JspConfig getJspConfig(); - - /** - * Is generation of X-Powered-By response header enabled/disabled? - */ - public boolean isXpoweredBy(); - - /** - * Obtain a Tag Plugin Manager - */ - public TagPluginManager getTagPluginManager(); - - /** - * Are Text strings to be generated as char arrays? - */ - public boolean genStringAsCharArray(); - - /** - * Are text strings to be generated as byte arrays, if the page is - * unbuffered? - */ - public boolean genStringAsByteArray(); - - /** - * If the buffer attribute for the page directive is not specified, - * is the default "none"? - */ - public boolean isDefaultBufferNone(); - - /** - * Modification test interval. - */ - public int getModificationTestInterval(); - - // BEGIN S1AS 6181923 - /** - * Returns the value of the usePrecompiled (or use-precompiled) init - * param. - */ - public boolean getUsePrecompiled(); - // END S1AS 6181923 - - // START SJSWS - /** - * Gets initial capacity of HashMap which maps JSPs to their corresponding - * servlets. - */ - public int getInitialCapacity(); - // END SJSWS - - // START SJSAS 6384538 - public boolean isValidationEnabled(); - // END SJSAS 6384538 - - /** - * If class files are generated as byte arrays, should they be saved to - * disk at the end of compilations? - */ - - public boolean getSaveBytecode(); - -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/AntJavaCompiler.java b/impl/src/main/java/org/apache/jasper/compiler/AntJavaCompiler.java deleted file mode 100644 index c891684..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/AntJavaCompiler.java +++ /dev/null @@ -1,398 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.File; -import java.io.IOException; -import java.io.FileOutputStream; -import java.io.Writer; -import java.io.OutputStreamWriter; -import java.io.PrintStream; -import java.io.UnsupportedEncodingException; -import java.util.List; -import java.util.concurrent.Executors; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.ThreadFactory; -import java.util.logging.Logger; -import java.util.logging.Level; - -import org.apache.jasper.JasperException; -import org.apache.jasper.JspCompilationContext; -import org.apache.jasper.Options; -import org.apache.jasper.util.SystemLogHandler; -import org.apache.jasper.Constants; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.DefaultLogger; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.taskdefs.Javac; -import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.PatternSet; - -/** - * Java compiler through ant - * - * @author Kin-man Chung - */ - -public class AntJavaCompiler implements JavaCompiler { - - private JasperAntLogger logger; - private Javac javac; - private Project project=null; - private JspCompilationContext ctxt; - private Options options; - private ErrorDispatcher errDispatcher; - private String javaFileName; - private String javaEncoding; - private StringBuilder info = new StringBuilder(); - // For collecting Java compilation enviroment - private Logger log; - - // Use a threadpool and force it to 1 to simulate serialization - private static ExecutorService threadPool = null; - private static ThreadFactory threadFactory = new JavacThreadFactory(); - private static final String JAVAC_THREAD_PREFIX = "javac-"; - - private static String lineSeparator = System.getProperty("line.separator"); - - - private Project getProject() { - - if( project!=null ) return project; - - // Initializing project - project = new Project(); - logger = new JasperAntLogger(); - logger.setOutputPrintStream(System.out); - logger.setErrorPrintStream(System.err); - logger.setMessageOutputLevel(Project.MSG_INFO); - project.addBuildListener( logger); - if (System.getProperty("catalina.home") != null) { - project.setBasedir( System.getProperty("catalina.home")); - } - - if( options.getCompiler() != null ) { - if( log.isLoggable(Level.FINE)) - log.fine("Compiler " + options.getCompiler() ); - project.setProperty("build.compiler", options.getCompiler() ); - } - project.init(); - return project; - } - - class JasperAntLogger extends DefaultLogger { - - private StringBuilder reportBuf = new StringBuilder(); - - protected void printMessage(final String message, - final PrintStream stream, - final int priority) { - } - - protected void log(String message) { - reportBuf.append(message); - reportBuf.append(lineSeparator); - } - - protected String getReport() { - String report = reportBuf.toString(); - reportBuf.setLength(0); - return report; - } - } - - public void init(JspCompilationContext ctxt, - ErrorDispatcher errDispatcher, - boolean suppressLogging) { - - this.ctxt = ctxt; - this.errDispatcher = errDispatcher; - options = ctxt.getOptions(); - log = Logger.getLogger(AntJavaCompiler.class.getName()); - if (suppressLogging) { - log.setLevel(Level.OFF); - } - getProject(); - javac = (Javac) project.createTask("javac"); - javac.setFork(options.getFork()); - // Set the Java compiler to use - if (options.getCompiler() != null) { - javac.setCompiler(options.getCompiler()); - } - startThreadPool(); - } - - public void release() { - } - - public void setExtdirs(String exts) { - Path extdirs = new Path(project); - extdirs.setPath(exts); - javac.setExtdirs(extdirs); - info.append(" extdirs=" + exts+ "\n"); - } - - public void setTargetVM(String targetVM) { - javac.setTarget(targetVM); - info.append(" compilerTargetVM=" + targetVM + "\n"); - - } - - public void setSourceVM(String sourceVM) { - javac.setSource(sourceVM); - info.append(" compilerSourceVM=" + sourceVM + "\n"); - } - - public void setClassPath(List cpath) { - Path path = new Path(project); - for (File file: cpath) { - path.setLocation(file); - info.append(" cp=" + file + "\n"); - } - javac.setClasspath(path); - } - - public void saveClassFile(String className, String classFileName) { - // class files are alwyas saved. - } - - public void setDebug(boolean debug) { - javac.setDebug(debug); - javac.setOptimize(!debug); - } - - public long getClassLastModified() { - File classFile = new File(ctxt.getClassFileName()); - return classFile.lastModified(); - } - - public Writer getJavaWriter(String javaFileName, - String javaEncoding) - throws JasperException { - - this.javaFileName = javaFileName; - info.append("Compile: javaFileName=" + javaFileName + "\n" ); - - this.javaEncoding = javaEncoding; - - Writer writer = null; - try { - writer = new OutputStreamWriter( - new FileOutputStream(javaFileName), javaEncoding); - } catch (UnsupportedEncodingException ex) { - errDispatcher.jspError("jsp.error.needAlternateJavaEncoding", - javaEncoding); - } catch (IOException ex) { - errDispatcher.jspError("jsp.error.unableToCreateOutputWriter", - javaFileName, ex); - } - return writer; - } - - public JavacErrorDetail[] compile(String className, Node.Nodes pageNodes) - throws JasperException { - - // Start capturing the System.err output for this thread - SystemLogHandler.setThread(); - - javac.setEncoding(javaEncoding); - // Initialize sourcepath - Path srcPath = new Path(project); - srcPath.setLocation(options.getScratchDir()); - javac.setSrcdir(srcPath); - info.append(" srcDir=" + srcPath + "\n" ); - info.append(" work dir=" + options.getScratchDir() + "\n"); - - // Build includes path - PatternSet.NameEntry includes = javac.createInclude(); - includes.setName(ctxt.getJavaPath()); - info.append(" include="+ ctxt.getJavaPath() + "\n" ); - - BuildException be = null; - StringBuilder errorReport = new StringBuilder(); - String errorCapture = null; - if (ctxt.getOptions().getFork()) { - try { - javac.execute(); - } catch (BuildException e) { - be = e; - log.log(Level.SEVERE, Localizer - .getMessage("jsp.error.javac.exception"), e); - log.log(Level.SEVERE, Localizer - .getMessage("jsp.error.javac.env", info.toString())); - } - errorReport.append(logger.getReport()); - // Stop capturing the System.err output for this thread - errorCapture = SystemLogHandler.unsetThread(); - } else { - errorReport.append(logger.getReport()); - errorCapture = SystemLogHandler.unsetThread(); - - // Capture the current thread - if (errorCapture != null) { - errorReport.append(lineSeparator); - errorReport.append(errorCapture); - } - - JavacObj javacObj = new JavacObj(javac); - synchronized(javacObj) { - threadPool.execute(javacObj); - // Wait for the thread to complete - try { - javacObj.wait(); - } catch (InterruptedException e) { - ; - } - } - be = javacObj.getException(); - if (be != null) { - log.log(Level.SEVERE, Localizer - .getMessage("jsp.error.javac.exception"), be); - log.log(Level.SEVERE, Localizer - .getMessage("jsp.error.javac.env", info.toString())); - } - errorReport.append(logger.getReport()); - errorCapture = javacObj.getErrorCapture(); - } - - if (errorCapture != null) { - errorReport.append(lineSeparator); - errorReport.append(errorCapture); - } - - JavacErrorDetail[] javacErrors = null; - if (be != null) { - try { - String errorReportString = errorReport.toString(); - javacErrors = ErrorDispatcher.parseJavacMessage( - pageNodes, errorReportString, javaFileName); - } catch (IOException ex) { - throw new JasperException(ex); - } - } - return javacErrors; - } - - public void doJavaFile(boolean keep) { - if (!keep) { - File javaFile = new File(javaFileName); - javaFile.delete(); - } - } - - public static void startThreadPool() { - if (threadPool == null) { - threadPool = Executors.newCachedThreadPool(threadFactory); - } - } - - public static void shutdownThreadPool() { - if (threadPool != null) { - threadPool.shutdown(); - } - } - - // Implement java compilation in a separate java thread to - // avoid stack overflow problem (exposed by 64 -bit server) - private static class JavacObj implements Runnable { - - Javac _javac = null; - BuildException _be = null; - String _errorCapture = null; - - public JavacObj(Javac javac) { - _javac = javac; - } - - public void run() { - SystemLogHandler.setThread(); - try { - _javac.execute(); - } catch (BuildException e) { - _be = e; - } finally { - _errorCapture = SystemLogHandler.unsetThread(); - synchronized(this) { - this.notify(); - } - } - } - - public BuildException getException() { - return _be; - } - - public String getErrorCapture() { - return _errorCapture; - } - } - - private static class JavacThreadFactory implements ThreadFactory { - - private ThreadFactory defaultFactory = Executors.defaultThreadFactory(); - - public Thread newThread(Runnable r) { - Thread t = defaultFactory.newThread(r); - t.setName(JAVAC_THREAD_PREFIX + t.getName()); - return t; - } - } -} - diff --git a/impl/src/main/java/org/apache/jasper/compiler/BeanRepository.java b/impl/src/main/java/org/apache/jasper/compiler/BeanRepository.java deleted file mode 100644 index f4e7f45..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/BeanRepository.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - - -import java.util.HashMap; - -import org.apache.jasper.JasperException; - -/** - * Repository of {page, request, session, application}-scoped beans - * - * @author Mandar Raje - */ -class BeanRepository { - - private HashMap beanTypes; - private ClassLoader loader; - private ErrorDispatcher errDispatcher; - - /* - * Constructor. - */ - public BeanRepository(ClassLoader loader, ErrorDispatcher err) { - - this.loader = loader; - this.errDispatcher = err; - beanTypes = new HashMap(); - } - - public void addBean(Node.UseBean n, String s, String type, String scope) - throws JasperException { - - if (scope == null || scope.equals("page") || - scope.equals("request") || - scope.equals("session") || - scope.equals("application") ) - { - beanTypes.put(s, type); - } else { - errDispatcher.jspError(n, "jsp.error.invalid.scope", scope); - } - - } - - public Class getBeanType(String bean) throws JasperException { - Class clazz = null; - try { - clazz = loader.loadClass (beanTypes.get(bean)); - } catch (ClassNotFoundException ex) { - throw new JasperException (ex); - } - return clazz; - } - - public boolean checkVariable (String bean) { - return beanTypes.containsKey(bean); - } - -} - - - - diff --git a/impl/src/main/java/org/apache/jasper/compiler/Collector.java b/impl/src/main/java/org/apache/jasper/compiler/Collector.java deleted file mode 100644 index a06923b..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/Collector.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import org.apache.jasper.JasperException; - -/** - * Collect info about the page and nodes, and make them availabe through - * the PageInfo object. - * - * @author Kin-man Chung - * @author Mark Roth - */ - -class Collector { - - /** - * A visitor for collecting information on the page and the body of - * the custom tags. - */ - static class CollectVisitor extends Node.Visitor { - - private int maxTagNesting = 0; - private int curTagNesting = 0; - private boolean scriptingElementSeen = false; - private boolean usebeanSeen = false; - private boolean includeActionSeen = false; - private boolean paramActionSeen = false; - private boolean setPropertySeen = false; - private boolean hasScriptingVars = false; - - public void visit(Node.ParamAction n) throws JasperException { - if (n.getValue().isExpression()) { - scriptingElementSeen = true; - } - paramActionSeen = true; - } - - public void visit(Node.IncludeAction n) throws JasperException { - if (n.getPage().isExpression()) { - scriptingElementSeen = true; - } - includeActionSeen = true; - visitBody(n); - } - - public void visit(Node.ForwardAction n) throws JasperException { - if (n.getPage().isExpression()) { - scriptingElementSeen = true; - } - visitBody(n); - } - - public void visit(Node.SetProperty n) throws JasperException { - if (n.getValue() != null && n.getValue().isExpression()) { - scriptingElementSeen = true; - } - setPropertySeen = true; - } - - public void visit(Node.UseBean n) throws JasperException { - if (n.getBeanName() != null && n.getBeanName().isExpression()) { - scriptingElementSeen = true; - } - usebeanSeen = true; - visitBody(n); - } - - public void visit(Node.PlugIn n) throws JasperException { - if (n.getHeight() != null && n.getHeight().isExpression()) { - scriptingElementSeen = true; - } - if (n.getWidth() != null && n.getWidth().isExpression()) { - scriptingElementSeen = true; - } - visitBody(n); - } - - public void visit(Node.CustomTag n) throws JasperException { - - curTagNesting++; - if (curTagNesting > maxTagNesting) { - maxTagNesting = curTagNesting; - } - - // Check to see what kinds of element we see as child elements - checkSeen( n.getChildInfo(), n ); - - curTagNesting--; - } - - /** - * Check all child nodes for various elements and update the given - * ChildInfo object accordingly. Visits body in the process. - */ - private void checkSeen( Node.ChildInfo ci, Node n ) - throws JasperException - { - // save values collected so far - boolean scriptingElementSeenSave = scriptingElementSeen; - scriptingElementSeen = false; - boolean usebeanSeenSave = usebeanSeen; - usebeanSeen = false; - boolean includeActionSeenSave = includeActionSeen; - includeActionSeen = false; - boolean paramActionSeenSave = paramActionSeen; - paramActionSeen = false; - boolean setPropertySeenSave = setPropertySeen; - setPropertySeen = false; - boolean hasScriptingVarsSave = hasScriptingVars; - hasScriptingVars = false; - - // Scan attribute list for expressions - if( n instanceof Node.CustomTag ) { - Node.CustomTag ct = (Node.CustomTag)n; - Node.JspAttribute[] attrs = ct.getJspAttributes(); - for (int i = 0; attrs != null && i < attrs.length; i++) { - if (attrs[i].isExpression()) { - scriptingElementSeen = true; - break; - } - } - } - - visitBody(n); - - if( (n instanceof Node.CustomTag) && !hasScriptingVars) { - Node.CustomTag ct = (Node.CustomTag)n; - hasScriptingVars = ct.getVariableInfos().length > 0 || - ct.getTagVariableInfos().length > 0; - } - - // Record if the tag element and its body contains any scriptlet. - ci.setScriptless(! scriptingElementSeen); - ci.setHasUseBean(usebeanSeen); - ci.setHasIncludeAction(includeActionSeen); - ci.setHasParamAction(paramActionSeen); - ci.setHasSetProperty(setPropertySeen); - ci.setHasScriptingVars(hasScriptingVars); - - // Propagate value of scriptingElementSeen up. - scriptingElementSeen = scriptingElementSeen || scriptingElementSeenSave; - usebeanSeen = usebeanSeen || usebeanSeenSave; - setPropertySeen = setPropertySeen || setPropertySeenSave; - includeActionSeen = includeActionSeen || includeActionSeenSave; - paramActionSeen = paramActionSeen || paramActionSeenSave; - hasScriptingVars = hasScriptingVars || hasScriptingVarsSave; - } - - public void visit(Node.JspElement n) throws JasperException { - if (n.getNameAttribute().isExpression()) - scriptingElementSeen = true; - - Node.JspAttribute[] attrs = n.getJspAttributes(); - for (int i = 0; i < attrs.length; i++) { - if (attrs[i].isExpression()) { - scriptingElementSeen = true; - break; - } - } - visitBody(n); - } - - public void visit(Node.JspBody n) throws JasperException { - checkSeen( n.getChildInfo(), n ); - } - - public void visit(Node.NamedAttribute n) throws JasperException { - checkSeen( n.getChildInfo(), n ); - } - - public void visit(Node.Declaration n) throws JasperException { - scriptingElementSeen = true; - } - - public void visit(Node.Expression n) throws JasperException { - scriptingElementSeen = true; - } - - public void visit(Node.Scriptlet n) throws JasperException { - scriptingElementSeen = true; - } - - public void updatePageInfo(PageInfo pageInfo) { - pageInfo.setMaxTagNesting(maxTagNesting); - pageInfo.setScriptless(! scriptingElementSeen); - } - } - - public static void collect(Compiler compiler, Node.Nodes page) - throws JasperException { - - CollectVisitor collectVisitor = new CollectVisitor(); - page.visit(collectVisitor); - collectVisitor.updatePageInfo(compiler.getPageInfo()); - - } -} - diff --git a/impl/src/main/java/org/apache/jasper/compiler/Compiler.java b/impl/src/main/java/org/apache/jasper/compiler/Compiler.java deleted file mode 100644 index 2447f09..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/Compiler.java +++ /dev/null @@ -1,835 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2014 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.PrintWriter; -import java.io.Writer; -import java.net.JarURLConnection; -import java.net.URL; -import java.net.URLConnection; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.StringTokenizer; -import java.util.logging.Logger; -import java.util.logging.Level; - -import org.apache.jasper.JasperException; -import org.apache.jasper.JspCompilationContext; -import org.apache.jasper.Options; -import org.apache.jasper.servlet.JspServletWrapper; - -/** - * Main JSP compiler class. - * - * @author Anil K. Vijendran - * @author Mandar Raje - * @author Pierre Delisle - * @author Kin-man Chung - * @author Remy Maucherat - * @author Mark Roth - */ - -public class Compiler { - - // ----------------------------------------------------------------- Static - - // ----------------------------------------------------- Instance Variables - - protected JspCompilationContext ctxt; - - private ErrorDispatcher errDispatcher; - private PageInfo pageInfo; - private JspServletWrapper jsw; - private TagFileProcessor tfp; - private JavaCompiler javaCompiler; - private Logger log; - private boolean jspcMode; - private SmapUtil smapUtil; - private Options options; - private Node.Nodes pageNodes; - private long jspModTime; - private boolean javaCompilerOptionsSet; - - // ------------------------------------------------------------ Constructor - - // Compiler for parsing only, needed by netbeans - public Compiler(JspCompilationContext ctxt, JspServletWrapper jsw) { - this.jsw = jsw; - this.ctxt = ctxt; - this.jspcMode = false; - this.options = ctxt.getOptions(); - this.log = Logger.getLogger(Compiler.class.getName()); - this.smapUtil = new SmapUtil(ctxt); - this.errDispatcher = new ErrorDispatcher(jspcMode); - this.javaCompiler = new NullJavaCompiler(); - javaCompiler.init(ctxt, errDispatcher, jspcMode); - this.javaCompilerOptionsSet = false; - } - - public Compiler(JspCompilationContext ctxt, JspServletWrapper jsw, - boolean jspcMode) throws JasperException { - this.jsw = jsw; - this.ctxt = ctxt; - this.jspcMode = jspcMode; - this.options = ctxt.getOptions(); - this.log = Logger.getLogger(Compiler.class.getName()); - if (jspcMode) { - log.setLevel(Level.OFF); - } - this.smapUtil = new SmapUtil(ctxt); - this.errDispatcher = new ErrorDispatcher(jspcMode); - initJavaCompiler(); - this.javaCompilerOptionsSet = false; - } - - - // --------------------------------------------------------- Public Methods - - - /** - * Compile the jsp file into equivalent servlet in java source - */ - private void generateJava() throws Exception { - - long t1, t2, t3, t4; - t1 = t2 = t3 = t4 = 0; - - if (log.isLoggable(Level.FINE)) { - t1 = System.currentTimeMillis(); - } - - // Setup page info area - pageInfo = new PageInfo(new BeanRepository(ctxt.getClassLoader(), - errDispatcher), - ctxt.getJspFile()); - - JspConfig jspConfig = options.getJspConfig(); - JspProperty jspProperty = - jspConfig.findJspProperty(ctxt.getJspFile()); - - /* - * If the current uri is matched by a pattern specified in - * a jsp-property-group in web.xml, initialize pageInfo with - * those properties. - */ - pageInfo.setELIgnored(JspUtil.booleanValue( - jspProperty.isELIgnored())); - pageInfo.setScriptingInvalid(JspUtil.booleanValue( - jspProperty.isScriptingInvalid())); - pageInfo.setTrimDirectiveWhitespaces(JspUtil.booleanValue( - jspProperty.getTrimSpaces())); - pageInfo.setDeferredSyntaxAllowedAsLiteral(JspUtil.booleanValue( - jspProperty.getPoundAllowed())); - pageInfo.setErrorOnUndeclaredNamespace(JspUtil.booleanValue( - jspProperty.errorOnUndeclaredNamespace())); - - if (jspProperty.getIncludePrelude() != null) { - pageInfo.setIncludePrelude(jspProperty.getIncludePrelude()); - } - if (jspProperty.getIncludeCoda() != null) { - pageInfo.setIncludeCoda(jspProperty.getIncludeCoda()); - } - if (options.isDefaultBufferNone() && pageInfo.getBufferValue() == null){ - // Set to unbuffered if not specified explicitly - pageInfo.setBuffer(0); - } - - String javaFileName = ctxt.getServletJavaFileName(); - ServletWriter writer = null; - - try { - // Setup the ServletWriter - Writer javaWriter = javaCompiler.getJavaWriter( - javaFileName, - ctxt.getOptions().getJavaEncoding()); - writer = new ServletWriter(new PrintWriter(javaWriter)); - ctxt.setWriter(writer); - - // Reset the temporary variable counter for the generator. - JspUtil.resetTemporaryVariableName(); - - // Parse the file - ParserController parserCtl = new ParserController(ctxt, this); - pageNodes = parserCtl.parse(ctxt.getJspFile()); - - if (ctxt.isPrototypeMode()) { - // generate prototype .java file for the tag file - Generator.generate(writer, this, pageNodes); - writer.close(); - writer = null; - return; - } - - // Validate and process attributes - Validator.validate(this, pageNodes); - - if (log.isLoggable(Level.FINE)) { - t2 = System.currentTimeMillis(); - } - - // Collect page info - Collector.collect(this, pageNodes); - - // Compile (if necessary) and load the tag files referenced in - // this compilation unit. - tfp = new TagFileProcessor(); - tfp.loadTagFiles(this, pageNodes); - - if (log.isLoggable(Level.FINE)) { - t3 = System.currentTimeMillis(); - } - - // Determine which custom tag needs to declare which scripting vars - ScriptingVariabler.set(pageNodes, errDispatcher); - - // Optimizations by Tag Plugins - TagPluginManager tagPluginManager = options.getTagPluginManager(); - tagPluginManager.apply(pageNodes, errDispatcher, pageInfo); - - // Optimization: concatenate contiguous template texts. - TextOptimizer.concatenate(this, pageNodes); - - // Generate static function mapper codes. - ELFunctionMapper.map(this, pageNodes); - - // generate servlet .java file - Generator.generate(writer, this, pageNodes); - writer.close(); - writer = null; - - // The writer is only used during the compile, dereference - // it in the JspCompilationContext when done to allow it - // to be GC'd and save memory. - ctxt.setWriter(null); - - if (log.isLoggable(Level.FINE)) { - t4 = System.currentTimeMillis(); - log.fine("Generated "+ javaFileName + " total=" - + (t4-t1) + " generate=" + (t4-t3) - + " validate=" + (t2-t1)); - } - - } catch (Exception e) { - if (writer != null) { - try { - writer.close(); - writer = null; - } catch (Exception e1) { - // do nothing - } - } - // Remove the generated .java file - javaCompiler.doJavaFile(false); - throw e; - } finally { - if (writer != null) { - try { - writer.close(); - } catch (Exception e2) { - // do nothing - } - } - } - - // JSR45 Support - if (! options.isSmapSuppressed()) { - smapUtil.generateSmap(pageNodes); - } - - // If any proto type .java and .class files was generated, - // the prototype .java may have been replaced by the current - // compilation (if the tag file is self referencing), but the - // .class file need to be removed, to make sure that javac would - // generate .class again from the new .java file just generated. - tfp.removeProtoTypeFiles(ctxt.getClassFileName()); - } - - - private void setJavaCompilerOptions() { - - if (javaCompilerOptionsSet) { - return; - } - javaCompilerOptionsSet = true; - - String classpath = ctxt.getClassPath(); - String sep = System.getProperty("path.separator"); - - // Initializing classpath - ArrayList cpath = new ArrayList(); - HashSet paths = new HashSet(); - - // Process classpath, which includes system classpath from compiler - // options, plus the context classpath from the classloader - String sysClassPath = options.getSystemClassPath(); - if (sysClassPath != null) { - StringTokenizer tokenizer = new StringTokenizer(sysClassPath, sep); - while (tokenizer.hasMoreElements()) { - String path = tokenizer.nextToken(); - if (! paths.contains(path) && ! systemJarInWebinf(path)) { - paths.add(path); - cpath.add(new File(path)); - } - } - } - if (classpath != null) { - StringTokenizer tokenizer = new StringTokenizer(classpath, sep); - while (tokenizer.hasMoreElements()) { - String path = tokenizer.nextToken(); - if (! paths.contains(path) && ! systemJarInWebinf(path)) { - paths.add(path); - cpath.add(new File(path)); - } - } - } - if(log.isLoggable(Level.FINE)) { - log.fine("Using classpath: " + sysClassPath + sep + classpath); - } - javaCompiler.setClassPath(cpath); - - // Set debug info - javaCompiler.setDebug(options.getClassDebugInfo()); - - // Initialize and set java extensions - String exts = System.getProperty("java.ext.dirs"); - if (exts != null) { - javaCompiler.setExtdirs(exts); - } - - if (options.getCompilerTargetVM() != null) { - javaCompiler.setTargetVM(options.getCompilerTargetVM()); - } - - if (options.getCompilerSourceVM() != null) { - javaCompiler.setSourceVM(options.getCompilerSourceVM()); - } - - } - - /** - * Compile the servlet from .java file to .class file - */ - private void generateClass() - throws FileNotFoundException, JasperException, Exception { - - long t1 = 0; - if (log.isLoggable(Level.FINE)) { - t1 = System.currentTimeMillis(); - } - - String javaFileName = ctxt.getServletJavaFileName(); - - setJavaCompilerOptions(); - - // Start java compilation - JavacErrorDetail[] javacErrors = - javaCompiler.compile(ctxt.getFullClassName(), pageNodes); - - if (javacErrors != null) { - // If there are errors, always generate java files to disk. - javaCompiler.doJavaFile(true); - - log.severe("Error compiling file: " + javaFileName); - errDispatcher.javacError(javacErrors); - } - - if (log.isLoggable(Level.FINE)) { - long t2 = System.currentTimeMillis(); - log.fine("Compiled " + javaFileName + " " + (t2-t1) + "ms"); - } - - // Save or delete the generated Java files, depending on the - // value of "keepgenerated" attribute - javaCompiler.doJavaFile(ctxt.keepGenerated()); - - // JSR45 Support - if (!ctxt.isPrototypeMode() && !options.isSmapSuppressed()) { - smapUtil.installSmap(); - } - - // START CR 6373479 - if (jsw != null && jsw.getServletClassLastModifiedTime() <= 0) { - jsw.setServletClassLastModifiedTime( - javaCompiler.getClassLastModified()); - } - // END CR 6373479 - - if (options.getSaveBytecode()) { - javaCompiler.saveClassFile(ctxt.getFullClassName(), - ctxt.getClassFileName()); - } - - // On some systems, due to file caching, the time stamp for the updated - // JSP file may actually be greater than that of the newly created byte - // codes in the cache. In such cases, adjust the cache time stamp to - // JSP page time, to avoid unnecessary recompilations. - ctxt.getRuntimeContext().adjustBytecodeTime(ctxt.getFullClassName(), - jspModTime); - } - - /** - * Compile the jsp file from the current engine context. As an side- - * effect, tag files that are referenced by this page are also compiled. - * - * @param compileClass If true, generate both .java and .class file - * If false, generate only .java file - */ - public void compile(boolean compileClass) - throws FileNotFoundException, JasperException, Exception - { - - try { - // Create the output directory for the generated files - // Always try and create the directory tree, in case the generated - // directories were deleted after the server was started. - ctxt.makeOutputDir(ctxt.getOutputDir()); - - // If errDispatcher is nulled from a previous compilation of the - // same page, instantiate one here. - if (errDispatcher == null) { - errDispatcher = new ErrorDispatcher(jspcMode); - } - generateJava(); - if (compileClass) { - generateClass(); - } - else { - // If called from jspc to only compile to .java files, - // make sure that .java files are written to disk. - javaCompiler.doJavaFile(ctxt.keepGenerated()); - } - } finally { - if (tfp != null) { - tfp.removeProtoTypeFiles(null); - } - javaCompiler.release(); - // Make sure these object which are only used during the - // generation and compilation of the JSP page get - // dereferenced so that they can be GC'd and reduce the - // memory footprint. - tfp = null; - errDispatcher = null; - if (!jspcMode) { - pageInfo = null; - } - pageNodes = null; - if (ctxt.getWriter() != null) { - ctxt.getWriter().close(); - ctxt.setWriter(null); - } - } - } - - /** - * This is a protected method intended to be overridden by - * subclasses of Compiler. This is used by the compile method - * to do all the compilation. - */ - public boolean isOutDated() { - return isOutDated( true ); - } - - /** - * Determine if a compilation is necessary by checking the time stamp - * of the JSP page with that of the corresponding .class or .java file. - * If the page has dependencies, the check is also extended to its - * dependeants, and so on. - * This method can by overidden by a subclasses of Compiler. - * @param checkClass If true, check against .class file, - * if false, check against .java file. - */ - public boolean isOutDated(boolean checkClass) { - - String jsp = ctxt.getJspFile(); - - if (jsw != null - && (ctxt.getOptions().getModificationTestInterval() > 0)) { - - if (jsw.getLastModificationTest() - + (ctxt.getOptions().getModificationTestInterval() * 1000) - > System.currentTimeMillis()) { - return false; - } else { - jsw.setLastModificationTest(System.currentTimeMillis()); - } - } - - long jspRealLastModified = 0; - // START PWC 6468930 - File targetFile; - - if (checkClass) { - targetFile = new File(ctxt.getClassFileName()); - } else { - targetFile = new File(ctxt.getServletJavaFileName()); - } - - // Get the target file's last modified time. File.lastModified() - // returns 0 if the file does not exist. - long targetLastModified = targetFile.lastModified(); - - // Check cached class file - if (checkClass) { - JspRuntimeContext rtctxt = ctxt.getRuntimeContext(); - String className = ctxt.getFullClassName(); - long cachedTime = rtctxt.getBytecodeBirthTime(className); - if (cachedTime > targetLastModified) { - targetLastModified = cachedTime; - } else { - // Remove from cache, since the bytecodes from the file is more - // current, so that JasperLoader won't load the cached version - rtctxt.setBytecode(className, null); - } - } - - if (targetLastModified == 0L) - return true; - - // Check if the jsp exists in the filesystem (instead of a jar - // or a remote location). If yes, then do a File.lastModified() - // to determine its last modified time. This is more performant - // (fewer stat calls) than the ctxt.getResource() followed by - // openConnection(). However, it only works for file system jsps. - // If the file has indeed changed, then need to call URL.OpenConnection() - // so that the cache loads the latest jsp file - if (jsw != null) { - File jspFile = jsw.getJspFile(); - if (jspFile != null) { - jspRealLastModified = jspFile.lastModified(); - } - } - if (jspRealLastModified == 0 || - targetLastModified < jspRealLastModified) { - // END PWC 6468930 - try { - URL jspUrl = ctxt.getResource(jsp); - if (jspUrl == null) { - ctxt.incrementRemoved(); - return false; - } - URLConnection uc = jspUrl.openConnection(); - if (uc instanceof JarURLConnection) { - jspRealLastModified = - ((JarURLConnection) uc).getJarEntry().getTime(); - } else { - jspRealLastModified = uc.getLastModified(); - } - uc.getInputStream().close(); - } catch (Exception e) { - e.printStackTrace(); - return true; - } - // START PWC 6468930 - } - // END PWC 6468930 - /* PWC 6468930 - long targetLastModified = 0; - File targetFile; - - if( checkClass ) { - targetFile = new File(ctxt.getClassFileName()); - } else { - targetFile = new File(ctxt.getServletJavaFileName()); - } - - if (!targetFile.exists()) { - return true; - } - - targetLastModified = targetFile.lastModified(); - */ - if (checkClass && jsw != null) { - jsw.setServletClassLastModifiedTime(targetLastModified); - } - - if (targetLastModified < jspRealLastModified) { - // Remember JSP mod time - jspModTime = jspRealLastModified; - if( log.isLoggable(Level.FINE) ) { - log.fine("Compiler: outdated: " + targetFile + " " + - targetLastModified ); - } - return true; - } - - // determine if source dependent files (e.g. includes using include - // directives) have been changed. - if( jsw==null ) { - return false; - } - - List depends = jsw.getDependants(); - if (depends == null) { - return false; - } - - for (String include: depends) { - try { - URL includeUrl = ctxt.getResource(include); - if (includeUrl == null) { - return true; - } - - URLConnection includeUconn = includeUrl.openConnection(); - long includeLastModified = 0; - if (includeUconn instanceof JarURLConnection) { - includeLastModified = - ((JarURLConnection)includeUconn).getJarEntry().getTime(); - } else { - includeLastModified = includeUconn.getLastModified(); - } - includeUconn.getInputStream().close(); - - if (includeLastModified > targetLastModified) { - // START GlassFish 750 - if (include.endsWith(".tld")) { - ctxt.clearTaglibs(); - ctxt.clearTagFileJarUrls(); - } - // END GlassFish 750 - return true; - } - } catch (Exception e) { - e.printStackTrace(); - return true; - } - } - - return false; - - } - - - /** - * Gets the error dispatcher. - */ - public ErrorDispatcher getErrorDispatcher() { - return errDispatcher; - } - - - /** - * Gets the info about the page under compilation - */ - public PageInfo getPageInfo() { - return pageInfo; - } - - - /** - * Sets the info about the page under compilation - */ - public void setPageInfo(PageInfo pageInfo) { - this.pageInfo = pageInfo; - } - - - public JspCompilationContext getCompilationContext() { - return ctxt; - } - - - /** - * Remove generated files - */ - public void removeGeneratedFiles() { - try { - String classFileName = ctxt.getClassFileName(); - if (classFileName != null) { - File classFile = new File(classFileName); - if( log.isLoggable(Level.FINE) ) - log.fine( "Deleting " + classFile ); - classFile.delete(); - } - } catch (Exception e) { - // Remove as much as possible, ignore possible exceptions - } - try { - String javaFileName = ctxt.getServletJavaFileName(); - if (javaFileName != null) { - File javaFile = new File(javaFileName); - if( log.isLoggable(Level.FINE) ) - log.fine( "Deleting " + javaFile ); - javaFile.delete(); - } - } catch (Exception e) { - // Remove as much as possible, ignore possible exceptions - } - } - - public void removeGeneratedClassFiles() { - try { - String classFileName = ctxt.getClassFileName(); - if (classFileName != null) { - File classFile = new File(classFileName); - if( log.isLoggable(Level.FINE) ) - log.fine( "Deleting " + classFile ); - classFile.delete(); - } - } catch (Exception e) { - // Remove as much as possible, ignore possible exceptions - } - } - - /** - * Get an instance of JavaCompiler. - * If a compiler is specified in Options, use that, - * else if Running with JDK 6, use a Jsr199JavaCompiler that supports JSR199, - * else if eclipse's JDT compiler is available, use that. - * The default is to use javac from ant. - */ - private void initJavaCompiler() throws JasperException { - if (options.getCompilerClassName() != null) { - Class c = getClassFor(options.getCompilerClassName()); - try { - javaCompiler = (JavaCompiler) c.newInstance(); - } catch (Exception ex) { - } - } - if (javaCompiler == null) { - boolean disablejsr199 = Boolean.TRUE.toString().equals( - System.getProperty("org.apache.jasper.compiler.disablejsr199")); - Double version = - Double.valueOf(System.getProperty("java.specification.version")); - if (!disablejsr199 && - (version >= 1.6 || getClassFor("javax.tools.Tool") != null)) { - // JDK 6 or bundled with jsr199 compiler - javaCompiler = new Jsr199JavaCompiler(); - } else { - Class c = getClassFor("org.eclipse.jdt.internal.compiler.Compiler"); - if (c != null) { - c = getClassFor("org.apache.jasper.compiler.JDTJavaCompiler"); - if (c != null) { - try { - javaCompiler = (JavaCompiler) c.newInstance(); - } catch (Exception ex) { - } - } - } - } - } - if (javaCompiler == null) { - Class c = getClassFor("org.apache.tools.ant.taskdefs.Javac"); - if (c != null) { - c = getClassFor("org.apache.jasper.compiler.AntJavaCompiler"); - if (c != null) { - try { - javaCompiler = (JavaCompiler) c.newInstance(); - } catch (Exception ex) { - } - } - } - } - if (javaCompiler == null) { - errDispatcher.jspError("jsp.error.nojavac"); - } - - javaCompiler.init(ctxt, errDispatcher, jspcMode); - } - - private Class getClassFor(String className) { - Class c = null; - try { - c = Class.forName(className, false, getClass().getClassLoader()); - } catch (ClassNotFoundException ex) { - } - return c; - } - - /* - * System jars should be exclude from the classpath for javac. - */ - private static String systemJars[] = - {"jstl.jar"}; - - private static String systemJsfJars[] = - {"jsf-api.jar", "jsf-impl.jar"}; - - /** - * Return true if the path refers to a jar file in WEB-INF and is a - * system jar. - */ - private boolean systemJarInWebinf(String path) { - - if (path.indexOf("/WEB-INF/") < 0) { - return false; - } - - Boolean useMyFaces = (Boolean) ctxt.getServletContext(). - getAttribute("com.sun.faces.useMyFaces"); - - if (useMyFaces == null || !useMyFaces) { - for (String jar: systemJsfJars) { - if (path.indexOf(jar) > 0) { - return true; - } - } - } - - for (String jar: systemJars) { - if (path.indexOf(jar) > 0) { - return true; - } - } - return false; - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/DefaultErrorHandler.java b/impl/src/main/java/org/apache/jasper/compiler/DefaultErrorHandler.java deleted file mode 100644 index ae6c42e..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/DefaultErrorHandler.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import org.apache.jasper.JasperException; - -/** - * Default implementation of ErrorHandler interface. - * - * @author Jan Luehe - */ -class DefaultErrorHandler implements ErrorHandler { - - /* - * Processes the given JSP parse error. - * - * @param fname Name of the JSP file in which the parse error occurred - * @param line Parse error line number - * @param column Parse error column number - * @param errMsg Parse error message - * @param exception Parse exception - */ - public void jspError(String fname, int line, int column, String errMsg, - Exception ex) throws JasperException { - throw new JasperException(fname + "(" + line + "," + column + ")" - + " " + errMsg, ex); - } - - /* - * Processes the given JSP parse error. - * - * @param errMsg Parse error message - * @param exception Parse exception - */ - public void jspError(String errMsg, Exception ex) throws JasperException { - throw new JasperException(errMsg, ex); - } - - /* - * Processes the given javac compilation errors. - * - * @param details Array of JavacErrorDetail instances corresponding to the - * compilation errors - */ - public void javacError(JavacErrorDetail[] details) throws JasperException { - - if (details == null) { - return; - } - - Object[] args = null; - StringBuilder buf = new StringBuilder(); - - for (int i=0; i < details.length; i++) { - if (details[i].getJspBeginLineNumber() >= 0) { - args = new Object[] { - Integer.valueOf(details[i].getJspBeginLineNumber()), - details[i].getJspFileName() }; - buf.append(Localizer.getMessage("jsp.error.single.line.number", - args)); - buf.append("\n"); - } - - buf.append( - Localizer.getMessage("jsp.error.corresponding.servlet")); - buf.append(details[i].getErrorMessage()); - buf.append("\n\n"); - } - - if (buf.length() == 0) { - throw new JasperException(Localizer.getMessage("jsp.error.nojdk")); - } - throw new JasperException( - Localizer.getMessage("jsp.error.unable.compile") + "\n\n" + buf); - } - - /** - * Processes the given javac error report and exception. - * - * @param errorReport Compilation error report - * @param exception Compilation exception - */ - public void javacError(String errorReport, Exception exception) - throws JasperException { - - throw new JasperException( - Localizer.getMessage("jsp.error.unable.compile"), exception); - } - -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/Dumper.java b/impl/src/main/java/org/apache/jasper/compiler/Dumper.java deleted file mode 100644 index 815edc5..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/Dumper.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import org.xml.sax.Attributes; -import org.apache.jasper.JasperException; - -class Dumper { - - static class DumpVisitor extends Node.Visitor { - private int indent = 0; - - private String getAttributes(Attributes attrs) { - if (attrs == null) - return ""; - - StringBuilder buf = new StringBuilder(); - for (int i=0; i < attrs.getLength(); i++) { - buf.append(" " + attrs.getQName(i) + "=\"" - + attrs.getValue(i) + "\""); - } - return buf.toString(); - } - - private void printString(String str) { - printIndent(); - System.out.print(str); - } - - private void printString(String prefix, char[] chars, String suffix) { - String str = null; - if (chars != null) { - str = new String(chars); - } - printString(prefix, str, suffix); - } - - private void printString(String prefix, String str, String suffix) { - printIndent(); - if (str != null) { - System.out.print(prefix + str + suffix); - } else { - System.out.print(prefix + suffix); - } - } - - private void printAttributes(String prefix, Attributes attrs, - String suffix) { - printString(prefix, getAttributes(attrs), suffix); - } - - private void dumpBody(Node n) throws JasperException { - Node.Nodes page = n.getBody(); - if (page != null) { -// indent++; - page.visit(this); -// indent--; - } - } - - public void visit(Node.PageDirective n) throws JasperException { - printAttributes("<%@ page", n.getAttributes(), "%>"); - } - - public void visit(Node.TaglibDirective n) throws JasperException { - printAttributes("<%@ taglib", n.getAttributes(), "%>"); - } - - public void visit(Node.IncludeDirective n) throws JasperException { - printAttributes("<%@ include", n.getAttributes(), "%>"); - dumpBody(n); - } - - public void visit(Node.Comment n) throws JasperException { - printString("<%--", n.getText(), "--%>"); - } - - public void visit(Node.Declaration n) throws JasperException { - printString("<%!", n.getText(), "%>"); - } - - public void visit(Node.Expression n) throws JasperException { - printString("<%=", n.getText(), "%>"); - } - - public void visit(Node.Scriptlet n) throws JasperException { - printString("<%", n.getText(), "%>"); - } - - public void visit(Node.IncludeAction n) throws JasperException { - printAttributes(""); - dumpBody(n); - printString(""); - } - - public void visit(Node.ForwardAction n) throws JasperException { - printAttributes(""); - dumpBody(n); - printString(""); - } - - public void visit(Node.GetProperty n) throws JasperException { - printAttributes(""); - } - - public void visit(Node.SetProperty n) throws JasperException { - printAttributes(""); - dumpBody(n); - printString(""); - } - - public void visit(Node.UseBean n) throws JasperException { - printAttributes(""); - dumpBody(n); - printString(""); - } - - public void visit(Node.PlugIn n) throws JasperException { - printAttributes(""); - dumpBody(n); - printString(""); - } - - public void visit(Node.ParamsAction n) throws JasperException { - printAttributes(""); - dumpBody(n); - printString(""); - } - - public void visit(Node.ParamAction n) throws JasperException { - printAttributes(""); - dumpBody(n); - printString(""); - } - - public void visit(Node.NamedAttribute n) throws JasperException { - printAttributes(""); - dumpBody(n); - printString(""); - } - - public void visit(Node.JspBody n) throws JasperException { - printAttributes(""); - dumpBody(n); - printString(""); - } - - public void visit(Node.ELExpression n) throws JasperException { - printString( n.getText()); - } - - public void visit(Node.CustomTag n) throws JasperException { - printAttributes("<" + n.getQName(), n.getAttributes(), ">"); - dumpBody(n); - printString(""); - } - - public void visit(Node.UninterpretedTag n) throws JasperException { - String tag = n.getQName(); - printAttributes("<"+tag, n.getAttributes(), ">"); - dumpBody(n); - printString(""); - } - - public void visit(Node.TemplateText n) throws JasperException { - printString(n.getText()); - } - - private void printIndent() { - for (int i=0; i < indent; i++) { - System.out.print(" "); - } - } - } - - public static void dump(Node n) { - try { - n.accept(new DumpVisitor()); - } catch (JasperException e) { - e.printStackTrace(); - } - } - - public static void dump(Node.Nodes page) { - try { - page.visit(new DumpVisitor()); - } catch (JasperException e) { - e.printStackTrace(); - } - } -} - diff --git a/impl/src/main/java/org/apache/jasper/compiler/ELFunctionMapper.java b/impl/src/main/java/org/apache/jasper/compiler/ELFunctionMapper.java deleted file mode 100644 index defcc30..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/ELFunctionMapper.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.util.*; -import javax.servlet.jsp.tagext.FunctionInfo; -import org.apache.jasper.JasperException; - -/** - * This class generates functions mappers for the EL expressions in the page. - * Instead of a global mapper, a mapper is used for ecah call to EL - * evaluator, thus avoiding the prefix overlapping and redefinition - * issues. - * - * @author Kin-man Chung - */ - -public class ELFunctionMapper { - private int currFunc = 0; - StringBuilder ds; // Contains codes to initialize the functions mappers. - StringBuilder ss; // Contains declarations of the functions mappers. - - /** - * Creates the functions mappers for all EL expressions in the JSP page. - * - * @param compiler Current compiler, mainly for accessing error dispatcher. - * @param page The current compilation unit. - */ - public static void map(Compiler compiler, Node.Nodes page) - throws JasperException { - - ELFunctionMapper map = new ELFunctionMapper(); - map.ds = new StringBuilder(); - map.ss = new StringBuilder(); - - page.visit(map.new ELFunctionVisitor()); - - // Append the declarations to the root node - String ds = map.ds.toString(); - if (ds.length() > 0) { - Node root = page.getRoot(); - new Node.Declaration(map.ss.toString(), null, root); - new Node.Declaration("static {\n" + ds + "}\n", null, root); - } - } - - /** - * A visitor for the page. The places where EL is allowed are scanned - * for functions, and if found functions mappers are created. - */ - class ELFunctionVisitor extends Node.Visitor { - - /** - * Use a global name map to facilitate reuse of function maps. - * The key used is prefix:function:uri. - */ - private HashMap gMap = new HashMap(); - - public void visit(Node.ParamAction n) throws JasperException { - doMap(n.getValue()); - visitBody(n); - } - - public void visit(Node.IncludeAction n) throws JasperException { - doMap(n.getPage()); - visitBody(n); - } - - public void visit(Node.ForwardAction n) throws JasperException { - doMap(n.getPage()); - visitBody(n); - } - - public void visit(Node.SetProperty n) throws JasperException { - doMap(n.getValue()); - visitBody(n); - } - - public void visit(Node.UseBean n) throws JasperException { - doMap(n.getBeanName()); - visitBody(n); - } - - public void visit(Node.PlugIn n) throws JasperException { - doMap(n.getHeight()); - doMap(n.getWidth()); - visitBody(n); - } - - public void visit(Node.JspElement n) throws JasperException { - - Node.JspAttribute[] attrs = n.getJspAttributes(); - for (int i = 0; attrs != null && i < attrs.length; i++) { - doMap(attrs[i]); - } - doMap(n.getNameAttribute()); - visitBody(n); - } - - public void visit(Node.UninterpretedTag n) throws JasperException { - - Node.JspAttribute[] attrs = n.getJspAttributes(); - for (int i = 0; attrs != null && i < attrs.length; i++) { - doMap(attrs[i]); - } - visitBody(n); - } - - public void visit(Node.CustomTag n) throws JasperException { - Node.JspAttribute[] attrs = n.getJspAttributes(); - for (int i = 0; attrs != null && i < attrs.length; i++) { - doMap(attrs[i]); - } - visitBody(n); - } - - public void visit(Node.ELExpression n) throws JasperException { - doMap(n.getEL()); - } - - private void doMap(Node.JspAttribute attr) - throws JasperException { - if (attr != null) { - doMap(attr.getEL()); - } - } - - /** - * Creates function mappers, if needed, from ELNodes - */ - private void doMap(ELNode.Nodes el) - throws JasperException { - - // Only care about functions in ELNode's - class Fvisitor extends ELNode.Visitor { - ArrayList funcs = - new ArrayList(); - Set keys = new HashSet(); - public void visit(ELNode.Function n) throws JasperException { - if (n.getUri() == null) { - // Can be a lambda expresion call - return; - } - String key = n.getPrefix() + ":" + n.getName(); - if (! keys.contains(key)) { - keys.add(key); - funcs.add(n); - } - } - } - - if (el == null) { - return; - } - - // First locate all unique functions in this EL - Fvisitor fv = new Fvisitor(); - el.visit(fv); - ArrayList functions = fv.funcs; - - if (functions.size() == 0) { - return; - } - - // Reuse a previous map if possible - String decName = matchMap(functions); - if (decName != null) { - el.setMapName(decName); - return; - } - - // Generate declaration for the map statically - decName = getMapName(); - ss.append("static private org.apache.jasper.runtime.ProtectedFunctionMapper " + decName + ";\n"); - - ds.append(" " + decName + "= "); - ds.append("org.apache.jasper.runtime.ProtectedFunctionMapper"); - - // Special case if there is only one function in the map - String funcMethod = null; - if (functions.size() == 1) { - funcMethod = ".getMapForFunction"; - } else { - ds.append(".getInstance();\n"); - funcMethod = " " + decName + ".mapFunction"; - } - - // Setup arguments for either getMapForFunction or mapFunction - for (int i = 0; i < functions.size(); i++) { - ELNode.Function f = (ELNode.Function)functions.get(i); - FunctionInfo funcInfo = f.getFunctionInfo(); - String key = f.getPrefix()+ ":" + f.getName(); - ds.append(funcMethod + "(\"" + key + "\", " + - funcInfo.getFunctionClass() + ".class, " + - '\"' + f.getMethodName() + "\", " + - "new Class[] {"); - String params[] = f.getParameters(); - for (int k = 0; k < params.length; k++) { - if (k != 0) { - ds.append(", "); - } - int iArray = params[k].indexOf('['); - if (iArray < 0) { - ds.append(params[k] + ".class"); - } - else { - String baseType = params[k].substring(0, iArray); - ds.append("java.lang.reflect.Array.newInstance("); - ds.append(baseType); - ds.append(".class,"); - - // Count the number of array dimension - int aCount = 0; - for (int jj = iArray; jj < params[k].length(); jj++ ) { - if (params[k].charAt(jj) == '[') { - aCount++; - } - } - if (aCount == 1) { - ds.append("0).getClass()"); - } else { - ds.append("new int[" + aCount + "]).getClass()"); - } - } - } - ds.append("});\n"); - // Put the current name in the global function map - gMap.put(f.getPrefix() + ':' + f.getName() + ':' + f.getUri(), - decName); - } - el.setMapName(decName); - } - - /** - * Find the name of the function mapper for an EL. Reuse a - * previously generated one if possible. - * @param functions An ArrayList of ELNode.Function instances that - * represents the functions in an EL - * @return A previous generated function mapper name that can be used - * by this EL; null if none found. - */ - private String matchMap(ArrayList functions) { - - String mapName = null; - for (int i = 0; i < functions.size(); i++) { - ELNode.Function f = functions.get(i); - String temName = gMap.get(f.getPrefix() + ':' + - f.getName() + ':' + f.getUri()); - if (temName == null) { - return null; - } - if (mapName == null) { - mapName = temName; - } else if (!temName.equals(mapName)) { - // If not all in the previous match, then no match. - return null; - } - } - return mapName; - } - - /* - * @return An unique name for a function mapper. - */ - private String getMapName() { - return "_jspx_fnmap_" + currFunc++; - } - } -} - diff --git a/impl/src/main/java/org/apache/jasper/compiler/ELNode.java b/impl/src/main/java/org/apache/jasper/compiler/ELNode.java deleted file mode 100644 index 9921918..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/ELNode.java +++ /dev/null @@ -1,317 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.util.*; -import javax.servlet.jsp.tagext.FunctionInfo; -import org.apache.jasper.JasperException; - -/** - * This class defines internal representation for an EL Expression - * - * It currently only defines functions. It can be expanded to define - * all the components of an EL expression, if need to. - * - * @author Kin-man Chung - */ - -abstract class ELNode { - - abstract public void accept(Visitor v) throws JasperException; - - /** - * Child classes - */ - - - /** - * Represents an EL expression: anything in ${ and }. - */ - public static class Root extends ELNode { - - private ELNode.Nodes expr; - private boolean isDollarExpr; - - Root(ELNode.Nodes expr, boolean isDollarExpr) { - this.expr = expr; - this.isDollarExpr = isDollarExpr; - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public ELNode.Nodes getExpression() { - return expr; - } - } - - /** - * Represents text outside of EL expression. - */ - public static class Text extends ELNode { - - private String text; - - Text(String text) { - this.text = text; - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public String getText() { - return text; - } - } - - /** - * Represents anything in EL expression, other than functions, including - * function arguments etc - */ - public static class ELText extends ELNode { - - private String text; - - ELText(String text) { - this.text = text; - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public String getText() { - return text; - } - } - - /** - * Represents a function - * Currently only include the prefix and function name, but not its - * arguments. - */ - public static class Function extends ELNode { - - private String prefix; - private String name; - private String uri; - private FunctionInfo functionInfo; - private String methodName; - private String[] parameters; - - Function(String prefix, String name) { - this.prefix = prefix; - this.name = name; - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public String getPrefix() { - return prefix; - } - - public String getName() { - return name; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public String getUri() { - return uri; - } - - public void setFunctionInfo(FunctionInfo f) { - this.functionInfo = f; - } - - public FunctionInfo getFunctionInfo() { - return functionInfo; - } - - public void setMethodName(String methodName) { - this.methodName = methodName; - } - - public String getMethodName() { - return methodName; - } - - public void setParameters(String[] parameters) { - this.parameters = parameters; - } - - public String[] getParameters() { - return parameters; - } - } - - /** - * An ordered list of ELNode. - */ - public static class Nodes { - - /* Name used for creating a map for the functions in this - EL expression, for communication to Generator. - */ - String mapName = null; // The function map associated this EL - private List list; - - public Nodes() { - list = new ArrayList(); - } - - public void add(ELNode en) { - list.add(en); - } - - /** - * Visit the nodes in the list with the supplied visitor - * @param v The visitor used - */ - public void visit(Visitor v) throws JasperException { - Iterator iter = list.iterator(); - while (iter.hasNext()) { - ELNode n = iter.next(); - n.accept(v); - } - } - - public Iterator iterator() { - return list.iterator(); - } - - public boolean isEmpty() { - return list.size() == 0; - } - - /** - * @return true if the expression contains a ${...} or #{} - */ - public boolean containsEL() { - Iterator iter = list.iterator(); - while (iter.hasNext()) { - ELNode n = iter.next(); - if (n instanceof Root) { - return true; - } - } - return false; - } - - public boolean hasDollarExpression() { - Iterator iter = list.iterator(); - while (iter.hasNext()) { - ELNode n = iter.next(); - if (n instanceof Root) { - if (((Root)n).isDollarExpr) { - return true; - } - } - } - return false; - } - - public boolean hasPoundExpression() { - Iterator iter = list.iterator(); - while (iter.hasNext()) { - ELNode n = iter.next(); - if (n instanceof Root) { - if (!((Root)n).isDollarExpr) { - return true; - } - } - } - return false; - } - - public void setMapName(String name) { - this.mapName = name; - } - - public String getMapName() { - return mapName; - } - } - - /* - * A visitor class for traversing ELNodes - */ - public static class Visitor { - - public void visit(Root n) throws JasperException { - n.getExpression().visit(this); - } - - public void visit(Function n) throws JasperException { - } - - public void visit(Text n) throws JasperException { - } - - public void visit(ELText n) throws JasperException { - } - } -} - diff --git a/impl/src/main/java/org/apache/jasper/compiler/ELParser.java b/impl/src/main/java/org/apache/jasper/compiler/ELParser.java deleted file mode 100644 index 4f31815..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/ELParser.java +++ /dev/null @@ -1,423 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -/** - * This class implements a parser for EL expressions. - * - * It takes strings of the form xxx${..}yyy${..}zzz etc, and turn it into - * a ELNode.Nodes. - * - * Currently, it only handles text outside ${..} and functions in ${ ..}. - * - * @author Kin-man Chung - */ - -public class ELParser { - - private Token curToken; // current token - private Token prevToken; // previous token - private ELNode.Nodes expr; - private ELNode.Nodes ELexpr; - private int index; // Current index of the expression - private String expression; // The EL expression - private boolean escapeBS; // is '\' an escape char in text outside EL? - private boolean isDollarExpr; - - private static final String reservedWords[] = { - "and", "div", "empty", "eq", "false", - "ge", "gt", "instanceof", "le", "lt", "mod", - "ne", "not", "null", "or", "true"}; - - public ELParser(String expression) { - index = 0; - this.expression = expression; - expr = new ELNode.Nodes(); - } - - /** - * Parse an EL expression - * @param expression The input expression string of the form - * ( (Char* | (('${' | '#{') Char* '}') )+ - * @return Parsed EL expression in ELNode.Nodes - */ - public static ELNode.Nodes parse(String expression) { - ELParser parser = new ELParser(expression); - while (parser.hasNextChar()) { - String text = parser.skipUntilEL(); - if (text.length() > 0) { - parser.expr.add(new ELNode.Text(text)); - } - ELNode.Nodes elexpr = parser.parseEL(); - if (! elexpr.isEmpty()) { - parser.expr.add(new ELNode.Root(elexpr, parser.isDollarExpr)); - } - } - return parser.expr; - } - - /** - * Parse an EL expression string '${...} or #{...}' - *@return An ELNode.Nodes representing the EL expression - * TODO: Currently only parsed into functions and text strings. This - * should be rewritten for a full parser. - */ - private ELNode.Nodes parseEL() { - - StringBuilder buf = new StringBuilder(); - ELexpr = new ELNode.Nodes(); - while (hasNext()) { - nextToken(); - if (curToken instanceof Char) { - if (curToken.toChar() == '}') { - break; - } - buf.append(curToken.toChar()); - } else { - // Output whatever is in buffer - if (buf.length() > 0) { - ELexpr.add(new ELNode.ELText(buf.toString())); - } - if (!parseFunction()) { - ELexpr.add(new ELNode.ELText(curToken.toString())); - } - } - } - if (buf.length() > 0) { - ELexpr.add(new ELNode.ELText(buf.toString())); - } - - return ELexpr; - } - - /** - * Parse for a function - * FunctionInvokation ::= (identifier ':')? identifier '(' - * (Expression (,Expression)*)? ')' - * Note: currently we don't parse arguments - * In EL 1.2, method can include parameters, so we need to exclude - * cases such as a.b(). - */ - private boolean parseFunction() { - if (! (curToken instanceof Id) || isELReserved(curToken.toString())) { - return false; - } - String s1 = null; // Function prefix - String s2 = curToken.toString(); // Function name - int mark = getIndex(); - if (hasNext()) { - boolean nodotSeen = prevToken == null || - (prevToken.toChar() != '.'); - Token t = nextToken(); - if (t.toChar() == ':') { - if (hasNext()) { - Token t2 = nextToken(); - if (t2 instanceof Id) { - s1 = s2; - s2 = t2.toString(); - if (hasNext()) { - t = nextToken(); - } - } - } - } - if (t.toChar() == '(' && nodotSeen) { - // In EL 1.2, method expressions can include parameters, so - // .foo() is a method expression , and not a function - ELexpr.add(new ELNode.Function(s1, s2)); - return true; - } - } - setIndex(mark); - return false; - } - - /** - * Test if an id is a reserved word in EL - */ - private boolean isELReserved(String id) { - int i = 0; - int j = reservedWords.length; - while (i < j) { - int k = (i+j)/2; - int result = reservedWords[k].compareTo(id); - if (result == 0) { - return true; - } - if (result < 0) { - i = k+1; - } else { - j = k; - } - } - return false; - } - - /** - * Skip until an EL expression ('${' or '#{') is reached, allowing escape - * sequences '\\', '\$', and '\#'. - * @return The text string up to the EL expression - */ - private String skipUntilEL() { - char prev = 0; - StringBuilder buf = new StringBuilder(); - while (hasNextChar()) { - char ch = nextChar(); - if (prev == '\\') { - prev = 0; - if (ch == '\\') { - buf.append('\\'); - if (!escapeBS) - prev = '\\'; - } else if (ch == '$' || ch == '#') { - buf.append(ch); - } - // else error! - } else if (prev == '$' || prev == '#') { - if (ch == '{') { - this.isDollarExpr = (prev == '$'); - prev = 0; - break; - } - buf.append(prev); - if (ch == '\\' || ch == '$' || ch == '#') { - prev = ch; - } else { - buf.append(ch); - } - } else if (ch == '\\' || ch == '$' || ch == '#') { - prev = ch; - } else { - buf.append(ch); - } - } - if (prev != 0) { - buf.append(prev); - } - return buf.toString(); - } - - /* - * @return true if there is something left in EL expression buffer other - * than white spaces. - */ - private boolean hasNext() { - skipSpaces(); - return hasNextChar(); - } - - /* - * @return The next token in the EL expression buffer. - */ - private Token nextToken() { - skipSpaces(); - if (hasNextChar()) { - prevToken = curToken; - char ch = nextChar(); - if (Character.isJavaIdentifierStart(ch)) { - StringBuilder buf = new StringBuilder(); - buf.append(ch); - while (peekChar() != -1 && - Character.isJavaIdentifierPart(ch=(char)peekChar())) { - buf.append(ch); - nextChar(); - } - return (curToken = new Id(buf.toString())); - } - - if (ch == '\'' || ch == '"') { - return curToken = parseQuotedChars(ch); - } else { - // For now... - return curToken = new Char(ch); - } - } - return curToken = null; - } - - /* - * Parse a string in single or double quotes, allowing for escape sequences - * '\\', and ('\"', or "\'") - */ - private Token parseQuotedChars(char quote) { - StringBuilder buf = new StringBuilder(); - buf.append(quote); - while (hasNextChar()) { - char ch = nextChar(); - if (ch == '\\') { - ch = nextChar(); - if (ch == '\\' || ch == quote) { - buf.append(ch); - } - // else error! - } else if (ch == quote) { - buf.append(ch); - break; - } else { - buf.append(ch); - } - } - return new QuotedString(buf.toString()); - } - - /* - * A collection of low level parse methods dealing with character in - * the EL expression buffer. - */ - - private void skipSpaces() { - while (hasNextChar()) { - if (expression.charAt(index) > ' ') - break; - index++; - } - } - - private boolean hasNextChar() { - return index < expression.length(); - } - - private char nextChar() { - if (index >= expression.length()) { - return (char)-1; - } - return expression.charAt(index++); - } - - private int peekChar() { - if (index >= expression.length()) { - return -1; - } - return expression.charAt(index); - } - - private int getIndex() { - return index; - } - - private void setIndex(int i) { - index = i; - } - - /* - * Represents a token in EL expression string - */ - private static class Token { - - char toChar() { - return 0; - } - - public String toString() { - return ""; - } - } - - /* - * Represents an ID token in EL - */ - private static class Id extends Token { - String id; - - Id(String id) { - this.id = id; - } - - public String toString() { - return id; - } - } - - /* - * Represents a character token in EL - */ - private static class Char extends Token { - - private char ch; - - Char(char ch) { - this.ch = ch; - } - - char toChar() { - return ch; - } - - public String toString() { - return (Character.valueOf(ch)).toString(); - } - } - - /* - * Represents a quoted (single or double) string token in EL - */ - private static class QuotedString extends Token { - - private String value; - - QuotedString(String v) { - this.value = v; - } - - public String toString() { - return value; - } - } -} - diff --git a/impl/src/main/java/org/apache/jasper/compiler/ErrorDispatcher.java b/impl/src/main/java/org/apache/jasper/compiler/ErrorDispatcher.java deleted file mode 100644 index 65dbe03..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/ErrorDispatcher.java +++ /dev/null @@ -1,552 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.StringReader; -import java.util.ResourceBundle; -import java.util.ArrayList; -import java.net.MalformedURLException; - -import org.apache.jasper.JasperException; -import org.xml.sax.SAXException; - -/** - * Class responsible for dispatching JSP parse and javac compilation errors - * to the configured error handler. - * - * This class is also responsible for localizing any error codes before they - * are passed on to the configured error handler. - * - * In the case of a Java compilation error, the compiler error message is - * parsed into an array of JavacErrorDetail instances, which is passed on to - * the configured error handler. - * - * @author Jan Luehe - * @author Kin-man Chung - */ -public class ErrorDispatcher { - - private static final ResourceBundle bundle = ResourceBundle.getBundle( - "org.apache.jasper.resources.messages"); - - // Custom error handler - private ErrorHandler errHandler; - - // Indicates whether the compilation was initiated by JspServlet or JspC - private boolean jspcMode = false; - - - /* - * Constructor. - * - * @param jspcMode true if compilation has been initiated by JspC, false - * otherwise - */ - public ErrorDispatcher(boolean jspcMode) { - // XXX check web.xml for custom error handler - errHandler = new DefaultErrorHandler(); - this.jspcMode = jspcMode; - } - - /* - * Dispatches the given JSP parse error to the configured error handler. - * - * The given error code is localized. If it is not found in the - * resource bundle for localized error messages, it is used as the error - * message. - * - * @param errCode Error code - */ - public void jspError(String errCode) throws JasperException { - dispatch(null, errCode, null, null); - } - - /* - * Dispatches the given JSP parse error to the configured error handler. - * - * The given error code is localized. If it is not found in the - * resource bundle for localized error messages, it is used as the error - * message. - * - * @param where Error location - * @param errCode Error code - */ - public void jspError(Mark where, String errCode) throws JasperException { - dispatch(where, errCode, null, null); - } - - /* - * Dispatches the given JSP parse error to the configured error handler. - * - * @param where Error location - * @param e The exception whose message is used as the error message - */ - public void jspError(Mark where, Exception e) throws JasperException { - dispatch(where, e.getMessage(), null, e); - } - - /* - * Dispatches the given JSP parse error to the configured error handler. - * - * The given error code is localized. If it is not found in the - * resource bundle for localized error messages, it is used as the error - * message. - * - * @param n Node that caused the error - * @param errCode Error code - */ - public void jspError(Node n, String errCode) throws JasperException { - dispatch(n.getStart(), errCode, null, null); - } - - /* - * Dispatches the given JSP parse error to the configured error handler. - * - * The given error code is localized. If it is not found in the - * resource bundle for localized error messages, it is used as the error - * message. - * - * @param errCode Error code - * @param args Arguments for parametric replacement - */ - public void jspError(String errCode, String ... args) - throws JasperException { - dispatch(null, errCode, args, null); - } - - /* - * Dispatches the given JSP parse error to the configured error handler. - * - * The given error code is localized. If it is not found in the - * resource bundle for localized error messages, it is used as the error - * message. - * - * @param where Error location - * @param errCode Error code - * @param args Arguments for parametric replacement - */ - public void jspError(Mark where, String errCode, String ... args) - throws JasperException { - dispatch(where, errCode, args, null); - } - - /* - * Dispatches the given JSP parse error to the configured error handler. - * - * The given error code is localized. If it is not found in the - * resource bundle for localized error messages, it is used as the error - * message. - * - * @param n Node that caused the error - * @param errCode Error code - * @param args Arguments for parametric replacement - */ - public void jspError(Node n, String errCode, String ... args) - throws JasperException { - dispatch(n.getStart(), errCode, args, null); - } - - /* - * Dispatches the given parsing exception to the configured error handler. - * - * @param e Parsing exception - */ - public void jspError(Exception e) throws JasperException { - dispatch(null, null, null, e); - } - - /* - * Dispatches the given JSP parse error to the configured error handler. - * - * The given error code is localized. If it is not found in the - * resource bundle for localized error messages, it is used as the error - * message. - * - * @param errCode Error code - * @param arg Argument for parametric replacement - * @param e Parsing exception - */ - public void jspError(String errCode, String arg, Exception e) - throws JasperException { - dispatch(null, errCode, new Object[] {arg}, e); - } - - /* - * Dispatches the given JSP parse error to the configured error handler. - * - * The given error code is localized. If it is not found in the - * resource bundle for localized error messages, it is used as the error - * message. - * - * @param n Node that caused the error - * @param errCode Error code - * @param arg Argument for parametric replacement - * @param e Parsing exception - */ - public void jspError(Node n, String errCode, String arg, Exception e) - throws JasperException { - dispatch(n.getStart(), errCode, new Object[] {arg}, e); - } - - /** - * Creates and throws a new exception from the given JasperException, - * by prepending the given location information (containing file name, - * line number, and column number) to the message of the given exception, - * and copying the stacktrace of the given exception to the new exception. - * - * @param where The location information (containing file name, - * line number, and column number) to prepend - * @param je The JasperException to amend - */ - public void throwException(Mark where, JasperException je) - throws JasperException { - - if (where == null) { - throw je; - } - - // Get file location - String file = null; - if (jspcMode) { - // Get the full URL of the resource that caused the error - try { - file = where.getURL().toString(); - } catch (MalformedURLException me) { - // Fallback to using context-relative path - file = where.getFile(); - } - } else { - // Get the context-relative resource path, so as to not - // disclose any local filesystem details - file = where.getFile(); - } - - JasperException newEx = new JasperException(file + "(" - + where.getLineNumber() + "," + where.getColumnNumber() - + ")" + " " + je.getMessage(),je.getCause()); - newEx.setStackTrace(je.getStackTrace()); - - throw newEx; - } - - /* - * Dispatches the given javac compilation errors to the configured error - * handler. - * - * @param javacErrors Array of javac compilation errors - */ - public void javacError(JavacErrorDetail[] javacErrors) - throws JasperException { - - errHandler.javacError(javacErrors); - } - - - /* - * Dispatches the given compilation error report and exception to the - * configured error handler. - * - * @param errorReport Compilation error report - * @param e Compilation exception - */ - public void javacError(String errorReport, Exception e) - throws JasperException { - - errHandler.javacError(errorReport, e); - } - - - //********************************************************************* - // Private utility methods - - /* - * Dispatches the given JSP parse error to the configured error handler. - * - * The given error code is localized. If it is not found in the - * resource bundle for localized error messages, it is used as the error - * message. - * - * @param where Error location - * @param errCode Error code - * @param args Arguments for parametric replacement - * @param e Parsing exception - */ - private void dispatch(Mark where, String errCode, Object[] args, - Exception e) throws JasperException { - String file = null; - String errMsg = null; - int line = -1; - int column = -1; - boolean hasLocation = false; - - // Localize - if (errCode != null) { - errMsg = Localizer.getMessage(errCode, args); - } else if (e != null) { - // give a hint about what's wrong - errMsg = e.getMessage(); - } - - // Get error location - if (where != null) { - if (jspcMode) { - // Get the full URL of the resource that caused the error - try { - file = where.getURL().toString(); - } catch (MalformedURLException me) { - // Fallback to using context-relative path - file = where.getFile(); - } - } else { - // Get the context-relative resource path, so as to not - // disclose any local filesystem details - file = where.getFile(); - } - line = where.getLineNumber(); - column = where.getColumnNumber(); - hasLocation = true; - } - - // Get nested exception - Exception nestedEx = e; - if ((e instanceof SAXException) - && (((SAXException) e).getException() != null)) { - nestedEx = ((SAXException) e).getException(); - } - - if (hasLocation) { - errHandler.jspError(file, line, column, errMsg, nestedEx); - } else { - errHandler.jspError(errMsg, nestedEx); - } - } - - /* - * Parses the given Java compilation error message, which may contain one - * or more compilation errors, into an array of JavacErrorDetail instances. - * - * Each JavacErrorDetail instance contains the information about a single - * compilation error. - * - * @param errMsg Compilation error message that was generated by the - * javac compiler - * @param fname Name of Java source file whose compilation failed - * - * @return Array of JavacErrorDetail instances corresponding to the - * compilation errors, or null if the given error message does not - * contain any compilation error line numbers - */ - public static JavacErrorDetail[] parseJavacMessage( - Node.Nodes pageNodes, - String errMsg, - String fname) - throws IOException, JasperException { - - ArrayList errors = new ArrayList(); - StringBuilder errMsgBuf = null; - int lineNum = -1; - JavacErrorDetail javacError = null; - - BufferedReader reader = new BufferedReader(new StringReader(errMsg)); - - /* - * Parse compilation errors. Each compilation error consists of a file - * path and error line number, followed by a number of lines describing - * the error. - */ - String line = null; - while ((line = reader.readLine()) != null) { - - /* - * Error line number is delimited by set of colons. - * Ignore colon following drive letter on Windows (fromIndex = 2). - * XXX Handle deprecation warnings that don't have line info - */ - int beginColon = line.indexOf(':', 2); - int endColon = line.indexOf(':', beginColon + 1); - if ((beginColon >= 0) && (endColon >= 0)) { - if (javacError != null) { - // add previous error to error vector - errors.add(javacError); - } - - String lineNumStr = line.substring(beginColon + 1, endColon); - try { - lineNum = Integer.parseInt(lineNumStr); - } catch (NumberFormatException e) { - // XXX - } - - errMsgBuf = new StringBuilder(); - - javacError = createJavacError(fname, pageNodes, - errMsgBuf, lineNum); - } - - // Ignore messages preceding first error - if (errMsgBuf != null) { - errMsgBuf.append(line); - errMsgBuf.append("\n"); - } - } - - // Add last error to error vector - if (javacError != null) { - errors.add(javacError); - } - reader.close(); - return errors.toArray(new JavacErrorDetail[0]); - } - - /** - * @param fname - * @param page - * @param errMsgBuf - * @param lineNum - * @return JavacErrorDetail The error details - * @throws JasperException - */ - public static JavacErrorDetail createJavacError(String fname, - Node.Nodes page, - StringBuilder errMsgBuf, - int lineNum) - - throws JasperException { - - JavacErrorDetail javacError; - // Attempt to map javac error line number to line in JSP page - ErrorVisitor errVisitor = new ErrorVisitor(lineNum); - if (page != null) - page.visit(errVisitor); - Node errNode = errVisitor.getJspSourceNode(); - if ((errNode != null) && (errNode.getStart() != null)) { - javacError = new JavacErrorDetail( - fname, - lineNum, - errNode.getStart().getFile(), - errNode.getStart().getLineNumber(), - errMsgBuf); - } else { - /* - * javac error line number cannot be mapped to JSP page - * line number. For example, this is the case if a - * scriptlet is missing a closing brace, which causes - * havoc with the try-catch-finally block that the code - * generator places around all generated code: As a result - * of this, the javac error line numbers will be outside - * the range of begin and end java line numbers that were - * generated for the scriptlet, and therefore cannot be - * mapped to the start line number of the scriptlet in the - * JSP page. - * Include just the javac error info in the error detail. - */ - javacError = new JavacErrorDetail( - fname, - lineNum, - errMsgBuf); - } - return javacError; - } - - - /* - * Visitor responsible for mapping a line number in the generated servlet - * source code to the corresponding JSP node. - */ - static class ErrorVisitor extends Node.Visitor { - - // Java source line number to be mapped - private int lineNum; - - /* - * JSP node whose Java source code range in the generated servlet - * contains the Java source line number to be mapped - */ - Node found; - - /* - * Constructor. - * - * @param lineNum Source line number in the generated servlet code - */ - public ErrorVisitor(int lineNum) { - this.lineNum = lineNum; - } - - public void doVisit(Node n) throws JasperException { - if ((lineNum >= n.getBeginJavaLine()) - && (lineNum < n.getEndJavaLine())) { - found = n; - } - } - - /* - * Gets the JSP node to which the source line number in the generated - * servlet code was mapped. - * - * @return JSP node to which the source line number in the generated - * servlet code was mapped - */ - public Node getJspSourceNode() { - return found; - } - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/ErrorHandler.java b/impl/src/main/java/org/apache/jasper/compiler/ErrorHandler.java deleted file mode 100644 index 66a3ba2..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/ErrorHandler.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import org.apache.jasper.JasperException; - -/** - * Interface for handling JSP parse and javac compilation errors. - * - * An implementation of this interface may be registered with the - * ErrorDispatcher by setting the XXX initialization parameter in the JSP - * page compiler and execution servlet in Catalina's web.xml file to the - * implementation's fully qualified class name. - * - * @author Jan Luehe - * @author Kin-man Chung - */ -public interface ErrorHandler { - - /** - * Processes the given JSP parse error. - * - * @param fname Name of the JSP file in which the parse error occurred - * @param line Parse error line number - * @param column Parse error column number - * @param msg Parse error message - * @param exception Parse exception - */ - public void jspError(String fname, int line, int column, String msg, - Exception exception) throws JasperException; - - /** - * Processes the given JSP parse error. - * - * @param msg Parse error message - * @param exception Parse exception - */ - public void jspError(String msg, Exception exception) - throws JasperException; - - /** - * Processes the given javac compilation errors. - * - * @param details Array of JavacErrorDetail instances corresponding to the - * compilation errors - */ - public void javacError(JavacErrorDetail[] details) - throws JasperException; - - /** - * Processes the given javac error report and exception. - * - * @param errorReport Compilation error report - * @param exception Compilation exception - */ - public void javacError(String errorReport, Exception exception) - throws JasperException; -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/Generator.java b/impl/src/main/java/org/apache/jasper/compiler/Generator.java deleted file mode 100644 index 3aad029..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/Generator.java +++ /dev/null @@ -1,4244 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.HashSet; - -import javax.el.ValueExpression; -import javax.el.MethodExpression; - -import javax.servlet.jsp.tagext.TagAttributeInfo; -import javax.servlet.jsp.tagext.TagInfo; -import javax.servlet.jsp.tagext.TagVariableInfo; -import javax.servlet.jsp.tagext.VariableInfo; -import javax.servlet.jsp.tagext.JspIdConsumer; - -import org.apache.jasper.Constants; -import org.apache.jasper.JasperException; -import org.apache.jasper.JspCompilationContext; -import org.apache.jasper.runtime.JspRuntimeLibrary; -import org.xml.sax.Attributes; - -/** - * Generate Java source from Nodes - * - * @author Anil K. Vijendran - * @author Danno Ferrin - * @author Mandar Raje - * @author Rajiv Mordani - * @author Pierre Delisle - * - * Tomcat 4.1.x and Tomcat 5: - * @author Kin-man Chung - * @author Jan Luehe - * @author Shawn Bayern - * @author Mark Roth - * @author Denis Benoit - */ - -class Generator { - - private static final Class[] OBJECT_CLASS = { Object.class }; - private ServletWriter out; - private ArrayList methodsBuffered; - private FragmentHelperClass fragmentHelperClass; - private ErrorDispatcher err; - private BeanRepository beanInfo; - private JspCompilationContext ctxt; - private boolean isPoolingEnabled; - private boolean breakAtLF; - private boolean genBytes; - private PageInfo pageInfo; - private Set tagHandlerPoolNames; - private GenBuffer arrayBuffer; - - /** - * @param s the input string - * @return quoted and escaped string, per Java rule - */ - static String quote(String s) { - - if (s == null) - return "null"; - - return '"' + escape(s) + '"'; - } - - /** - * @param s the input string - * @return escaped string, per Java rule - */ - static String escape(String s) { - - if (s == null) - return ""; - - StringBuilder b = new StringBuilder(); - for (int i = 0; i < s.length(); i++) { - char c = s.charAt(i); - if (c == '"') - b.append('\\').append('"'); - else if (c == '\\') - b.append('\\').append('\\'); - else if (c == '\n') - b.append('\\').append('n'); - else if (c == '\r') - b.append('\\').append('r'); - else - b.append(c); - } - return b.toString(); - } - - /** - * Single quote and escape a character - */ - static String quote(char c) { - - StringBuilder b = new StringBuilder(); - b.append('\''); - if (c == '\'') - b.append('\\').append('\''); - else if (c == '\\') - b.append('\\').append('\\'); - else if (c == '\n') - b.append('\\').append('n'); - else if (c == '\r') - b.append('\\').append('r'); - else - b.append(c); - b.append('\''); - return b.toString(); - } - - /** - * Generates declarations. This includes "info" of the page directive, - * and scriptlet declarations. - */ - private void generateDeclarations(Node.Nodes page) throws JasperException { - - class DeclarationVisitor extends Node.Visitor { - - private boolean getServletInfoGenerated = false; - - /* - * Generates getServletInfo() method that returns the value of the - * page directive's 'info' attribute, if present. - * - * The Validator has already ensured that if the translation unit - * contains more than one page directive with an 'info' attribute, - * their values match. - */ - public void visit(Node.PageDirective n) throws JasperException { - - if (getServletInfoGenerated) { - return; - } - - String info = n.getAttributeValue("info"); - if (info == null) - return; - - getServletInfoGenerated = true; - out.printil("public String getServletInfo() {"); - out.pushIndent(); - out.printin("return "); - out.print(quote(info)); - out.println(";"); - out.popIndent(); - out.printil("}"); - out.println(); - } - - public void visit(Node.Declaration n) throws JasperException { - n.setBeginJavaLine(out.getJavaLine()); - out.printMultiLn(n.getText()); - out.println(); - n.setEndJavaLine(out.getJavaLine()); - } - - // Custom Tags may contain declarations from tag plugins. - public void visit(Node.CustomTag n) throws JasperException { - if (n.useTagPlugin()) { - if (n.getAtSTag() != null) { - n.getAtSTag().visit(this); - } - visitBody(n); - if (n.getAtETag() != null) { - n.getAtETag().visit(this); - } - } else { - visitBody(n); - } - } - } - - out.println(); - page.visit(new DeclarationVisitor()); - } - - /** - * Compiles list of tag handler pool names. - */ - private void compileTagHandlerPoolList(Node.Nodes page) - throws JasperException { - - class TagHandlerPoolVisitor extends Node.Visitor { - - private Set names = new HashSet(); - - /* - * Constructor - * - * @param v Set of tag handler pool names to populate - */ - TagHandlerPoolVisitor(Set v) { - names = v; - } - - /* - * Gets the name of the tag handler pool for the given custom tag - * and adds it to the list of tag handler pool names unless it is - * already contained in it. - */ - public void visit(Node.CustomTag n) throws JasperException { - - if (!n.implementsSimpleTag()) { - String name = - createTagHandlerPoolName( - n.getPrefix(), - n.getLocalName(), - n.getAttributes(), - n.hasEmptyBody()); - n.setTagHandlerPoolName(name); - if (!names.contains(name)) { - names.add(name); - } - } - visitBody(n); - } - - /* - * Creates the name of the tag handler pool whose tag handlers may - * be (re)used to service this action. - * - * @return The name of the tag handler pool - */ - private String createTagHandlerPoolName( - String prefix, - String shortName, - Attributes attrs, - boolean hasEmptyBody) { - String poolName = null; - - poolName = "_jspx_tagPool_" + prefix + "_" + shortName; - if (attrs != null) { - String[] attrNames = new String[attrs.getLength()]; - for (int i = 0; i < attrNames.length; i++) { - attrNames[i] = attrs.getQName(i); - } - Arrays.sort(attrNames, Collections.reverseOrder()); - for (int i = 0; i < attrNames.length; i++) { - poolName = poolName + "_" + attrNames[i]; - } - } - if (hasEmptyBody) { - poolName = poolName + "_nobody"; - } - return JspUtil.makeXmlJavaIdentifier(poolName); - } - } - - page.visit(new TagHandlerPoolVisitor(tagHandlerPoolNames)); - } - - - /** - * Generates the _jspInit() method for instantiating the tag handler pools. - * For tag file, _jspInit has to be invoked manually, and the ServletConfig - * object explicitly passed. - */ - private void generateTagHandlerInit() { - - if (!isPoolingEnabled || tagHandlerPoolNames.isEmpty()) { - return; - } - - if (ctxt.isTagFile()) { - out.printil("private void _jspInit(ServletConfig config) {"); - } else { - out.printil("public void _jspInit() {"); - } - - out.pushIndent(); - for (String tagHandlerPoolName: tagHandlerPoolNames) { - out.printin(tagHandlerPoolName); - out.print( - " = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool("); - if (ctxt.isTagFile()) { - out.print("config"); - } else { - out.print("getServletConfig()"); - } - out.println(");"); - } - out.popIndent(); - out.printil("}"); - out.println(); - } - - /** - * Generates the _jspDestroy() method which is responsible for calling the - * release() method on every tag handler in any of the tag handler pools. - */ - private void generateTagHandlerDestroy() { - - if (!isPoolingEnabled || tagHandlerPoolNames.isEmpty()) { - return; - } - - out.printil("public void _jspDestroy() {"); - out.pushIndent(); - for (String tagHandlerPoolName: tagHandlerPoolNames) { - out.printin(tagHandlerPoolName); - out.println(".release();"); - } - out.popIndent(); - out.printil("}"); - out.println(); - } - - /** - * Generate preamble package name - * (shared by servlet and tag handler preamble generation) - */ - private void genPreamblePackage(String packageName) - throws JasperException { - if (!"".equals(packageName) && packageName != null) { - out.printil("package " + packageName + ";"); - out.println(); - } - } - - /** - * Generate preamble imports - * (shared by servlet and tag handler preamble generation) - */ - private void genPreambleImports() throws JasperException { - Iterator iter = pageInfo.getImports().iterator(); - while (iter.hasNext()) { - out.printin("import "); - out.print(iter.next()); - out.println(";"); - } - out.println(); - } - - /** - * Generation of static initializers in preamble. - * For example, dependant list, el function map, prefix map. - * (shared by servlet and tag handler preamble generation) - */ - private void genPreambleStaticInitializers() throws JasperException { - out.printil("private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();"); - out.println(); - - // Static data for getDependants() - out.printil("private static java.util.List _jspx_dependants;"); - out.println(); - List dependants = pageInfo.getDependants(); - Iterator iter = dependants.iterator(); - if (!dependants.isEmpty()) { - out.printil("static {"); - out.pushIndent(); - out.printin("_jspx_dependants = new java.util.ArrayList("); - out.print("" + dependants.size()); - out.println(");"); - while (iter.hasNext()) { - out.printin("_jspx_dependants.add(\""); - out.print(iter.next()); - out.println("\");"); - } - out.popIndent(); - out.printil("}"); - out.println(); - } - - // Codes to support genStringAsByteArray option - // Generate a static variable for the initial response encoding - if (genBytes) { - // first get the respons encoding - String contentType = pageInfo.getContentType(); - String encoding = "ISO-8859-1"; - int i = contentType.indexOf("charset="); - if (i > 0) - encoding = contentType.substring(i+8); - - // Make sure the encoding is supported - // Assume that this can be determined at compile time - try { - "testing".getBytes(encoding); - out.printin("private static final String _jspx_encoding = "); - out.print(quote(encoding)); - out.println(";"); - out.printil("private boolean _jspx_gen_bytes = true;"); - out.printil("private boolean _jspx_encoding_tested;"); - } catch (java.io.UnsupportedEncodingException ex) { - genBytes = false; - } - } - } - - /** - * Declare tag handler pools (tags of the same type and with the same - * attribute set share the same tag handler pool) - * (shared by servlet and tag handler preamble generation) - */ - private void genPreambleClassVariableDeclarations(String className) - throws JasperException { - - if (isPoolingEnabled) { - if (!tagHandlerPoolNames.isEmpty()) { - for (String tagHandlerPoolName: tagHandlerPoolNames) { - out.printil( - "private org.apache.jasper.runtime.TagHandlerPool " - + tagHandlerPoolName + ";"); - } - out.println(); - } - } - - out.printil("private org.glassfish.jsp.api.ResourceInjector " - + "_jspx_resourceInjector;"); - out.println(); - } - - /** - * Declare general-purpose methods - * (shared by servlet and tag handler preamble generation) - */ - private void genPreambleMethods() throws JasperException { - // Method used to get compile time file dependencies - out.printil("public java.util.List getDependants() {"); - out.pushIndent(); - out.printil("return _jspx_dependants;"); - out.popIndent(); - out.printil("}"); - out.println(); - - // Method to get bytes from String - if (genBytes) { - out.printil("private static byte[] _jspx_getBytes(String s) {"); - out.pushIndent(); - out.printil("try {"); - out.pushIndent(); - out.printil("return s.getBytes(_jspx_encoding);"); - out.popIndent(); - out.printil("} catch (java.io.UnsupportedEncodingException ex) {"); - out.printil("}"); - out.printil("return null;"); - out.popIndent(); - out.printil("}"); - out.println(); - - // Generate code to see if the response encoding has been set - // differently from the encoding declared in the page directive. - // Note that we only need to do the test once. The assumption - // is that the encoding cannot be changed once some data has been - // written. - out.printil("private boolean _jspx_same_encoding(String encoding) {"); - out.pushIndent(); - out.printil("if (! _jspx_encoding_tested) {"); - out.pushIndent(); - out.printil("_jspx_gen_bytes = _jspx_encoding.equals(encoding);"); - out.printil("_jspx_encoding_tested = true;"); - out.popIndent(); - out.printil("}"); - out.printil("return _jspx_gen_bytes;"); - out.popIndent(); - out.printil("}"); - out.println(); - } - - generateTagHandlerInit(); - generateTagHandlerDestroy(); - } - - /** - * Generates the beginning of the static portion of the servlet. - */ - private void generatePreamble(Node.Nodes page) throws JasperException { - - String servletPackageName = ctxt.getServletPackageName(); - String servletClassName = ctxt.getServletClassName(); - String serviceMethodName = Constants.SERVICE_METHOD_NAME; - - // First the package name: - genPreamblePackage(servletPackageName); - - // Generate imports - genPreambleImports(); - - // Generate class declaration - out.printin("public final class "); - out.print(servletClassName); - out.print(" extends "); - out.println(pageInfo.getExtends()); - out.printin( - " implements org.apache.jasper.runtime.JspSourceDependent"); - if (!pageInfo.isThreadSafe()) { - out.println(","); - out.printin(" SingleThreadModel"); - } - out.println(" {"); - out.pushIndent(); - - // Class body begins here - generateDeclarations(page); - - // Static initializations here - genPreambleStaticInitializers(); - - // Class variable declarations - genPreambleClassVariableDeclarations(servletClassName); - - // Constructor - // generateConstructor(className); - - // Methods here - genPreambleMethods(); - - // Now the service method - out.printin("public void "); - out.print(serviceMethodName); - out.println( - "(HttpServletRequest request, HttpServletResponse response)"); - out.println(" throws java.io.IOException, ServletException {"); - - out.pushIndent(); - out.println(); - - // Local variable declarations - out.printil("PageContext pageContext = null;"); - if (pageInfo.isSession()) - out.printil("HttpSession session = null;"); - - if (pageInfo.isErrorPage()) { - out.printil( - "Throwable exception = org.apache.jasper.runtime.JspRuntimeLibrary.getThrowable(request);"); - out.printil("if (exception != null) {"); - out.pushIndent(); - out.printil( - "response.setStatus((Integer)request.getAttribute(\"javax.servlet.error.status_code\"));"); - out.popIndent(); - out.printil("}"); - } - - out.printil("ServletContext application = null;"); - out.printil("ServletConfig config = null;"); - out.printil("JspWriter out = null;"); - out.printil("Object page = this;"); - - out.printil("JspWriter _jspx_out = null;"); - out.printil("PageContext _jspx_page_context = null;"); - out.println(); - - out.printil("try {"); - out.pushIndent(); - - out.printin("response.setContentType("); - out.print(quote(pageInfo.getContentType())); - out.println(");"); - - if (ctxt.getOptions().isXpoweredBy()) { - out.printil("response.setHeader(\"X-Powered-By\", \"" + - Constants.JSP_NAME + "\");"); - } - - out.printil( - "pageContext = _jspxFactory.getPageContext(this, request, response,"); - out.printin("\t\t\t"); - out.print(quote(pageInfo.getErrorPage())); - out.print(", " + pageInfo.isSession()); - out.print(", " + pageInfo.getBuffer()); - out.print(", " + pageInfo.isAutoFlush()); - out.println(");"); - out.printil("_jspx_page_context = pageContext;"); - - out.printil("application = pageContext.getServletContext();"); - out.printil("config = pageContext.getServletConfig();"); - - if (pageInfo.isSession()) - out.printil("session = pageContext.getSession();"); - out.printil("out = pageContext.getOut();"); - out.printil("_jspx_out = out;"); - out.printil("_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute(\"com.sun.appserv.jsp.resource.injector\");"); - out.println(); - } - - /** - * Generates an XML Prolog, which includes an XML declaration and - * an XML doctype declaration. - */ - private void generateXmlProlog(Node.Nodes page) { - - /* - * An XML declaration is generated under the following conditions: - * - * - 'omit-xml-declaration' attribute of action is set to - * "no" or "false" - * - JSP document without a - */ - String omitXmlDecl = pageInfo.getOmitXmlDecl(); - if ((omitXmlDecl != null && !JspUtil.booleanValue(omitXmlDecl)) - || (omitXmlDecl == null - && page.getRoot().isXmlSyntax() - && !pageInfo.hasJspRoot() - && !ctxt.isTagFile())) { - String cType = pageInfo.getContentType(); - String charSet = cType.substring(cType.indexOf("charset=") + 8); - out.printil( - "out.write(\"\\n\");"); - } - - /* - * Output a DOCTYPE declaration if the doctype-root-element appears. - * If doctype-public appears: - * - * else - * - */ - - String doctypeName = pageInfo.getDoctypeName(); - if (doctypeName != null) { - String doctypePublic = pageInfo.getDoctypePublic(); - String doctypeSystem = pageInfo.getDoctypeSystem(); - out.printin("out.write(\"\\n\");"); - } - } - - /* - * Generates the constructor. - * (shared by servlet and tag handler preamble generation) - */ - private void generateConstructor(String className) { - out.printil("public " + className + "() {"); - out.printil("}"); - out.println(); - } - - /** - * A visitor that generates codes for the elements in the page. - */ - class GenerateVisitor extends Node.Visitor { - - /* - * HashMap containing introspection information on tag handlers: - * : tag prefix - * : hashtable containing introspection on tag handlers: - * : tag short name - * : introspection info of tag handler for - * tag - */ - private HashMap> handlerInfos; - - private HashMap tagVarNumbers; - private String parent; - private boolean isSimpleTagParent; // Is parent a SimpleTag? - private String pushBodyCountVar; - private String simpleTagHandlerVar; - private boolean isSimpleTagHandler; - private boolean isFragment; - private boolean isTagFile; - private ServletWriter out; - private ArrayList methodsBuffered; - private FragmentHelperClass fragmentHelperClass; - private int methodNesting; - private int arrayCount; - private HashMap textMap; - - /** - * Constructor. - */ - public GenerateVisitor( - boolean isTagFile, - ServletWriter out, - ArrayList methodsBuffered, - FragmentHelperClass fragmentHelperClass) { - - this.isTagFile = isTagFile; - this.out = out; - this.methodsBuffered = methodsBuffered; - this.fragmentHelperClass = fragmentHelperClass; - methodNesting = 0; - handlerInfos = new HashMap>(); - tagVarNumbers = new HashMap(); - textMap = new HashMap(); - } - - /** - * Returns an attribute value, optionally URL encoded. If - * the value is a runtime expression, the result is the expression - * itself, as a string. If the result is an EL expression, we insert - * a call to the interpreter. If the result is a Named Attribute - * we insert the generated variable name. Otherwise the result is a - * string literal, quoted and escaped. - * - * @param attr An JspAttribute object - * @param encode true if to be URL encoded - * @param expectedType the expected type for an EL evaluation - * (ignored for attributes that aren't EL expressions) - */ - private String attributeValue( - Node.JspAttribute attr, - boolean encode, - Class expectedType) { - String v = attr.getValue(); - if (!attr.isNamedAttribute() && (v == null)) - return ""; - - if (attr.isExpression()) { - if (encode) { - return "org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(String.valueOf(" - + v - + "), request.getCharacterEncoding())"; - } - return v; - } else if (attr.isELInterpreterInput()) { - v = JspUtil.interpreterCall( - this.isTagFile, - v, - expectedType, - attr.getEL().getMapName(), - null, null, null); - if (encode) { - return "org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(" - + v - + ", request.getCharacterEncoding())"; - } - return v; - } else if (attr.isNamedAttribute()) { - return attr.getNamedAttributeNode().getTemporaryVariableName(); - } else { - if (encode) { - return "org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(" - + quote(v) - + ", request.getCharacterEncoding())"; - } - return quote(v); - } - } - - /** - * Prints the attribute value specified in the param action, in the - * form of name=value string. - * - * @param n the parent node for the param action nodes. - */ - private void printParams(Node n, String pageParam, boolean literal) - throws JasperException { - - class ParamVisitor extends Node.Visitor { - String separator; - - ParamVisitor(String separator) { - this.separator = separator; - } - - public void visit(Node.ParamAction n) throws JasperException { - - out.print(" + "); - out.print(separator); - out.print(" + "); - out.print( - "org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(" - + quote(n.getTextAttribute("name")) - + ", request.getCharacterEncoding())"); - out.print("+ \"=\" + "); - out.print(attributeValue(n.getValue(), true, String.class)); - - // The separator is '&' after the second use - separator = "\"&\""; - } - } - - String sep; - if (literal) { - sep = pageParam.indexOf('?') > 0 ? "\"&\"" : "\"?\""; - } else { - sep = "((" + pageParam + ").indexOf('?')>0? '&': '?')"; - } - if (n.getBody() != null) { - n.getBody().visit(new ParamVisitor(sep)); - } - } - - public void visit(Node.Expression n) throws JasperException { - n.setBeginJavaLine(out.getJavaLine()); - out.printil("out.print(" + n.getText() + ");"); - n.setEndJavaLine(out.getJavaLine()); - } - - public void visit(Node.Scriptlet n) throws JasperException { - n.setBeginJavaLine(out.getJavaLine()); - out.printMultiLn(n.getText()); - out.println(); - n.setEndJavaLine(out.getJavaLine()); - } - - public void visit(Node.ELExpression n) throws JasperException { - n.setBeginJavaLine(out.getJavaLine()); - if (n.getEL() != null) { - out.printil( - "out.write(" - + JspUtil.interpreterCall( - this.isTagFile, - n.getText(), - String.class, - n.getEL().getMapName(), - null, null, null) - + ");"); - } else { - out.printil( - "out.write(" - + quote(n.getText()) - + ");"); - } - n.setEndJavaLine(out.getJavaLine()); - } - - public void visit(Node.IncludeAction n) throws JasperException { - - String flush = n.getTextAttribute("flush"); - Node.JspAttribute page = n.getPage(); - - boolean isFlush = false; // default to false; - if ("true".equals(flush)) - isFlush = true; - - n.setBeginJavaLine(out.getJavaLine()); - - String pageParam; - if (page.isNamedAttribute()) { - // If the page for jsp:include was specified via - // jsp:attribute, first generate code to evaluate - // that body. - pageParam = - generateNamedAttributeValue(page.getNamedAttributeNode()); - } else { - pageParam = attributeValue(page, false, String.class); - } - - // If any of the params have their values specified by - // jsp:attribute, prepare those values first. - Node jspBody = findJspBody(n); - if (jspBody != null) { - prepareParams(jspBody); - } else { - prepareParams(n); - } - - out.printin( - "org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, " - + pageParam); - printParams(n, pageParam, page.isLiteral()); - out.println(", out, " + isFlush + ");"); - - n.setEndJavaLine(out.getJavaLine()); - } - - /** - * Scans through all child nodes of the given parent for - * subelements. For each element, if its value - * is specified via a Named Attribute (), - * generate the code to evaluate those bodies first. - *

    - * If parent is null, simply returns. - */ - private void prepareParams(Node parent) throws JasperException { - if (parent == null) - return; - - Node.Nodes subelements = parent.getBody(); - if (subelements != null) { - for (int i = 0; i < subelements.size(); i++) { - Node n = subelements.getNode(i); - if (n instanceof Node.ParamAction) { - Node.Nodes paramSubElements = n.getBody(); - for (int j = 0; - (paramSubElements != null) - && (j < paramSubElements.size()); - j++) { - Node m = paramSubElements.getNode(j); - if (m instanceof Node.NamedAttribute) { - generateNamedAttributeValue( - (Node.NamedAttribute)m); - } - } - } - } - } - } - - /** - * Finds the subelement of the given parent node. - * If not found, null is returned. - */ - private Node.JspBody findJspBody(Node parent) throws JasperException { - Node.JspBody result = null; - - Node.Nodes subelements = parent.getBody(); - for (int i = 0; - (subelements != null) && (i < subelements.size()); - i++) { - Node n = subelements.getNode(i); - if (n instanceof Node.JspBody) { - result = (Node.JspBody)n; - break; - } - } - - return result; - } - - public void visit(Node.ForwardAction n) throws JasperException { - Node.JspAttribute page = n.getPage(); - - n.setBeginJavaLine(out.getJavaLine()); - - out.printil("if (true) {"); // So that javac won't complain about - out.pushIndent(); // codes after "return" - - String pageParam; - if (page.isNamedAttribute()) { - // If the page for jsp:forward was specified via - // jsp:attribute, first generate code to evaluate - // that body. - pageParam = - generateNamedAttributeValue(page.getNamedAttributeNode()); - } else { - pageParam = attributeValue(page, false, String.class); - } - - // If any of the params have their values specified by - // jsp:attribute, prepare those values first. - Node jspBody = findJspBody(n); - if (jspBody != null) { - prepareParams(jspBody); - } else { - prepareParams(n); - } - - out.printin("_jspx_page_context.forward("); - out.print(pageParam); - printParams(n, pageParam, page.isLiteral()); - out.println(");"); - if (isTagFile || isFragment) { - out.printil("throw new SkipPageException();"); - } else { - out.printil((methodNesting > 0) ? "return true;" : "return;"); - } - out.popIndent(); - out.printil("}"); - - n.setEndJavaLine(out.getJavaLine()); - // XXX Not sure if we can eliminate dead codes after this. - } - - public void visit(Node.GetProperty n) throws JasperException { - String name = n.getTextAttribute("name"); - String property = n.getTextAttribute("property"); - - n.setBeginJavaLine(out.getJavaLine()); - - if (beanInfo.checkVariable(name)) { - // Bean is defined using useBean, introspect at compile time - Class bean = beanInfo.getBeanType(name); - String beanName = JspUtil.getCanonicalName(bean); - java.lang.reflect.Method meth = - JspRuntimeLibrary.getReadMethod(bean, property); - String methodName = meth.getName(); - out.printil( - "out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString(" - + "(((" - + beanName - + ")_jspx_page_context.findAttribute(" - + "\"" - + name - + "\"))." - + methodName - + "())));"); - } else { - // The object could be a custom action with an associated - // VariableInfo entry for this name. - // Get the class name and then introspect at runtime. - out.printil( - "out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString" - + "(org.apache.jasper.runtime.JspRuntimeLibrary.handleGetProperty" - + "(_jspx_page_context.findAttribute(\"" - + name - + "\"), \"" - + property - + "\")));"); - } - - n.setEndJavaLine(out.getJavaLine()); - } - - public void visit(Node.SetProperty n) throws JasperException { - String name = n.getTextAttribute("name"); - String property = n.getTextAttribute("property"); - String param = n.getTextAttribute("param"); - Node.JspAttribute value = n.getValue(); - - n.setBeginJavaLine(out.getJavaLine()); - - if ("*".equals(property)) { - out.printil( - "org.apache.jasper.runtime.JspRuntimeLibrary.introspect(" - + "_jspx_page_context.findAttribute(" - + "\"" - + name - + "\"), request);"); - } else if (value == null) { - if (param == null) - param = property; // default to same as property - out.printil( - "org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(" - + "_jspx_page_context.findAttribute(\"" - + name - + "\"), \"" - + property - + "\", request.getParameter(\"" - + param - + "\"), " - + "request, \"" - + param - + "\", false);"); - } else if (value.isExpression()) { - out.printil( - "org.apache.jasper.runtime.JspRuntimeLibrary.handleSetProperty(" - + "_jspx_page_context.findAttribute(\"" - + name - + "\"), \"" - + property - + "\","); - out.print(attributeValue(value, false, null)); - out.println(");"); - } else if (value.isELInterpreterInput()) { - // We've got to resolve the very call to the interpreter - // at runtime since we don't know what type to expect - // in the general case; we thus can't hard-wire the call - // into the generated code. (XXX We could, however, - // optimize the case where the bean is exposed with - // , much as the code here does for - // getProperty.) - - out.printil( - "org.apache.jasper.runtime.JspRuntimeLibrary.handleSetPropertyExpression(" - + "_jspx_page_context.findAttribute(\"" - + name - + "\"), \"" - + property - + "\", " - + quote(value.getValue()) - + ", " - + "_jspx_page_context, " - + value.getEL().getMapName() - + ");"); - } else if (value.isNamedAttribute()) { - // If the value for setProperty was specified via - // jsp:attribute, first generate code to evaluate - // that body. - String valueVarName = - generateNamedAttributeValue(value.getNamedAttributeNode()); - out.printil( - "org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(" - + "_jspx_page_context.findAttribute(\"" - + name - + "\"), \"" - + property - + "\", " - + valueVarName - + ", null, null, false);"); - } else { - out.printin( - "org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(" - + "_jspx_page_context.findAttribute(\"" - + name - + "\"), \"" - + property - + "\", "); - out.print(attributeValue(value, false, null)); - out.println(", null, null, false);"); - } - - n.setEndJavaLine(out.getJavaLine()); - } - - public void visit(Node.UseBean n) throws JasperException { - - String name = n.getTextAttribute("id"); - String scope = n.getTextAttribute("scope"); - String klass = n.getTextAttribute("class"); - String type = n.getTextAttribute("type"); - Node.JspAttribute beanName = n.getBeanName(); - - // If "class" is specified, try an instantiation at compile time - boolean generateNew = false; - String canonicalName = null; // Canonical name for klass - if (klass != null) { - try { - Class bean = ctxt.getClassLoader().loadClass(klass); - if (klass.indexOf('$') >= 0) { - // Obtain the canonical type name - canonicalName = JspUtil.getCanonicalName(bean); - } else { - canonicalName = klass; - } - int modifiers = bean.getModifiers(); - if (!Modifier.isPublic(modifiers) || - Modifier.isInterface(modifiers) || - Modifier.isAbstract(modifiers)) { - throw new Exception("Invalid bean class modifier"); - } - // Check that there is a 0 arg constructor - bean.getConstructor(new Class[]{}); - // At compile time, we have determined that the bean class - // exists, with a public zero constructor, new() can be - // used for bean instantiation. - generateNew = true; - } catch (Exception e) { - // Cannot instantiate the specified class, either a - // compilation error or a runtime error will be raised, - // depending on a compiler flag. - if (ctxt.getOptions().getErrorOnUseBeanInvalidClassAttribute()) { - err.jspError(n, "jsp.error.invalid.bean", klass); - } - if (canonicalName == null) { - // Doing our best here to get a canonical name - // from the binary name, should work 99.99% of time. - canonicalName = klass.replace('$','.'); - } - } - if (type == null) { - // if type is unspecified, use "class" as type of bean - type = canonicalName; - } - } - - String scopename = "PageContext.PAGE_SCOPE"; // Default to page - String lock = "_jspx_page_context"; - - if ("request".equals(scope)) { - scopename = "PageContext.REQUEST_SCOPE"; - lock = "request"; - } else if ("session".equals(scope)) { - scopename = "PageContext.SESSION_SCOPE"; - lock = "session"; - } else if ("application".equals(scope)) { - scopename = "PageContext.APPLICATION_SCOPE"; - lock = "application"; - } - - n.setBeginJavaLine(out.getJavaLine()); - - // Declare bean - out.printin(type); - out.print(' '); - out.print(name); - out.println(" = null;"); - - /* - * Use synchonized block only if 'klass' or 'beanName' is defined. - * In all other cases, bean must be located in the given scope. - */ - // START S1AS 4642094 - if (klass != null || beanName != null) { - // END S1AS 4642094 - out.printin("synchronized ("); - out.print(lock); - out.println(") {"); - out.pushIndent(); - // START S1AS 4642094 - } - // END S1AS 4642094 - - // Locate bean from context - out.printin(name); - out.print(" = ("); - out.print(type); - out.print(") _jspx_page_context.getAttribute("); - out.print(quote(name)); - out.print(", "); - out.print(scopename); - out.println(");"); - - // Create bean - /* - * Check if bean is alredy there - */ - out.printin("if ("); - out.print(name); - out.println(" == null){"); - out.pushIndent(); - if (klass == null && beanName == null) { - /* - * If both class name and beanName is not specified, the bean - * must be found locally, otherwise it's an error - */ - out.printin( - "throw new java.lang.InstantiationException(\"bean "); - out.print(name); - out.println(" not found within scope\");"); - } else { - /* - * Instantiate the bean if it is not in the specified scope. - */ - if (!generateNew) { - String binaryName; - if (beanName != null) { - if (beanName.isNamedAttribute()) { - // If the value for beanName was specified via - // jsp:attribute, first generate code to evaluate - // that body. - binaryName = - generateNamedAttributeValue( - beanName.getNamedAttributeNode()); - } else { - binaryName = - attributeValue(beanName, false, String.class); - } - } else { - // Implies klass is not null - binaryName = quote(klass); - } - out.printil("try {"); - out.pushIndent(); - out.printin(name); - out.print(" = ("); - out.print(type); - out.print(") java.beans.Beans.instantiate("); - out.print("this.getClass().getClassLoader(), "); - out.print(binaryName); - out.println(");"); - out.popIndent(); - /* - * Note: Beans.instantiate throws ClassNotFoundException - * if the bean class is abstract. - */ - out.printil("} catch (ClassNotFoundException exc) {"); - out.pushIndent(); - out.printil( - "throw new InstantiationException(exc.getMessage());"); - out.popIndent(); - out.printil("} catch (Exception exc) {"); - out.pushIndent(); - out.printin("throw new ServletException("); - out.print("\"Cannot create bean of class \" + "); - out.print(binaryName); - out.println(", exc);"); - out.popIndent(); - out.printil("}"); // close of try - } else { - // Implies klass is not null - // Generate codes to instantiate the bean class - out.printin(name); - out.print(" = new "); - out.print(canonicalName); - out.println("();"); - } - /* - * Set attribute for bean in the specified scope - */ - out.printin("_jspx_page_context.setAttribute("); - out.print(quote(name)); - out.print(", "); - out.print(name); - out.print(", "); - out.print(scopename); - out.println(");"); - - // Only visit the body when bean is instantiated - visitBody(n); - } - out.popIndent(); - out.printil("}"); - - // End of lock block - // START S1AS 4642094 - if (klass != null || beanName != null) { - // END S1AS 4642094 - out.popIndent(); - out.printil("}"); - // START S1AS 4642094 - } - // END S1AS 4642094 - - n.setEndJavaLine(out.getJavaLine()); - } - - /** - * @return a string for the form 'attr = "value"' - */ - private String makeAttr(String attr, String value) { - if (value == null) - return ""; - - return " " + attr + "=\"" + value + '\"'; - } - - public void visit(Node.PlugIn n) throws JasperException { - - /** - * A visitor to handle in a plugin - */ - class ParamVisitor extends Node.Visitor { - - private boolean ie; - - ParamVisitor(boolean ie) { - this.ie = ie; - } - - public void visit(Node.ParamAction n) throws JasperException { - - String name = n.getTextAttribute("name"); - if (name.equalsIgnoreCase("object")) - name = "java_object"; - else if (name.equalsIgnoreCase("type")) - name = "java_type"; - - n.setBeginJavaLine(out.getJavaLine()); - // XXX - Fixed a bug here - value used to be output - // inline, which is only okay if value is not an EL - // expression. Also, key/value pairs for the - // embed tag were not being generated correctly. - // Double check that this is now the correct behavior. - if (ie) { - // We want something of the form - // out.println( "" ); - out.printil( - "out.write( \"\" );"); - out.printil("out.write(\"\\n\");"); - } else { - // We want something of the form - // out.print( " blah=\"" + ... + "\"" ); - out.printil( - "out.write( \" " - + escape(name) - + "=\\\"\" + " - + attributeValue( - n.getValue(), - false, - String.class) - + " + \"\\\"\" );"); - } - - n.setEndJavaLine(out.getJavaLine()); - } - } - - String type = n.getTextAttribute("type"); - String code = n.getTextAttribute("code"); - String name = n.getTextAttribute("name"); - Node.JspAttribute height = n.getHeight(); - Node.JspAttribute width = n.getWidth(); - String hspace = n.getTextAttribute("hspace"); - String vspace = n.getTextAttribute("vspace"); - String align = n.getTextAttribute("align"); - String iepluginurl = n.getTextAttribute("iepluginurl"); - String nspluginurl = n.getTextAttribute("nspluginurl"); - String codebase = n.getTextAttribute("codebase"); - String archive = n.getTextAttribute("archive"); - String jreversion = n.getTextAttribute("jreversion"); - - String widthStr = null; - if (width != null) { - if (width.isNamedAttribute()) { - widthStr = - generateNamedAttributeValue( - width.getNamedAttributeNode()); - } else { - widthStr = attributeValue(width, false, String.class); - } - } - - String heightStr = null; - if (height != null) { - if (height.isNamedAttribute()) { - heightStr = - generateNamedAttributeValue( - height.getNamedAttributeNode()); - } else { - heightStr = attributeValue(height, false, String.class); - } - } - - if (iepluginurl == null) - iepluginurl = Constants.IE_PLUGIN_URL; - if (nspluginurl == null) - nspluginurl = Constants.NS_PLUGIN_URL; - - n.setBeginJavaLine(out.getJavaLine()); - - // If any of the params have their values specified by - // jsp:attribute, prepare those values first. - // Look for a params node and prepare its param subelements: - Node.JspBody jspBody = findJspBody(n); - if (jspBody != null) { - Node.Nodes subelements = jspBody.getBody(); - if (subelements != null) { - for (int i = 0; i < subelements.size(); i++) { - Node m = subelements.getNode(i); - if (m instanceof Node.ParamsAction) { - prepareParams(m); - break; - } - } - } - } - - // XXX - Fixed a bug here - width and height can be set - // dynamically. Double-check if this generation is correct. - - // IE style plugin - // - // First compose the runtime output string - String s0 = "'; - - // Then print the output string to the java file - out.printil( - "out.write(" + quote(s0) + s1 + s2 + " + " + quote(s3) + ");"); - out.printil("out.write(\"\\n\");"); - - // for java_code - s0 = "'; - out.printil("out.write(" + quote(s0) + ");"); - out.printil("out.write(\"\\n\");"); - - // for java_codebase - if (codebase != null) { - s0 = "'; - out.printil("out.write(" + quote(s0) + ");"); - out.printil("out.write(\"\\n\");"); - } - - // for java_archive - if (archive != null) { - s0 = "'; - out.printil("out.write(" + quote(s0) + ");"); - out.printil("out.write(\"\\n\");"); - } - - // for type - s0 = " for each in the plugin body - */ - if (n.getBody() != null) - n.getBody().visit(new ParamVisitor(true)); - - /* - * Netscape style plugin part - */ - out.printil("out.write(" + quote("") + ");"); - out.printil("out.write(\"\\n\");"); - s0 = " in plugin body - */ - if (n.getBody() != null) - n.getBody().visit(new ParamVisitor(false)); - - out.printil("out.write(" + quote("/>") + ");"); - out.printil("out.write(\"\\n\");"); - - out.printil("out.write(" + quote("") + ");"); - out.printil("out.write(\"\\n\");"); - - /* - * Fallback - */ - if (n.getBody() != null) { - visitBody(n); - out.printil("out.write(\"\\n\");"); - } - - out.printil("out.write(" + quote("") + ");"); - out.printil("out.write(\"\\n\");"); - - out.printil("out.write(" + quote("") + ");"); - out.printil("out.write(\"\\n\");"); - - out.printil("out.write(" + quote("") + ");"); - out.printil("out.write(\"\\n\");"); - - n.setEndJavaLine(out.getJavaLine()); - } - - public void visit(Node.NamedAttribute n) throws JasperException { - // Don't visit body of this tag - we already did earlier. - } - - public void visit(Node.CustomTag n) throws JasperException { - - // Use plugin to generate more efficient code if there is one. - if (n.useTagPlugin()) { - generateTagPlugin(n); - return; - } - - TagHandlerInfo handlerInfo = getTagHandlerInfo(n); - - // Create variable names - String baseVar = - createTagVarName(n.getQName(), n.getPrefix(), n.getLocalName()); - String tagEvalVar = "_jspx_eval_" + baseVar; - String tagHandlerVar = "_jspx_th_" + baseVar; - String tagPushBodyCountVar = "_jspx_push_body_count_" + baseVar; - - // If the tag contains no scripting element, generate its codes - // to a method. - ServletWriter outSave = null; - Node.ChildInfo ci = n.getChildInfo(); - if (ci.isScriptless() && !ci.hasScriptingVars()) { - // The tag handler and its body code can reside in a separate - // method if it is scriptless and does not have any scripting - // variable defined. - - String tagMethod = "_jspx_meth_" + baseVar; - - // Generate a call to this method - out.printin("if ("); - out.print(tagMethod); - out.print("("); - if (parent != null) { - // START SJSAS 6388329 - out.print("(javax.servlet.jsp.tagext.JspTag) "); - // END SJSAS 6388329 - out.print(parent); - out.print(", "); - } - out.print("_jspx_page_context"); - if (pushBodyCountVar != null) { - out.print(", "); - out.print(pushBodyCountVar); - } - out.println("))"); - out.pushIndent(); - out.printil((methodNesting > 0) ? "return true;" : "return;"); - out.popIndent(); - - // Set up new buffer for the method - outSave = out; - /* For fragments, their bodies will be generated in fragment - helper classes, and the Java line adjustments will be done - there, hence they are set to null here to avoid double - adjustments. - */ - GenBuffer genBuffer = - new GenBuffer(n, n.implementsSimpleTag()? null: n.getBody()); - methodsBuffered.add(genBuffer); - out = genBuffer.getOut(); - - methodNesting++; - // Generate code for method declaration - out.println(); - out.pushIndent(); - out.printin("private boolean "); - out.print(tagMethod); - out.print("("); - if (parent != null) { - out.print("javax.servlet.jsp.tagext.JspTag "); - out.print(parent); - out.print(", "); - } - out.print("PageContext _jspx_page_context"); - if (pushBodyCountVar != null) { - out.print(", int[] "); - out.print(pushBodyCountVar); - } - out.println(")"); - out.printil(" throws Throwable {"); - out.pushIndent(); - - // Initilaize local variables used in this method. - if (! isTagFile) { - out.printil("PageContext pageContext = _jspx_page_context;"); - } - out.printil("JspWriter out = _jspx_page_context.getOut();"); - generateLocalVariables(out, n, genBytes); - } - - if (n.implementsSimpleTag()) { - generateCustomDoTag(n, handlerInfo, tagHandlerVar); - } else { - /* - * Classic tag handler: Generate code for start element, body, - * and end element - */ - boolean genBytesSave = genBytes; - generateCustomStart( - n, - handlerInfo, - tagHandlerVar, - tagEvalVar, - tagPushBodyCountVar); - - // visit body - String tmpParent = parent; - parent = tagHandlerVar; - boolean isSimpleTagParentSave = isSimpleTagParent; - isSimpleTagParent = false; - String tmpPushBodyCountVar = null; - if (n.implementsTryCatchFinally()) { - tmpPushBodyCountVar = pushBodyCountVar; - pushBodyCountVar = tagPushBodyCountVar; - } - boolean tmpIsSimpleTagHandler = isSimpleTagHandler; - isSimpleTagHandler = false; - - visitBody(n); - - parent = tmpParent; - isSimpleTagParent = isSimpleTagParentSave; - if (n.implementsTryCatchFinally()) { - pushBodyCountVar = tmpPushBodyCountVar; - } - isSimpleTagHandler = tmpIsSimpleTagHandler; - - generateCustomEnd( - n, - tagHandlerVar, - tagEvalVar, - tagPushBodyCountVar); - genBytes = genBytesSave; - } - - if (ci.isScriptless() && !ci.hasScriptingVars()) { - // Generate end of method - if (methodNesting > 0) { - out.printil("return false;"); - } - out.popIndent(); - out.printil("}"); - out.popIndent(); - - methodNesting--; - - // restore previous writer - out = outSave; - } - } - - private static final String SINGLE_QUOTE = "'"; - private static final String DOUBLE_QUOTE = "\\\""; - - public void visit(Node.UninterpretedTag n) throws JasperException { - - n.setBeginJavaLine(out.getJavaLine()); - - /* - * Write begin tag - */ - out.printin("out.write(\"<"); - out.print(n.getQName()); - - Attributes attrs = n.getNonTaglibXmlnsAttributes(); - int attrsLen = (attrs == null) ? 0 : attrs.getLength(); - for (int i = 0; i < attrsLen; i++) { - out.print(" "); - out.print(attrs.getQName(i)); - out.print("="); - String quote = DOUBLE_QUOTE; - String value = attrs.getValue(i); - if (value.indexOf('"') != -1) { - quote = SINGLE_QUOTE; - } - out.print(quote); - out.print(value); - out.print(quote); - } - - attrs = n.getAttributes(); - attrsLen = (attrs == null) ? 0 : attrs.getLength(); - Node.JspAttribute[] jspAttrs = n.getJspAttributes(); - for (int i = 0; i < attrsLen; i++) { - out.print(" "); - out.print(attrs.getQName(i)); - out.print("="); - if (jspAttrs[i].isELInterpreterInput()) { - out.print("\\\"\" + "); - out.print(attributeValue(jspAttrs[i], false, String.class)); - out.print(" + \"\\\""); - } else { - String quote = DOUBLE_QUOTE; - String value = attrs.getValue(i); - if (value.indexOf('"') != -1) { - quote = SINGLE_QUOTE; - } - out.print(quote); - out.print(value); - out.print(quote); - } - } - - if (n.getBody() != null) { - out.println(">\");"); - - // Visit tag body - visitBody(n); - - /* - * Write end tag - */ - out.printin("out.write(\"\");"); - } else { - // Needs a space before "/>" to fix 6334245 - out.println(" />\");"); - } - - n.setEndJavaLine(out.getJavaLine()); - } - - public void visit(Node.JspElement n) throws JasperException { - - n.setBeginJavaLine(out.getJavaLine()); - - // Compute attribute value string for XML-style and named - // attributes - HashMap map = new HashMap(); - Node.JspAttribute[] attrs = n.getJspAttributes(); - for (int i = 0; attrs != null && i < attrs.length; i++) { - String attrStr = null; - StringBuilder genStr = new StringBuilder(" + "); - boolean genCloseParen = false; - if (attrs[i].isNamedAttribute()) { - Node.NamedAttribute attributeNode = - attrs[i].getNamedAttributeNode(); - Node.JspAttribute omit = attributeNode.getOmit(); - if ((omit != null) && omit.isLiteral() && - JspUtil.booleanValue(omit.getValue())) { - // if we know omit is true at compile time, skip - continue; - } - attrStr = - generateNamedAttributeValue( - attrs[i].getNamedAttributeNode()); - if (omit != null && !omit.isLiteral()) { - // If omit is a literal, its value is known to be false - // else generate test for omit at runtime - genCloseParen = true; - genStr.append("(") - .append(attributeValue(omit,false,Boolean.class)) - .append("? \"\": "); - } - } else { - attrStr = attributeValue(attrs[i], false, Object.class); - } - genStr.append("\" ") - .append(attrs[i].getName()) - .append("=\\\"\" + ") - .append(attrStr) - .append(" + \"\\\"\""); - if (genCloseParen) - genStr.append(")"); - map.put(attrs[i].getName(), genStr.toString()); - } - - // Write begin tag, using XML-style 'name' attribute as the - // element name - String elemName = - attributeValue(n.getNameAttribute(), false, String.class); - out.printin("out.write(\"<\""); - out.print(" + " + elemName); - - // Write remaining attributes - for (String attrName: map.keySet()) { - out.print(map.get(attrName)); - } - - // Does the have nested tags other than - // - boolean hasBody = false; - Node.Nodes subelements = n.getBody(); - if (subelements != null) { - for (int i = 0; i < subelements.size(); i++) { - Node subelem = subelements.getNode(i); - if (!(subelem instanceof Node.NamedAttribute)) { - hasBody = true; - break; - } - } - } - if (hasBody) { - out.println(" + \">\");"); - - // Visit tag body - visitBody(n); - - // Write end tag - out.printin("out.write(\"\");"); - } else { - out.println(" + \"/>\");"); - } - - n.setEndJavaLine(out.getJavaLine()); - } - - public void visit(Node.TemplateText n) throws JasperException { - - String text = n.getText(); - - int textSize = text.length(); - if (textSize == 0) { - return; - } - - if (textSize < 3) { - // Special case small text strings - n.setBeginJavaLine(out.getJavaLine()); - int lineInc = 0; - for (int i = 0; i < textSize; i++) { - char ch = text.charAt(i); - out.printil("out.write(" + quote(ch) + ");"); - if (i > 0) { - n.addSmap(lineInc); - } - if (ch == '\n') { - lineInc++; - } - } - n.setEndJavaLine(out.getJavaLine()); - return; - } - - if (genBytes || ctxt.getOptions().genStringAsCharArray()) { - // Generate Strings as byte or char arrays, for performance - n.setBeginJavaLine(out.getJavaLine()); - - ServletWriter aOut; - if (arrayBuffer == null) { - arrayBuffer = new GenBuffer(); - aOut = arrayBuffer.getOut(); - aOut.pushIndent(); - textMap = new HashMap(); - } else { - aOut = arrayBuffer.getOut(); - } - String arrayName = textMap.get(text); - - if (arrayName == null) { - arrayName = "_jspx_array_" + arrayCount++; - textMap.put(text, arrayName); - if (genBytes) { - // First output the String itself - aOut.printin("private final static String "); - aOut.print(arrayName); - aOut.print("S = "); - aOut.print(quote(text)); - aOut.println(";"); - // Then output the bytes for the String - aOut.printin("private final static byte[] "); - aOut.print(arrayName); - aOut.print(" = _jspx_getBytes("); - aOut.print(arrayName); - aOut.println("S);"); - } else { - aOut.printin("private final static char[] "); - aOut.print(arrayName); - aOut.print(" = "); - aOut.print(quote(text)); - aOut.println(".toCharArray();"); - } - } - - if (genBytes) { - out.printin("((org.apache.jasper.runtime.JspWriterImpl)out).write(_jspx_same_encoding(response.getCharacterEncoding()), "); - out.print(arrayName); - out.print(", "); - out.print(arrayName); - out.println("S);"); - } else { - out.printil("out.write(" + arrayName + ");"); - } - - n.setEndJavaLine(out.getJavaLine()); - return; - } - - n.setBeginJavaLine(out.getJavaLine()); - - out.printin(); - StringBuilder sb = new StringBuilder("out.write(\""); - int initLength = sb.length(); - int count = JspUtil.CHUNKSIZE; - int srcLine = 0; // relative to starting srouce line - for (int i = 0; i < text.length(); i++) { - char ch = text.charAt(i); - --count; - switch (ch) { - case '"' : - sb.append('\\').append('\"'); - break; - case '\\' : - sb.append('\\').append('\\'); - break; - case '\r' : - sb.append('\\').append('r'); - break; - case '\n' : - sb.append('\\').append('n'); - srcLine++; - - if (breakAtLF || count < 0) { - // Generate an out.write() when see a '\n' in template - sb.append("\");"); - out.println(sb.toString()); - if (i < text.length() - 1) { - out.printin(); - } - sb.setLength(initLength); - count = JspUtil.CHUNKSIZE; - } - // add a Smap for this line - n.addSmap(srcLine); - break; - case '\t' : // Not sure we need this - sb.append('\\').append('t'); - break; - case '$': - // The fact that we get a ${} means that the original - // EL was escaped with a '\\' (otherwise it would be - // parsed as a ELExpression node). If ELIgnored is - // true, '\\' must be preserved. - if (pageInfo.isELIgnored() - && (i+1 < text.length()) - && (text.charAt(i+1) == '{')){ - sb.append('\\').append('\\'); - } - sb.append(ch); - break; - case '#': - boolean unescapePound = false; - if (isTagFile) { - String verS = ctxt.getTagInfo(). - getTagLibrary().getRequiredVersion(); - Double version = Double.valueOf(verS).doubleValue(); - if (version < 2.1) { - unescapePound = true; - } - } - unescapePound = unescapePound || pageInfo.isELIgnored() - || pageInfo.isDeferredSyntaxAllowedAsLiteral(); - if (unescapePound - && (i+1 < text.length()) - && (text.charAt(i+1) == '{')){ - sb.append('\\').append('\\'); - } - sb.append(ch); - break; - default : - sb.append(ch); - } - } - - if (sb.length() > initLength) { - sb.append("\");"); - out.println(sb.toString()); - } - - n.setEndJavaLine(out.getJavaLine()); - } - - public void visit(Node.JspBody n) throws JasperException { - if (n.getBody() != null) { - if (isSimpleTagHandler) { - out.printin(simpleTagHandlerVar); - out.print(".setJspBody("); - generateJspFragment(n, simpleTagHandlerVar); - out.println(");"); - } else { - visitBody(n); - } - } - } - - public void visit(Node.InvokeAction n) throws JasperException { - - n.setBeginJavaLine(out.getJavaLine()); - - // Copy virtual page scope of tag file to page scope of invoking - // page - out.printil( - "((org.apache.jasper.runtime.JspContextWrapper) this.jspContext).syncBeforeInvoke();"); - String varReaderAttr = n.getTextAttribute("varReader"); - String varAttr = n.getTextAttribute("var"); - if (varReaderAttr != null || varAttr != null) { - out.printil("_jspx_sout = new java.io.StringWriter();"); - } else { - out.printil("_jspx_sout = null;"); - } - - // Invoke fragment, unless fragment is null - out.printin("if ("); - out.print(toGetterMethod(n.getTextAttribute("fragment"))); - out.println(" != null) {"); - out.pushIndent(); - out.printin(toGetterMethod(n.getTextAttribute("fragment"))); - out.println(".invoke(_jspx_sout);"); - out.popIndent(); - out.printil("}"); - - // Store varReader in appropriate scope - if (varReaderAttr != null || varAttr != null) { - String scopeName = n.getTextAttribute("scope"); - out.printin("_jspx_page_context.setAttribute("); - if (varReaderAttr != null) { - out.print(quote(varReaderAttr)); - out.print( - ", new java.io.StringReader(_jspx_sout.toString())"); - } else { - out.print(quote(varAttr)); - out.print(", _jspx_sout.toString()"); - } - if (scopeName != null) { - out.print(", "); - out.print(getScopeConstant(scopeName)); - } - out.println(");"); - } - - n.setEndJavaLine(out.getJavaLine()); - } - - public void visit(Node.DoBodyAction n) throws JasperException { - - n.setBeginJavaLine(out.getJavaLine()); - - // Copy virtual page scope of tag file to page scope of invoking - // page - out.printil( - "((org.apache.jasper.runtime.JspContextWrapper) this.jspContext).syncBeforeInvoke();"); - - // Invoke body - String varReaderAttr = n.getTextAttribute("varReader"); - String varAttr = n.getTextAttribute("var"); - if (varReaderAttr != null || varAttr != null) { - out.printil("_jspx_sout = new java.io.StringWriter();"); - } else { - out.printil("_jspx_sout = null;"); - } - out.printil("if (getJspBody() != null)"); - out.pushIndent(); - out.printil("getJspBody().invoke(_jspx_sout);"); - out.popIndent(); - - // Store varReader in appropriate scope - if (varReaderAttr != null || varAttr != null) { - String scopeName = n.getTextAttribute("scope"); - out.printin("_jspx_page_context.setAttribute("); - if (varReaderAttr != null) { - out.print(quote(varReaderAttr)); - out.print( - ", new java.io.StringReader(_jspx_sout.toString())"); - } else { - out.print(quote(varAttr)); - out.print(", _jspx_sout.toString()"); - } - if (scopeName != null) { - out.print(", "); - out.print(getScopeConstant(scopeName)); - } - out.println(");"); - } - - n.setEndJavaLine(out.getJavaLine()); - } - - public void visit(Node.AttributeGenerator n) throws JasperException { - Node.CustomTag tag = n.getTag(); - Node.JspAttribute[] attrs = tag.getJspAttributes(); - for (int i = 0; attrs != null && i < attrs.length; i++) { - if (attrs[i].getName().equals(n.getName())) { - out.print( - evaluateAttribute( - getTagHandlerInfo(tag), - attrs[i], - tag, - null)); - break; - } - } - } - - private TagHandlerInfo getTagHandlerInfo(Node.CustomTag n) - throws JasperException { - HashMap handlerInfosByShortName = - handlerInfos.get(n.getPrefix()); - if (handlerInfosByShortName == null) { - handlerInfosByShortName = new HashMap(); - handlerInfos.put(n.getPrefix(), handlerInfosByShortName); - } - TagHandlerInfo handlerInfo = - handlerInfosByShortName.get(n.getLocalName()); - if (handlerInfo == null) { - handlerInfo = - new TagHandlerInfo(n, n.getTagHandlerClass(), err); - handlerInfosByShortName.put(n.getLocalName(), handlerInfo); - } - return handlerInfo; - } - - private void generateTagPlugin(Node.CustomTag n) - throws JasperException { - if (n.getAtSTag() != null) { - n.getAtSTag().visit(this); - } - visitBody(n); - if (n.getAtETag() != null) { - n.getAtETag().visit(this); - } - } - - private void generateCustomStart( - Node.CustomTag n, - TagHandlerInfo handlerInfo, - String tagHandlerVar, - String tagEvalVar, - String tagPushBodyCountVar) - throws JasperException { - - Class tagHandlerClass = handlerInfo.getTagHandlerClass(); - - out.printin("// "); - out.println(n.getQName()); - n.setBeginJavaLine(out.getJavaLine()); - - // Declare AT_BEGIN scripting variables - declareScriptingVars(n, VariableInfo.AT_BEGIN); - saveScriptingVars(n, VariableInfo.AT_BEGIN); - - String tagHandlerClassName = - JspUtil.getCanonicalName(tagHandlerClass); - out.printin(tagHandlerClassName); - out.print(" "); - out.print(tagHandlerVar); - out.print(" = "); - if (isPoolingEnabled && - !JspIdConsumer.class.isAssignableFrom(tagHandlerClass)) { - out.print("("); - out.print(tagHandlerClassName); - out.print(") "); - out.print(n.getTagHandlerPoolName()); - out.print(".get("); - out.print(tagHandlerClassName); - out.println(".class);"); - } else { - out.print("(_jspx_resourceInjector != null) ? "); - out.print("_jspx_resourceInjector.createTagHandlerInstance("); - out.print(tagHandlerClassName); - out.print(".class) : new "); - out.print(tagHandlerClassName); - out.println("();"); - } - - generateSetters(n, tagHandlerVar, handlerInfo, false); - - if (n.implementsTryCatchFinally()) { - out.printin("int[] "); - out.print(tagPushBodyCountVar); - out.println(" = new int[] { 0 };"); - out.printil("try {"); - out.pushIndent(); - } - out.printin("int "); - out.print(tagEvalVar); - out.print(" = "); - out.print(tagHandlerVar); - out.println(".doStartTag();"); - - if (!n.implementsBodyTag()) { - // Synchronize AT_BEGIN scripting variables - syncScriptingVars(n, VariableInfo.AT_BEGIN); - } - - if (!n.hasEmptyBody()) { - out.printin("if ("); - out.print(tagEvalVar); - out.println(" != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {"); - out.pushIndent(); - - // Declare NESTED scripting variables - declareScriptingVars(n, VariableInfo.NESTED); - saveScriptingVars(n, VariableInfo.NESTED); - - if (n.implementsBodyTag()) { - out.printin("if ("); - out.print(tagEvalVar); - out.println( - " != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {"); - // Assume EVAL_BODY_BUFFERED - genBytes = false; // Can't handle bytes in a body content - out.pushIndent(); - out.printil("out = _jspx_page_context.pushBody();"); - if (n.implementsTryCatchFinally()) { - out.printin(tagPushBodyCountVar); - out.println("[0]++;"); - } else if (pushBodyCountVar != null) { - out.printin(pushBodyCountVar); - out.println("[0]++;"); - } - out.printin(tagHandlerVar); - out.println( - ".setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);"); - out.printin(tagHandlerVar); - out.println(".doInitBody();"); - - out.popIndent(); - out.printil("}"); - - // Synchronize AT_BEGIN and NESTED scripting variables - syncScriptingVars(n, VariableInfo.AT_BEGIN); - syncScriptingVars(n, VariableInfo.NESTED); - - } else { - // Synchronize NESTED scripting variables - syncScriptingVars(n, VariableInfo.NESTED); - } - - if (n.implementsIterationTag()) { - out.printil("do {"); - out.pushIndent(); - } - } - // Map the Java lines that handles start of custom tags to the - // JSP line for this tag - n.setEndJavaLine(out.getJavaLine()); - } - - private void generateCustomEnd( - Node.CustomTag n, - String tagHandlerVar, - String tagEvalVar, - String tagPushBodyCountVar) { - - if (!n.hasEmptyBody()) { - if (n.implementsIterationTag()) { - out.printin("int evalDoAfterBody = "); - out.print(tagHandlerVar); - out.println(".doAfterBody();"); - - // Synchronize AT_BEGIN and NESTED scripting variables - syncScriptingVars(n, VariableInfo.AT_BEGIN); - syncScriptingVars(n, VariableInfo.NESTED); - - out.printil( - "if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)"); - out.pushIndent(); - out.printil("break;"); - out.popIndent(); - - out.popIndent(); - out.printil("} while (true);"); - } - - restoreScriptingVars(n, VariableInfo.NESTED); - - if (n.implementsBodyTag()) { - out.printin("if ("); - out.print(tagEvalVar); - out.println( - " != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)"); - out.pushIndent(); - out.printil("out = _jspx_page_context.popBody();"); - if (n.implementsTryCatchFinally()) { - out.printin(tagPushBodyCountVar); - out.println("[0]--;"); - } else if (pushBodyCountVar != null) { - out.printin(pushBodyCountVar); - out.println("[0]--;"); - } - out.popIndent(); - } - - out.popIndent(); // EVAL_BODY - out.printil("}"); - } - - out.printin("if ("); - out.print(tagHandlerVar); - out.println( - ".doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {"); - out.pushIndent(); - if (!n.implementsTryCatchFinally()) { - if (isPoolingEnabled) { - out.printin(n.getTagHandlerPoolName()); - out.print(".reuse("); - out.print(tagHandlerVar); - out.println(");"); - } else { - out.printin("if (_jspx_resourceInjector != null) "); - out.print("_jspx_resourceInjector.preDestroy("); - out.print(tagHandlerVar); - out.println(");"); - out.printin(tagHandlerVar); - out.println(".release();"); - } - } - if (isTagFile || isFragment) { - out.printil("throw new SkipPageException();"); - } else { - out.printil((methodNesting > 0) ? "return true;" : "return;"); - } - out.popIndent(); - out.printil("}"); - - // Synchronize AT_BEGIN scripting variables - syncScriptingVars(n, VariableInfo.AT_BEGIN); - - // TryCatchFinally - if (n.implementsTryCatchFinally()) { - out.popIndent(); // try - out.printil("} catch (Throwable _jspx_exception) {"); - out.pushIndent(); - - out.printin("while ("); - out.print(tagPushBodyCountVar); - out.println("[0]-- > 0)"); - out.pushIndent(); - out.printil("out = _jspx_page_context.popBody();"); - out.popIndent(); - - out.printin(tagHandlerVar); - out.println(".doCatch(_jspx_exception);"); - out.popIndent(); - out.printil("} finally {"); - out.pushIndent(); - out.printin(tagHandlerVar); - out.println(".doFinally();"); - } - - if (isPoolingEnabled) { - out.printin(n.getTagHandlerPoolName()); - out.print(".reuse("); - out.print(tagHandlerVar); - out.println(");"); - } else { - out.printin("if (_jspx_resourceInjector != null) "); - out.print("_jspx_resourceInjector.preDestroy("); - out.print(tagHandlerVar); - out.println(");"); - out.printin(tagHandlerVar); - out.println(".release();"); - } - - if (n.implementsTryCatchFinally()) { - out.popIndent(); - out.printil("}"); - } - - // Declare and synchronize AT_END scripting variables (must do this - // outside the try/catch/finally block) - declareScriptingVars(n, VariableInfo.AT_END); - syncScriptingVars(n, VariableInfo.AT_END); - - restoreScriptingVars(n, VariableInfo.AT_BEGIN); - } - - private void generateCustomDoTag( - Node.CustomTag n, - TagHandlerInfo handlerInfo, - String tagHandlerVar) - throws JasperException { - - Class tagHandlerClass = handlerInfo.getTagHandlerClass(); - - n.setBeginJavaLine(out.getJavaLine()); - out.printin("// "); - out.println(n.getQName()); - - // Declare AT_BEGIN scripting variables - declareScriptingVars(n, VariableInfo.AT_BEGIN); - saveScriptingVars(n, VariableInfo.AT_BEGIN); - - String tagHandlerClassName = - JspUtil.getCanonicalName(tagHandlerClass); - out.printin(tagHandlerClassName); - out.print(" "); - out.print(tagHandlerVar); - out.print(" = "); - if (n.getTagFileInfo() == null) { - // Tag files do not support resource injection - out.print("(_jspx_resourceInjector != null)? "); - out.print("_jspx_resourceInjector.createTagHandlerInstance("); - out.print(tagHandlerClassName); - out.print(".class) : "); - } - out.print("new "); - out.print(tagHandlerClassName); - out.println("();"); - - generateSetters(n, tagHandlerVar, handlerInfo, true); - - // Set the body - if (findJspBody(n) == null) { - /* - * Encapsulate body of custom tag invocation in JspFragment - * and pass it to tag handler's setJspBody(), unless tag body - * is empty - */ - if (!n.hasEmptyBody()) { - out.printin(tagHandlerVar); - out.print(".setJspBody("); - generateJspFragment(n, tagHandlerVar); - out.println(");"); - } - } else { - /* - * Body of tag is the body of the element. - * The visit method for that element is going to encapsulate - * that element's body in a JspFragment and pass it to - * the tag handler's setJspBody() - */ - String tmpTagHandlerVar = simpleTagHandlerVar; - simpleTagHandlerVar = tagHandlerVar; - boolean tmpIsSimpleTagHandler = isSimpleTagHandler; - isSimpleTagHandler = true; - visitBody(n); - simpleTagHandlerVar = tmpTagHandlerVar; - isSimpleTagHandler = tmpIsSimpleTagHandler; - } - - out.printin(tagHandlerVar); - out.println(".doTag();"); - - restoreScriptingVars(n, VariableInfo.AT_BEGIN); - - // Synchronize AT_BEGIN scripting variables - syncScriptingVars(n, VariableInfo.AT_BEGIN); - - // Declare and synchronize AT_END scripting variables - declareScriptingVars(n, VariableInfo.AT_END); - syncScriptingVars(n, VariableInfo.AT_END); - - if (n.getTagFileInfo() == null) { - // Tag files do not support resource injection - out.printin("if (_jspx_resourceInjector != null) "); - out.print("_jspx_resourceInjector.preDestroy("); - out.print(tagHandlerVar); - out.println(");"); - } - - n.setEndJavaLine(out.getJavaLine()); - } - - private void declareScriptingVars(Node.CustomTag n, int scope) { - - // Skip if the page is scriptless - if (pageInfo.isScriptless()) return; - - ArrayList vec = n.getScriptingVars(scope); - if (vec != null) { - for (int i = 0; i < vec.size(); i++) { - Object elem = vec.get(i); - if (elem instanceof VariableInfo) { - VariableInfo varInfo = (VariableInfo)elem; - if (varInfo.getDeclare()) { - out.printin(varInfo.getClassName()); - out.print(" "); - out.print(varInfo.getVarName()); - out.println(" = null;"); - } - } else { - TagVariableInfo tagVarInfo = (TagVariableInfo)elem; - if (tagVarInfo.getDeclare()) { - String varName = tagVarInfo.getNameGiven(); - if (varName == null) { - varName = - n.getTagData().getAttributeString( - tagVarInfo.getNameFromAttribute()); - } else if ( - tagVarInfo.getNameFromAttribute() != null) { - // alias - continue; - } - out.printin(tagVarInfo.getClassName()); - out.print(" "); - out.print(varName); - out.println(" = null;"); - } - } - } - } - } - - /* - * This method is called as part of the custom tag's start element. - * - * If the given custom tag has a custom nesting level greater than 0, - * save the current values of its scripting variables to - * temporary variables, so those values may be restored in the tag's - * end element. This way, the scripting variables may be synchronized - * by the given tag without affecting their original values. - */ - private void saveScriptingVars(Node.CustomTag n, int scope) { - - // Skip if the page is scriptless - if (pageInfo.isScriptless()) return; - - if (n.getCustomNestingLevel() == 0) { - return; - } - - TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); - VariableInfo[] varInfos = n.getVariableInfos(); - if ((varInfos.length == 0) && (tagVarInfos.length == 0)) { - return; - } - - if (varInfos.length > 0) { - for (int i = 0; i < varInfos.length; i++) { - if (varInfos[i].getScope() != scope) - continue; - // If the scripting variable has been declared, skip codes - // for saving and restoring it. - if (n.getScriptingVars(scope).contains(varInfos[i])) - continue; - String varName = varInfos[i].getVarName(); - String tmpVarName = JspUtil.nextTemporaryVariableName(); - n.setTempScriptingVar(varName, tmpVarName); - out.printin(varInfos[i].getClassName()); - out.print(" "); - out.print(tmpVarName); - out.print(" = "); - out.print(varName); - out.println(";"); - } - } else { - for (int i = 0; i < tagVarInfos.length; i++) { - if (tagVarInfos[i].getScope() != scope) - continue; - // If the scripting variable has been declared, skip codes - // for saving and restoring it. - if (n.getScriptingVars(scope).contains(tagVarInfos[i])) - continue; - String varName = tagVarInfos[i].getNameGiven(); - if (varName == null) { - varName = - n.getTagData().getAttributeString( - tagVarInfos[i].getNameFromAttribute()); - } else if (tagVarInfos[i].getNameFromAttribute() != null) { - // alias - continue; - } - String tmpVarName = JspUtil.nextTemporaryVariableName(); - n.setTempScriptingVar(varName, tmpVarName); - out.printin(tagVarInfos[i].getClassName()); - out.print(" "); - out.print(tmpVarName); - out.print(" = "); - out.print(varName); - out.println(";"); - } - } - } - - /* - * This method is called as part of the custom tag's end element. - * - * If the given custom tag has a custom nesting level greater than 0, - * restore its scripting variables to their original values that were - * saved in the tag's start element. - */ - private void restoreScriptingVars(Node.CustomTag n, int scope) { - - // Skip if the page is scriptless - if (pageInfo.isScriptless()) return; - - if (n.getCustomNestingLevel() == 0) { - return; - } - - TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); - VariableInfo[] varInfos = n.getVariableInfos(); - if ((varInfos.length == 0) && (tagVarInfos.length == 0)) { - return; - } - - if (varInfos.length > 0) { - for (int i = 0; i < varInfos.length; i++) { - if (varInfos[i].getScope() != scope) - continue; - // If the scripting variable has been declared, skip codes - // for saving and restoring it. - if (n.getScriptingVars(scope).contains(varInfos[i])) - continue; - String varName = varInfos[i].getVarName(); - String tmpVarName = n.getTempScriptingVar(varName); - if (tmpVarName == null) - continue; // should never happen - out.printin(varName); - out.print(" = "); - out.print(tmpVarName); - out.println(";"); - } - } else { - for (int i = 0; i < tagVarInfos.length; i++) { - if (tagVarInfos[i].getScope() != scope) - continue; - // If the scripting variable has been declared, skip codes - // for saving and restoring it. - if (n.getScriptingVars(scope).contains(tagVarInfos[i])) - continue; - String varName = tagVarInfos[i].getNameGiven(); - if (varName == null) { - varName = - n.getTagData().getAttributeString( - tagVarInfos[i].getNameFromAttribute()); - } else if (tagVarInfos[i].getNameFromAttribute() != null) { - // alias - continue; - } - String tmpVarName = n.getTempScriptingVar(varName); - if (tmpVarName == null) - continue; // should never happen - out.printin(varName); - out.print(" = "); - out.print(tmpVarName); - out.println(";"); - } - } - } - - /* - * Synchronizes the scripting variables of the given custom tag for - * the given scope. - */ - private void syncScriptingVars(Node.CustomTag n, int scope) { - - // Skip if the page is scriptless - if (pageInfo.isScriptless()) return; - - TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); - VariableInfo[] varInfos = n.getVariableInfos(); - - if ((varInfos.length == 0) && (tagVarInfos.length == 0)) { - return; - } - - if (varInfos.length > 0) { - for (int i = 0; i < varInfos.length; i++) { - if (varInfos[i].getScope() == scope) { - out.printin(varInfos[i].getVarName()); - out.print(" = ("); - out.print(varInfos[i].getClassName()); - out.print(") _jspx_page_context.findAttribute("); - out.print(quote(varInfos[i].getVarName())); - out.println(");"); - } - } - } else { - for (int i = 0; i < tagVarInfos.length; i++) { - if (tagVarInfos[i].getScope() == scope) { - String name = tagVarInfos[i].getNameGiven(); - if (name == null) { - name = - n.getTagData().getAttributeString( - tagVarInfos[i].getNameFromAttribute()); - } else if ( - tagVarInfos[i].getNameFromAttribute() != null) { - // alias - continue; - } - out.printin(name); - out.print(" = ("); - out.print(tagVarInfos[i].getClassName()); - out.print(") _jspx_page_context.findAttribute("); - out.print(quote(name)); - out.println(");"); - } - } - } - } - - /* - * Creates a tag variable name by concatenating the given prefix and - * shortName and encoded to make the resultant string a valid Java - * Identifier. - */ - private String createTagVarName( - String fullName, - String prefix, - String shortName) { - - String varName; - synchronized (tagVarNumbers) { - varName = prefix + "_" + shortName + "_"; - if (tagVarNumbers.get(fullName) != null) { - Integer i = tagVarNumbers.get(fullName); - varName = varName + i.intValue(); - tagVarNumbers.put(fullName, - Integer.valueOf(i.intValue() + 1)); - } else { - tagVarNumbers.put(fullName, Integer.valueOf(1)); - varName = varName + "0"; - } - } - return JspUtil.makeXmlJavaIdentifier(varName); - } - - private String evaluateAttribute( - TagHandlerInfo handlerInfo, - Node.JspAttribute attr, - Node.CustomTag n, - String tagHandlerVar) - throws JasperException { - - String attrValue = attr.getValue(); - if (attrValue == null) { - if (attr.isNamedAttribute()) { - if (n.checkIfAttributeIsJspFragment(attr.getName())) { - // XXX - no need to generate temporary variable here - attrValue = - generateNamedAttributeJspFragment( - attr.getNamedAttributeNode(), - tagHandlerVar); - } else { - attrValue = - generateNamedAttributeValue( - attr.getNamedAttributeNode()); - } - } else { - return null; - } - } - - String localName = attr.getLocalName(); - - Method m = null; - Class[] c = null; - if (attr.isDynamic()) { - c = OBJECT_CLASS; - } else { - m = handlerInfo.getSetterMethod(localName); - if (m == null) { - err.jspError( - n, - "jsp.error.unable.to_find_method", - attr.getName()); - } - c = m.getParameterTypes(); - // XXX assert(c.length > 0) - } - - if (attr.isExpression()) { - // Do nothing - } else if (attr.isNamedAttribute()) { - if (!n.checkIfAttributeIsJspFragment(attr.getName()) - && !attr.isDynamic()) { - attrValue = - convertString( - c[0], - attrValue, - localName, - handlerInfo.getPropertyEditorClass(localName), - true); - } - } else if (attr.isELInterpreterInput()) { - // run attrValue through the expression interpreter - - Class attrType = c[0]; - - // When type == Object and attribute value contains #{}, - // then type is adjusted accordingly. - if (attrType == Object.class && - attr.getEL().hasPoundExpression()) { - attrType = javax.el.ValueExpression.class; - } - attrValue = - JspUtil.interpreterCall( - this.isTagFile, - attrValue, - attrType, - attr.getEL().getMapName(), - attr.getExpectedType(), - attr.getExpectedReturnType(), - attr.getExpectedParamTypes()); - } else { - attrValue = - convertString( - c[0], - attrValue, - localName, - handlerInfo.getPropertyEditorClass(localName), - false); - } - return attrValue; - } - - /** - * Generate code to create a map for the alias variables - * @return the name of the map - */ - private String generateAliasMap(Node.CustomTag n, String tagHandlerVar) - throws JasperException { - - TagVariableInfo[] tagVars = n.getTagVariableInfos(); - String aliasMapVar = null; - - boolean aliasSeen = false; - for (int i = 0; i < tagVars.length; i++) { - - String nameFrom = tagVars[i].getNameFromAttribute(); - if (nameFrom != null) { - String aliasedName = n.getAttributeValue(nameFrom); - if (aliasedName == null) - continue; - - if (!aliasSeen) { - out.printin("java.util.HashMap "); - aliasMapVar = tagHandlerVar + "_aliasMap"; - out.print(aliasMapVar); - out.println(" = new java.util.HashMap();"); - aliasSeen = true; - } - out.printin(aliasMapVar); - out.print(".put("); - out.print(quote(tagVars[i].getNameGiven())); - out.print(", "); - out.print(quote(aliasedName)); - out.println(");"); - } - } - return aliasMapVar; - } - - private void generateSetters( - Node.CustomTag n, - String tagHandlerVar, - TagHandlerInfo handlerInfo, - boolean simpleTag) - throws JasperException { - - // Set context - if (simpleTag) { - // Generate alias map - String aliasMapVar = null; - if (n.isTagFile()) { - aliasMapVar = generateAliasMap(n, tagHandlerVar); - } - out.printin(tagHandlerVar); - if (aliasMapVar == null) { - out.println(".setJspContext(_jspx_page_context);"); - } else { - out.print(".setJspContext(_jspx_page_context, "); - out.print(aliasMapVar); - out.println(");"); - } - } else { - out.printin(tagHandlerVar); - out.println(".setPageContext(_jspx_page_context);"); - } - - // Set parent - if (!simpleTag) { - out.printin(tagHandlerVar); - out.print(".setParent("); - if (parent != null) { - if (isSimpleTagParent) { - out.print("new javax.servlet.jsp.tagext.TagAdapter("); - out.print("(javax.servlet.jsp.tagext.SimpleTag) "); - out.print(parent); - out.println("));"); - } else { - out.print("(javax.servlet.jsp.tagext.Tag) "); - out.print(parent); - out.println(");"); - } - } else { - out.println("null);"); - } - } else { - // The setParent() method need not be called if the value being - // passed is null, since SimpleTag instances are not reused - if (parent != null) { - out.printin(tagHandlerVar); - out.print(".setParent("); - out.print(parent); - out.println(");"); - } - } - - // setJspId - if (JspIdConsumer.class.isAssignableFrom(n.getTagHandlerClass())) { - out.printin(tagHandlerVar); - out.print(".setJspId(\"id"); - out.print(n.getJspId()); - out.println("\");"); - } - - Node.JspAttribute[] attrs = n.getJspAttributes(); - for (int i = 0; attrs != null && i < attrs.length; i++) { - String attrValue = - evaluateAttribute(handlerInfo, attrs[i], n, tagHandlerVar); - - if (attrs[i].isDynamic()) { - out.printin(tagHandlerVar); - out.print("."); - out.print("setDynamicAttribute("); - String uri = attrs[i].getURI(); - if ("".equals(uri) || (uri == null)) { - out.print("null"); - } else { - out.print("\"" + attrs[i].getURI() + "\""); - } - out.print(", \""); - out.print(attrs[i].getLocalName()); - out.print("\", "); - out.print(attrValue); - out.println(");"); - } else { - out.printin(tagHandlerVar); - out.print("."); - out.print( - handlerInfo - .getSetterMethod(attrs[i].getLocalName()) - .getName()); - out.print("("); - out.print(attrValue); - out.println(");"); - } - } - } - - /* - * @param c The target class to which to coerce the given string - * @param s The string value - * @param attrName The name of the attribute whose value is being - * supplied - * @param propEditorClass The property editor for the given attribute - * @param isNamedAttribute true if the given attribute is a named - * attribute (that is, specified using the jsp:attribute standard - * action), and false otherwise - */ - private String convertString( - Class c, - String s, - String attrName, - Class propEditorClass, - boolean isNamedAttribute) - throws JasperException { - - String quoted = s; - if (!isNamedAttribute) { - quoted = quote(s); - } - - if (propEditorClass != null) { - String className = JspUtil.getCanonicalName(c); - return "(" - + className - + ")org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromBeanInfoPropertyEditor(" - + className - + ".class, \"" - + attrName - + "\", " - + quoted - + ", " - + JspUtil.getCanonicalName(propEditorClass) - + ".class)"; - } else if (c == String.class) { - return quoted; - } else if (c == boolean.class) { - return JspUtil.coerceToPrimitiveBoolean(s, isNamedAttribute); - } else if (c == Boolean.class) { - return JspUtil.coerceToBoolean(s, isNamedAttribute); - } else if (c == byte.class) { - return JspUtil.coerceToPrimitiveByte(s, isNamedAttribute); - } else if (c == Byte.class) { - return JspUtil.coerceToByte(s, isNamedAttribute); - } else if (c == char.class) { - return JspUtil.coerceToChar(s, isNamedAttribute); - } else if (c == Character.class) { - return JspUtil.coerceToCharacter(s, isNamedAttribute); - } else if (c == double.class) { - return JspUtil.coerceToPrimitiveDouble(s, isNamedAttribute); - } else if (c == Double.class) { - return JspUtil.coerceToDouble(s, isNamedAttribute); - } else if (c == float.class) { - return JspUtil.coerceToPrimitiveFloat(s, isNamedAttribute); - } else if (c == Float.class) { - return JspUtil.coerceToFloat(s, isNamedAttribute); - } else if (c == int.class) { - return JspUtil.coerceToInt(s, isNamedAttribute); - } else if (c == Integer.class) { - return JspUtil.coerceToInteger(s, isNamedAttribute); - } else if (c == short.class) { - return JspUtil.coerceToPrimitiveShort(s, isNamedAttribute); - } else if (c == Short.class) { - return JspUtil.coerceToShort(s, isNamedAttribute); - } else if (c == long.class) { - return JspUtil.coerceToPrimitiveLong(s, isNamedAttribute); - } else if (c == Long.class) { - return JspUtil.coerceToLong(s, isNamedAttribute); - } else if (c.isEnum()) { - return JspUtil.coerceToEnum(s, c.getName(), isNamedAttribute); - } else if (c == Object.class) { - return "new String(" + quoted + ")"; - } else { - String className = JspUtil.getCanonicalName(c); - return "(" - + className - + ")org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(" - + className - + ".class, \"" - + attrName - + "\", " - + quoted - + ")"; - } - } - - /* - * Converts the scope string representation, whose possible values - * are "page", "request", "session", and "application", to the - * corresponding scope constant. - */ - private String getScopeConstant(String scope) { - String scopeName = "PageContext.PAGE_SCOPE"; // Default to page - - if ("request".equals(scope)) { - scopeName = "PageContext.REQUEST_SCOPE"; - } else if ("session".equals(scope)) { - scopeName = "PageContext.SESSION_SCOPE"; - } else if ("application".equals(scope)) { - scopeName = "PageContext.APPLICATION_SCOPE"; - } - - return scopeName; - } - - /** - * Generates anonymous JspFragment inner class which is passed as an - * argument to SimpleTag.setJspBody(). - */ - private void generateJspFragment(Node n, String tagHandlerVar) - throws JasperException { - // XXX - A possible optimization here would be to check to see - // if the only child of the parent node is TemplateText. If so, - // we know there won't be any parameters, etc, so we can - // generate a low-overhead JspFragment that just echoes its - // body. The implementation of this fragment can come from - // the org.apache.jasper.runtime package as a support class. - FragmentHelperClass.Fragment fragment = - fragmentHelperClass.openFragment( - n, - tagHandlerVar, - methodNesting); - ServletWriter outSave = out; - out = fragment.getGenBuffer().getOut(); - String tmpParent = parent; - parent = "_jspx_parent"; - boolean isSimpleTagParentSave = isSimpleTagParent; - isSimpleTagParent = true; - boolean tmpIsFragment = isFragment; - isFragment = true; - String pushBodyCountVarSave = pushBodyCountVar; - if (pushBodyCountVar != null) { - // Use a fixed name for push body count, to simplify code gen - pushBodyCountVar = "_jspx_push_body_count"; - } - boolean genBytesSave = genBytes; // can't output bytes in fragments - genBytes = false; - visitBody(n); - genBytes = genBytesSave; - out = outSave; - parent = tmpParent; - isSimpleTagParent = isSimpleTagParentSave; - isFragment = tmpIsFragment; - pushBodyCountVar = pushBodyCountVarSave; - fragmentHelperClass.closeFragment(fragment, methodNesting); - // XXX - Need to change pageContext to jspContext if - // we're not in a place where pageContext is defined (e.g. - // in a fragment or in a tag file. - out.print( - "new " - + fragmentHelperClass.getClassName() - + "( " - + fragment.getId() - + ", _jspx_page_context, " - + tagHandlerVar - + ", " - + pushBodyCountVar - + ")"); - } - - /** - * Generate the code required to obtain the runtime value of the - * given named attribute. - * - * @return The name of the temporary variable the result is stored in. - */ - public String generateNamedAttributeValue(Node.NamedAttribute n) - throws JasperException { - - String varName = n.getTemporaryVariableName(); - - // If the only body element for this named attribute node is - // template text, we need not generate an extra call to - // pushBody and popBody. Maybe we can further optimize - // here by getting rid of the temporary variable, but in - // reality it looks like javac does this for us. - Node.Nodes body = n.getBody(); - if (body != null) { - boolean templateTextOptimization = false; - if (body.size() == 1) { - Node bodyElement = body.getNode(0); - if (bodyElement instanceof Node.TemplateText) { - templateTextOptimization = true; - out.printil( - "String " - + varName - + " = " - + quote( - ((Node.TemplateText)bodyElement).getText()) - + ";"); - } - } - - // XXX - Another possible optimization would be for - // lone EL expressions (no need to pushBody here either). - - if (!templateTextOptimization) { - out.printil("out = _jspx_page_context.pushBody();"); - visitBody(n); - out.printil( - "String " - + varName - + " = " - + "((javax.servlet.jsp.tagext.BodyContent)" - + "out).getString();"); - out.printil("out = _jspx_page_context.popBody();"); - } - } else { - // Empty body must be treated as "" - out.printil("String " + varName + " = \"\";"); - } - - return varName; - } - - /** - * Similar to generateNamedAttributeValue, but create a JspFragment - * instead. - * - * @param n The parent node of the named attribute - * @param tagHandlerVar The variable the tag handler is stored in, - * so the fragment knows its parent tag. - * @return The name of the temporary variable the fragment - * is stored in. - */ - public String generateNamedAttributeJspFragment( - Node.NamedAttribute n, - String tagHandlerVar) - throws JasperException { - String varName = n.getTemporaryVariableName(); - - out.printin( - "javax.servlet.jsp.tagext.JspFragment " + varName + " = "); - generateJspFragment(n, tagHandlerVar); - out.println(";"); - - return varName; - } - } - - private static void generateLocalVariables(ServletWriter out, Node n, - boolean genBytes) - throws JasperException { - Node.ChildInfo ci; - if (n instanceof Node.CustomTag) { - ci = ((Node.CustomTag)n).getChildInfo(); - } else if (n instanceof Node.JspBody) { - ci = ((Node.JspBody)n).getChildInfo(); - } else if (n instanceof Node.NamedAttribute) { - ci = ((Node.NamedAttribute)n).getChildInfo(); - } else { - // Cannot access err since this method is static, but at - // least flag an error. - throw new JasperException("Unexpected Node Type"); - //err.getString( - // "jsp.error.internal.unexpected_node_type" ) ); - } - - if (ci.hasUseBean()) { - out.printil("HttpSession session = _jspx_page_context.getSession();"); - out.printil( - "ServletContext application = _jspx_page_context.getServletContext();"); - } - if (ci.hasUseBean() - || ci.hasIncludeAction() - || ci.hasSetProperty() - || ci.hasParamAction()) { - out.printil( - "HttpServletRequest request = (HttpServletRequest)_jspx_page_context.getRequest();"); - } - if (ci.hasIncludeAction() || genBytes) { - out.printil( - "HttpServletResponse response = (HttpServletResponse)_jspx_page_context.getResponse();"); - } - } - - /** - * Common part of postamble, shared by both servlets and tag files. - */ - private void genCommonPostamble() { - // Append any methods that were generated in the buffer. - for (int i = 0; i < methodsBuffered.size(); i++) { - GenBuffer methodBuffer = methodsBuffered.get(i); - methodBuffer.adjustJavaLines(out.getJavaLine() - 1); - out.printMultiLn(methodBuffer.toString()); - } - - // Append the helper class - if (fragmentHelperClass.isUsed()) { - fragmentHelperClass.generatePostamble(); - fragmentHelperClass.adjustJavaLines(out.getJavaLine() - 1); - out.printMultiLn(fragmentHelperClass.toString()); - } - - // Append char array declarations - if (arrayBuffer != null) { - out.printMultiLn(arrayBuffer.toString()); - } - - // Close the class definition - out.popIndent(); - out.printil("}"); - } - - /** - * Generates the ending part of the static portion of the servlet. - */ - private void generatePostamble(Node.Nodes page) { - out.popIndent(); - out.printil("} catch (Throwable t) {"); - out.pushIndent(); - out.printil( - "if (!(t instanceof SkipPageException)){"); - out.pushIndent(); - out.printil("out = _jspx_out;"); - out.printil("if (out != null && out.getBufferSize() != 0)"); - out.pushIndent(); - out.printil("out.clearBuffer();"); - out.popIndent(); - - out.printil( - "if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);"); - out.printil("else throw new ServletException(t);"); - out.popIndent(); - out.printil("}"); - out.popIndent(); - out.printil("} finally {"); - out.pushIndent(); - - out.printil( - "_jspxFactory.releasePageContext(_jspx_page_context);"); - - out.popIndent(); - out.printil("}"); - - // Close the service method - out.popIndent(); - out.printil("}"); - - // Generated methods, helper classes, etc. - genCommonPostamble(); - } - - /** - * Constructor. - */ - Generator(ServletWriter out, Compiler compiler) { - this.out = out; - methodsBuffered = new ArrayList(); - arrayBuffer = null; - err = compiler.getErrorDispatcher(); - ctxt = compiler.getCompilationContext(); - fragmentHelperClass = - new FragmentHelperClass(ctxt.getFullClassName(), - ctxt.getServletClassName() + "Helper"); - pageInfo = compiler.getPageInfo(); - - /* - * Temporary hack. If a JSP page uses the "extends" attribute of the - * page directive, the _jspInit() method of the generated servlet class - * will not be called (it is only called for those generated servlets - * that extend HttpJspBase, the default), causing the tag handler pools - * not to be initialized and resulting in a NPE. - * The JSP spec needs to clarify whether containers can override - * init() and destroy(). For now, we just disable tag pooling for pages - * that use "extends". - */ - if (pageInfo.getExtends(false) == null) { - isPoolingEnabled = ctxt.getOptions().isPoolingEnabled(); - } else { - isPoolingEnabled = false; - } - beanInfo = pageInfo.getBeanRepository(); - breakAtLF = ctxt.getOptions().getMappedFile(); - genBytes = pageInfo.getBuffer() == 0 && - ctxt.getOptions().genStringAsByteArray(); - if (isPoolingEnabled) { - tagHandlerPoolNames = new HashSet(); - } - } - - /** - * The main entry for Generator. - * @param out The servlet output writer - * @param compiler The compiler - * @param page The input page - */ - public static void generate( - ServletWriter out, - Compiler compiler, - Node.Nodes page) - throws JasperException { - - Generator gen = new Generator(out, compiler); - - if (gen.isPoolingEnabled) { - gen.compileTagHandlerPoolList(page); - } - if (gen.ctxt.isTagFile()) { - JasperTagInfo tagInfo = (JasperTagInfo)gen.ctxt.getTagInfo(); - gen.generateTagHandlerPreamble(tagInfo, page); - - if (gen.ctxt.isPrototypeMode()) { - return; - } - - gen.generateXmlProlog(page); - gen.fragmentHelperClass.generatePreamble(); - page.visit( - gen.new GenerateVisitor( - gen.ctxt.isTagFile(), - out, - gen.methodsBuffered, - gen.fragmentHelperClass)); - gen.generateTagHandlerPostamble(tagInfo); - } else { - gen.generatePreamble(page); - gen.generateXmlProlog(page); - gen.fragmentHelperClass.generatePreamble(); - page.visit( - gen.new GenerateVisitor( - gen.ctxt.isTagFile(), - out, - gen.methodsBuffered, - gen.fragmentHelperClass)); - gen.generatePostamble(page); - } - } - - /* - * Generates tag handler preamble. - */ - private void generateTagHandlerPreamble( - JasperTagInfo tagInfo, - Node.Nodes tag) - throws JasperException { - - // Generate package declaration - String className = tagInfo.getTagClassName(); - int lastIndex = className.lastIndexOf('.'); - if (lastIndex != -1) { - String pkgName = className.substring(0, lastIndex); - genPreamblePackage(pkgName); - className = className.substring(lastIndex + 1); - } - - // Generate imports - genPreambleImports(); - - // Generate class declaration - out.printin("public final class "); - out.println(className); - out.printil(" extends javax.servlet.jsp.tagext.SimpleTagSupport"); - out.printin( - " implements org.apache.jasper.runtime.JspSourceDependent"); - if (tagInfo.hasDynamicAttributes()) { - out.println(","); - out.printin( - " javax.servlet.jsp.tagext.DynamicAttributes"); - } - out.println(" {"); - out.println(); - out.pushIndent(); - - /* - * Class body begins here - */ - - generateDeclarations(tag); - - // Static initializations here - genPreambleStaticInitializers(); - - out.printil("private JspContext jspContext;"); - - // Declare writer used for storing result of fragment/body invocation - // if 'varReader' or 'var' attribute is specified - out.printil("private java.io.Writer _jspx_sout;"); - - // Class variable declarations - genPreambleClassVariableDeclarations(tagInfo.getTagName()); - - generateSetJspContext(tagInfo); - - // Tag-handler specific declarations - generateTagHandlerAttributes(tagInfo); - if (tagInfo.hasDynamicAttributes()) - generateSetDynamicAttribute(); - - // Methods here - genPreambleMethods(); - - // Now the doTag() method - out.printil( - "public void doTag() throws JspException, java.io.IOException {"); - - if (ctxt.isPrototypeMode()) { - out.printil("}"); - out.popIndent(); - out.printil("}"); - return; - } - - out.pushIndent(); - - /* - * According to the spec, 'pageContext' must not be made available as - * an implicit object in tag files. - * Declare _jspx_page_context, so we can share the code generator with - * JSPs. - */ - out.printil("PageContext _jspx_page_context = (PageContext)jspContext;"); - - // Declare implicit objects. - out.printil( - "HttpServletRequest request = " - + "(HttpServletRequest) _jspx_page_context.getRequest();"); - out.printil( - "HttpServletResponse response = " - + "(HttpServletResponse) _jspx_page_context.getResponse();"); - out.printil("HttpSession session = _jspx_page_context.getSession();"); - out.printil( - "ServletContext application = _jspx_page_context.getServletContext();"); - out.printil("ServletConfig config = _jspx_page_context.getServletConfig();"); - out.printil("JspWriter out = jspContext.getOut();"); - if (isPoolingEnabled && !tagHandlerPoolNames.isEmpty()) { - out.printil("_jspInit(config);"); - } - generatePageScopedVariables(tagInfo); - out.println(); - - out.printil("try {"); - out.pushIndent(); - } - - private void generateTagHandlerPostamble(TagInfo tagInfo) { - out.popIndent(); - - // Have to catch Throwable because a classic tag handler - // helper method is declared to throw Throwable. - out.printil("} catch( Throwable t ) {"); - out.pushIndent(); - out.printil("if( t instanceof SkipPageException )"); - out.printil(" throw (SkipPageException) t;"); - out.printil("if( t instanceof java.io.IOException )"); - out.printil(" throw (java.io.IOException) t;"); - out.printil("if( t instanceof IllegalStateException )"); - out.printil(" throw (IllegalStateException) t;"); - out.printil("if( t instanceof JspException )"); - out.printil(" throw (JspException) t;"); - out.printil("throw new JspException(t);"); - out.popIndent(); - out.printil("} finally {"); - out.pushIndent(); - out.printil( - "((org.apache.jasper.runtime.JspContextWrapper) jspContext).syncEndTagFile();"); - if (isPoolingEnabled && !tagHandlerPoolNames.isEmpty()) { - out.printil("_jspDestroy();"); - } - out.popIndent(); - out.printil("}"); - - // Close the doTag method - out.popIndent(); - out.printil("}"); - - // Generated methods, helper classes, etc. - genCommonPostamble(); - } - - /** - * Generates declarations for tag handler attributes, and defines the - * getter and setter methods for each. - */ - private void generateTagHandlerAttributes(TagInfo tagInfo) - throws JasperException { - - if (tagInfo.hasDynamicAttributes()) { - out.printil( - "private java.util.HashMap _jspx_dynamic_attrs = new java.util.HashMap();"); - } - - // Declare attributes - TagAttributeInfo[] attrInfos = tagInfo.getAttributes(); - for (int i = 0; i < attrInfos.length; i++) { - out.printin("private "); - if (attrInfos[i].isFragment()) { - out.print("javax.servlet.jsp.tagext.JspFragment "); - } else { - out.print(JspUtil.toJavaSourceType(attrInfos[i].getTypeName())); - out.print(" "); - } - out.print(attrInfos[i].getName()); - out.println(";"); - } - out.println(); - - // Define attribute getter and setter methods - for (int i = 0; i < attrInfos.length; i++) { - // getter method - out.printin("public "); - if (attrInfos[i].isFragment()) { - out.print("javax.servlet.jsp.tagext.JspFragment "); - } else { - out.print(JspUtil.toJavaSourceType(attrInfos[i].getTypeName())); - out.print(" "); - } - out.print(toGetterMethod(attrInfos[i].getName())); - out.println(" {"); - out.pushIndent(); - out.printin("return this."); - out.print(attrInfos[i].getName()); - out.println(";"); - out.popIndent(); - out.printil("}"); - out.println(); - - // setter method - out.printin("public void "); - out.print(toSetterMethodName(attrInfos[i].getName())); - if (attrInfos[i].isFragment()) { - out.print("(javax.servlet.jsp.tagext.JspFragment "); - } else { - out.print("("); - out.print(JspUtil.toJavaSourceType(attrInfos[i].getTypeName())); - out.print(" "); - } - out.print(attrInfos[i].getName()); - out.println(") {"); - out.pushIndent(); - out.printin("this."); - out.print(attrInfos[i].getName()); - out.print(" = "); - out.print(attrInfos[i].getName()); - out.println(";"); - out.popIndent(); - out.printil("}"); - out.println(); - } - } - - /* - * Generate setter for JspContext so we can create a wrapper and - * store both the original and the wrapper. We need the wrapper - * to mask the page context from the tag file and simulate a - * fresh page context. We need the original to do things like - * sync AT_BEGIN and AT_END scripting variables. - */ - private void generateSetJspContext(TagInfo tagInfo) { - - boolean nestedSeen = false; - boolean atBeginSeen = false; - boolean atEndSeen = false; - - // Determine if there are any aliases - boolean aliasSeen = false; - TagVariableInfo[] tagVars = tagInfo.getTagVariableInfos(); - for (int i = 0; i < tagVars.length; i++) { - if (tagVars[i].getNameFromAttribute() != null - && tagVars[i].getNameGiven() != null) { - aliasSeen = true; - break; - } - } - - if (aliasSeen) { - out.printil( - "public void setJspContext(JspContext ctx, java.util.Map aliasMap) {"); - } else { - out.printil("public void setJspContext(JspContext ctx) {"); - } - out.pushIndent(); - out.printil("super.setJspContext(ctx);"); - out.printil("java.util.ArrayList _jspx_nested = null;"); - out.printil("java.util.ArrayList _jspx_at_begin = null;"); - out.printil("java.util.ArrayList _jspx_at_end = null;"); - - for (int i = 0; i < tagVars.length; i++) { - - switch (tagVars[i].getScope()) { - case VariableInfo.NESTED : - if (!nestedSeen) { - out.printil( - "_jspx_nested = new java.util.ArrayList();"); - nestedSeen = true; - } - out.printin("_jspx_nested.add("); - break; - - case VariableInfo.AT_BEGIN : - if (!atBeginSeen) { - out.printil( - "_jspx_at_begin = new java.util.ArrayList();"); - atBeginSeen = true; - } - out.printin("_jspx_at_begin.add("); - break; - - case VariableInfo.AT_END : - if (!atEndSeen) { - out.printil( - "_jspx_at_end = new java.util.ArrayList();"); - atEndSeen = true; - } - out.printin("_jspx_at_end.add("); - break; - } // switch - - out.print(quote(tagVars[i].getNameGiven())); - out.println(");"); - } - if (aliasSeen) { - out.printil( - "this.jspContext = new org.apache.jasper.runtime.JspContextWrapper(ctx, _jspx_nested, _jspx_at_begin, _jspx_at_end, aliasMap);"); - } else { - out.printil( - "this.jspContext = new org.apache.jasper.runtime.JspContextWrapper(ctx, _jspx_nested, _jspx_at_begin, _jspx_at_end, null);"); - } - out.popIndent(); - out.printil("}"); - out.println(); - out.printil("public JspContext getJspContext() {"); - out.pushIndent(); - out.printil("return this.jspContext;"); - out.popIndent(); - out.printil("}"); - } - - /* - * Generates implementation of - * javax.servlet.jsp.tagext.DynamicAttributes.setDynamicAttribute() method, - * which saves each dynamic attribute that is passed in so that a scoped - * variable can later be created for it. - */ - public void generateSetDynamicAttribute() { - out.printil( - "public void setDynamicAttribute(String uri, String localName, Object value) throws JspException {"); - out.pushIndent(); - /* - * According to the spec, only dynamic attributes with no uri are to - * be present in the Map; all other dynamic attributes are ignored. - */ - out.printil("if (uri == null)"); - out.pushIndent(); - out.printil("_jspx_dynamic_attrs.put(localName, value);"); - out.popIndent(); - out.popIndent(); - out.printil("}"); - } - - /* - * Creates a page-scoped variable for each declared tag attribute. - * Also, if the tag accepts dynamic attributes, a page-scoped variable - * is made available for each dynamic attribute that was passed in. - */ - private void generatePageScopedVariables(JasperTagInfo tagInfo) { - - // "normal" attributes - TagAttributeInfo[] attrInfos = tagInfo.getAttributes(); - for (int i = 0; i < attrInfos.length; i++) { - String attrName = attrInfos[i].getName(); - out.printil("if( " + toGetterMethod(attrName) + " != null ) {"); - out.pushIndent(); - out.printin("_jspx_page_context.setAttribute("); - out.print(quote(attrName)); - out.print(", "); - out.print(toGetterMethod(attrName)); - out.println(");"); - if (attrInfos[i].isDeferredValue()) { - // If the attribute is a deferred value, also set it to an EL - // variable of the same name. - out.printin("org.apache.jasper.runtime.PageContextImpl.setValueVariable("); - out.print("_jspx_page_context, "); - out.print(quote(attrName)); - out.print(", "); - out.print(toGetterMethod(attrName)); - out.println(");"); - } - - if (attrInfos[i].isDeferredMethod()) { - // If the attribute is a deferred method, set a wrapped - // ValueExpression to an EL variable of the same name. - out.printin("org.apache.jasper.runtime.PageContextImpl.setMethodVariable("); - out.print("_jspx_page_context, "); - out.print(quote(attrName)); - out.print(", "); - out.print(toGetterMethod(attrName)); - out.println(");"); - } - out.popIndent(); - out.println("}"); - } - - // Expose the Map containing dynamic attributes as a page-scoped var - if (tagInfo.hasDynamicAttributes()) { - out.printin("_jspx_page_context.setAttribute(\""); - out.print(tagInfo.getDynamicAttributesMapName()); - out.print("\", _jspx_dynamic_attrs);"); - } - } - - /* - * Generates the getter method for the given attribute name. - */ - private String toGetterMethod(String attrName) { - char[] attrChars = attrName.toCharArray(); - attrChars[0] = Character.toUpperCase(attrChars[0]); - return "get" + new String(attrChars) + "()"; - } - - /* - * Generates the setter method name for the given attribute name. - */ - private String toSetterMethodName(String attrName) { - char[] attrChars = attrName.toCharArray(); - attrChars[0] = Character.toUpperCase(attrChars[0]); - return "set" + new String(attrChars); - } - - /** - * Class storing the result of introspecting a custom tag handler. - */ - private static class TagHandlerInfo { - - private HashMap methodMaps; - private HashMap> propertyEditorMaps; - private Class tagHandlerClass; - - /** - * Constructor. - * - * @param n The custom tag whose tag handler class is to be - * introspected - * @param tagHandlerClass Tag handler class - * @param err Error dispatcher - */ - TagHandlerInfo(Node n, Class tagHandlerClass, ErrorDispatcher err) - throws JasperException { - this.tagHandlerClass = tagHandlerClass; - this.methodMaps = new HashMap(); - this.propertyEditorMaps = new HashMap>(); - - try { - BeanInfo tagClassInfo = - Introspector.getBeanInfo(tagHandlerClass); - PropertyDescriptor[] pd = tagClassInfo.getPropertyDescriptors(); - for (int i = 0; i < pd.length; i++) { - /* - * FIXME: should probably be checking for things like - * pageContext, bodyContent, and parent here -akv - */ - if (pd[i].getWriteMethod() != null) { - methodMaps.put(pd[i].getName(), pd[i].getWriteMethod()); - } - if (pd[i].getPropertyEditorClass() != null) - propertyEditorMaps.put( - pd[i].getName(), - pd[i].getPropertyEditorClass()); - } - } catch (IntrospectionException ie) { - err.jspError( - n, - "jsp.error.introspect.taghandler", - tagHandlerClass.getName(), - ie); - } - } - - /** - * XXX - */ - public Method getSetterMethod(String attrName) { - return methodMaps.get(attrName); - } - - /** - * XXX - */ - public Class getPropertyEditorClass(String attrName) { - return propertyEditorMaps.get(attrName); - } - - /** - * XXX - */ - public Class getTagHandlerClass() { - return tagHandlerClass; - } - } - - /** - * A class for generating codes to a buffer. Included here are some - * support for tracking source to Java lines mapping. - */ - private static class GenBuffer { - - /* - * For a CustomTag, the codes that are generated at the beginning of - * the tag may not be in the same buffer as those for the body of the - * tag. Two fields are used here to keep this straight. For codes - * that do not corresponds to any JSP lines, they should be null. - */ - private Node node; - private Node.Nodes body; - private java.io.CharArrayWriter charWriter; - protected ServletWriter out; - - GenBuffer() { - this(null, null); - } - - GenBuffer(Node n, Node.Nodes b) { - node = n; - body = b; - if (body != null) { - body.setGeneratedInBuffer(true); - } - charWriter = new java.io.CharArrayWriter(); - out = new ServletWriter(new java.io.PrintWriter(charWriter)); - } - - public ServletWriter getOut() { - return out; - } - - public String toString() { - return charWriter.toString(); - } - - /** - * Adjust the Java Lines. This is necessary because the Java lines - * stored with the nodes are relative the beginning of this buffer - * and need to be adjusted when this buffer is inserted into the - * source. - */ - public void adjustJavaLines(final int offset) { - - if (node != null) { - adjustJavaLine(node, offset); - } - - if (body != null) { - try { - body.visit(new Node.Visitor() { - - public void doVisit(Node n) { - adjustJavaLine(n, offset); - } - - public void visit(Node.CustomTag n) - throws JasperException { - Node.Nodes b = n.getBody(); - if (b != null && !b.isGeneratedInBuffer()) { - // Don't adjust lines for the nested tags that - // are also generated in buffers, because the - // adjustments will be done elsewhere. - b.visit(this); - } - } - }); - } catch (JasperException ex) { - } - } - } - - private static void adjustJavaLine(Node n, int offset) { - if (n.getBeginJavaLine() > 0) { - n.setBeginJavaLine(n.getBeginJavaLine() + offset); - n.setEndJavaLine(n.getEndJavaLine() + offset); - } - } - } - - /** - * Keeps track of the generated Fragment Helper Class - */ - private static class FragmentHelperClass { - - private static class Fragment { - private GenBuffer genBuffer; - private int id; - - public Fragment(int id, Node node) { - this.id = id; - genBuffer = new GenBuffer(null, node.getBody()); - } - - public GenBuffer getGenBuffer() { - return this.genBuffer; - } - - public int getId() { - return this.id; - } - } - - // True if the helper class should be generated. - private boolean used = false; - - private ArrayList fragments = new ArrayList(); - - private String className; - private String fullClassName; - - // Buffer for entire helper class - private GenBuffer classBuffer = new GenBuffer(); - - public FragmentHelperClass(String outterClassName, String className) { - this.fullClassName = outterClassName + '$' + className; - this.className = className; - } - - public String getClassName() { - return this.className; - } - - public boolean isUsed() { - return this.used; - } - - public void generatePreamble() { - ServletWriter out = this.classBuffer.getOut(); - out.println(); - out.pushIndent(); - // Note: cannot be static, as we need to reference things like - // _jspx_meth_* - out.printil("private class " + className); - out.printil( - " extends " + "org.apache.jasper.runtime.JspFragmentHelper"); - out.printil("{"); - out.pushIndent(); - out.printil( - "private javax.servlet.jsp.tagext.JspTag _jspx_parent;"); - out.printil("private int[] _jspx_push_body_count;"); - out.println(); - out.printil( - "public " - + className - + "( int discriminator, JspContext jspContext, " - + "javax.servlet.jsp.tagext.JspTag _jspx_parent, " - + "int[] _jspx_push_body_count ) {"); - out.pushIndent(); - out.printil("super( discriminator, jspContext, _jspx_parent );"); - out.printil("this._jspx_parent = _jspx_parent;"); - out.printil("this._jspx_push_body_count = _jspx_push_body_count;"); - out.popIndent(); - out.printil("}"); - } - - public Fragment openFragment( - Node parent, - String tagHandlerVar, - int methodNesting) - throws JasperException { - Fragment result = new Fragment(fragments.size(), parent); - fragments.add(result); - this.used = true; - parent.setInnerClassName(fullClassName); - - ServletWriter out = result.getGenBuffer().getOut(); - out.pushIndent(); - out.pushIndent(); - // XXX - Returns boolean because if a tag is invoked from - // within this fragment, the Generator sometimes might - // generate code like "return true". This is ignored for now, - // meaning only the fragment is skipped. The JSR-152 - // expert group is currently discussing what to do in this case. - // See comment in closeFragment() - if (methodNesting > 0) { - out.printin("public boolean invoke"); - } else { - out.printin("public void invoke"); - } - out.println(result.getId() + "( " + "JspWriter out ) "); - out.pushIndent(); - // Note: Throwable required because methods like _jspx_meth_* - // throw Throwable. - out.printil("throws Throwable"); - out.popIndent(); - out.printil("{"); - out.pushIndent(); - generateLocalVariables(out, parent, false); - - return result; - } - - public void closeFragment(Fragment fragment, int methodNesting) { - ServletWriter out = fragment.getGenBuffer().getOut(); - // XXX - See comment in openFragment() - if (methodNesting > 0) { - out.printil("return false;"); - } else { - out.printil("return;"); - } - out.popIndent(); - out.printil("}"); - } - - public void generatePostamble() { - ServletWriter out = this.classBuffer.getOut(); - // Generate all fragment methods: - for (int i = 0; i < fragments.size(); i++) { - Fragment fragment = fragments.get(i); - fragment.getGenBuffer().adjustJavaLines(out.getJavaLine() - 1); - out.printMultiLn(fragment.getGenBuffer().toString()); - } - - // Generate postamble: - out.printil("public void invoke( java.io.Writer writer )"); - out.pushIndent(); - out.printil("throws JspException"); - out.popIndent(); - out.printil("{"); - out.pushIndent(); - out.printil("JspWriter out = null;"); - out.printil("if( writer != null ) {"); - out.pushIndent(); - out.printil("out = this.jspContext.pushBody(writer);"); - out.popIndent(); - out.printil("} else {"); - out.pushIndent(); - out.printil("out = this.jspContext.getOut();"); - out.popIndent(); - out.printil("}"); - out.printil("try {"); - out.pushIndent(); - out.printil("switch( this.discriminator ) {"); - out.pushIndent(); - for (int i = 0; i < fragments.size(); i++) { - out.printil("case " + i + ":"); - out.pushIndent(); - out.printil("invoke" + i + "( out );"); - out.printil("break;"); - out.popIndent(); - } - out.popIndent(); - out.printil("}"); // switch - out.popIndent(); - out.printil("}"); // try - out.printil("catch( Throwable e ) {"); - out.pushIndent(); - out.printil( - "if (e instanceof SkipPageException)"); - out.printil(" throw (SkipPageException) e;"); - out.printil("throw new JspException( e );"); - out.popIndent(); - out.printil("}"); // catch - out.printil("finally {"); - out.pushIndent(); - - out.printil("if( writer != null ) {"); - out.pushIndent(); - out.printil("this.jspContext.popBody();"); - out.popIndent(); - out.printil("}"); - - out.popIndent(); - out.printil("}"); // finally - out.popIndent(); - out.printil("}"); // invoke method - out.popIndent(); - out.printil("}"); // helper class - out.popIndent(); - } - - public String toString() { - return classBuffer.toString(); - } - - public void adjustJavaLines(int offset) { - for (int i = 0; i < fragments.size(); i++) { - Fragment fragment = fragments.get(i); - fragment.getGenBuffer().adjustJavaLines(offset); - } - } - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java b/impl/src/main/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java deleted file mode 100644 index 467997a..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java +++ /dev/null @@ -1,300 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.InputStream; -import java.net.URL; -import java.util.*; -import javax.servlet.ServletContext; -import javax.servlet.jsp.tagext.FunctionInfo; -import javax.servlet.jsp.tagext.TagLibraryInfo; -import javax.servlet.jsp.tagext.TagInfo; -import javax.servlet.jsp.tagext.TagFileInfo; -import org.apache.jasper.Constants; -import org.apache.jasper.JspCompilationContext; -import org.apache.jasper.JasperException; -import org.apache.jasper.xmlparser.ParserUtils; -import org.apache.jasper.xmlparser.TreeNode; - -/** - * Class responsible for generating an implicit tag library containing tag - * handlers corresponding to the tag files in "/WEB-INF/tags/" or a - * subdirectory of it. - * - * @author Jan Luehe - */ -class ImplicitTagLibraryInfo extends TagLibraryInfo { - - private static final String WEB_INF_TAGS = "/WEB-INF/tags"; - private static final String TAG_FILE_SUFFIX = ".tag"; - private static final String TAGX_FILE_SUFFIX = ".tagx"; - private static final String TAGS_SHORTNAME = "tags"; - private static final String TLIB_VERSION = "1.0"; - private static final String JSP_VERSION = "2.0"; - private static final String IMPLICIT_TLD = "implicit.tld"; - - // Maps tag names to tag file paths - private HashMap tagFileMap; - - private ParserController pc; - private PageInfo pageInfo; - private ArrayList vec; - private ErrorDispatcher err; - - /** - * Constructor. - */ - public ImplicitTagLibraryInfo(JspCompilationContext ctxt, - ParserController pc, - String prefix, - String tagdir, - ErrorDispatcher err) throws JasperException { - super(prefix, null); - this.pc = pc; - this.err = err; - this.pageInfo = pc.getCompiler().getPageInfo(); - this.tagFileMap = new HashMap(); - this.vec = new ArrayList(); - - // Implicit tag libraries have no functions: - this.functions = new FunctionInfo[0]; - - tlibversion = TLIB_VERSION; - jspversion = JSP_VERSION; - - if (!tagdir.startsWith(WEB_INF_TAGS)) { - err.jspError("jsp.error.invalid.tagdir", tagdir); - } - - // Determine the value of the subelement of the - // "imaginary" element - if (tagdir.equals(WEB_INF_TAGS) - || tagdir.equals( WEB_INF_TAGS + "/")) { - shortname = TAGS_SHORTNAME; - } else { - shortname = tagdir.substring(WEB_INF_TAGS.length()); - shortname = shortname.replace('/', '-'); - } - - // Populate mapping of tag names to tag file paths - Set dirList = ctxt.getResourcePaths(tagdir); - if (dirList != null) { - Iterator it = dirList.iterator(); - while (it.hasNext()) { - String path = (String) it.next(); - if (path.endsWith(TAG_FILE_SUFFIX) - || path.endsWith(TAGX_FILE_SUFFIX)) { - /* - * Use the filename of the tag file, without the .tag or - * .tagx extension, respectively, as the subelement - * of the "imaginary" element - */ - String suffix = path.endsWith(TAG_FILE_SUFFIX) ? - TAG_FILE_SUFFIX : TAGX_FILE_SUFFIX; - String tagName = path.substring(path.lastIndexOf("/") + 1); - tagName = tagName.substring(0, - tagName.lastIndexOf(suffix)); - tagFileMap.put(tagName, path); - } else if (path.endsWith(IMPLICIT_TLD)) { - String tldName = path.substring(path.lastIndexOf("/") + 1); - if (IMPLICIT_TLD.equals(tldName)) { - parseImplicitTld(ctxt, path); - } - } - } - } - } - - - /** - * Returns an array of TagLibraryInfo objects representing the entire set - * of tag libraries (including this TagLibraryInfo) imported by taglib - * directives in the translation unit that references this - * TagLibraryInfo. - * - * If a tag library is imported more than once and bound to different - * prefices, only the TagLibraryInfo bound to the first prefix must be - * included in the returned array. - * - * @return Array of TagLibraryInfo objects representing the entire set - * of tag libraries (including this TagLibraryInfo) imported by taglib - * directives in the translation unit that references this TagLibraryInfo. - * - * @since 2.1 - */ - public TagLibraryInfo[] getTagLibraryInfos() { - - TagLibraryInfo[] taglibs = null; - - Collection c = pageInfo.getTaglibs(); - if (c != null) { - Object[] objs = c.toArray(); - if (objs != null && objs.length > 0) { - taglibs = new TagLibraryInfo[objs.length]; - for (int i=0; i cpath) { - // No op here, because the current classloader is used. However, - // This may not include the system classpath specified in options - } - - public long getClassLastModified() { - File classFile = new File(ctxt.getClassFileName()); - return classFile.lastModified(); - } - - public Writer getJavaWriter(String javaFileName, - String javaEncoding) - throws JasperException { - - this.javaFileName = javaFileName; - - Writer writer = null; - try { - writer = new OutputStreamWriter( - new FileOutputStream(javaFileName), javaEncoding); - } catch (UnsupportedEncodingException ex) { - errDispatcher.jspError("jsp.error.needAlternateJavaEncoding", - javaEncoding); - } catch (IOException ex) { - errDispatcher.jspError("jsp.error.unableToCreateOutputWriter", - javaFileName, ex); - } - return writer; - } - - public void setDebug(boolean debug) { - settings.put(CompilerOptions.OPTION_LineNumberAttribute, - CompilerOptions.GENERATE); - settings.put(CompilerOptions.OPTION_SourceFileAttribute, - CompilerOptions.GENERATE); - settings.put(CompilerOptions.OPTION_ReportDeprecation, - CompilerOptions.IGNORE); - if (debug) { - settings.put(CompilerOptions.OPTION_LocalVariableAttribute, - CompilerOptions.GENERATE); - } - } - - public void setSourceVM(String sourceVM) { - if(sourceVM.equals("1.1")) { - settings.put(CompilerOptions.OPTION_Source, - CompilerOptions.VERSION_1_1); - } else if(sourceVM.equals("1.2")) { - settings.put(CompilerOptions.OPTION_Source, - CompilerOptions.VERSION_1_2); - } else if(sourceVM.equals("1.3")) { - settings.put(CompilerOptions.OPTION_Source, - CompilerOptions.VERSION_1_3); - } else if(sourceVM.equals("1.4")) { - settings.put(CompilerOptions.OPTION_Source, - CompilerOptions.VERSION_1_4); - } else if(sourceVM.equals("1.5")) { - settings.put(CompilerOptions.OPTION_Source, - CompilerOptions.VERSION_1_5); - } else { - log.warning("Unknown source VM " + sourceVM + " ignored."); - settings.put(CompilerOptions.OPTION_Source, - CompilerOptions.VERSION_1_5); - } - } - - public void setTargetVM(String targetVM) { - if(targetVM.equals("1.1")) { - settings.put(CompilerOptions.OPTION_TargetPlatform, - CompilerOptions.VERSION_1_1); - } else if(targetVM.equals("1.2")) { - settings.put(CompilerOptions.OPTION_TargetPlatform, - CompilerOptions.VERSION_1_2); - } else if(targetVM.equals("1.3")) { - settings.put(CompilerOptions.OPTION_TargetPlatform, - CompilerOptions.VERSION_1_3); - } else if(targetVM.equals("1.4")) { - settings.put(CompilerOptions.OPTION_TargetPlatform, - CompilerOptions.VERSION_1_4); - } else if(targetVM.equals("1.5")) { - settings.put(CompilerOptions.OPTION_TargetPlatform, - CompilerOptions.VERSION_1_5); - } else { - log.warning("Unknown target VM " + targetVM + " ignored."); - settings.put(CompilerOptions.OPTION_TargetPlatform, - CompilerOptions.VERSION_1_5); - } - } - - public void saveClassFile(String className, String classFileName) { - // class file are alwyas saved. - } - - public void doJavaFile(boolean keep) { - if (!keep) { - File javaFile = new File(javaFileName); - javaFile.delete(); - } - } - - public JavacErrorDetail[] compile(final String targetClassName, - final Node.Nodes pageNodes) - throws JasperException { - - final String sourceFile = ctxt.getServletJavaFileName(); - final String outputDir = - ctxt.getOptions().getScratchDir().getAbsolutePath(); - String packageName = ctxt.getServletPackageName(); - - final ClassLoader classLoader = ctxt.getJspLoader(); - String[] fileNames = new String[] {sourceFile}; - String[] classNames = new String[] {targetClassName}; - final ArrayList problemList = - new ArrayList(); - - class CompilationUnit implements ICompilationUnit { - - String className; - String sourceFile; - - CompilationUnit(String sourceFile, String className) { - this.className = className; - this.sourceFile = sourceFile; - } - - public char[] getFileName() { - return className.toCharArray(); - } - - public char[] getContents() { - char[] result = null; - Reader reader = null; - try { - InputStreamReader isReader = - new InputStreamReader(new FileInputStream(sourceFile), - ctxt.getOptions().getJavaEncoding()); - reader = new BufferedReader(isReader); - if (reader != null) { - char[] chars = new char[8192]; - StringBuilder buf = new StringBuilder(); - int count; - while ((count = reader.read(chars, 0, - chars.length)) > 0) { - buf.append(chars, 0, count); - } - result = new char[buf.length()]; - buf.getChars(0, result.length, result, 0); - } - } catch (IOException e) { - log.log(Level.SEVERE, "Compilation error", e); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException ioe) { - // Ignore - } - } - } - return result; - } - - public char[] getMainTypeName() { - int dot = className.lastIndexOf('.'); - if (dot > 0) { - return className.substring(dot + 1).toCharArray(); - } - return className.toCharArray(); - } - - public char[][] getPackageName() { - StringTokenizer izer = - new StringTokenizer(className, "."); - char[][] result = new char[izer.countTokens()-1][]; - for (int i = 0; i < result.length; i++) { - String tok = izer.nextToken(); - result[i] = tok.toCharArray(); - } - return result; - } - } - - final INameEnvironment env = new INameEnvironment() { - - public NameEnvironmentAnswer - findType(char[][] compoundTypeName) { - String result = ""; - String sep = ""; - for (int i = 0; i < compoundTypeName.length; i++) { - result += sep; - result += new String(compoundTypeName[i]); - sep = "."; - } - return findType(result); - } - - public NameEnvironmentAnswer - findType(char[] typeName, - char[][] packageName) { - String result = ""; - String sep = ""; - for (int i = 0; i < packageName.length; i++) { - result += sep; - result += new String(packageName[i]); - sep = "."; - } - result += sep; - result += new String(typeName); - return findType(result); - } - - private NameEnvironmentAnswer findType(String className) { - - InputStream is = null; - try { - if (className.equals(targetClassName)) { - ICompilationUnit compilationUnit = - new CompilationUnit(sourceFile, className); - return - new NameEnvironmentAnswer(compilationUnit, null); - } - String resourceName = - className.replace('.', '/') + ".class"; - is = classLoader.getResourceAsStream(resourceName); - if (is != null) { - byte[] classBytes; - byte[] buf = new byte[8192]; - ByteArrayOutputStream baos = - new ByteArrayOutputStream(buf.length); - int count; - while ((count = is.read(buf, 0, buf.length)) > 0) { - baos.write(buf, 0, count); - } - baos.flush(); - classBytes = baos.toByteArray(); - char[] fileName = className.toCharArray(); - ClassFileReader classFileReader = - new ClassFileReader(classBytes, fileName, - true); - return - new NameEnvironmentAnswer(classFileReader, null); - } - } catch (IOException exc) { - log.log(Level.SEVERE, "Compilation error", exc); - } catch (org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException exc) { - log.log(Level.SEVERE, "Compilation error", exc); - } finally { - if (is != null) { - try { - is.close(); - } catch (IOException exc) { - // Ignore - } - } - } - return null; - } - - private boolean isPackage(String result) { - if (result.equals(targetClassName)) { - return false; - } - String resourceName = result.replace('.', '/') + ".class"; - InputStream is = - classLoader.getResourceAsStream(resourceName); - return is == null; - } - - public boolean isPackage(char[][] parentPackageName, - char[] packageName) { - String result = ""; - String sep = ""; - if (parentPackageName != null) { - for (int i = 0; i < parentPackageName.length; i++) { - result += sep; - String str = new String(parentPackageName[i]); - result += str; - sep = "."; - } - } - String str = new String(packageName); - if (Character.isUpperCase(str.charAt(0))) { - if (!isPackage(result)) { - return false; - } - } - result += sep; - result += str; - return isPackage(result); - } - - public void cleanup() { - } - - }; - - final IErrorHandlingPolicy policy = - DefaultErrorHandlingPolicies.proceedWithAllProblems(); - - if (ctxt.getOptions().getJavaEncoding() != null) { - settings.put(CompilerOptions.OPTION_Encoding, - ctxt.getOptions().getJavaEncoding()); - } - - final IProblemFactory problemFactory = - new DefaultProblemFactory(Locale.getDefault()); - - final ICompilerRequestor requestor = new ICompilerRequestor() { - public void acceptResult(CompilationResult result) { - try { - if (result.hasProblems()) { - IProblem[] problems = safeGetProblems(result); - for (int i = 0; i < problems.length; i++) { - IProblem problem = problems[i]; - if (problem.isError()) { - String name = - new String(problems[i].getOriginatingFileName()); - try { - problemList.add( - ErrorDispatcher.createJavacError( - name, - pageNodes, - new StringBuilder(problem.getMessage()), - problem.getSourceLineNumber())); - } catch (JasperException e) { - log.log(Level.SEVERE, "Error visiting node", e); - } - } - } - } - if (problemList.isEmpty()) { - ClassFile[] classFiles = result.getClassFiles(); - for (int i = 0; i < classFiles.length; i++) { - ClassFile classFile = classFiles[i]; - char[][] compoundName = - classFile.getCompoundName(); - String className = ""; - String sep = ""; - for (int j = 0; - j < compoundName.length; j++) { - className += sep; - className += new String(compoundName[j]); - sep = "."; - } - byte[] bytes = classFile.getBytes(); - String outFile = outputDir + "/" + - className.replace('.', '/') + ".class"; - FileOutputStream fout = - new FileOutputStream(outFile); - BufferedOutputStream bos = - new BufferedOutputStream(fout); - bos.write(bytes); - bos.close(); - } - } - } catch (IOException exc) { - log.log(Level.SEVERE, "Compilation error", exc); - } - } - }; - - ICompilationUnit[] compilationUnits = - new ICompilationUnit[classNames.length]; - for (int i = 0; i < compilationUnits.length; i++) { - compilationUnits[i] = new CompilationUnit(fileNames[i], classNames[i]); - } - - Compiler compiler = new Compiler(env, - policy, - settings, - requestor, - problemFactory); - compiler.compile(compilationUnits); - - if (problemList.isEmpty()) { - return null; - } - return problemList.toArray(new JavacErrorDetail[]{}); - } - - private static boolean USE_INTROSPECTION_TO_INVOKE_GET_PROBLEM = false; - private static java.lang.reflect.Method GET_PROBLEM_METH = null; - /** - * Invoke CompilationResult#getProblems safely so that it works with - * 3.1.1 and more recent versions of the eclipse java compiler. - * See https://jsp.dev.java.net/issues/show_bug.cgi?id=13 - * - * @param result The compilation result. - * @return The same object than CompilationResult#getProblems - */ - private static final IProblem[] safeGetProblems(CompilationResult result) { - if (!USE_INTROSPECTION_TO_INVOKE_GET_PROBLEM) { - try { - return result.getProblems(); - } catch (NoSuchMethodError re) { - USE_INTROSPECTION_TO_INVOKE_GET_PROBLEM = true; - } - } - try { - if (GET_PROBLEM_METH == null) { - GET_PROBLEM_METH = result.getClass() - .getDeclaredMethod("getProblems", new Class[] {}); - } - //an array of a particular type can be casted into an array of a super type. - return (IProblem[]) GET_PROBLEM_METH.invoke(result, null); - } catch (Throwable e) { - if (e instanceof RuntimeException) { - throw (RuntimeException)e; - } else { - throw new RuntimeException(e); - } - } - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/JasperTagInfo.java b/impl/src/main/java/org/apache/jasper/compiler/JasperTagInfo.java deleted file mode 100644 index e6e7552..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/JasperTagInfo.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import javax.servlet.jsp.tagext.*; - -/** - * TagInfo extension used by tag handlers that are implemented via tag files. - * This class provides access to the name of the Map used to store the - * dynamic attribute names and values passed to the custom action invocation. - * This information is used by the code generator. - */ -class JasperTagInfo extends TagInfo { - - private String dynamicAttrsMapName; - - public JasperTagInfo(String tagName, - String tagClassName, - String bodyContent, - String infoString, - TagLibraryInfo taglib, - TagExtraInfo tagExtraInfo, - TagAttributeInfo[] attributeInfo, - String displayName, - String smallIcon, - String largeIcon, - TagVariableInfo[] tvi, - String mapName) { - - super(tagName, tagClassName, bodyContent, infoString, taglib, - tagExtraInfo, attributeInfo, displayName, smallIcon, largeIcon, - tvi); - this.dynamicAttrsMapName = mapName; - } - - public String getDynamicAttributesMapName() { - return dynamicAttrsMapName; - } - - public boolean hasDynamicAttributes() { - return dynamicAttrsMapName != null; - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/JavaCompiler.java b/impl/src/main/java/org/apache/jasper/compiler/JavaCompiler.java deleted file mode 100644 index 8f6d429..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/JavaCompiler.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.File; -import java.io.Writer; -import java.util.List; - -import org.apache.jasper.JasperException; -import org.apache.jasper.JspCompilationContext; - -interface JavaCompiler { - - /** - * Start Java compilation - * @param className Name of the class under compilation - * @param pageNode Internal form for the page, used for error line mapping - */ - public JavacErrorDetail[] compile(String className, Node.Nodes pageNodes) - throws JasperException; - - /** - * Get a Writer for the Java file. - * The writer is used by JSP compiler. This method allows the Java - * compiler control where the Java file should be generated so it knows how - * to handle the input for java compilation accordingly. - */ - public Writer getJavaWriter(String javaFileName, String javaEncoding) - throws JasperException; - - /** - * Remove/save the generated Java File from/to disk - */ - public void doJavaFile(boolean keep) throws JasperException; - - /** - * Return the time the class file was generated. - */ - public long getClassLastModified(); - - /** - * Save the generated class file to disk, if not already done. - */ - public void saveClassFile(String className, String classFileName); - - /** - * Java Compiler options. - */ - public void setClassPath(List cp); - public void setDebug(boolean debug); - public void setExtdirs(String exts); - public void setTargetVM(String targetVM); - public void setSourceVM(String sourceVM); - - /** - * Initializations - */ - public void init(JspCompilationContext ctxt, - ErrorDispatcher err, - boolean suppressLogging); - - /** - * Release resouces used in the current compilation - */ - public void release(); -} - diff --git a/impl/src/main/java/org/apache/jasper/compiler/JavacErrorDetail.java b/impl/src/main/java/org/apache/jasper/compiler/JavacErrorDetail.java deleted file mode 100644 index 1fcf52b..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/JavacErrorDetail.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -/** - * Class providing details about a javac compilation error. - * - * @author Jan Luehe - * @author Kin-man Chung - */ -public class JavacErrorDetail { - - private String javaFileName; - private int javaLineNum; - private String jspFileName; - private int jspBeginLineNum; - private StringBuilder errMsg; - - /** - * Constructor. - * - * @param javaFileName The name of the Java file in which the - * compilation error occurred - * @param javaLineNum The compilation error line number - * @param errMsg The compilation error message - */ - public JavacErrorDetail(String javaFileName, - int javaLineNum, - StringBuilder errMsg) { - - this.javaFileName = javaFileName; - this.javaLineNum = javaLineNum; - this.errMsg = errMsg; - this.jspBeginLineNum = -1; - } - - /** - * Constructor. - * - * @param javaFileName The name of the Java file in which the - * compilation error occurred - * @param javaLineNum The compilation error line number - * @param jspFileName The name of the JSP file from which the Java source - * file was generated - * @param jspBeginLineNum The start line number of the JSP element - * responsible for the compilation error - * @param errMsg The compilation error message - */ - public JavacErrorDetail(String javaFileName, - int javaLineNum, - String jspFileName, - int jspBeginLineNum, - StringBuilder errMsg) { - - this(javaFileName, javaLineNum, errMsg); - this.jspFileName = jspFileName; - this.jspBeginLineNum = jspBeginLineNum; - } - - /** - * Gets the name of the Java source file in which the compilation error - * occurred. - * - * @return Java source file name - */ - public String getJavaFileName() { - return this.javaFileName; - } - - /** - * Gets the compilation error line number. - * - * @return Compilation error line number - */ - public int getJavaLineNumber() { - return this.javaLineNum; - } - - /** - * Gets the name of the JSP file from which the Java source file was - * generated. - * - * @return JSP file from which the Java source file was generated. - */ - public String getJspFileName() { - return this.jspFileName; - } - - /** - * Gets the start line number (in the JSP file) of the JSP element - * responsible for the compilation error. - * - * @return Start line number of the JSP element responsible for the - * compilation error - */ - public int getJspBeginLineNumber() { - return this.jspBeginLineNum; - } - - /** - * Gets the compilation error message. - * - * @return Compilation error message - */ - public String getErrorMessage() { - return this.errMsg.toString(); - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/JspConfig.java b/impl/src/main/java/org/apache/jasper/compiler/JspConfig.java deleted file mode 100644 index b2d94d1..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/JspConfig.java +++ /dev/null @@ -1,454 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.logging.Logger; -import java.util.logging.Level; - -import javax.servlet.ServletContext; -import javax.servlet.descriptor.JspConfigDescriptor; -import javax.servlet.descriptor.JspPropertyGroupDescriptor; - -import org.apache.jasper.JasperException; -import org.apache.jasper.Constants; - -/** - * Handles the jsp-config element in WEB_INF/web.xml. This is used - * for specifying the JSP configuration information on a JSP page - * - * @author Kin-man Chung - */ - -public class JspConfig { - - private static final String WEB_XML = "/WEB-INF/web.xml"; - - // Logger - private static Logger log = Logger.getLogger(JspConfig.class.getName()); - - private ArrayList jspProperties = null; - private ServletContext ctxt; - private boolean initialized = false; - - private String defaultIsXml = null; // unspecified - private String defaultIsELIgnored = null; // unspecified - private String defaultIsScriptingInvalid = "false"; - private String defaultTrimSpaces = "false"; - private String defaultPoundAllowed = "false"; - private String defaultErrorOnUndeclaredNamespace = "false"; - private JspProperty defaultJspProperty; - - public JspConfig(ServletContext ctxt) { - this.ctxt = ctxt; - } - - private void processWebDotXml(ServletContext ctxt) throws JasperException { - - JspConfigDescriptor jspConfig = ctxt.getJspConfigDescriptor(); - if (jspConfig == null) { - return; - } - - jspProperties = new ArrayList(); - for (JspPropertyGroupDescriptor jpg: jspConfig.getJspPropertyGroups()) { - - Collection urlPatterns = jpg.getUrlPatterns(); - String pageEncoding = jpg.getPageEncoding(); - String scriptingInvalid = jpg.getScriptingInvalid(); - String elIgnored = jpg.getElIgnored(); - String isXml = jpg.getIsXml(); - String trimSpaces = jpg.getTrimDirectiveWhitespaces(); - String poundAllowed = jpg.getDeferredSyntaxAllowedAsLiteral(); - String buffer = jpg.getBuffer(); - String defaultContentType = jpg.getDefaultContentType(); - String errorOnUndeclaredNamespace = jpg.getErrorOnUndeclaredNamespace(); - ArrayList includePrelude = new ArrayList(); - includePrelude.addAll(jpg.getIncludePreludes()); - ArrayList includeCoda = new ArrayList(); - includeCoda.addAll(jpg.getIncludeCodas()); - - // Creates a JspPropertyGroup for each url pattern in the given - // urlPatterns, and adds it to the given jspProperties. - // This simplifies the matching logic. - - for (String urlPattern: urlPatterns) { - String path = null; - String extension = null; - - if (urlPattern.indexOf('*') < 0) { - // Exact match - path = urlPattern; - } else { - int i = urlPattern.lastIndexOf('/'); - String file; - if (i >= 0) { - path = urlPattern.substring(0,i+1); - file = urlPattern.substring(i+1); - } else { - file = urlPattern; - } - - // pattern must be "*", or of the form "*.jsp" - if (file.equals("*")) { - extension = "*"; - } else if (file.startsWith("*.")) { - extension = file.substring(file.indexOf('.')+1); - } - - // The url patterns are reconstructed as the following: - // path != null, extension == null: / or /foo/bar.ext - // path == null, extension != null: *.ext - // path != null, extension == "*": /foo/* - boolean isStar = "*".equals(extension); - if ((path == null && (extension == null || isStar)) - || (path != null && !isStar)) { - if (log.isLoggable(Level.WARNING)) { - log.warning(Localizer.getMessage( - "jsp.warning.bad.urlpattern.propertygroup", - urlPattern)); - } - continue; - } - } - - JspProperty property = new JspProperty(isXml, - elIgnored, - scriptingInvalid, - trimSpaces, - poundAllowed, - pageEncoding, - includePrelude, - includeCoda, - defaultContentType, - buffer, - errorOnUndeclaredNamespace); - JspPropertyGroup propertyGroup = - new JspPropertyGroup(path, extension, property); - - jspProperties.add(propertyGroup); - } - } - } - - private synchronized void init() throws JasperException { - - if (!initialized) { - - processWebDotXml(ctxt); - if (ctxt.getEffectiveMajorVersion() < 2 || - (ctxt.getEffectiveMajorVersion() == 2 && - ctxt.getEffectiveMinorVersion() <= 3)) { - // for version 2.3 or before, default for el-ignored is true - defaultIsELIgnored = "true"; - } - - defaultJspProperty = new JspProperty(defaultIsXml, - defaultIsELIgnored, - defaultIsScriptingInvalid, - defaultTrimSpaces, - defaultPoundAllowed, - null, null, null, - null, null, - defaultErrorOnUndeclaredNamespace); - initialized = true; - } - } - - /** - * Select the property group that has more restrictive url-pattern. - * In case of tie, select the first. - */ - private JspPropertyGroup selectProperty(JspPropertyGroup prev, - JspPropertyGroup curr) { - if (prev == null) { - return curr; - } - if (prev.getExtension() == null) { - // exact match - return prev; - } - if (curr.getExtension() == null) { - // exact match - return curr; - } - String prevPath = prev.getPath(); - String currPath = curr.getPath(); - if (prevPath == null && currPath == null) { - // Both specifies a *.ext, keep the first one - return prev; - } - if (prevPath == null && currPath != null) { - return curr; - } - if (prevPath != null && currPath == null) { - return prev; - } - if (prevPath.length() >= currPath.length()) { - return prev; - } - return curr; - } - - - /** - * Find a property that best matches the supplied resource. - * @param uri the resource supplied. - * @return a JspProperty indicating the best match, or some default. - */ - public JspProperty findJspProperty(String uri) throws JasperException { - - init(); - - // JSP Configuration settings do not apply to tag files - if (jspProperties == null || uri.endsWith(".tag") - || uri.endsWith(".tagx")) { - return defaultJspProperty; - } - - String uriPath = null; - int index = uri.lastIndexOf('/'); - if (index >=0 ) { - uriPath = uri.substring(0, index+1); - } - String uriExtension = null; - index = uri.lastIndexOf('.'); - if (index >=0) { - uriExtension = uri.substring(index+1); - } - - ArrayList includePreludes = new ArrayList(); - ArrayList includeCodas = new ArrayList(); - - JspPropertyGroup isXmlMatch = null; - JspPropertyGroup elIgnoredMatch = null; - JspPropertyGroup scriptingInvalidMatch = null; - JspPropertyGroup trimSpacesMatch = null; - JspPropertyGroup poundAllowedMatch = null; - JspPropertyGroup pageEncodingMatch = null; - JspPropertyGroup defaultContentTypeMatch = null; - JspPropertyGroup bufferMatch = null; - JspPropertyGroup errorOnUndeclaredNamespaceMatch = null; - - for (JspPropertyGroup jpg: jspProperties) { - - JspProperty jp = jpg.getJspProperty(); - - // (arrays will be the same length) - String extension = jpg.getExtension(); - String path = jpg.getPath(); - - if (extension == null) { - // exact match pattern: /a/foo.jsp - if (!uri.equals(path)) { - // not matched; - continue; - } - } else { - // Matching patterns *.ext or /p/* - if (path != null && uriPath != null && - ! uriPath.startsWith(path)) { - // not matched - continue; - } - if (!extension.equals("*") && - !extension.equals(uriExtension)) { - // not matched - continue; - } - } - // We have a match - // Add include-preludes and include-codas - if (jp.getIncludePrelude() != null) { - includePreludes.addAll(jp.getIncludePrelude()); - } - if (jp.getIncludeCoda() != null) { - includeCodas.addAll(jp.getIncludeCoda()); - } - - // If there is a previous match for the same property, remember - // the one that is more restrictive. - if (jp.isXml() != null) { - isXmlMatch = selectProperty(isXmlMatch, jpg); - } - if (jp.isELIgnored() != null) { - elIgnoredMatch = selectProperty(elIgnoredMatch, jpg); - } - if (jp.isScriptingInvalid() != null) { - scriptingInvalidMatch = - selectProperty(scriptingInvalidMatch, jpg); - } - if (jp.getPageEncoding() != null) { - pageEncodingMatch = selectProperty(pageEncodingMatch, jpg); - } - if (jp.getTrimSpaces() != null) { - trimSpacesMatch = selectProperty(trimSpacesMatch, jpg); - } - if (jp.getPoundAllowed() != null) { - poundAllowedMatch = selectProperty(poundAllowedMatch, jpg); - } - if (jp.getDefaultContentType() != null) { - defaultContentTypeMatch = - selectProperty(defaultContentTypeMatch, jpg); - } - if (jp.getBuffer() != null) { - bufferMatch = selectProperty(bufferMatch, jpg); - } - if (jp.errorOnUndeclaredNamespace() != null) { - errorOnUndeclaredNamespaceMatch = - selectProperty(errorOnUndeclaredNamespaceMatch, jpg); - } - } - - - String isXml = defaultIsXml; - String isELIgnored = defaultIsELIgnored; - String isScriptingInvalid = defaultIsScriptingInvalid; - String trimSpaces = defaultTrimSpaces; - String poundAllowed = defaultPoundAllowed; - String pageEncoding = null; - String defaultContentType = null; - String buffer = null; - String errorOnUndeclaredNamespace = defaultErrorOnUndeclaredNamespace; - - if (isXmlMatch != null) { - isXml = isXmlMatch.getJspProperty().isXml(); - } - if (elIgnoredMatch != null) { - isELIgnored = elIgnoredMatch.getJspProperty().isELIgnored(); - } - if (scriptingInvalidMatch != null) { - isScriptingInvalid = - scriptingInvalidMatch.getJspProperty().isScriptingInvalid(); - } - if (trimSpacesMatch != null) { - trimSpaces = trimSpacesMatch.getJspProperty().getTrimSpaces(); - } - if (poundAllowedMatch != null) { - poundAllowed = poundAllowedMatch.getJspProperty().getPoundAllowed(); - } - if (pageEncodingMatch != null) { - pageEncoding = pageEncodingMatch.getJspProperty().getPageEncoding(); - } - if (defaultContentTypeMatch != null) { - defaultContentType = - defaultContentTypeMatch.getJspProperty().getDefaultContentType(); - } - if (bufferMatch != null) { - buffer = bufferMatch.getJspProperty().getBuffer(); - } - if (errorOnUndeclaredNamespaceMatch != null) { - errorOnUndeclaredNamespace = errorOnUndeclaredNamespaceMatch. - getJspProperty().errorOnUndeclaredNamespace(); - } - - return new JspProperty(isXml, isELIgnored, isScriptingInvalid, - trimSpaces, poundAllowed, - pageEncoding, includePreludes, includeCodas, - defaultContentType, buffer, - errorOnUndeclaredNamespace); - } - - /** - * To find out if an uri matches an url pattern in jsp config. If so, - * then the uri is a JSP page. This is used primarily for jspc. - */ - public boolean isJspPage(String uri) throws JasperException { - - init(); - if (jspProperties == null) { - return false; - } - - String uriPath = null; - int index = uri.lastIndexOf('/'); - if (index >=0 ) { - uriPath = uri.substring(0, index+1); - } - String uriExtension = null; - index = uri.lastIndexOf('.'); - if (index >=0) { - uriExtension = uri.substring(index+1); - } - - for (JspPropertyGroup jpg: jspProperties) { - - JspProperty jp = jpg.getJspProperty(); - - String extension = jpg.getExtension(); - String path = jpg.getPath(); - - if (extension == null) { - if (uri.equals(path)) { - // There is an exact match - return true; - } - } else { - if ((path == null || path.equals(uriPath)) && - (extension.equals("*") || extension.equals(uriExtension))) { - // Matches *, *.ext, /p/*, or /p/*.ext - return true; - } - } - } - return false; - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/JspDocumentParser.java b/impl/src/main/java/org/apache/jasper/compiler/JspDocumentParser.java deleted file mode 100644 index 1443aa2..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/JspDocumentParser.java +++ /dev/null @@ -1,1538 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.CharArrayWriter; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; - -// START GlassFish 750 -import java.util.concurrent.ConcurrentHashMap; -// START GlassFish 750 -import java.util.Iterator; -import java.util.List; -import java.util.jar.JarFile; -import java.security.AccessController; - -import javax.servlet.jsp.tagext.TagFileInfo; -import javax.servlet.jsp.tagext.TagInfo; -import javax.servlet.jsp.tagext.TagLibraryInfo; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -import org.apache.jasper.JasperException; -import org.apache.jasper.Constants; -import org.apache.jasper.security.PrivilegedGetTccl; -import org.apache.jasper.security.PrivilegedSetTccl; -import org.apache.jasper.JspCompilationContext; -import org.xml.sax.Attributes; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.XMLReader; -import org.xml.sax.ext.LexicalHandler; -import org.xml.sax.helpers.AttributesImpl; -import org.xml.sax.helpers.DefaultHandler; - -/** - * Class implementing a parser for a JSP document, that is, a JSP page in XML - * syntax. - * - * @author Jan Luehe - * @author Kin-man Chung - */ - -class JspDocumentParser - extends DefaultHandler - implements LexicalHandler, TagConstants { - - private static final String JSP_VERSION = "version"; - private static final String LEXICAL_HANDLER_PROPERTY = - "http://xml.org/sax/properties/lexical-handler"; - private static final String JSP_URI = "http://java.sun.com/JSP/Page"; - - private static final EnableDTDValidationException ENABLE_DTD_VALIDATION_EXCEPTION = - new EnableDTDValidationException( - "jsp.error.enable_dtd_validation", - null); - - private ParserController parserController; - private JspCompilationContext ctxt; - private PageInfo pageInfo; - private String path; - private StringBuilder charBuffer; - - // Node representing the XML element currently being parsed - private Node current; - - /* - * Outermost (in the nesting hierarchy) node whose body is declared to be - * scriptless. If a node's body is declared to be scriptless, all its - * nested nodes must be scriptless, too. - */ - private Node scriptlessBodyNode; - - private Locator locator; - - //Mark representing the start of the current element. Note - //that locator.getLineNumber() and locator.getColumnNumber() - //return the line and column numbers for the character - //immediately _following_ the current element. The underlying - //XMl parser eats white space that is not part of character - //data, so for Nodes that are not created from character data, - //this is the best we can do. But when we parse character data, - //we get an accurate starting location by starting with startMark - //as set by the previous element, and updating it as we advance - //through the characters. - private Mark startMark; - - // Flag indicating whether we are inside DTD declarations - private boolean inDTD; - - private boolean isValidating; - - private ErrorDispatcher err; - private boolean isTagFile; - private boolean directivesOnly; - private boolean isTop; - - // Nesting level of Tag dependent bodies - private int tagDependentNesting = 0; - // Flag set to delay incrmenting tagDependentNesting until jsp:body - // is first encountered - private boolean tagDependentPending = false; - - /* - * Constructor - */ - public JspDocumentParser( - ParserController pc, - String path, - boolean isTagFile, - boolean directivesOnly) { - this.parserController = pc; - this.ctxt = pc.getJspCompilationContext(); - this.pageInfo = pc.getCompiler().getPageInfo(); - this.err = pc.getCompiler().getErrorDispatcher(); - this.path = path; - this.isTagFile = isTagFile; - this.directivesOnly = directivesOnly; - this.isTop = true; - } - - /* - * Parses a JSP document by responding to SAX events. - * - * @throws JasperException - */ - public static Node.Nodes parse( - ParserController pc, - String path, - JarFile jarFile, - Node parent, - boolean isTagFile, - boolean directivesOnly, - String pageEnc, - String jspConfigPageEnc, - boolean isEncodingSpecifiedInProlog) - throws JasperException { - - JspDocumentParser jspDocParser = - new JspDocumentParser(pc, path, isTagFile, directivesOnly); - Node.Nodes pageNodes = null; - - try { - - // Create dummy root and initialize it with given page encodings - Node.Root dummyRoot = new Node.Root(null, parent, true); - dummyRoot.setPageEncoding(pageEnc); - dummyRoot.setJspConfigPageEncoding(jspConfigPageEnc); - dummyRoot.setIsEncodingSpecifiedInProlog( - isEncodingSpecifiedInProlog); - jspDocParser.current = dummyRoot; - if (parent == null) { - jspDocParser.addInclude( - dummyRoot, - jspDocParser.pageInfo.getIncludePrelude()); - } else { - jspDocParser.isTop = false; - } - - // Parse the input - SAXParser saxParser = getSAXParser(false, jspDocParser); - InputStream inStream = null; - try { - inStream = JspUtil.getInputStream(path, jarFile, - jspDocParser.ctxt, - jspDocParser.err); - saxParser.parse(new InputSource(inStream), jspDocParser); - } catch (EnableDTDValidationException e) { - saxParser = getSAXParser(true, jspDocParser); - jspDocParser.isValidating = true; - if (inStream != null) { - try { - inStream.close(); - } catch (Exception any) { - } - } - inStream = JspUtil.getInputStream(path, jarFile, - jspDocParser.ctxt, - jspDocParser.err); - saxParser.parse(new InputSource(inStream), jspDocParser); - } finally { - if (inStream != null) { - try { - inStream.close(); - } catch (Exception any) { - } - } - } - - if (parent == null) { - jspDocParser.addInclude( - dummyRoot, - jspDocParser.pageInfo.getIncludeCoda()); - jspDocParser.pageInfo.setRootPath(path); - } - - // Create Node.Nodes from dummy root - pageNodes = new Node.Nodes(dummyRoot); - - } catch (IOException ioe) { - jspDocParser.err.jspError("jsp.error.data.file.read", path, ioe); - } catch (SAXParseException e) { - jspDocParser.err.jspError - (new Mark(jspDocParser.ctxt, path, e.getLineNumber(), - e.getColumnNumber()), - e.getMessage()); - } catch (Exception e) { - jspDocParser.err.jspError(e); - } - - return pageNodes; - } - - /* - * Processes the given list of included files. - * - * This is used to implement the include-prelude and include-coda - * subelements of the jsp-config element in web.xml - */ - private void addInclude(Node parent, List files) throws SAXException { - if (files != null) { - Iterator iter = files.iterator(); - while (iter.hasNext()) { - String file = (String)iter.next(); - AttributesImpl attrs = new AttributesImpl(); - attrs.addAttribute("", "file", "file", "CDATA", file); - - // Create a dummy Include directive node - Node includeDir = - new Node.IncludeDirective(attrs, null, // XXX - parent); - processIncludeDirective(file, includeDir); - } - } - } - - /* - * Receives notification of the start of an element. - * - * This method assigns the given tag attributes to one of 3 buckets: - * - * - "xmlns" attributes that represent (standard or custom) tag libraries. - * - "xmlns" attributes that do not represent tag libraries. - * - all remaining attributes. - * - * For each "xmlns" attribute that represents a custom tag library, the - * corresponding TagLibraryInfo object is added to the set of custom - * tag libraries. - */ - public void startElement( - String uri, - String localName, - String qName, - Attributes attrs) - throws SAXException { - - AttributesImpl taglibAttrs = null; - AttributesImpl nonTaglibAttrs = null; - AttributesImpl nonTaglibXmlnsAttrs = null; - - processChars(); - - checkPrefixes(uri, qName, attrs); - - if (directivesOnly && - !(JSP_URI.equals(uri) && - (localName.startsWith(DIRECTIVE_ACTION) - || localName.startsWith(ROOT_ACTION)))) { - return; - } - - // jsp:text must not have any subelements - if (JSP_URI.equals(uri) && TEXT_ACTION.equals(current.getLocalName())) { - throw new SAXParseException( - Localizer.getMessage("jsp.error.text.has_subelement"), - locator); - } - - startMark = new Mark(ctxt, path, locator.getLineNumber(), - locator.getColumnNumber()); - - if (attrs != null) { - /* - * Notice that due to a bug in the underlying SAX parser, the - * attributes must be enumerated in descending order. - */ - boolean isTaglib = false; - for (int i = attrs.getLength() - 1; i >= 0; i--) { - isTaglib = false; - String attrQName = attrs.getQName(i); - if (!attrQName.startsWith("xmlns")) { - if (nonTaglibAttrs == null) { - nonTaglibAttrs = new AttributesImpl(); - } - nonTaglibAttrs.addAttribute( - attrs.getURI(i), - attrs.getLocalName(i), - attrs.getQName(i), - attrs.getType(i), - attrs.getValue(i)); - } else { - if (attrQName.startsWith("xmlns:jsp")) { - isTaglib = true; - } else { - String attrUri = attrs.getValue(i); - // TaglibInfo for this uri already established in - // startPrefixMapping - isTaglib = pageInfo.hasTaglib(attrUri); - } - if (isTaglib) { - if (taglibAttrs == null) { - taglibAttrs = new AttributesImpl(); - } - taglibAttrs.addAttribute( - attrs.getURI(i), - attrs.getLocalName(i), - attrs.getQName(i), - attrs.getType(i), - attrs.getValue(i)); - } else { - if (nonTaglibXmlnsAttrs == null) { - nonTaglibXmlnsAttrs = new AttributesImpl(); - } - nonTaglibXmlnsAttrs.addAttribute( - attrs.getURI(i), - attrs.getLocalName(i), - attrs.getQName(i), - attrs.getType(i), - attrs.getValue(i)); - } - } - } - } - - Node node = null; - - if (tagDependentPending && JSP_URI.equals(uri) && - localName.equals(BODY_ACTION)) { - tagDependentPending = false; - tagDependentNesting++; - current = - parseStandardAction( - qName, - localName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - startMark, - current); - return; - } - - if (tagDependentPending && JSP_URI.equals(uri) && - localName.equals(ATTRIBUTE_ACTION)) { - current = - parseStandardAction( - qName, - localName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - startMark, - current); - return; - } - - if (tagDependentPending) { - tagDependentPending = false; - tagDependentNesting++; - } - - if (tagDependentNesting > 0) { - node = - new Node.UninterpretedTag( - qName, - localName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - startMark, - current); - } else if (JSP_URI.equals(uri)) { - node = - parseStandardAction( - qName, - localName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - startMark, - current); - } else { - node = - parseCustomAction( - qName, - localName, - uri, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - startMark, - current); - if (node == null) { - node = - new Node.UninterpretedTag( - qName, - localName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - startMark, - current); - } else { - // custom action - String bodyType = getBodyType((Node.CustomTag) node); - - if (scriptlessBodyNode == null - && bodyType.equalsIgnoreCase(TagInfo.BODY_CONTENT_SCRIPTLESS)) { - scriptlessBodyNode = node; - } - else if (TagInfo.BODY_CONTENT_TAG_DEPENDENT.equalsIgnoreCase(bodyType)) { - tagDependentPending = true; - } - } - } - - current = node; - } - - /* - * Receives notification of character data inside an element. - * - * The SAX does not call this method with all of the template text, but may - * invoke this method with chunks of it. This is a problem when we try - * to determine if the text contains only whitespaces, or when we are - * looking for an EL expression string. Therefore it is necessary to - * buffer and concatenate the chunks and process the concatenated text - * later (at beginTag and endTag) - * - * @param buf The characters - * @param offset The start position in the character array - * @param len The number of characters to use from the character array - * - * @throws SAXException - */ - public void characters(char[] buf, int offset, int len) { - - if (charBuffer == null) { - charBuffer = new StringBuilder(); - } - charBuffer.append(buf, offset, len); - } - - private void processChars() throws SAXException { - - if (charBuffer == null || directivesOnly) { - return; - } - - /* - * JSP.6.1.1: All textual nodes that have only white space are to be - * dropped from the document, except for nodes in a jsp:text element, - * and any leading and trailing white-space-only textual nodes in a - * jsp:attribute whose 'trim' attribute is set to FALSE, which are to - * be kept verbatim. - * JSP.6.2.3 defines white space characters. - */ - boolean isAllSpace = true; - if (!(current instanceof Node.JspText) - && !(current instanceof Node.NamedAttribute)) { - for (int i = 0; i < charBuffer.length(); i++) { - if (!(charBuffer.charAt(i) == ' ' - || charBuffer.charAt(i) == '\n' - || charBuffer.charAt(i) == '\r' - || charBuffer.charAt(i) == '\t')) { - isAllSpace = false; - break; - } - } - } - - if (!isAllSpace && tagDependentPending) { - tagDependentPending = false; - tagDependentNesting++; - } - - if (tagDependentNesting > 0) { - if (charBuffer.length() > 0) { - new Node.TemplateText(charBuffer.toString(), startMark, current); - } - startMark = new Mark(ctxt, path, locator.getLineNumber(), - locator.getColumnNumber()); - charBuffer = null; - return; - } - - if ((current instanceof Node.JspText) - || (current instanceof Node.NamedAttribute) - || !isAllSpace) { - - int line = startMark.getLineNumber(); - int column = startMark.getColumnNumber(); - - CharArrayWriter ttext = new CharArrayWriter(); - int lastCh = 0; - for (int i = 0; i < charBuffer.length(); i++) { - - int ch = charBuffer.charAt(i); - if (ch == '\n') { - column = 1; - line++; - } else { - column++; - } - if ((lastCh == '$' || lastCh == '#') && ch == '{') { - if (ttext.size() > 0) { - new Node.TemplateText( - ttext.toString(), - startMark, - current); - ttext = new CharArrayWriter(); - //We subtract two from the column number to - //account for the '${' that we've already parsed - startMark = new Mark(ctxt, path, line, column - 2); - } - ttext.write(lastCh); - ttext.write('{'); - // following "${" to first unquoted "}" - i++; - boolean singleQ = false; - boolean doubleQ = false; - lastCh = 0; - for (;; i++) { - if (i >= charBuffer.length()) { - throw new SAXParseException( - Localizer.getMessage( - "jsp.error.unterminated", - lastCh=='$'? "${": "#{"), - locator); - - } - ch = charBuffer.charAt(i); - if (ch == '\n') { - column = 1; - line++; - } else { - column++; - } - if (lastCh == '\\' && (singleQ || doubleQ)) { - ttext.write(ch); - lastCh = 0; - continue; - } - if (ch == '}') { - ttext.write('}'); - new Node.ELExpression( - ttext.toString(), - startMark, - current); - ttext = new CharArrayWriter(); - startMark = new Mark(ctxt, path, line, column); - break; - } - if (ch == '"') - doubleQ = !doubleQ; - else if (ch == '\'') - singleQ = !singleQ; - - ttext.write(ch); - lastCh = ch; - } - } else if (lastCh == '\\' && (ch == '$' || ch == '#')) { - ttext.write(ch); - ch = 0; // Not start of EL anymore - } else { - if (lastCh == '$' || lastCh == '#' || lastCh == '\\') { - ttext.write(lastCh); - } - if (ch != '$' && ch != '#' && ch != '\\') { - ttext.write(ch); - } - } - lastCh = ch; - } - if (lastCh == '$' || lastCh == '#' || lastCh == '\\') { - ttext.write(lastCh); - } - if (ttext.size() > 0) { - new Node.TemplateText(ttext.toString(), startMark, current); - } - } - startMark = new Mark(ctxt, path, locator.getLineNumber(), - locator.getColumnNumber()); - - charBuffer = null; - } - - /* - * Receives notification of the end of an element. - */ - public void endElement(String uri, String localName, String qName) - throws SAXException { - - processChars(); - - if (directivesOnly && - !(JSP_URI.equals(uri) && localName.startsWith(DIRECTIVE_ACTION))) { - return; - } - - if (current instanceof Node.NamedAttribute) { - boolean isTrim = ((Node.NamedAttribute)current).isTrim(); - Node.Nodes subElems = ((Node.NamedAttribute)current).getBody(); - for (int i = 0; subElems != null && i < subElems.size(); i++) { - Node subElem = subElems.getNode(i); - if (!(subElem instanceof Node.TemplateText)) { - continue; - } - // Ignore any whitespace (including spaces, carriage returns, - // line feeds, and tabs, that appear at the beginning and at - // the end of the body of the action, if the - // action's 'trim' attribute is set to TRUE (default). - // In addition, any textual nodes in the that - // have only white space are dropped from the document, with - // the exception of leading and trailing white-space-only - // textual nodes in a whose 'trim' attribute - // is set to FALSE, which must be kept verbatim. - if (i == 0) { - if (isTrim) { - ((Node.TemplateText)subElem).ltrim(); - } - } else if (i == subElems.size() - 1) { - if (isTrim) { - ((Node.TemplateText)subElem).rtrim(); - } - } else { - if (((Node.TemplateText)subElem).isAllSpace()) { - subElems.remove(subElem); - } - } - } - } else if (current instanceof Node.ScriptingElement) { - checkScriptingBody((Node.ScriptingElement)current); - } - - if ( isTagDependent(current)) { - tagDependentNesting--; - } - - if (scriptlessBodyNode != null - && current.equals(scriptlessBodyNode)) { - scriptlessBodyNode = null; - } - - if (current.getParent() != null) { - current = current.getParent(); - } - } - - /* - * Receives the document locator. - * - * @param locator the document locator - */ - public void setDocumentLocator(Locator locator) { - this.locator = locator; - } - - /* - * See org.xml.sax.ext.LexicalHandler. - */ - public void comment(char[] buf, int offset, int len) throws SAXException { - - processChars(); // Flush char buffer and remove white spaces - - // ignore comments in the DTD - if (!inDTD) { - startMark = - new Mark( - ctxt, - path, - locator.getLineNumber(), - locator.getColumnNumber()); - new Node.Comment(new String(buf, offset, len), startMark, current); - } - } - - /* - * See org.xml.sax.ext.LexicalHandler. - */ - public void startCDATA() throws SAXException { - - processChars(); // Flush char buffer and remove white spaces - startMark = new Mark(ctxt, path, locator.getLineNumber(), - locator.getColumnNumber()); - } - - /* - * See org.xml.sax.ext.LexicalHandler. - */ - public void endCDATA() throws SAXException { - processChars(); // Flush char buffer and remove white spaces - } - - /* - * See org.xml.sax.ext.LexicalHandler. - */ - public void startEntity(String name) throws SAXException { - // do nothing - } - - /* - * See org.xml.sax.ext.LexicalHandler. - */ - public void endEntity(String name) throws SAXException { - // do nothing - } - - /* - * See org.xml.sax.ext.LexicalHandler. - */ - public void startDTD(String name, String publicId, String systemId) - throws SAXException { - if (!isValidating) { - fatalError(ENABLE_DTD_VALIDATION_EXCEPTION); - } - - inDTD = true; - } - - /* - * See org.xml.sax.ext.LexicalHandler. - */ - public void endDTD() throws SAXException { - inDTD = false; - } - - /* - * Receives notification of a non-recoverable error. - */ - public void fatalError(SAXParseException e) throws SAXException { - throw e; - } - - /* - * Receives notification of a recoverable error. - */ - public void error(SAXParseException e) throws SAXException { - throw e; - } - - /* - * Receives notification of the start of a Namespace mapping. - */ - public void startPrefixMapping(String prefix, String uri) - throws SAXException { - - if (directivesOnly && !(JSP_URI.equals(uri))) { - return; - } - - try { - addTaglibInfo(prefix, uri); - } catch (JasperException je) { - throw new SAXParseException( - Localizer.getMessage("jsp.error.could.not.add.taglibraries"), - locator, - je); - } - } - - /* - * Receives notification of the end of a Namespace mapping. - */ - public void endPrefixMapping(String prefix) throws SAXException { - - if (directivesOnly) { - String uri = pageInfo.getURI(prefix); - if (!JSP_URI.equals(uri)) { - return; - } - } - - pageInfo.popPrefixMapping(prefix); - } - - //********************************************************************* - // Private utility methods - - private Node parseStandardAction( - String qName, - String localName, - Attributes nonTaglibAttrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, - Mark start, - Node parent) - throws SAXException { - - Node node = null; - - if (localName.equals(ROOT_ACTION)) { - if (!(current instanceof Node.Root)) { - throw new SAXParseException( - Localizer.getMessage("jsp.error.nested_jsproot"), - locator); - } - node = - new Node.JspRoot( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - if (isTop) { - pageInfo.setHasJspRoot(true); - } - } else if (localName.equals(PAGE_DIRECTIVE_ACTION)) { - if (isTagFile) { - throw new SAXParseException( - Localizer.getMessage( - "jsp.error.action.istagfile", - localName), - locator); - } - node = - new Node.PageDirective( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - String imports = nonTaglibAttrs.getValue("import"); - // There can only be one 'import' attribute per page directive - if (imports != null) { - ((Node.PageDirective)node).addImport(imports); - } - } else if (localName.equals(INCLUDE_DIRECTIVE_ACTION)) { - node = - new Node.IncludeDirective( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - processIncludeDirective(nonTaglibAttrs.getValue("file"), node); - } else if (localName.equals(DECLARATION_ACTION)) { - if (scriptlessBodyNode != null) { - // We're nested inside a node whose body is - // declared to be scriptless - throw new SAXParseException( - Localizer.getMessage( - "jsp.error.no.scriptlets", - localName), - locator); - } - node = - new Node.Declaration( - qName, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(SCRIPTLET_ACTION)) { - if (scriptlessBodyNode != null) { - // We're nested inside a node whose body is - // declared to be scriptless - throw new SAXParseException( - Localizer.getMessage( - "jsp.error.no.scriptlets", - localName), - locator); - } - node = - new Node.Scriptlet( - qName, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(EXPRESSION_ACTION)) { - if (scriptlessBodyNode != null) { - // We're nested inside a node whose body is - // declared to be scriptless - throw new SAXParseException( - Localizer.getMessage( - "jsp.error.no.scriptlets", - localName), - locator); - } - node = - new Node.Expression( - qName, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(USE_BEAN_ACTION)) { - node = - new Node.UseBean( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(SET_PROPERTY_ACTION)) { - node = - new Node.SetProperty( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(GET_PROPERTY_ACTION)) { - node = - new Node.GetProperty( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(INCLUDE_ACTION)) { - node = - new Node.IncludeAction( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(FORWARD_ACTION)) { - node = - new Node.ForwardAction( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(PARAM_ACTION)) { - node = - new Node.ParamAction( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(PARAMS_ACTION)) { - node = - new Node.ParamsAction( - qName, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(PLUGIN_ACTION)) { - node = - new Node.PlugIn( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(TEXT_ACTION)) { - node = - new Node.JspText( - qName, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(BODY_ACTION)) { - node = - new Node.JspBody( - qName, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(ATTRIBUTE_ACTION)) { - node = - new Node.NamedAttribute( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(OUTPUT_ACTION)) { - node = - new Node.JspOutput( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(TAG_DIRECTIVE_ACTION)) { - if (!isTagFile) { - throw new SAXParseException( - Localizer.getMessage( - "jsp.error.action.isnottagfile", - localName), - locator); - } - node = - new Node.TagDirective( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - String imports = nonTaglibAttrs.getValue("import"); - // There can only be one 'import' attribute per tag directive - if (imports != null) { - ((Node.TagDirective)node).addImport(imports); - } - } else if (localName.equals(ATTRIBUTE_DIRECTIVE_ACTION)) { - if (!isTagFile) { - throw new SAXParseException( - Localizer.getMessage( - "jsp.error.action.isnottagfile", - localName), - locator); - } - node = - new Node.AttributeDirective( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(VARIABLE_DIRECTIVE_ACTION)) { - if (!isTagFile) { - throw new SAXParseException( - Localizer.getMessage( - "jsp.error.action.isnottagfile", - localName), - locator); - } - node = - new Node.VariableDirective( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(INVOKE_ACTION)) { - if (!isTagFile) { - throw new SAXParseException( - Localizer.getMessage( - "jsp.error.action.isnottagfile", - localName), - locator); - } - node = - new Node.InvokeAction( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(DOBODY_ACTION)) { - if (!isTagFile) { - throw new SAXParseException( - Localizer.getMessage( - "jsp.error.action.isnottagfile", - localName), - locator); - } - node = - new Node.DoBodyAction( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(ELEMENT_ACTION)) { - node = - new Node.JspElement( - qName, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else if (localName.equals(FALLBACK_ACTION)) { - node = - new Node.FallBackAction( - qName, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - current); - } else { - throw new SAXParseException( - Localizer.getMessage( - "jsp.error.xml.badStandardAction", - localName), - locator); - } - - return node; - } - - /* - * Checks if the XML element with the given tag name is a custom action, - * and returns the corresponding Node object. - */ - private Node parseCustomAction( - String qName, - String localName, - String uri, - Attributes nonTaglibAttrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, - Mark start, - Node parent) - throws SAXException { - - if (uri.startsWith(TagConstants.URN_JSPTLD)) { - uri = uri.substring(TagConstants.URN_JSPTLD.length()); - } - - // Check if this is a user-defined (custom) tag - TagLibraryInfo tagLibInfo = pageInfo.getTaglib(uri); - if (tagLibInfo == null) { - return null; - } - - TagInfo tagInfo = tagLibInfo.getTag(localName); - TagFileInfo tagFileInfo = tagLibInfo.getTagFile(localName); - if (tagInfo == null && tagFileInfo == null) { - throw new SAXException( - Localizer.getMessage("jsp.error.xml.bad_tag", localName, uri)); - } - Class tagHandlerClass = null; - if (tagInfo != null) { - String handlerClassName = tagInfo.getTagClassName(); - try { - tagHandlerClass = - ctxt.getClassLoader().loadClass(handlerClassName); - } catch (Exception e) { - throw new SAXException( - Localizer.getMessage("jsp.error.loadclass.taghandler", - handlerClassName, - qName), - e); - } - } - - String prefix = ""; - int colon = qName.indexOf(':'); - if (colon != -1) { - prefix = qName.substring(0, colon); - } - - Node.CustomTag ret = null; - if (tagInfo != null) { - ret = - new Node.CustomTag( - tagLibInfo.getRequiredVersion(), - qName, - prefix, - localName, - uri, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - parent, - tagInfo, - tagHandlerClass); - } else { - ret = - new Node.CustomTag( - tagLibInfo.getRequiredVersion(), - qName, - prefix, - localName, - uri, - nonTaglibAttrs, - nonTaglibXmlnsAttrs, - taglibAttrs, - start, - parent, - tagFileInfo); - } - - return ret; - } - - /* - * Adds the tag library associated with the given uri namespace to the - * translation unit that this parser is associated with. - * - * If the tag library does not exist, it is created. - * - * @param prefix The prefix of the xmlns attribute - * @param uri The uri namespace (value of the xmlns attribute) - */ - private void addTaglibInfo(String prefix, String uri) - throws JasperException { - - if (uri.startsWith(URN_JSPTAGDIR)) { - // uri (of the form "urn:jsptagdir:path") references tag file dir - String tagdir = uri.substring(URN_JSPTAGDIR.length()); - TagLibraryInfo taglibInfo = new ImplicitTagLibraryInfo( - ctxt, - parserController, - prefix, - tagdir, - err); - if (pageInfo.getTaglib(uri) == null) { - pageInfo.addTaglib(uri, taglibInfo); - } - pageInfo.pushPrefixMapping(prefix, uri); - - } else { - // uri references TLD file - boolean isPlainUri = false; - if (uri.startsWith(TagConstants.URN_JSPTLD)) { - uri = uri.substring(TagConstants.URN_JSPTLD.length()); - } else { - isPlainUri = true; - } - - // START GlassFish 750 - ConcurrentHashMap taglibs = - ctxt.getTaglibs(); - TagLibraryInfoImpl taglibInfo = taglibs.get(uri); - if (taglibInfo == null) { - synchronized (taglibs) { - taglibInfo = taglibs.get(uri); - if (taglibInfo == null) { - // END GlassFish 750 - String[] location = ctxt.getTldLocation(uri); - if (location != null || !isPlainUri) { - /* - * If the uri value is a plain uri, a translation - * error must not be generated if the uri is not - * found in the taglib map. - * Instead, any actions in the namespace defined - * by the uri value must be treated as - * uninterpreted. - */ - taglibInfo = - new TagLibraryInfoImpl( - ctxt, - parserController, - prefix, - uri, - location, - err); - // START GlassFish 750 - ctxt.addTaglib(uri, taglibInfo); - pageInfo.addTaglib(uri, taglibInfo); - // END GlassFish 750 - } - // START GlassFish 750 - } - } - } - // END GlassFish 750 - - if (taglibInfo != null) { - if (pageInfo.getTaglib(uri) == null) { - pageInfo.addTaglib(uri, - new TagLibraryInfoImpl(prefix, - uri, - taglibInfo, - pageInfo)); - } - pageInfo.pushPrefixMapping(prefix, uri); - } else { - pageInfo.pushPrefixMapping(prefix, null); - } - } - } - - /* - * Ensures that the given body only contains nodes that are instances of - * TemplateText. - * - * This check is performed only for the body of a scripting (that is: - * declaration, scriptlet, or expression) element, after the end tag of a - * scripting element has been reached. - */ - private void checkScriptingBody(Node.ScriptingElement scriptingElem) - throws SAXException { - Node.Nodes body = scriptingElem.getBody(); - if (body != null) { - int size = body.size(); - for (int i = 0; i < size; i++) { - Node n = body.getNode(i); - if (!(n instanceof Node.TemplateText)) { - String elemType = SCRIPTLET_ACTION; - if (scriptingElem instanceof Node.Declaration) - elemType = DECLARATION_ACTION; - if (scriptingElem instanceof Node.Expression) - elemType = EXPRESSION_ACTION; - String msg = - Localizer.getMessage( - "jsp.error.parse.xml.scripting.invalid.body", - elemType); - throw new SAXException(msg); - } - } - } - } - - /* - * Parses the given file included via an include directive. - * - * @param fname The path to the included resource, as specified by the - * 'file' attribute of the include directive - * @param parent The Node representing the include directive - */ - private void processIncludeDirective(String fname, Node parent) - throws SAXException { - - if (fname == null) { - return; - } - - try { - parserController.parse(fname, parent, null); - } catch (FileNotFoundException fnfe) { - throw new SAXParseException( - Localizer.getMessage("jsp.error.file.not.found", fname), - locator, - fnfe); - } catch (Exception e) { - throw new SAXException(e); - } - } - - /* - * Checks an element's given URI, qname, and attributes to see if any - * of them hijack the 'jsp' prefix, that is, bind it to a namespace other - * than http://java.sun.com/JSP/Page. - * - * @param uri The element's URI - * @param qName The element's qname - * @param attrs The element's attributes - */ - private void checkPrefixes(String uri, String qName, Attributes attrs) { - - checkPrefix(uri, qName); - - int len = attrs.getLength(); - for (int i = 0; i < len; i++) { - checkPrefix(attrs.getURI(i), attrs.getQName(i)); - } - } - - /* - * Checks the given URI and qname to see if they hijack the 'jsp' prefix, - * which would be the case if qName contained the 'jsp' prefix and - * uri was different from http://java.sun.com/JSP/Page. - * - * @param uri The URI to check - * @param qName The qname to check - */ - private void checkPrefix(String uri, String qName) { - - int index = qName.indexOf(':'); - if (index != -1) { - String prefix = qName.substring(0, index); - pageInfo.addPrefix(prefix); - if ("jsp".equals(prefix) && !JSP_URI.equals(uri)) { - pageInfo.setIsJspPrefixHijacked(true); - } - } - } - - /* - * Gets SAXParser. - * - * @param validating Indicates whether the requested SAXParser should - * be validating - * @param jspDocParser The JSP document parser - * - * @return The SAXParser - */ - private static SAXParser getSAXParser( - boolean validating, - JspDocumentParser jspDocParser) - throws Exception { - - ClassLoader original; - if (Constants.IS_SECURITY_ENABLED) { - PrivilegedGetTccl pa = new PrivilegedGetTccl(); - original = AccessController.doPrivileged(pa); - } else { - original = Thread.currentThread().getContextClassLoader(); - } - try { - if (Constants.IS_SECURITY_ENABLED) { - PrivilegedSetTccl pa = - new PrivilegedSetTccl(JspDocumentParser.class.getClassLoader()); - AccessController.doPrivileged(pa); - } else { - Thread.currentThread().setContextClassLoader( - JspDocumentParser.class.getClassLoader()); - } - - SAXParserFactory factory = SAXParserFactory.newInstance(); - factory.setNamespaceAware(true); - - // Preserve xmlns attributes - factory.setFeature( - "http://xml.org/sax/features/namespace-prefixes", - true); - factory.setFeature( - "http://xml.org/sax/features/validation", - validating); - - // Configure the parser - SAXParser saxParser = factory.newSAXParser(); - XMLReader xmlReader = saxParser.getXMLReader(); - xmlReader.setProperty(LEXICAL_HANDLER_PROPERTY, jspDocParser); - xmlReader.setErrorHandler(jspDocParser); - - return saxParser; - } finally { - if (Constants.IS_SECURITY_ENABLED) { - PrivilegedSetTccl pa = new PrivilegedSetTccl(original); - AccessController.doPrivileged(pa); - } else { - Thread.currentThread().setContextClassLoader(original); - } - } - } - - /* - * Exception indicating that a DOCTYPE declaration is present, but - * validation is turned off. - */ - private static class EnableDTDValidationException - extends SAXParseException { - - EnableDTDValidationException(String message, Locator loc) { - super(message, loc); - } - } - - private static String getBodyType(Node.CustomTag custom) { - - if (custom.getTagInfo() != null) { - return custom.getTagInfo().getBodyContent(); - } - - return custom.getTagFileInfo().getTagInfo().getBodyContent(); - } - - private boolean isTagDependent(Node n) { - - if (n instanceof Node.CustomTag) { - String bodyType = getBodyType((Node.CustomTag) n); - return - TagInfo.BODY_CONTENT_TAG_DEPENDENT.equalsIgnoreCase(bodyType); - } - return false; - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/JspProperty.java b/impl/src/main/java/org/apache/jasper/compiler/JspProperty.java deleted file mode 100644 index 3e1eefc..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/JspProperty.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.util.List; - -public class JspProperty { - - private String isXml; - private String elIgnored; - private String scriptingInvalid; - private String pageEncoding; - private String trimSpaces; - private String poundAllowed; - private List includePrelude; - private List includeCoda; - private String buffer; - private String defaultContentType; - private String errorOnUndeclaredNamespace; - - public JspProperty(String isXml, - String elIgnored, - String scriptingInvalid, - String trimSpaces, - String poundAllowed, - String pageEncoding, - List includePrelude, - List includeCoda, - String defaultContentType, - String buffer, - String errorOnUndeclaredNamespace) { - - - this.isXml = isXml; - this.elIgnored = elIgnored; - this.scriptingInvalid = scriptingInvalid; - this.trimSpaces = trimSpaces; - this.poundAllowed = poundAllowed; - this.pageEncoding = pageEncoding; - this.includePrelude = includePrelude; - this.includeCoda = includeCoda; - this.defaultContentType = defaultContentType; - this.buffer = buffer; - this.errorOnUndeclaredNamespace = errorOnUndeclaredNamespace; - } - - public String isXml() { - return isXml; - } - - public String isELIgnored() { - return elIgnored; - } - - public String isScriptingInvalid() { - return scriptingInvalid; - } - - public String getPageEncoding() { - return pageEncoding; - } - - public String getTrimSpaces() { - return trimSpaces; - } - - public String getPoundAllowed() { - return poundAllowed; - } - - public List getIncludePrelude() { - return includePrelude; - } - - public List getIncludeCoda() { - return includeCoda; - } - - public String getBuffer() { - return buffer; - } - - public String getDefaultContentType() { - return defaultContentType; - } - - public String errorOnUndeclaredNamespace() { - return errorOnUndeclaredNamespace; - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/JspPropertyGroup.java b/impl/src/main/java/org/apache/jasper/compiler/JspPropertyGroup.java deleted file mode 100644 index a36c935..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/JspPropertyGroup.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -public class JspPropertyGroup { - - private String path; - private String extension; - private JspProperty jspProperty; - - public JspPropertyGroup(String path, String extension, - JspProperty jspProperty) { - this.path = path; - this.extension = extension; - this.jspProperty = jspProperty; - } - - public String getPath() { - return path; - } - - public String getExtension() { - return extension; - } - - public JspProperty getJspProperty() { - return jspProperty; - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/JspReader.java b/impl/src/main/java/org/apache/jasper/compiler/JspReader.java deleted file mode 100644 index 5956ec1..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/JspReader.java +++ /dev/null @@ -1,624 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.CharArrayWriter; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.jar.JarFile; -import java.util.logging.Logger; -import java.util.logging.Level; -import java.net.URL; -import java.net.MalformedURLException; - -import org.apache.jasper.JasperException; -import org.apache.jasper.JspCompilationContext; - -/** - * JspReader is an input buffer for the JSP parser. It should allow - * unlimited lookahead and pushback. It also has a bunch of parsing - * utility methods for understanding htmlesque thingies. - * - * @author Anil K. Vijendran - * @author Anselm Baird-Smith - * @author Harish Prabandham - * @author Rajiv Mordani - * @author Mandar Raje - * @author Danno Ferrin - * @author Kin-man Chung - * @author Shawn Bayern - * @author Mark Roth - */ - -class JspReader { - - // Logger - private static Logger log = Logger.getLogger(JspReader.class.getName()); - - private Mark current; - private String master; - private ArrayList sourceFiles; - private int currFileId; - private int size; - private JspCompilationContext context; - private ErrorDispatcher err; - - /* - * Set to true when using the JspReader on a single file where we read up - * to the end and reset to the beginning many times. - * (as in ParserController.figureOutJspDocument()). - */ - private boolean singleFile; - - /* - * Constructor. - */ - public JspReader(JspCompilationContext ctxt, - String fname, - String encoding, - JarFile jarFile, - ErrorDispatcher err) - throws JasperException, FileNotFoundException, IOException { - - this(ctxt, fname, encoding, - JspUtil.getReader(fname, encoding, jarFile, ctxt, err), - err); - } - - /* - * Constructor. - */ - public JspReader(JspCompilationContext ctxt, - String fname, - String encoding, - InputStreamReader reader, - ErrorDispatcher err) - throws JasperException, FileNotFoundException { - - this.context = ctxt; - this.err = err; - sourceFiles = new ArrayList(); - currFileId = 0; - size = 0; - singleFile = false; - pushFile(fname, encoding, reader); - } - - /* - * @return JSP compilation context with which this JspReader is - * associated - */ - JspCompilationContext getJspCompilationContext() { - return context; - } - - String getFile(int fileid) { - return sourceFiles.get(fileid); - } - - boolean hasMoreInput() throws JasperException { - if (current.cursor >= current.stream.length) { - if (singleFile) return false; - while (popFile()) { - if (current.cursor < current.stream.length) return true; - } - return false; - } - return true; - } - - int nextChar() throws JasperException { - if (!hasMoreInput()) - return -1; - - int ch = current.stream[current.cursor]; - - current.cursor++; - - if (ch == '\n') { - current.line++; - current.col = 0; - } else { - current.col++; - } - return ch; - } - - /** - * Back up the current cursor by one char, assumes current.cursor > 0, - * and that the char to be pushed back is not '\n'. - */ - void pushChar() { - current.cursor--; - current.col--; - } - - String getText(Mark start, Mark stop) throws JasperException { - Mark oldstart = mark(); - reset(start); - CharArrayWriter caw = new CharArrayWriter(); - while (!stop.equals(mark())) - caw.write(nextChar()); - caw.close(); - reset(oldstart); - return caw.toString(); - } - - int peekChar() throws JasperException { - if (!hasMoreInput()) - return -1; - return current.stream[current.cursor]; - } - - Mark mark() { - return new Mark(current); - } - - void reset(Mark mark) { - current = new Mark(mark); - } - - boolean matchesIgnoreCase(String string) throws JasperException { - Mark mark = mark(); - int ch = 0; - int i = 0; - do { - ch = nextChar(); - if (Character.toLowerCase((char) ch) != string.charAt(i++)) { - reset(mark); - return false; - } - } while (i < string.length()); - reset(mark); - return true; - } - - /** - * search the stream for a match to a string - * @param string The string to match - * @return true is one is found, the current position - * in stream is positioned after the search string, - * false otherwise, position in stream unchanged. - */ - boolean matches(String string) throws JasperException { - Mark mark = mark(); - int ch = 0; - int i = 0; - do { - ch = nextChar(); - if (((char) ch) != string.charAt(i++)) { - reset(mark); - return false; - } - } while (i < string.length()); - return true; - } - - boolean matchesETag(String tagName) throws JasperException { - Mark mark = mark(); - - if (!matches("') - return true; - - reset(mark); - return false; - } - - boolean matchesETagWithoutLessThan(String tagName) - throws JasperException - { - Mark mark = mark(); - - if (!matches("/" + tagName)) - return false; - skipSpaces(); - if (nextChar() == '>') - return true; - - reset(mark); - return false; - } - - - /** - * Looks ahead to see if there are optional spaces followed by - * the given String. If so, true is returned and those spaces and - * characters are skipped. If not, false is returned and the - * position is restored to where we were before. - */ - boolean matchesOptionalSpacesFollowedBy( String s ) - throws JasperException - { - Mark mark = mark(); - - skipSpaces(); - boolean result = matches( s ); - if( !result ) { - reset( mark ); - } - - return result; - } - - int skipSpaces() throws JasperException { - int i = 0; - while (hasMoreInput() && isSpace()) { - i++; - nextChar(); - } - return i; - } - - /** - * Skip until the given string is matched in the stream. - * When returned, the context is positioned past the end of the match. - * - * @param s The String to match. - * @return A non-null Mark instance (positioned immediately - * before the search string) if found, null - * otherwise. - */ - Mark skipUntil(String limit) throws JasperException { - Mark ret = null; - int limlen = limit.length(); - int ch; - - skip: - for (ret = mark(), ch = nextChar() ; ch != -1 ; - ret = mark(), ch = nextChar()) { - if (ch == limit.charAt(0)) { - Mark restart = mark(); - for (int i = 1 ; i < limlen ; i++) { - if (peekChar() == limit.charAt(i)) - nextChar(); - else { - reset(restart); - continue skip; - } - } - return ret; - } - } - return null; - } - - /** - * Skip until the given string is matched in the stream, but ignoring - * chars initially escaped by a '\'. - * When returned, the context is positioned past the end of the match. - * - * @param s The String to match. - * @return A non-null Mark instance (positioned immediately - * before the search string) if found, null - * otherwise. - */ - Mark skipUntilIgnoreEsc(String limit) throws JasperException { - Mark ret = null; - int limlen = limit.length(); - int ch; - int prev = 'x'; // Doesn't matter - - skip: - for (ret = mark(), ch = nextChar() ; ch != -1 ; - ret = mark(), prev = ch, ch = nextChar()) { - if (ch == '\\' && prev == '\\') { - ch = 0; // Double \ is not an escape char anymore - } - else if (ch == limit.charAt(0) && prev != '\\') { - for (int i = 1 ; i < limlen ; i++) { - if (peekChar() == limit.charAt(i)) - nextChar(); - else - continue skip; - } - return ret; - } - } - return null; - } - - /** - * Skip until the given end tag is matched in the stream. - * When returned, the context is positioned past the end of the tag. - * - * @param tag The name of the tag whose ETag () to match. - * @return A non-null Mark instance (positioned immediately - * before the ETag) if found, null otherwise. - */ - Mark skipUntilETag(String tag) throws JasperException { - Mark ret = skipUntil("') - ret = null; - } - return ret; - } - - final boolean isSpace() throws JasperException { - // Note: If this logic changes, also update Node.TemplateText.rtrim() - return peekChar() <= ' '; - } - - /** - * Parse a space delimited token. - * If quoted the token will consume all characters up to a matching quote, - * otherwise, it consumes up to the first delimiter character. - * - * @param quoted If true accept quoted strings. - */ - String parseToken(boolean quoted) throws JasperException { - StringBuilder stringBuffer = new StringBuilder(); - skipSpaces(); - stringBuffer.setLength(0); - - if (!hasMoreInput()) { - return ""; - } - - int ch = peekChar(); - - if (quoted) { - if (ch == '"' || ch == '\'') { - - char endQuote = ch == '"' ? '"' : '\''; - // Consume the open quote: - ch = nextChar(); - for (ch = nextChar(); ch != -1 && ch != endQuote; - ch = nextChar()) { - if (ch == '\\') - ch = nextChar(); - stringBuffer.append((char) ch); - } - // Check end of quote, skip closing quote: - if (ch == -1) { - err.jspError(mark(), "jsp.error.quotes.unterminated"); - } - } else { - err.jspError(mark(), "jsp.error.attr.quoted"); - } - } else { - if (!isDelimiter()) { - // Read value until delimiter is found: - do { - ch = nextChar(); - // Take care of the quoting here. - if (ch == '\\') { - if (peekChar() == '"' || peekChar() == '\'' || - peekChar() == '>' || peekChar() == '%') - ch = nextChar(); - } - stringBuffer.append((char) ch); - } while (!isDelimiter()); - } - } - - return stringBuffer.toString(); - } - - void setSingleFile(boolean val) { - singleFile = val; - } - - /** - * Gets the URL for the given path name. - * - * @param path Path name - * - * @return URL for the given path name. - * - * @exception MalformedURLException if the path name is not given in - * the correct form - */ - URL getResource(String path) throws MalformedURLException { - return context.getResource(path); - } - - /** - * Parse utils - Is current character a token delimiter ? - * Delimiters are currently defined to be =, >, <, ", and ' or any - * any space character as defined by isSpace. - * - * @return A boolean. - */ - private boolean isDelimiter() throws JasperException { - if (! isSpace()) { - int ch = peekChar(); - // Look for a single-char work delimiter: - if (ch == '=' || ch == '>' || ch == '"' || ch == '\'' - || ch == '/') { - return true; - } - // Look for an end-of-comment or end-of-tag: - if (ch == '-') { - Mark mark = mark(); - if (((ch = nextChar()) == '>') - || ((ch == '-') && (nextChar() == '>'))) { - reset(mark); - return true; - } else { - reset(mark); - return false; - } - } - return false; - } else { - return true; - } - } - - /** - * Register a new source file. - * This method is used to implement file inclusion. Each included file - * gets a unique identifier (which is the index in the array of source - * files). - * - * @return The index of the now registered file. - */ - private int registerSourceFile(String file) { - if (sourceFiles.contains(file)) - return -1; - sourceFiles.add(file); - this.size++; - return sourceFiles.size() - 1; - } - - - /** - * Unregister the source file. - * This method is used to implement file inclusion. Each included file - * gets a uniq identifier (which is the index in the array of source - * files). - * - * @return The index of the now registered file. - */ - private int unregisterSourceFile(String file) { - if (!sourceFiles.contains(file)) - return -1; - sourceFiles.remove(file); - this.size--; - return sourceFiles.size() - 1; - } - - /** - * Push a file (and its associated Stream) on the file stack. THe - * current position in the current file is remembered. - */ - private void pushFile(String file, String encoding, - InputStreamReader reader) - throws JasperException, FileNotFoundException { - - // Register the file - String longName = file; - - int fileid = registerSourceFile(longName); - - if (fileid == -1) { - err.jspError("jsp.error.file.already.registered", file); - } - - currFileId = fileid; - - try { - CharArrayWriter caw = new CharArrayWriter(); - char buf[] = new char[1024]; - for (int i = 0 ; (i = reader.read(buf)) != -1 ;) - caw.write(buf, 0, i); - caw.close(); - if (current == null) { - current = new Mark(this, caw.toCharArray(), fileid, - getFile(fileid), master, encoding); - } else { - current.pushStream(caw.toCharArray(), fileid, getFile(fileid), - longName, encoding); - } - } catch (Throwable ex) { - log.log(Level.SEVERE, "Exception parsing file ", ex); - // Pop state being constructed: - popFile(); - err.jspError("jsp.error.file.cannot.read", file); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (Exception any) {} - } - } - } - - /** - * Pop a file from the file stack. The field "current" is retored - * to the value to point to the previous files, if any, and is set - * to null otherwise. - * @return true is there is a previous file on the stck. - * false otherwise. - */ - private boolean popFile() throws JasperException { - - // Is stack created ? (will happen if the Jsp file we're looking at is - // missing. - if (current == null || currFileId < 0) { - return false; - } - - // Restore parser state: - String fName = getFile(currFileId); - currFileId = unregisterSourceFile(fName); - if (currFileId < -1) { - err.jspError("jsp.error.file.not.registered", fName); - } - - Mark previous = current.popStream(); - if (previous != null) { - master = current.baseDir; - current = previous; - return true; - } - // Note that although the current file is undefined here, "current" - // is not set to null just for convience, for it maybe used to - // set the current (undefined) position. - return false; - } -} - diff --git a/impl/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java b/impl/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java deleted file mode 100644 index 190e9e4..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java +++ /dev/null @@ -1,709 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FilePermission; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URL; -import java.net.URLClassLoader; -import java.net.URLDecoder; -import java.security.CodeSource; -import java.security.cert.Certificate; -import java.security.PermissionCollection; -import java.security.Policy; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.*; -import java.util.logging.Logger; -import java.util.logging.Level; - -import javax.servlet.ServletContext; -import javax.servlet.jsp.JspFactory; -import javax.tools.JavaFileObject; - -import org.apache.jasper.Constants; -import org.apache.jasper.JspCompilationContext; -import org.apache.jasper.Options; -import org.apache.jasper.runtime.JspFactoryImpl; -import org.apache.jasper.security.SecurityClassLoad; -import org.apache.jasper.servlet.JspServletWrapper; - -/** - * Class for tracking JSP compile time file dependencies when the - * &060;%@include file="..."%&062; directive is used. - * - * A background thread periodically checks the files a JSP page - * is dependent upon. If a dpendent file changes the JSP page - * which included it is recompiled. - * - * Only used if a web application context is a directory. - * - * @author Glenn L. Nielsen - * @version $Revision: 1.13 $ - */ -public final class JspRuntimeContext implements Runnable { - - // Logger - private static Logger log = - Logger.getLogger(JspRuntimeContext.class.getName()); - - /* - * Counts how many times the webapp's JSPs have been reloaded. - */ - private AtomicInteger jspReloadCount = new AtomicInteger(0); - - /** - * Preload classes required at runtime by a JSP servlet so that - * we don't get a defineClassInPackage security exception. - */ - static { - JspFactoryImpl factory = new JspFactoryImpl(); - SecurityClassLoad.securityClassLoad(factory.getClass().getClassLoader()); - if( System.getSecurityManager() != null ) { - String basePackage = "org.apache.jasper."; - try { - factory.getClass().getClassLoader().loadClass( - basePackage - + "runtime.JspFactoryImpl$PrivilegedGetPageContext"); - factory.getClass().getClassLoader().loadClass( - basePackage - + "runtime.JspFactoryImpl$PrivilegedReleasePageContext"); - factory.getClass().getClassLoader().loadClass( - basePackage - + "runtime.JspRuntimeLibrary"); - factory.getClass().getClassLoader().loadClass( - basePackage - + "runtime.JspRuntimeLibrary$PrivilegedIntrospectHelper"); - factory.getClass().getClassLoader().loadClass( - basePackage - + "runtime.ServletResponseWrapperInclude"); - factory.getClass().getClassLoader().loadClass( - basePackage - + "servlet.JspServletWrapper"); - } catch (ClassNotFoundException ex) { - log.log(Level.SEVERE, - "Jasper JspRuntimeContext preload of class failed: " - + ex.getMessage(), ex); - } - } - - JspFactory.setDefaultFactory(factory); - } - - // ----------------------------------------------------------- Constructors - - /** - * Create a JspRuntimeContext for a web application context. - * - * Loads in any previously generated dependencies from file. - * - * @param context ServletContext for web application - */ - public JspRuntimeContext(ServletContext context, Options options) { - - this.context = context; - this.options = options; - - int hashSize = options.getInitialCapacity(); - jsps = new ConcurrentHashMap(hashSize); - - bytecodes = new ConcurrentHashMap(hashSize); - bytecodeBirthTimes = new ConcurrentHashMap(hashSize); - packageMap = new ConcurrentHashMap>(); - - if (log.isLoggable(Level.FINEST)) { - ClassLoader parentClassLoader = getParentClassLoader(); - if (parentClassLoader != null) { - log.finest(Localizer.getMessage("jsp.message.parent_class_loader_is", - parentClassLoader.toString())); - } else { - log.finest(Localizer.getMessage("jsp.message.parent_class_loader_is", - "")); - } - } - - initClassPath(); - - if (context instanceof org.apache.jasper.servlet.JspCServletContext) { - return; - } - - if (Constants.IS_SECURITY_ENABLED) { - initSecurity(); - } - - // If this web application context is running from a - // directory, start the background compilation thread - String appBase = context.getRealPath("/"); - if (!options.getDevelopment() - && appBase != null - && options.getCheckInterval() > 0 - && !options.getUsePrecompiled()) { - if (appBase.endsWith(File.separator) ) { - appBase = appBase.substring(0,appBase.length()-1); - } - String directory = - appBase.substring(appBase.lastIndexOf(File.separator)); - threadName = threadName + "[" + directory + "]"; - threadStart(); - } - } - - // ----------------------------------------------------- Instance Variables - - /** - * This web applications ServletContext - */ - private ServletContext context; - private Options options; - private PermissionCollection permissionCollection; - private CodeSource codeSource; - private String classpath; - - /** - * Maps JSP pages to their JspServletWrapper's - */ - private Map jsps; - - /** - * Maps class names to in-memory bytecodes - */ - private Map bytecodes; - private Map bytecodeBirthTimes; - - /** - * Maps classes in packages compiled by the JSP compiler. - * Used only by Jsr199Compiler. - */ - private Map> packageMap; - - /** - * The background thread. - */ - private Thread thread = null; - - - /** - * The background thread completion semaphore. - */ - private boolean threadDone = false; - - - /** - * Name to register for the background thread. - */ - private String threadName = "JspRuntimeContext"; - - // ------------------------------------------------------ Public Methods - - /** - * Add a new JspServletWrapper. - * - * @param jspUri JSP URI - * @param jsw Servlet wrapper for JSP - */ - public void addWrapper(String jspUri, JspServletWrapper jsw) { - jsps.remove(jspUri); - jsps.put(jspUri,jsw); - } - - /** - * Get an already existing JspServletWrapper. - * - * @param jspUri JSP URI - * @return JspServletWrapper for JSP - */ - public JspServletWrapper getWrapper(String jspUri) { - return jsps.get(jspUri); - } - - /** - * Remove a JspServletWrapper. - * - * @param jspUri JSP URI of JspServletWrapper to remove - */ - public void removeWrapper(String jspUri) { - jsps.remove(jspUri); - } - - /** - * Returns the number of JSPs for which JspServletWrappers exist, i.e., - * the number of JSPs that have been loaded into the webapp. - * - * @return The number of JSPs that have been loaded into the webapp - */ - public int getJspCount() { - return jsps.size(); - } - - /** - * Get the SecurityManager Policy CodeSource for this web - * applicaiton context. - * - * @return CodeSource for JSP - */ - public CodeSource getCodeSource() { - return codeSource; - } - - /** - * Get the parent class loader. - * - * @return ClassLoader parent - */ - public ClassLoader getParentClassLoader() { - ClassLoader parentClassLoader = - Thread.currentThread().getContextClassLoader(); - if (parentClassLoader == null) { - parentClassLoader = this.getClass().getClassLoader(); - } - return parentClassLoader; - } - - /** - * Get the SecurityManager PermissionCollection for this - * web application context. - * - * @return PermissionCollection permissions - */ - public PermissionCollection getPermissionCollection() { - return permissionCollection; - } - - /** - * Process a "destory" event for this web application context. - */ - public void destroy() { - - threadStop(); - - for (JspServletWrapper jsw: jsps.values()) { - jsw.destroy(); - } - } - - /** - * Increments the JSP reload counter. - */ - public void incrementJspReloadCount() { - jspReloadCount.incrementAndGet(); - } - - /** - * Resets the JSP reload counter. - * - * @param count Value to which to reset the JSP reload counter - */ - public void setJspReloadCount(int count) { - jspReloadCount.set(count); - } - - /** - * Gets the current value of the JSP reload counter. - * - * @return The current value of the JSP reload counter - */ - public int getJspReloadCount() { - return jspReloadCount.get(); - } - - /** - * Save the bytecode for the class in a map. The current time is noted. - * @param name The name of the class - * @param bytecode The bytecode in byte array - */ - public void setBytecode(String name, byte[] bytecode) { - if (bytecode == null) { - bytecodes.remove(name); - bytecodeBirthTimes.remove(name); - return; - } - bytecodes.put(name, bytecode); - bytecodeBirthTimes.put(name, Long.valueOf(System.currentTimeMillis())); - } - - public void adjustBytecodeTime(String name, long reference) { - Long time = bytecodeBirthTimes.get(name); - if (time == null) - return; - - if (time.longValue() < reference) { - bytecodeBirthTimes.put(name, Long.valueOf(reference)); - } - } - - /** - * Get the class-name to bytecode map - */ - public Map getBytecodes() { - return bytecodes; - } - - /** - * Retrieve the bytecode associated with the class - */ - public byte[] getBytecode(String name) { - return bytecodes.get(name); - } - - /** - * Retrieve the time the bytecode for a class was created - */ - public long getBytecodeBirthTime(String name) { - Long time = bytecodeBirthTimes.get(name); - return (time != null? time.longValue(): 0); - } - - /** - * The packageMap keeps track of the bytecode files in a package generated - * by a java compiler. This is in turn loaded by the java compiler during - * compilation. This is gets around the fact that JSR199 API does not - * provide a way for the compiler use current classloader. - */ - public Map> getPackageMap() { - return packageMap; - } - - /** - * Save the bytecode for a class to disk. - */ - public void saveBytecode(String className, String classFileName) { - byte[] bytecode = getBytecode(className); - if (bytecode != null) { - try { - FileOutputStream fos = new FileOutputStream(classFileName); - fos.write(bytecode); - fos.close(); - } catch (IOException ex) { - context.log("Error in saving bytecode for " + className + - " to " + classFileName, ex); - } - } - } - - - // -------------------------------------------------------- Private Methods - - - /** - * Method used by background thread to check the JSP dependencies - * registered with this class for JSP's. - */ - private void checkCompile() { - for (JspServletWrapper jsw: jsps.values()) { - if (jsw.isTagFile()) { - // Skip tag files in background compiliations, since modified - // tag files will be recompiled anyway when their client JSP - // pages are compiled. This also avoids problems when the - // tag files and their clients are not modified simultaneously. - continue; - } - - JspCompilationContext ctxt = jsw.getJspEngineContext(); - // JspServletWrapper also synchronizes on this when - // it detects it has to do a reload - synchronized(jsw) { - try { - ctxt.compile(); - } catch (FileNotFoundException ex) { - ctxt.incrementRemoved(); - } catch (Throwable t) { - jsw.getServletContext().log( - Localizer.getMessage("jsp.error.background.compile"), - t); - } - } - } - } - - /** - * The classpath that is passed off to the Java compiler. - */ - public String getClassPath() { - return classpath; - } - - /** - * Method used to initialize classpath for compiles. - */ - private void initClassPath() { - - /* Classpath can be specified in one of two ways, depending on - whether the compilation is embedded or invoked from Jspc. - 1. Calculated by the web container, and passed to Jasper in the - context attribute. - 2. Jspc directly invoke JspCompilationContext.setClassPath, in - case the classPath initialzed here is ignored. - */ - - StringBuilder cpath = new StringBuilder(); - String sep = System.getProperty("path.separator"); - - cpath.append(options.getScratchDir() + sep); - - String cp = (String) context.getAttribute(Constants.SERVLET_CLASSPATH); - if (cp == null || cp.equals("")) { - cp = options.getClassPath(); - } - - if (cp != null) { - classpath = cpath.toString() + cp; - } - - // START GlassFish Issue 845 - if (classpath != null) { - try { - classpath = URLDecoder.decode(classpath, "UTF-8"); - } catch (UnsupportedEncodingException e) { - if (log.isLoggable(Level.FINE)) - log.log(Level.FINE, - "Exception decoding classpath : " + classpath, e); - } - } - // END GlassFish Issue 845 - } - - /** - * Method used to initialize SecurityManager data. - */ - private void initSecurity() { - - // Setup the PermissionCollection for this web app context - // based on the permissions configured for the root of the - // web app context directory, then add a file read permission - // for that directory. - Policy policy = Policy.getPolicy(); - if( policy != null ) { - try { - // Get the permissions for the web app context - String docBase = context.getRealPath("/"); - if( docBase == null ) { - docBase = options.getScratchDir().toString(); - } - String codeBase = docBase; - if (!codeBase.endsWith(File.separator)){ - codeBase = codeBase + File.separator; - } - File contextDir = new File(codeBase); - URL url = contextDir.getCanonicalFile().toURL(); - codeSource = new CodeSource(url,(Certificate[])null); - permissionCollection = policy.getPermissions(codeSource); - - // Create a file read permission for web app context directory - if (!docBase.endsWith(File.separator)){ - permissionCollection.add - (new FilePermission(docBase,"read")); - docBase = docBase + File.separator; - } else { - permissionCollection.add - (new FilePermission - (docBase.substring(0,docBase.length() - 1),"read")); - } - docBase = docBase + "-"; - permissionCollection.add(new FilePermission(docBase,"read")); - - // Create a file read permission for web app tempdir (work) - // directory - String workDir = options.getScratchDir().toString(); - if (!workDir.endsWith(File.separator)){ - permissionCollection.add - (new FilePermission(workDir,"read")); - workDir = workDir + File.separator; - } - workDir = workDir + "-"; - permissionCollection.add(new FilePermission(workDir,"read")); - - // Allow the JSP to access org.apache.jasper.runtime.HttpJspBase - permissionCollection.add( new RuntimePermission( - "accessClassInPackage.org.apache.jasper.runtime") ); - - ClassLoader parentClassLoader = getParentClassLoader(); - if (parentClassLoader instanceof URLClassLoader) { - URL [] urls = ((URLClassLoader)parentClassLoader).getURLs(); - String jarUrl = null; - String jndiUrl = null; - for (int i=0; icheckInterval - * property. - */ - protected void threadSleep() { - - try { - Thread.sleep(options.getCheckInterval() * 1000L); - } catch (InterruptedException e) { - ; - } - - } - - - // ------------------------------------------------------ Background Thread - - - /** - * The background thread that checks for changes to files - * included by a JSP and flags that a recompile is required. - */ - public void run() { - - // Loop until the termination semaphore is set - while (!threadDone) { - - // Wait for our check interval - threadSleep(); - - // Check for included files which are newer than the - // JSP which uses them. - try { - checkCompile(); - } catch (Throwable t) { - t.printStackTrace(); - log.log(Level.SEVERE, Localizer - .getMessage("jsp.error.recompile"), t); - } - } - - } - -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/JspUtil.java b/impl/src/main/java/org/apache/jasper/compiler/JspUtil.java deleted file mode 100644 index 47d6e46..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/JspUtil.java +++ /dev/null @@ -1,1271 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.CharArrayWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.File; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; -import java.util.jar.JarFile; -import java.util.jar.Manifest; -import java.util.zip.ZipEntry; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import javax.el.ELException; -import javax.el.FunctionMapper; -import javax.el.ExpressionFactory; - -import org.apache.jasper.Constants; -import org.apache.jasper.JasperException; -import org.apache.jasper.JspCompilationContext; -import org.apache.jasper.runtime.ELContextImpl; -import org.xml.sax.Attributes; - -/** - * This class has all the utility method(s). - * Ideally should move all the bean containers here. - * - * @author Mandar Raje. - * @author Rajiv Mordani. - * @author Danno Ferrin - * @author Pierre Delisle - * @author Shawn Bayern - * @author Mark Roth - * @author Kin-man Chung - */ -public class JspUtil { - - private static final String WEB_INF_TAGS = "/WEB-INF/tags/"; - private static final String META_INF_TAGS = "/META-INF/tags/"; - - // Delimiters for request-time expressions (JSP and XML syntax) - private static final String OPEN_EXPR = "<%="; - private static final String CLOSE_EXPR = "%>"; - private static final String OPEN_EXPR_XML = "%="; - private static final String CLOSE_EXPR_XML = "%"; - - private static int tempSequenceNumber = 0; - private static ExpressionFactory expFactory; - - private static final String javaKeywords[] = { - "abstract", "assert", "boolean", "break", "byte", "case", - "catch", "char", "class", "const", "continue", - "default", "do", "double", "else", "enum", "extends", - "final", "finally", "float", "for", "goto", - "if", "implements", "import", "instanceof", "int", - "interface", "long", "native", "new", "package", - "private", "protected", "public", "return", "short", - "static", "strictfp", "super", "switch", "synchronized", - "this", "throws", "transient", "try", "void", - "volatile", "while" }; - - public static final int CHUNKSIZE = 1024; - - public static char[] removeQuotes(char []chars) { - CharArrayWriter caw = new CharArrayWriter(); - for (int i = 0; i < chars.length; i++) { - if (chars[i] == '%' && chars[i+1] == '\\' && - chars[i+2] == '>') { - caw.write('%'); - caw.write('>'); - i = i + 2; - } else { - caw.write(chars[i]); - } - } - return caw.toCharArray(); - } - - public static char[] escapeQuotes (char []chars) { - // Prescan to convert %\> to %> - String s = new String(chars); - while (true) { - int n = s.indexOf("%\\>"); - if (n < 0) - break; - StringBuilder sb = new StringBuilder(s.substring(0, n)); - sb.append("%>"); - sb.append(s.substring(n + 3)); - s = sb.toString(); - } - chars = s.toCharArray(); - return (chars); - - - // Escape all backslashes not inside a Java string literal - /* - CharArrayWriter caw = new CharArrayWriter(); - boolean inJavaString = false; - for (int i = 0; i < chars.length; i++) { - if (chars[i] == '"') inJavaString = !inJavaString; - // escape out the escape character - if (!inJavaString && (chars[i] == '\\')) caw.write('\\'); - caw.write(chars[i]); - } - return caw.toCharArray(); - */ - } - - /** - * Checks if the token is a runtime expression. - * In standard JSP syntax, a runtime expression starts with '<%' and - * ends with '%>'. When the JSP document is in XML syntax, a runtime - * expression starts with '%=' and ends with '%'. - * - * @param token The token to be checked - * return whether the token is a runtime expression or not. - */ - public static boolean isExpression(String token, boolean isXml) { - String openExpr; - String closeExpr; - if (isXml) { - openExpr = OPEN_EXPR_XML; - closeExpr = CLOSE_EXPR_XML; - } else { - openExpr = OPEN_EXPR; - closeExpr = CLOSE_EXPR; - } - if (token.startsWith(openExpr) && token.endsWith(closeExpr)) { - return true; - } else { - return false; - } - } - - /** - * @return the "expression" part of a runtime expression, - * taking the delimiters out. - */ - public static String getExpr (String expression, boolean isXml) { - String returnString; - String openExpr; - String closeExpr; - if (isXml) { - openExpr = OPEN_EXPR_XML; - closeExpr = CLOSE_EXPR_XML; - } else { - openExpr = OPEN_EXPR; - closeExpr = CLOSE_EXPR; - } - int length = expression.length(); - if (expression.startsWith(openExpr) && - expression.endsWith(closeExpr)) { - returnString = expression.substring( - openExpr.length(), length - closeExpr.length()); - } else { - returnString = ""; - } - return returnString; - } - - /** - * Takes a potential expression and converts it into XML form - */ - public static String getExprInXml(String expression) { - String returnString; - int length = expression.length(); - - if (expression.startsWith(OPEN_EXPR) - && expression.endsWith(CLOSE_EXPR)) { - returnString = expression.substring (1, length - 1); - } else { - returnString = expression; - } - - return escapeXml(returnString); - } - - /** - * Checks to see if the given scope is valid. - * - * @param scope The scope to be checked - * @param n The Node containing the 'scope' attribute whose value is to be - * checked - * @param err error dispatcher - * - * @throws JasperException if scope is not null and different from - * "page", "request", "session", and - * "application" - */ - public static void checkScope(String scope, Node n, ErrorDispatcher err) - throws JasperException { - if (scope != null && !scope.equals("page") && !scope.equals("request") - && !scope.equals("session") && !scope.equals("application")) { - err.jspError(n, "jsp.error.invalid.scope", scope); - } - } - - /** - * Checks if all mandatory attributes are present and if all attributes - * present have valid names. Checks attributes specified as XML-style - * attributes as well as attributes specified using the jsp:attribute - * standard action. - */ - public static void checkAttributes(String typeOfTag, - Node n, - ValidAttribute[] validAttributes, - ErrorDispatcher err) - throws JasperException { - Attributes attrs = n.getAttributes(); - Mark start = n.getStart(); - boolean valid = true; - - // AttributesImpl.removeAttribute is broken, so we do this... - int tempLength = (attrs == null) ? 0 : attrs.getLength(); - ArrayList temp = new ArrayList(tempLength); - for (int i = 0; i < tempLength; i++) { - String qName = attrs.getQName(i); - if ((!qName.equals("xmlns")) && (!qName.startsWith("xmlns:"))) - temp.add(qName); - } - - // Add names of attributes specified using jsp:attribute - Node.Nodes tagBody = n.getBody(); - if( tagBody != null ) { - int numSubElements = tagBody.size(); - for( int i = 0; i < numSubElements; i++ ) { - Node node = tagBody.getNode( i ); - if( node instanceof Node.NamedAttribute ) { - String attrName = node.getAttributeValue( "name" ); - temp.add( attrName ); - // Check if this value appear in the attribute of the node - if (n.getAttributeValue(attrName) != null) { - err.jspError(n, "jsp.error.duplicate.name.jspattribute", - attrName); - } - } - else { - // Nothing can come before jsp:attribute, and only - // jsp:body can come after it. - break; - } - } - } - - /* - * First check to see if all the mandatory attributes are present. - * If so only then proceed to see if the other attributes are valid - * for the particular tag. - */ - String missingAttribute = null; - - for (int i = 0; i < validAttributes.length; i++) { - int attrPos; - if (validAttributes[i].mandatory) { - attrPos = temp.indexOf(validAttributes[i].name); - if (attrPos != -1) { - temp.remove(attrPos); - valid = true; - } else { - valid = false; - missingAttribute = validAttributes[i].name; - break; - } - } - } - - // If mandatory attribute is missing then the exception is thrown - if (!valid) - err.jspError(start, "jsp.error.mandatory.attribute", typeOfTag, - missingAttribute); - - // Check to see if there are any more attributes for the specified tag. - int attrLeftLength = temp.size(); - if (attrLeftLength == 0) - return; - - // Now check to see if the rest of the attributes are valid too. - String attribute = null; - - for (int j = 0; j < attrLeftLength; j++) { - valid = false; - attribute = temp.get(j); - for (int i = 0; i < validAttributes.length; i++) { - if (attribute.equals(validAttributes[i].name)) { - valid = true; - break; - } - } - if (!valid) - err.jspError(start, "jsp.error.invalid.attribute", typeOfTag, - attribute); - } - // XXX *could* move EL-syntax validation here... (sb) - } - - public static String escapeQueryString(String unescString) { - if ( unescString == null ) - return null; - - String escString = ""; - String shellSpChars = "\\\""; - - for(int index=0; index') { - sb.append(">"); - } else if (c == '\'') { - sb.append("'"); - } else if (c == '&') { - sb.append("&"); - } else if (c == '"') { - sb.append("""); - } else { - sb.append(c); - } - } - return sb.toString(); - } - - /** - * Replaces any occurrences of the character replace with the - * string with. - */ - public static String replace(String name, char replace, String with) { - StringBuilder buf = new StringBuilder(); - int begin = 0; - int end; - int last = name.length(); - - while (true) { - end = name.indexOf(replace, begin); - if (end < 0) { - end = last; - } - buf.append(name.substring(begin, end)); - if (end == last) { - break; - } - buf.append(with); - begin = end + 1; - } - - return buf.toString(); - } - - public static class ValidAttribute { - String name; - boolean mandatory; - - public ValidAttribute (String name, boolean mandatory) - { - this.name = name; - this.mandatory = mandatory; - } - - public ValidAttribute (String name) { - this (name, false); - } - } - - /** - * Convert a String value to 'boolean'. - * Besides the standard conversions done by - * Boolean.valueOf(s).booleanValue(), the value "yes" - * (ignore case) is also converted to 'true'. - * If 's' is null, then 'false' is returned. - * - * @param s the string to be converted - * @return the boolean value associated with the string s - */ - public static boolean booleanValue(String s) { - boolean b = false; - if (s != null) { - if (s.equalsIgnoreCase("yes")) { - b = true; - } else { - b = Boolean.valueOf(s).booleanValue(); - } - } - return b; - } - - /** - * Returns the Class object associated with the class or - * interface with the given string name. - * - *

    The Class object is determined by passing the given string - * name to the Class.forName() method, unless the given string - * name represents a primitive type, in which case it is converted to a - * Class object by appending ".class" to it (e.g., "int.class"). - */ - public static Class toClass(String type, ClassLoader loader) - throws ClassNotFoundException { - - Class c = null; - int i0 = type.indexOf('['); - int dims = 0; - if (i0 > 0) { - // This is an array. Count the dimensions - for (int i = 0; i < type.length(); i++) { - if (type.charAt(i) == '[') - dims++; - } - type = type.substring(0, i0); - } - - if ("boolean".equals(type)) - c = boolean.class; - else if ("char".equals(type)) - c = char.class; - else if ("byte".equals(type)) - c = byte.class; - else if ("short".equals(type)) - c = short.class; - else if ("int".equals(type)) - c = int.class; - else if ("long".equals(type)) - c = long.class; - else if ("float".equals(type)) - c = float.class; - else if ("double".equals(type)) - c = double.class; - else if (type.indexOf('[') < 0) - c = loader.loadClass(type); - - if (dims == 0) - return c; - - if (dims == 1) - return java.lang.reflect.Array.newInstance(c, 1).getClass(); - - // Array of more than i dimension - return java.lang.reflect.Array.newInstance(c, new int[dims]).getClass(); - } - - /** - * Produces a String representing a call to the EL interpreter. - * @param expression a String containing zero or more "${}" expressions - * @param expectedType the expected type of the interpreted result - * @param fnmapvar Variable pointing to a function map. - * @return a String representing a call to the EL interpreter. - */ - public static String interpreterCall(boolean isTagFile, - String expression, - Class expectedType, - String fnmapvar, - String expectedDeferredType, - String expectedReturnType, - String[] expectedParamTypes - ) - { - /* - * Determine which context object to use. - */ - String jspCtxt = null; - if (isTagFile) - jspCtxt = "this.getJspContext()"; - else - jspCtxt = "_jspx_page_context"; - - if (expectedType == javax.el.ValueExpression.class) { - - if (expectedDeferredType == null) { - expectedDeferredType = "java.lang.Object"; - } - - return "org.apache.jasper.runtime.PageContextImpl.getValueExpression" - + "(" + Generator.quote(expression) + ", " - + "(PageContext)" + jspCtxt + ", " - + expectedDeferredType + ".class, " - + fnmapvar + ")"; - - } - - if (expectedType == javax.el.MethodExpression.class) { - - if (expectedReturnType == null) { - expectedReturnType = "Void"; - } - - StringBuilder params = new StringBuilder(); - if (expectedParamTypes != null) { - for (int i = 0; i < expectedParamTypes.length; i++) { - if (i > 0) { - params.append(", "); - } - params.append(expectedParamTypes[i] + ".class"); - } - } - - return "org.apache.jasper.runtime.PageContextImpl.getMethodExpression" - + "(" + Generator.quote(expression) + ", " - + "(PageContext)" + jspCtxt + ", " - + fnmapvar + ", " - + expectedReturnType + ".class, " - + "new Class[] {" + params.toString() + "})"; - } - - /* - * Determine whether to use the expected type's textual name - * or, if it's a primitive, the name of its correspondent boxed - * type. - */ - String returnType = expectedType.getName(); - String targetType = returnType; - String primitiveConverterMethod = null; - if (expectedType.isPrimitive()) { - if (expectedType.equals(Boolean.TYPE)) { - returnType = Boolean.class.getName(); - primitiveConverterMethod = "booleanValue"; - } else if (expectedType.equals(Byte.TYPE)) { - returnType = Byte.class.getName(); - primitiveConverterMethod = "byteValue"; - } else if (expectedType.equals(Character.TYPE)) { - returnType = Character.class.getName(); - primitiveConverterMethod = "charValue"; - } else if (expectedType.equals(Short.TYPE)) { - returnType = Short.class.getName(); - primitiveConverterMethod = "shortValue"; - } else if (expectedType.equals(Integer.TYPE)) { - returnType = Integer.class.getName(); - primitiveConverterMethod = "intValue"; - } else if (expectedType.equals(Long.TYPE)) { - returnType = Long.class.getName(); - primitiveConverterMethod = "longValue"; - } else if (expectedType.equals(Float.TYPE)) { - returnType = Float.class.getName(); - primitiveConverterMethod = "floatValue"; - } else if (expectedType.equals(Double.TYPE)) { - returnType = Double.class.getName(); - primitiveConverterMethod = "doubleValue"; - } - } else { - returnType = toJavaSourceType(returnType); - } - - targetType = toJavaSourceType(targetType); - - StringBuilder call = new StringBuilder( - "(" + returnType + ") " - + "org.apache.jasper.runtime.PageContextImpl.evaluateExpression" - + "(" + Generator.quote(expression) + ", " - + targetType + ".class, " - + "(PageContext)" + jspCtxt - + ", " + fnmapvar - + ")"); - - /* - * Add the primitive converter method if we need to. - */ - if (primitiveConverterMethod != null) { - call.insert(0, "("); - call.append(")." + primitiveConverterMethod + "()"); - } - - return call.toString(); - } - - /** - * Validates the syntax of all EL expressions within the given string. - * @param where the approximate location of the expressions in the JSP page - * @param expressions a string containing an EL expressions - * @param err an error dispatcher to use - */ - public static void validateExpressions(Mark where, - String expressions, - FunctionMapper functionMapper, - ErrorDispatcher err) - throws JasperException { - - try { - ELContextImpl elContext = new ELContextImpl(null); - elContext.setFunctionMapper(functionMapper); - getExpressionFactory().createValueExpression( - elContext, - expressions, Object.class); - } - catch( ELException e ) { - err.jspError(where, "jsp.error.invalid.expression", expressions, - e.toString() ); - } - } - - public static Object coerce(Class targetType, String value) - throws ELException { - return getExpressionFactory().coerceToType(value, targetType); - } - - /** - * Resets the temporary variable name. - * (not thread-safe) - */ - public static void resetTemporaryVariableName() { - tempSequenceNumber = 0; - } - - /** - * Generates a new temporary variable name. - * (not thread-safe) - */ - public static String nextTemporaryVariableName() { - return Constants.TEMP_VARIABLE_NAME_PREFIX + (tempSequenceNumber++); - } - - public static String coerceToPrimitiveBoolean(String s, - boolean isNamedAttribute) { - if (isNamedAttribute) { - return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToBoolean(" + s + ")"; - } else { - if (s == null || s.length() == 0) - return "false"; - else - return Boolean.valueOf(s).toString(); - } - } - - public static String coerceToBoolean(String s, boolean isNamedAttribute) { - if (isNamedAttribute) { - return "(Boolean) org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s + ", Boolean.class)"; - } else { - if (s == null || s.length() == 0) { - return "Boolean.FALSE"; - } else { - // Detect format error at translation time - return "new Boolean(" + Boolean.valueOf(s).toString() + ")"; - } - } - } - - public static String coerceToPrimitiveByte(String s, - boolean isNamedAttribute) { - if (isNamedAttribute) { - return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToByte(" + s + ")"; - } else { - if (s == null || s.length() == 0) - return "(byte) 0"; - else - return "((byte)" + Byte.valueOf(s).toString() + ")"; - } - } - - public static String coerceToByte(String s, boolean isNamedAttribute) { - if (isNamedAttribute) { - return "(Byte) org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s + ", Byte.class)"; - } else { - if (s == null || s.length() == 0) { - return "Byte.valueOf((byte) 0)"; - } else { - // Detect format error at translation time - return "new Byte((byte)" + Byte.valueOf(s).toString() + ")"; - } - } - } - - public static String coerceToChar(String s, boolean isNamedAttribute) { - if (isNamedAttribute) { - return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToChar(" + s + ")"; - } else { - if (s == null || s.length() == 0) { - return "(char) 0"; - } else { - char ch = s.charAt(0); - // this trick avoids escaping issues - return "((char) " + (int) ch + ")"; - } - } - } - - public static String coerceToCharacter(String s, boolean isNamedAttribute) { - if (isNamedAttribute) { - return "(Character) org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s + ", Character.class)"; - } else { - if (s == null || s.length() == 0) { - return "new Character((char) 0)"; - } else { - char ch = s.charAt(0); - // this trick avoids escaping issues - return "new Character((char) " + (int) ch + ")"; - } - } - } - - public static String coerceToPrimitiveDouble(String s, - boolean isNamedAttribute) { - if (isNamedAttribute) { - return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToDouble(" + s + ")"; - } else { - if (s == null || s.length() == 0) - return "(double) 0"; - else - return Double.valueOf(s).toString(); - } - } - - public static String coerceToDouble(String s, boolean isNamedAttribute) { - if (isNamedAttribute) { - return "(Double) org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s + ", Double.class)"; - } else { - if (s == null || s.length() == 0) { - return "new Double(0)"; - } else { - // Detect format error at translation time - return "new Double(" + Double.valueOf(s).toString() + ")"; - } - } - } - - public static String coerceToPrimitiveFloat(String s, - boolean isNamedAttribute) { - if (isNamedAttribute) { - return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToFloat(" + s + ")"; - } else { - if (s == null || s.length() == 0) - return "(float) 0"; - else - return Float.valueOf(s).toString() + "f"; - } - } - - public static String coerceToFloat(String s, boolean isNamedAttribute) { - if (isNamedAttribute) { - return "(Float) org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s + ", Float.class)"; - } else { - if (s == null || s.length() == 0) { - return "Float.valueOf(0)"; - } else { - // Detect format error at translation time - return "new Float(" + Float.valueOf(s).toString() + "f)"; - } - } - } - - public static String coerceToInt(String s, boolean isNamedAttribute) { - if (isNamedAttribute) { - return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToInt(" + s + ")"; - } else { - if (s == null || s.length() == 0) - return "0"; - else - return Integer.valueOf(s).toString(); - } - } - - public static String coerceToInteger(String s, boolean isNamedAttribute) { - if (isNamedAttribute) { - return "(Integer) org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s + ", Integer.class)"; - } else { - if (s == null || s.length() == 0) { - return "Integer.valueOf(0)"; - } else { - // Detect format error at translation time - return "new Integer(" + Integer.valueOf(s).toString() + ")"; - } - } - } - - public static String coerceToPrimitiveShort(String s, - boolean isNamedAttribute) { - if (isNamedAttribute) { - return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToShort(" + s + ")"; - } else { - if (s == null || s.length() == 0) - return "(short) 0"; - else - return "((short) " + Short.valueOf(s).toString() + ")"; - } - } - - public static String coerceToShort(String s, boolean isNamedAttribute) { - if (isNamedAttribute) { - return "(Short) org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s + ", Short.class)"; - } else { - if (s == null || s.length() == 0) { - return "Short.valueOf((short) 0)"; - } else { - // Detect format error at translation time - return "new Short(\"" + Short.valueOf(s).toString() + "\")"; - } - } - } - - public static String coerceToPrimitiveLong(String s, - boolean isNamedAttribute) { - if (isNamedAttribute) { - return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToLong(" + s + ")"; - } else { - if (s == null || s.length() == 0) - return "(long) 0"; - else - return Long.valueOf(s).toString() + "l"; - } - } - - public static String coerceToLong(String s, boolean isNamedAttribute) { - if (isNamedAttribute) { - return "(Long) org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s + ", Long.class)"; - } else { - if (s == null || s.length() == 0) { - return "Long.valueOf(0)"; - } else { - // Detect format error at translation time - return "new Long(" + Long.valueOf(s).toString() + "l)"; - } - } - } - - public static String coerceToEnum(String s, String enumClass, boolean isNamedAttribute) { - if (isNamedAttribute) { - return "org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" - + s + "," + enumClass + ".class)"; - } else { - if (s == null || s.length() == 0) { - return "null"; - } else { - return "Enum.valueOf(" + enumClass + ".class, \"" + s + "\")"; - } - } - } - - - public static InputStream getInputStream(String fname, JarFile jarFile, - JspCompilationContext ctxt, - ErrorDispatcher err) - throws JasperException, IOException { - - InputStream in = null; - - if (jarFile != null) { - String jarEntryName = fname.substring(1, fname.length()); - ZipEntry jarEntry = jarFile.getEntry(jarEntryName); - if (jarEntry == null) { - err.jspError("jsp.error.file.not.found", fname); - } - in = jarFile.getInputStream(jarEntry); - } else { - in = ctxt.getResourceAsStream(fname); - } - - if (in == null) { - err.jspError("jsp.error.file.not.found", fname); - } - - return in; - } - - /** - * Gets the fully-qualified class name of the tag handler corresponding to - * the given tag file path. - * - * @param path Tag file path - * @param err Error dispatcher - * - * @return Fully-qualified class name of the tag handler corresponding to - * the given tag file path - */ - public static String getTagHandlerClassName(String path, - ErrorDispatcher err) - throws JasperException { - - String className = null; - int begin = 0; - int index; - - index = path.lastIndexOf(".tag"); - if (index == -1) { - err.jspError("jsp.error.tagfile.badSuffix", path); - } - - //It's tempting to remove the ".tag" suffix here, but we can't. - //If we remove it, the fully-qualified class name of this tag - //could conflict with the package name of other tags. - //For instance, the tag file - // /WEB-INF/tags/foo.tag - //would have fully-qualified class name - // org.apache.jsp.tag.web.foo - //which would conflict with the package name of the tag file - // /WEB-INF/tags/foo/bar.tag - - index = path.indexOf(WEB_INF_TAGS); - if (index != -1) { - className = "org.apache.jsp.tag.web."; - begin = index + WEB_INF_TAGS.length(); - } else { - index = path.indexOf(META_INF_TAGS); - if (index != -1) { - className = "org.apache.jsp.tag.meta."; - begin = index + META_INF_TAGS.length(); - } else { - err.jspError("jsp.error.tagfile.illegalPath", path); - } - } - - className += makeJavaPackage(path.substring(begin)); - - return className; - } - - /** - * Converts the given path to a Java package or fully-qualified class name - * - * @param path Path to convert - * - * @return Java package corresponding to the given path - */ - public static final String makeJavaPackage(String path) { - String classNameComponents[] = split(path,"/"); - StringBuilder legalClassNames = new StringBuilder(); - for (int i = 0; i < classNameComponents.length; i++) { - legalClassNames.append(makeJavaIdentifier(classNameComponents[i])); - if (i < classNameComponents.length - 1) { - legalClassNames.append('.'); - } - } - return legalClassNames.toString(); - } - - /** - * Splits a string into it's components. - * @param path String to split - * @param pat Pattern to split at - * @return the components of the path - */ - private static final String [] split(String path, String pat) { - ArrayList comps = new ArrayList(); - int pos = path.indexOf(pat); - int start = 0; - while( pos >= 0 ) { - if(pos > start ) { - String comp = path.substring(start,pos); - comps.add(comp); - } - start = pos + pat.length(); - pos = path.indexOf(pat,start); - } - if( start < path.length()) { - comps.add(path.substring(start)); - } - String [] result = new String[comps.size()]; - for(int i=0; i < comps.size(); i++) { - result[i] = comps.get(i); - } - return result; - } - - /** - * Converts the given identifier to a legal Java identifier - * - * @param identifier Identifier to convert - * - * @return Legal Java identifier corresponding to the given identifier - */ - public static final String makeJavaIdentifier(String identifier) { - StringBuilder modifiedIdentifier = - new StringBuilder(identifier.length()); - if (!Character.isJavaIdentifierStart(identifier.charAt(0))) { - modifiedIdentifier.append('_'); - } - for (int i = 0; i < identifier.length(); i++) { - char ch = identifier.charAt(i); - if (Character.isJavaIdentifierPart(ch) && ch != '_') { - modifiedIdentifier.append(ch); - } else if (ch == '.') { - modifiedIdentifier.append('_'); - } else { - modifiedIdentifier.append(mangleChar(ch)); - } - } - if (isJavaKeyword(modifiedIdentifier.toString())) { - modifiedIdentifier.append('_'); - } - return modifiedIdentifier.toString(); - } - - /** - * Mangle the specified character to create a legal Java class name. - */ - public static final String mangleChar(char ch) { - char[] result = new char[5]; - result[0] = '_'; - result[1] = Character.forDigit((ch >> 12) & 0xf, 16); - result[2] = Character.forDigit((ch >> 8) & 0xf, 16); - result[3] = Character.forDigit((ch >> 4) & 0xf, 16); - result[4] = Character.forDigit(ch & 0xf, 16); - return new String(result); - } - - /** - * Test whether the argument is a Java keyword - */ - public static boolean isJavaKeyword(String key) { - int i = 0; - int j = javaKeywords.length; - while (i < j) { - int k = (i+j)/2; - int result = javaKeywords[k].compareTo(key); - if (result == 0) { - return true; - } - if (result < 0) { - i = k+1; - } else { - j = k; - } - } - return false; - } - - /** - * Converts the given Xml name to a legal Java identifier. This is - * slightly more efficient than makeJavaIdentifier in that we only need - * to worry about '.', '-', and ':' in the string. We also assume that - * the resultant string is further concatenated with some prefix string - * so that we don't have to worry about it being a Java key word. - * - * @param name Identifier to convert - * - * @return Legal Java identifier corresponding to the given identifier - */ - public static final String makeXmlJavaIdentifier(String name) { - if (name.indexOf('-') >= 0) - name = replace(name, '-', "$1"); - if (name.indexOf('.') >= 0) - name = replace(name, '.', "$2"); - if (name.indexOf(':') >= 0) - name = replace(name, ':', "$3"); - return name; - } - - static InputStreamReader getReader(String fname, String encoding, - JarFile jarFile, - JspCompilationContext ctxt, - ErrorDispatcher err) - throws JasperException, IOException { - - InputStreamReader reader = null; - InputStream in = getInputStream(fname, jarFile, ctxt, err); - - try { - reader = new InputStreamReader(in, encoding); - } catch (UnsupportedEncodingException ex) { - err.jspError("jsp.error.unsupported.encoding", encoding); - } - - return reader; - } - - /** - * Class.getName() return arrays in the form "[[[", where et, - * the element type can be one of ZBCDFIJS or L; - * It is converted into forms that can be understood by javac. - */ - public static String toJavaSourceType(String type) { - - if (type.charAt(0) != '[') { - return type; - } - - int dims = 1; - String t = null; - for (int i = 1; i < type.length(); i++) { - if (type.charAt(i) == '[') { - dims++; - } else { - switch (type.charAt(i)) { - case 'Z': t = "boolean"; break; - case 'B': t = "byte"; break; - case 'C': t = "char"; break; - case 'D': t = "double"; break; - case 'F': t = "float"; break; - case 'I': t = "int"; break; - case 'J': t = "long"; break; - case 'S': t = "short"; break; - case 'L': t = type.substring(i+1, type.indexOf(';')); break; - } - break; - } - } - StringBuilder resultType = new StringBuilder(t); - for (; dims > 0; dims--) { - resultType.append("[]"); - } - return resultType.toString(); - } - - /** - * Compute the canonical name from a Class instance. Note that a - * simple replacment of '$' with '.' of a binary name would not work, - * as '$' is a legal Java Identifier character. - * @param c A instance of java.lang.Class - * @return The canonical name of c. - */ - public static String getCanonicalName(Class c) { - - String binaryName = c.getName(); - c = c.getDeclaringClass(); - - if (c == null) { - return binaryName; - } - - StringBuilder buf = new StringBuilder(binaryName); - do { - buf.setCharAt(c.getName().length(), '.'); - c = c.getDeclaringClass(); - } while ( c != null); - - return buf.toString(); - } - - private static ExpressionFactory getExpressionFactory() { - if (expFactory == null) { - expFactory = ExpressionFactory.newInstance(); - } - return expFactory; - } - - static Map manifestMap = - new ConcurrentHashMap(); - static Manifest nullManifest = new Manifest(); - - /** - * Given a list of jar files, their manifest attribute Class-path are - * scanned, and jars specified there are added to the list. This is - * carried out recursively. - * Note: This is needed to work around the JDK bug 6725230. - */ - public static List expandClassPath(Listfiles) { - - for (int i = 0; i < files.size(); i++) { - String file = files.get(i); - if (! file.endsWith(".jar")) { - continue; - } - Manifest manifest = manifestMap.get(file); - JarFile jarfile = null; - if (manifest == null) { - try { - jarfile = new JarFile(file, false); - manifest = jarfile.getManifest(); - if (manifest == null) { - // mark jar file as known to contain no manifest - manifestMap.put(file, nullManifest); - continue; - } else if (! file.contains("/WEB-INF")) { - // Don't cache any jars bundled with the app. - manifestMap.put(file, manifest); - } - } catch (IOException ex) { - // Ignored - continue; - } finally { - try { - if (jarfile != null) - jarfile.close(); - } catch (IOException ex) { - // Ignored - } - } - } else if (manifest == nullManifest) { - continue; - } - - java.util.jar.Attributes attrs = manifest.getMainAttributes(); - String cp = (String) attrs.getValue("Class-Path"); - if (cp == null) { - continue; - } - - String[] paths = cp.split(" "); - int lastIndex = file.lastIndexOf(File.separatorChar); - String baseDir = ""; - if (lastIndex > 0) { - baseDir = file.substring(0, lastIndex+1); - } - for (String path: paths) { - String p; - if (path.startsWith(File.separator)) { - p = path; - } else { - p = baseDir + path; - } - if (! files.contains(p)) { - files.add(p); - } - } - } - return files; - } - -} - diff --git a/impl/src/main/java/org/apache/jasper/compiler/Jsr199JavaCompiler.java b/impl/src/main/java/org/apache/jasper/compiler/Jsr199JavaCompiler.java deleted file mode 100644 index 11f02ca..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/Jsr199JavaCompiler.java +++ /dev/null @@ -1,385 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2014 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -package org.apache.jasper.compiler; - -import javax.tools.DiagnosticCollector; -import javax.tools.Diagnostic; -import javax.tools.FileObject; -import javax.tools.ToolProvider; -import javax.tools.JavaFileManager; -import javax.tools.JavaFileManager.Location; -import javax.tools.JavaFileObject; -import javax.tools.JavaFileObject.Kind; -import javax.tools.SimpleJavaFileObject; -import javax.tools.ForwardingJavaFileManager; -import javax.tools.StandardJavaFileManager; -import javax.tools.StandardLocation; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.Reader; -import java.io.Writer; -import java.io.CharArrayWriter; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -import java.net.URI; -import java.util.Map; -import java.util.List; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Arrays; -import java.util.Set; - -import org.apache.jasper.JasperException; -import org.apache.jasper.Constants; -import org.apache.jasper.JspCompilationContext; - - -/** - * Invoke Java Compiler per JSR 199, using in-memory storage for both the - * input Java source and the generated bytecodes. - * - * @author Kin-man Chung - */ -public class Jsr199JavaCompiler implements JavaCompiler { - - protected List cpath; - private JspRuntimeContext rtctxt; - protected ArrayList classFiles; - // a JSP compilation can produce multiple class files, we need to - // keep track of all generated bytecodes.. - - protected ArrayList options = new ArrayList(); - protected CharArrayWriter charArrayWriter; - private JspCompilationContext ctxt; - protected String javaFileName; - protected String javaEncoding; - private ErrorDispatcher errDispatcher; - - public void init(JspCompilationContext ctxt, - ErrorDispatcher errDispatcher, - boolean suppressLogging) { - this.ctxt = ctxt; - this.errDispatcher = errDispatcher; - rtctxt = ctxt.getRuntimeContext(); - options.add("-proc:none"); // Disable annotation processing - } - - public void release() { - classFiles = null; // release temp bytecodes - } - - public void setClassPath(List path) { - // Jsr199 does not expand jar manifest Class-Path (JDK bug?), we - // need to do it here - List paths = new ArrayList(); - for (File f: path) { - paths.add(f.toString()); - } - List files = JspUtil.expandClassPath(paths); - this.cpath = new ArrayList(); - for (String file: files) { - this.cpath.add(new File(file)); - } - } - - public void setExtdirs(String exts) { - options.add("-extdirs"); - options.add(exts); - } - - public void setSourceVM(String sourceVM) { - options.add("-source"); - options.add(sourceVM); - } - - public void setTargetVM(String targetVM) { - options.add("-target"); - options.add(targetVM); - } - - public void saveClassFile(String className, String classFileName) { - for (BytecodeFile bytecodeFile: classFiles) { - String c = bytecodeFile.getClassName(); - String f = classFileName; - if (!className.equals(c)) { - // Compute inner class file name - f = f.substring(0, f.lastIndexOf(File.separator)+1) + - c.substring(c.lastIndexOf('.')+1) + ".class"; - } - rtctxt.saveBytecode(c, f); - } - } - - public void doJavaFile(boolean keep) throws JasperException { - - if (! keep) { - charArrayWriter = null; - return; - } - - try { - Writer writer = new OutputStreamWriter( - new FileOutputStream(javaFileName), - javaEncoding); - writer.write(charArrayWriter.toString()); - writer.close(); - charArrayWriter = null; - } catch (UnsupportedEncodingException ex) { - errDispatcher.jspError("jsp.error.needAlternateJavaEncoding", - javaEncoding); - } catch (IOException ex) { - throw new JasperException(ex); - } - } - - public void setDebug(boolean debug) { - if (debug) { - options.add("-g"); - } else { - options.add("-g:none"); - } - } - - public Writer getJavaWriter(String javaFileName, String javaEncoding) { - this.javaFileName = javaFileName; - this.javaEncoding = javaEncoding; - this.charArrayWriter = new CharArrayWriter(); - return this.charArrayWriter; - } - - public long getClassLastModified() { - String className = ctxt.getFullClassName(); - return rtctxt.getBytecodeBirthTime(className); - } - - public JavacErrorDetail[] compile(String className, Node.Nodes pageNodes) - throws JasperException { - - final String source = charArrayWriter.toString(); - classFiles = new ArrayList(); - - javax.tools.JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); - if (javac == null) { - errDispatcher.jspError("jsp.error.nojdk"); - } - - DiagnosticCollector diagnostics = - new DiagnosticCollector(); - StandardJavaFileManager stdFileManager = - javac.getStandardFileManager(diagnostics, null, null); - - String name = className.substring(className.lastIndexOf('.')+1); - - JavaFileObject[] sourceFiles = { - new SimpleJavaFileObject( - URI.create("string:///" + name.replace('.','/') + - Kind.SOURCE.extension), - Kind.SOURCE) { - public CharSequence getCharContent(boolean ignore) { - return source; - } - } - }; - - try { - stdFileManager.setLocation(StandardLocation.CLASS_PATH, this.cpath); - } catch (IOException e) { - } - - JavaFileManager javaFileManager = getJavaFileManager(stdFileManager); - javax.tools.JavaCompiler.CompilationTask ct = - javac.getTask(null, - javaFileManager, - diagnostics, - options, - null, - Arrays.asList(sourceFiles)); - - try { - javaFileManager.close(); - } catch (IOException ex) { - } - - if (ct.call()) { - for (BytecodeFile bytecodeFile: classFiles) { - rtctxt.setBytecode(bytecodeFile.getClassName(), - bytecodeFile.getBytecode()); - } - return null; - } - - // There are compilation errors! - ArrayList problems = - new ArrayList(); - for (Diagnostic dm: diagnostics.getDiagnostics()) { - problems.add(ErrorDispatcher.createJavacError( - javaFileName, - pageNodes, - new StringBuilder(dm.getMessage(null)), - (int) dm.getLineNumber())); - } - return problems.toArray(new JavacErrorDetail[0]); - } - - - protected static class BytecodeFile extends SimpleJavaFileObject { - - private byte[] bytecode; - private String className; - - BytecodeFile(URI uri, String className) { - super(uri, Kind.CLASS); - this.className = className; - } - - String getClassName() { - return this.className; - } - - byte[] getBytecode() { - return this.bytecode; - } - - public OutputStream openOutputStream() { - return new ByteArrayOutputStream() { - public void close() { - bytecode = this.toByteArray(); - } - }; - } - - public InputStream openInputStream() { - return new ByteArrayInputStream(bytecode); - } - } - - - protected JavaFileObject getOutputFile(final String className, - final URI uri) { - - BytecodeFile classFile = new BytecodeFile(uri, className); - - // File the class file away, by its package name - String packageName = className.substring(0, className.lastIndexOf(".")); - Map> packageMap = - rtctxt.getPackageMap(); - Map packageFiles = packageMap.get(packageName); - if (packageFiles == null) { - packageFiles = new HashMap(); - packageMap.put(packageName, packageFiles); - } - packageFiles.put(className, classFile); - classFiles.add(classFile); - return classFile; - } - - protected JavaFileManager getJavaFileManager(JavaFileManager fm) { - - return new ForwardingJavaFileManager(fm) { - -/* - @Override - public FileObject getFileForOutput(Location location, - String packageName, - String relativeName, - FileObject sibling){ - System.out.println(" At getFileForOutput: location = " + - location + " pachageName = " + packageName + - " relativeName = " + relativeName + - " sibling = " + sibling); - return getOutputFile(relativeName, null); - } -*/ - - @Override - public JavaFileObject getJavaFileForOutput(Location location, - String className, - Kind kind, - FileObject sibling){ - return getOutputFile(className, - URI.create("file:///" + className.replace('.','/') + kind)); - } - - @Override - public String inferBinaryName(Location location, - JavaFileObject file) { - - if (file instanceof BytecodeFile) { - return ((BytecodeFile)file).getClassName(); - } - return super.inferBinaryName(location, file); - } - - @Override - public Iterable list(Location location, - String packageName, - Set kinds, - boolean recurse) - throws IOException { - - if (location == StandardLocation.CLASS_PATH && - packageName.startsWith(Constants.JSP_PACKAGE_NAME)) { - - // TODO: Need to handle the case where some of the classes - // are on disk - - Map packageFiles - = rtctxt.getPackageMap().get(packageName); - if (packageFiles != null) { - return packageFiles.values(); - } - } - Iterable lst = - super.list(location, packageName, kinds, recurse); - - return lst; - } - }; - - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/Localizer.java b/impl/src/main/java/org/apache/jasper/compiler/Localizer.java deleted file mode 100644 index 4d73384..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/Localizer.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.util.*; -import java.io.*; -import java.text.MessageFormat; -import org.xml.sax.*; -import org.apache.jasper.JasperException; - -/** - * Class responsible for converting error codes to corresponding localized - * error messages. - * - * @author Jan Luehe - */ -public class Localizer { - - private static final ResourceBundle bundle = ResourceBundle.getBundle( - "org.apache.jasper.resources.messages"); - - /* - * Returns the localized error message corresponding to the given error - * code. - * - * If the given error code is not defined in the resource bundle for - * localized error messages, it is used as the error message. - * - * @param errCode Error code to localize - * - * @return Localized error message - */ - public static String getMessage(String errCode) { - String errMsg = errCode; - try { - errMsg = bundle.getString(errCode); - } catch (MissingResourceException e) { - } - return errMsg; - } - - /* - * Returns the localized error message corresponding to the given error - * code. - * - * If the given error code is not defined in the resource bundle for - * localized error messages, it is used as the error message. - * - * @param errCode Error code to localize - * @param arg Argument for parametric replacement - * - * @return Localized error message - */ - public static String getMessage(String errCode, String arg) { - return getMessage(errCode, new Object[] {arg}); - } - - /* - * Returns the localized error message corresponding to the given error - * code. - * - * If the given error code is not defined in the resource bundle for - * localized error messages, it is used as the error message. - * - * @param errCode Error code to localize - * @param arg1 First argument for parametric replacement - * @param arg2 Second argument for parametric replacement - * - * @return Localized error message - */ - public static String getMessage(String errCode, String arg1, String arg2) { - return getMessage(errCode, new Object[] {arg1, arg2}); - } - - /* - * Returns the localized error message corresponding to the given error - * code. - * - * If the given error code is not defined in the resource bundle for - * localized error messages, it is used as the error message. - * - * @param errCode Error code to localize - * @param arg1 First argument for parametric replacement - * @param arg2 Second argument for parametric replacement - * @param arg3 Third argument for parametric replacement - * - * @return Localized error message - */ - public static String getMessage(String errCode, String arg1, String arg2, - String arg3) { - return getMessage(errCode, new Object[] {arg1, arg2, arg3}); - } - - /* - * Returns the localized error message corresponding to the given error - * code. - * - * If the given error code is not defined in the resource bundle for - * localized error messages, it is used as the error message. - * - * @param errCode Error code to localize - * @param arg1 First argument for parametric replacement - * @param arg2 Second argument for parametric replacement - * @param arg3 Third argument for parametric replacement - * @param arg4 Fourth argument for parametric replacement - * - * @return Localized error message - */ - public static String getMessage(String errCode, String arg1, String arg2, - String arg3, String arg4) { - return getMessage(errCode, new Object[] {arg1, arg2, arg3, arg4}); - } - - /* - * Returns the localized error message corresponding to the given error - * code. - * - * If the given error code is not defined in the resource bundle for - * localized error messages, it is used as the error message. - * - * @param errCode Error code to localize - * @param args Arguments for parametric replacement - * - * @return Localized error message - */ - public static String getMessage(String errCode, Object[] args) { - String errMsg = errCode; - try { - errMsg = bundle.getString(errCode); - if (args != null) { - MessageFormat formatter = new MessageFormat(errMsg); - errMsg = formatter.format(args); - } - } catch (MissingResourceException e) { - } - - return errMsg; - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/Mark.java b/impl/src/main/java/org/apache/jasper/compiler/Mark.java deleted file mode 100644 index d92920d..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/Mark.java +++ /dev/null @@ -1,300 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.util.Stack; -import java.net.URL; -import java.net.MalformedURLException; -import org.apache.jasper.JspCompilationContext; - -/** - * Mark represents a point in the JSP input. - * - * @author Anil K. Vijendran - */ -final class Mark { - int cursor, line, col; // position within current stream - int fileid; // fileid of current stream - String fileName; // name of the current file - String baseDir; // directory of file for current stream - char[] stream = null; // current stream - Stack includeStack = null; - // stack of stream and stream state of streams - // that have included current stream - String encoding = null; // encoding of current file - private JspReader reader; // reader that owns this mark - // (so we can look up fileid's) - private JspCompilationContext ctxt; - - - /** - * Keep track of parser before parsing an included file. - * This class keeps track of the parser before we switch to parsing an - * included file. In other words, it's the parser's continuation to be - * reinstalled after the included file parsing is done. - */ - class IncludeState { - int cursor, line, col; - int fileid; - String fileName; - String baseDir; - String encoding; - char[] stream = null; - - IncludeState(int inCursor, int inLine, int inCol, int inFileid, - String name, String inBaseDir, String inEncoding, - char[] inStream) - { - cursor = inCursor; - line = inLine; - col = inCol; - fileid = inFileid; - fileName = name; - baseDir = inBaseDir; - encoding = inEncoding; - stream = inStream; - } - } - - /** - * Constructor - * - * @param reader JspReader this mark belongs to - * @param inStream current stream for this mark - * @param fileid id of requested jsp file - * @param name JSP file name - * @param inBaseDir base directory of requested jsp file - * @param inEncoding encoding of current file - */ - Mark(JspReader reader, char[] inStream, int fileid, String name, - String inBaseDir, String inEncoding) - { - this.reader = reader; - this.ctxt = reader.getJspCompilationContext(); - this.stream = inStream; - this.cursor = 0; - this.line = 1; - this.col = 1; - this.fileid = fileid; - this.fileName = name; - this.baseDir = inBaseDir; - this.encoding = inEncoding; - this.includeStack = new Stack(); - } - - /** - * Constructor - */ - Mark(Mark other) { - this.reader = other.reader; - this.ctxt = other.reader.getJspCompilationContext(); - this.stream = other.stream; - this.fileid = other.fileid; - this.fileName = other.fileName; - this.cursor = other.cursor; - this.line = other.line; - this.col = other.col; - this.baseDir = other.baseDir; - this.encoding = other.encoding; - - // clone includeStack without cloning contents - includeStack = new Stack(); - for ( int i=0; i < other.includeStack.size(); i++ ) { - includeStack.addElement( other.includeStack.elementAt(i) ); - } - } - - /** - * Constructor - */ - Mark(JspCompilationContext ctxt, String filename, int line, int col) { - this.reader = null; - this.ctxt = ctxt; - this.stream = null; - this.cursor = 0; - this.line = line; - this.col = col; - this.fileid = -1; - this.fileName = filename; - this.baseDir = "le-basedir"; - this.encoding = "le-endocing"; - this.includeStack = null; - } - - /** Sets this mark's state to a new stream. - * It will store the current stream in it's includeStack. - * @param inStream new stream for mark - * @param inFileid id of new file from which stream comes from - * @param inBaseDir directory of file - * @param inEncoding encoding of new file - */ - public void pushStream(char[] inStream, int inFileid, String name, - String inBaseDir, String inEncoding) - { - - // store current state in stack - includeStack.push(new IncludeState(cursor, line, col, fileid, fileName, baseDir, - encoding, stream) ); - - // set new variables - cursor = 0; - line = 1; - col = 1; - fileid = inFileid; - fileName = name; - baseDir = inBaseDir; - encoding = inEncoding; - stream = inStream; - } - - /** - /* Restores this mark's state to a previously stored stream. - * @return null if there is no previous stream - * The previous Makr instance when the stream is pushed. - */ - public Mark popStream() { - // make sure we have something to pop - if ( includeStack.size() <= 0 ) { - return null; - } - - // get previous state in stack - IncludeState state = includeStack.pop( ); - - // set new variables - cursor = state.cursor; - line = state.line; - col = state.col; - fileid = state.fileid; - fileName = state.fileName; - baseDir = state.baseDir; - stream = state.stream; - return this; - } - - // -------------------- Locator interface -------------------- - - public int getLineNumber() { - return line; - } - - public int getColumnNumber() { - return col; - } - - public String getSystemId() { - return getFile(); - } - - public String getPublicId() { - return null; - } - - public String toString() { - return getFile()+"("+line+","+col+")"; - } - - public String getFile() { - return this.fileName; - } - - /** - * Gets the URL of the resource with which this Mark is associated - * - * @return URL of the resource with which this Mark is associated - * - * @exception MalformedURLException if the resource pathname is incorrect - */ - public URL getURL() throws MalformedURLException { - return ctxt.getResource(getFile()); - } - - public String toShortString() { - return "("+line+","+col+")"; - } - - public boolean equals(Object other) { - if (other instanceof Mark) { - Mark m = (Mark) other; - return this.reader == m.reader && this.fileid == m.fileid - && this.cursor == m.cursor && this.line == m.line - && this.col == m.col; - } - return false; - } - - /** - * @return true if this Mark is greather than the other - * Mark, false otherwise. - */ - public boolean isGreater(Mark other) { - - boolean greater = false; - - if (this.line > other.line) { - greater = true; - } else if (this.line == other.line && this.col > other.col) { - greater = true; - } - - return greater; - } - -} - diff --git a/impl/src/main/java/org/apache/jasper/compiler/Node.java b/impl/src/main/java/org/apache/jasper/compiler/Node.java deleted file mode 100644 index c8dc6c2..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/Node.java +++ /dev/null @@ -1,2503 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.util.Iterator; -import java.util.List; -import java.util.ArrayList; -import java.util.HashMap; - -import javax.servlet.jsp.tagext.BodyTag; -import javax.servlet.jsp.tagext.DynamicAttributes; -import javax.servlet.jsp.tagext.IterationTag; -import javax.servlet.jsp.tagext.SimpleTag; -import javax.servlet.jsp.tagext.TagAttributeInfo; -import javax.servlet.jsp.tagext.TagData; -import javax.servlet.jsp.tagext.TagFileInfo; -import javax.servlet.jsp.tagext.TagInfo; -import javax.servlet.jsp.tagext.TagVariableInfo; -import javax.servlet.jsp.tagext.TryCatchFinally; -import javax.servlet.jsp.tagext.VariableInfo; - -import org.apache.jasper.JasperException; -import org.apache.jasper.compiler.tagplugin.TagPluginContext; -import org.xml.sax.Attributes; - - -/** - * An internal data representation of a JSP page or a JSP docuement (XML). - * Also included here is a visitor class for tranversing nodes. - * - * @author Kin-man Chung - * @author Jan Luehe - * @author Shawn Bayern - * @author Mark Roth - */ - -abstract class Node implements TagConstants { - - private static final VariableInfo[] ZERO_VARIABLE_INFO = { }; - - protected Attributes attrs; - - // xmlns attributes that represent tag libraries (only in XML syntax) - protected Attributes taglibAttrs; - - /* - * xmlns attributes that do not represent tag libraries - * (only in XML syntax) - */ - protected Attributes nonTaglibXmlnsAttrs; - - protected Nodes body; - protected String text; - protected Mark startMark; - protected int beginJavaLine; - protected int endJavaLine; - protected Node parent; - protected Nodes namedAttributeNodes; // cached for performance - protected String qName; - protected String localName; - /* - * The name of the inner class to which the codes for this node and - * its body are generated. For instance, for in foo.jsp, - * this is "foo_jspHelper". This is primarily used for communicating - * such info from Generator to Smap generator. - */ - protected String innerClassName; - - private boolean isDummy; - - /** - * Zero-arg Constructor. - */ - public Node() { - this.isDummy = true; - } - - /** - * Constructor. - * - * @param start The location of the jsp page - * @param parent The enclosing node - */ - public Node(Mark start, Node parent) { - this.startMark = start; - this.isDummy = (start == null); - addToParent(parent); - } - - /** - * Constructor. - * - * @param qName The action's qualified name - * @param localName The action's local name - * @param start The location of the jsp page - * @param parent The enclosing node - */ - public Node(String qName, String localName, Mark start, Node parent) { - this.qName = qName; - this.localName = localName; - this.startMark = start; - this.isDummy = (start == null); - addToParent(parent); - } - - /** - * Constructor for Nodes parsed from standard syntax. - * - * @param qName The action's qualified name - * @param localName The action's local name - * @param attrs The attributes for this node - * @param start The location of the jsp page - * @param parent The enclosing node - */ - public Node(String qName, String localName, Attributes attrs, Mark start, - Node parent) { - this.qName = qName; - this.localName = localName; - this.attrs = attrs; - this.startMark = start; - this.isDummy = (start == null); - addToParent(parent); - } - - /** - * Constructor for Nodes parsed from XML syntax. - * - * @param qName The action's qualified name - * @param localName The action's local name - * @param attrs The action's attributes whose name does not start with - * xmlns - * @param nonTaglibXmlnsAttrs The action's xmlns attributes that do not - * represent tag libraries - * @param taglibAttrs The action's xmlns attributes that represent tag - * libraries - * @param start The location of the jsp page - * @param parent The enclosing node - */ - public Node(String qName, String localName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs, - Mark start, Node parent) { - this.qName = qName; - this.localName = localName; - this.attrs = attrs; - this.nonTaglibXmlnsAttrs = nonTaglibXmlnsAttrs; - this.taglibAttrs = taglibAttrs; - this.startMark = start; - this.isDummy = (start == null); - addToParent(parent); - } - - /* - * Constructor. - * - * @param qName The action's qualified name - * @param localName The action's local name - * @param text The text associated with this node - * @param start The location of the jsp page - * @param parent The enclosing node - */ - public Node(String qName, String localName, String text, Mark start, - Node parent) { - this.qName = qName; - this.localName = localName; - this.text = text; - this.startMark = start; - this.isDummy = (start == null); - addToParent(parent); - } - - public String getQName() { - return this.qName; - } - - public String getLocalName() { - return this.localName; - } - - /* - * Gets this Node's attributes. - * - * In the case of a Node parsed from standard syntax, this method returns - * all the Node's attributes. - * - * In the case of a Node parsed from XML syntax, this method returns only - * those attributes whose name does not start with xmlns. - */ - public Attributes getAttributes() { - return this.attrs; - } - - /* - * Gets this Node's xmlns attributes that represent tag libraries - * (only meaningful for Nodes parsed from XML syntax) - */ - public Attributes getTaglibAttributes() { - return this.taglibAttrs; - } - - /* - * Gets this Node's xmlns attributes that do not represent tag libraries - * (only meaningful for Nodes parsed from XML syntax) - */ - public Attributes getNonTaglibXmlnsAttributes() { - return this.nonTaglibXmlnsAttrs; - } - - public void setAttributes(Attributes attrs) { - this.attrs = attrs; - } - - public String getAttributeValue(String name) { - return (attrs == null) ? null : attrs.getValue(name); - } - - /** - * Get the attribute that is non request time expression, either - * from the attribute of the node, or from a jsp:attrbute - */ - public String getTextAttribute(String name) { - - String attr = getAttributeValue(name); - if (attr != null) { - return attr; - } - - NamedAttribute namedAttribute = getNamedAttributeNode(name); - if (namedAttribute == null) { - return null; - } - - return namedAttribute.getText(); - } - - /** - * Searches all subnodes of this node for jsp:attribute standard - * actions with the given name, and returns the NamedAttribute node - * of the matching named attribute, nor null if no such node is found. - *

    - * This should always be called and only be called for nodes that - * accept dynamic runtime attribute expressions. - */ - public NamedAttribute getNamedAttributeNode( String name ) { - NamedAttribute result = null; - - // Look for the attribute in NamedAttribute children - Nodes nodes = getNamedAttributeNodes(); - int numChildNodes = nodes.size(); - for( int i = 0; i < numChildNodes; i++ ) { - NamedAttribute na = (NamedAttribute)nodes.getNode( i ); - boolean found = false; - int index = name.indexOf(':'); - if (index != -1) { - // qualified name - found = na.getName().equals(name); - } else { - found = na.getLocalName().equals(name); - } - if (found) { - result = na; - break; - } - } - - return result; - } - - /** - * Searches all subnodes of this node for jsp:attribute standard - * actions, and returns that set of nodes as a Node.Nodes object. - * - * @return Possibly empty Node.Nodes object containing any jsp:attribute - * subnodes of this Node - */ - public Node.Nodes getNamedAttributeNodes() { - - if (namedAttributeNodes != null) { - return namedAttributeNodes; - } - - Node.Nodes result = new Node.Nodes(); - - // Look for the attribute in NamedAttribute children - Nodes nodes = getBody(); - if( nodes != null ) { - int numChildNodes = nodes.size(); - for( int i = 0; i < numChildNodes; i++ ) { - Node n = nodes.getNode( i ); - if( n instanceof NamedAttribute ) { - result.add( n ); - } - else if (! (n instanceof Comment)) { - // Nothing can come before jsp:attribute, and only - // jsp:body can come after it. - break; - } - } - } - - namedAttributeNodes = result; - return result; - } - - public Nodes getBody() { - return body; - } - - public void setBody(Nodes body) { - this.body = body; - } - - public String getText() { - return text; - } - - public Mark getStart() { - return startMark; - } - - public Node getParent() { - return parent; - } - - public int getBeginJavaLine() { - return beginJavaLine; - } - - public void setBeginJavaLine(int begin) { - beginJavaLine = begin; - } - - public int getEndJavaLine() { - return endJavaLine; - } - - public void setEndJavaLine(int end) { - endJavaLine = end; - } - - public boolean isDummy() { - return isDummy; - } - - public Node.Root getRoot() { - Node n = this; - while (!(n instanceof Node.Root)) { - n = n.getParent(); - } - return (Node.Root) n; - } - - public String getInnerClassName() { - return innerClassName; - } - - public void setInnerClassName(String icn) { - innerClassName = icn; - } - - /** - * Selects and invokes a method in the visitor class based on the node - * type. This is abstract and should be overrode by the extending classes. - * @param v The visitor class - */ - abstract void accept(Visitor v) throws JasperException; - - - //********************************************************************* - // Private utility methods - - /* - * Adds this Node to the body of the given parent. - */ - private void addToParent(Node parent) { - if (parent != null) { - this.parent = parent; - Nodes parentBody = parent.getBody(); - if (parentBody == null) { - parentBody = new Nodes(); - parent.setBody(parentBody); - } - parentBody.add(this); - } - } - - - /********************************************************************* - * Child classes - */ - - /** - * Represents the root of a Jsp page or Jsp document - */ - public static class Root extends Node { - - private Root parentRoot; - private boolean isXmlSyntax; - private boolean hasBom; - - // Source encoding of the page containing this Root - private String pageEnc; - - // Page encoding specified in JSP config element - private String jspConfigPageEnc; - - /* - * Flag indicating if the default page encoding is being used (only - * applicable with standard syntax). - * - * True if the page does not provide a page directive with a - * 'contentType' attribute (or the 'contentType' attribute doesn't - * have a CHARSET value), the page does not provide a page directive - * with a 'pageEncoding' attribute, and there is no JSP configuration - * element page-encoding whose URL pattern matches the page. - */ - private boolean isDefaultPageEncoding; - - /* - * Indicates whether an encoding has been explicitly specified in the - * page's XML prolog (only used for pages in XML syntax). - * This information is used to decide whether a translation error must - * be reported for encoding conflicts. - */ - private boolean isEncodingSpecifiedInProlog; - - /* - * Constructor. - */ - Root(Mark start, Node parent, boolean isXmlSyntax) { - super(start, parent); - this.isXmlSyntax = isXmlSyntax; - this.qName = JSP_ROOT_ACTION; - this.localName = ROOT_ACTION; - - // Figure out and set the parent root - Node r = parent; - while ((r != null) && !(r instanceof Node.Root)) - r = r.getParent(); - parentRoot = (Node.Root) r; - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public boolean isXmlSyntax() { - return isXmlSyntax; - } - - /* - * Sets the encoding specified in the JSP config element whose URL - * pattern matches the page containing this Root. - */ - public void setJspConfigPageEncoding(String enc) { - jspConfigPageEnc = enc; - } - - /* - * Gets the encoding specified in the JSP config element whose URL - * pattern matches the page containing this Root. - */ - public String getJspConfigPageEncoding() { - return jspConfigPageEnc; - } - - public void setPageEncoding(String enc) { - pageEnc = enc; - } - - public String getPageEncoding() { - return pageEnc; - } - - public void setIsDefaultPageEncoding(boolean isDefault) { - isDefaultPageEncoding = isDefault; - } - - public boolean isDefaultPageEncoding() { - return isDefaultPageEncoding; - } - - public void setIsEncodingSpecifiedInProlog(boolean isSpecified) { - isEncodingSpecifiedInProlog = isSpecified; - } - - public boolean isEncodingSpecifiedInProlog() { - return isEncodingSpecifiedInProlog; - } - - public void setHasBom(boolean hasBom) { - this.hasBom = hasBom; - } - - public boolean hasBom() { - return hasBom; - } - - /** - * @return The enclosing root to this Root. Usually represents the - * page that includes this one. - */ - public Root getParentRoot() { - return parentRoot; - } - } - - /** - * Represents the root of a Jsp document (XML syntax) - */ - public static class JspRoot extends Node { - - public JspRoot(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs, - Mark start, Node parent) { - super(qName, ROOT_ACTION, attrs, nonTaglibXmlnsAttrs, taglibAttrs, - start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Represents a page directive - */ - public static class PageDirective extends Node { - - private ArrayList imports; - - public PageDirective(Attributes attrs, Mark start, Node parent) { - this(JSP_PAGE_DIRECTIVE_ACTION, attrs, null, null, start, parent); - } - - public PageDirective(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, Node parent) { - super(qName, PAGE_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - imports = new ArrayList(); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - /** - * Parses the comma-separated list of class or package names in the - * given attribute value and adds each component to this - * PageDirective's vector of imported classes and packages. - * @param value A comma-separated string of imports. - */ - public void addImport(String value) { - int start = 0; - int index; - while ((index = value.indexOf(',', start)) != -1) { - imports.add(value.substring(start, index).trim()); - start = index + 1; - } - if (start == 0) { - // No comma found - imports.add(value.trim()); - } else { - imports.add(value.substring(start).trim()); - } - } - - public List getImports() { - return imports; - } - } - - /** - * Represents an include directive - */ - public static class IncludeDirective extends Node { - - public IncludeDirective(Attributes attrs, Mark start, Node parent) { - this(JSP_INCLUDE_DIRECTIVE_ACTION, attrs, null, null, start, - parent); - } - - public IncludeDirective(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, - Node parent) { - super(qName, INCLUDE_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Represents a custom taglib directive - */ - public static class TaglibDirective extends Node { - - public TaglibDirective(Attributes attrs, Mark start, Node parent) { - super(JSP_TAGLIB_DIRECTIVE_ACTION, TAGLIB_DIRECTIVE_ACTION, attrs, - start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Represents a tag directive - */ - public static class TagDirective extends Node { - private ArrayList imports; - - public TagDirective(Attributes attrs, Mark start, Node parent) { - this(JSP_TAG_DIRECTIVE_ACTION, attrs, null, null, start, parent); - } - - public TagDirective(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, Node parent) { - super(qName, TAG_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - imports = new ArrayList(); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - /** - * Parses the comma-separated list of class or package names in the - * given attribute value and adds each component to this - * PageDirective's vector of imported classes and packages. - * @param value A comma-separated string of imports. - */ - public void addImport(String value) { - int start = 0; - int index; - while ((index = value.indexOf(',', start)) != -1) { - imports.add(value.substring(start, index).trim()); - start = index + 1; - } - if (start == 0) { - // No comma found - imports.add(value.trim()); - } else { - imports.add(value.substring(start).trim()); - } - } - - public List getImports() { - return imports; - } - } - - /** - * Represents an attribute directive - */ - public static class AttributeDirective extends Node { - - public AttributeDirective(Attributes attrs, Mark start, Node parent) { - this(JSP_ATTRIBUTE_DIRECTIVE_ACTION, attrs, null, null, start, - parent); - } - - public AttributeDirective(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, - Node parent) { - super(qName, ATTRIBUTE_DIRECTIVE_ACTION, attrs, - nonTaglibXmlnsAttrs, taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Represents a variable directive - */ - public static class VariableDirective extends Node { - - public VariableDirective(Attributes attrs, Mark start, Node parent) { - this(JSP_VARIABLE_DIRECTIVE_ACTION, attrs, null, null, start, - parent); - } - - public VariableDirective(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, - Mark start, Node parent) { - super(qName, VARIABLE_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Represents a tag file action - */ - public static class InvokeAction extends Node { - - public InvokeAction(Attributes attrs, Mark start, Node parent) { - this(JSP_INVOKE_ACTION, attrs, null, null, start, parent); - } - - public InvokeAction(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, Node parent) { - super(qName, INVOKE_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Represents a tag file action - */ - public static class DoBodyAction extends Node { - - public DoBodyAction(Attributes attrs, Mark start, Node parent) { - this(JSP_DOBODY_ACTION, attrs, null, null, start, parent); - } - - public DoBodyAction(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, Node parent) { - super(qName, DOBODY_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Represents a Jsp comment - * Comments are kept for completeness. - */ - public static class Comment extends Node { - - public Comment(String text, Mark start, Node parent) { - super(null, null, text, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Represents an expression, declaration, or scriptlet - */ - public static abstract class ScriptingElement extends Node { - - public ScriptingElement(String qName, String localName, String text, - Mark start, Node parent) { - super(qName, localName, text, start, parent); - } - - public ScriptingElement(String qName, String localName, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, - Node parent) { - super(qName, localName, null, nonTaglibXmlnsAttrs, taglibAttrs, - start, parent); - } - - /** - * When this node was created from a JSP page in JSP syntax, its text - * was stored as a String in the "text" field, whereas when this node - * was created from a JSP document, its text was stored as one or more - * TemplateText nodes in its body. This method handles either case. - * @return The text string - */ - public String getText() { - String ret = text; - if ((ret == null) && (body != null)) { - StringBuilder buf = new StringBuilder(); - for (int i=0; i 0) { - return body.getNode(0).getStart(); - } else { - return super.getStart(); - } - } - } - - /** - * Represents a declaration - */ - public static class Declaration extends ScriptingElement { - - public Declaration(String text, Mark start, Node parent) { - super(JSP_DECLARATION_ACTION, DECLARATION_ACTION, text, start, - parent); - } - - public Declaration(String qName, Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, - Node parent) { - super(qName, DECLARATION_ACTION, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Represents an expression. Expressions in attributes are embedded - * in the attribute string and not here. - */ - public static class Expression extends ScriptingElement { - - public Expression(String text, Mark start, Node parent) { - super(JSP_EXPRESSION_ACTION, EXPRESSION_ACTION, text, start, - parent); - } - - public Expression(String qName, Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, - Node parent) { - super(qName, EXPRESSION_ACTION, nonTaglibXmlnsAttrs, taglibAttrs, - start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Represents a scriptlet - */ - public static class Scriptlet extends ScriptingElement { - - public Scriptlet(String text, Mark start, Node parent) { - super(JSP_SCRIPTLET_ACTION, SCRIPTLET_ACTION, text, start, parent); - } - - public Scriptlet(String qName, Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, - Node parent) { - super(qName, SCRIPTLET_ACTION, nonTaglibXmlnsAttrs, taglibAttrs, - start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Represents an EL expression. Expressions in attributes are embedded - * in the attribute string and not here. - */ - public static class ELExpression extends Node { - - private ELNode.Nodes el; - - public ELExpression(String text, Mark start, Node parent) { - super(null, null, text, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public void setEL(ELNode.Nodes el) { - this.el = el; - } - - public ELNode.Nodes getEL() { - return el; - } - } - - /** - * Represents a param action - */ - public static class ParamAction extends Node { - - JspAttribute value; - - public ParamAction(Attributes attrs, Mark start, Node parent) { - this(JSP_PARAM_ACTION, attrs, null, null, start, parent); - } - - public ParamAction(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, Node parent) { - super(qName, PARAM_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public void setValue(JspAttribute value) { - this.value = value; - } - - public JspAttribute getValue() { - return value; - } - } - - /** - * Represents a params action - */ - public static class ParamsAction extends Node { - - public ParamsAction(Mark start, Node parent) { - this(JSP_PARAMS_ACTION, null, null, start, parent); - } - - public ParamsAction(String qName, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, - Mark start, Node parent) { - super(qName, PARAMS_ACTION, null, nonTaglibXmlnsAttrs, taglibAttrs, - start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Represents a fallback action - */ - public static class FallBackAction extends Node { - - public FallBackAction(Mark start, Node parent) { - this(JSP_FALLBACK_ACTION, null, null, start, parent); - } - - public FallBackAction(String qName, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, - Node parent) { - super(qName, FALLBACK_ACTION, null, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Represents an include action - */ - public static class IncludeAction extends Node { - - private JspAttribute page; - - public IncludeAction(Attributes attrs, Mark start, Node parent) { - this(JSP_INCLUDE_ACTION, attrs, null, null, start, parent); - } - - public IncludeAction(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, Node parent) { - super(qName, INCLUDE_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public void setPage(JspAttribute page) { - this.page = page; - } - - public JspAttribute getPage() { - return page; - } - } - - /** - * Represents a forward action - */ - public static class ForwardAction extends Node { - - private JspAttribute page; - - public ForwardAction(Attributes attrs, Mark start, Node parent) { - this(JSP_FORWARD_ACTION, attrs, null, null, start, parent); - } - - public ForwardAction(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, Node parent) { - super(qName, FORWARD_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public void setPage(JspAttribute page) { - this.page = page; - } - - public JspAttribute getPage() { - return page; - } - } - - /** - * Represents a getProperty action - */ - public static class GetProperty extends Node { - - public GetProperty(Attributes attrs, Mark start, Node parent) { - this(JSP_GET_PROPERTY_ACTION, attrs, null, null, start, parent); - } - - public GetProperty(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, Node parent) { - super(qName, GET_PROPERTY_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Represents a setProperty action - */ - public static class SetProperty extends Node { - - private JspAttribute value; - - public SetProperty(Attributes attrs, Mark start, Node parent) { - this(JSP_SET_PROPERTY_ACTION, attrs, null, null, start, parent); - } - - public SetProperty(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, Node parent) { - super(qName, SET_PROPERTY_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public void setValue(JspAttribute value) { - this.value = value; - } - - public JspAttribute getValue() { - return value; - } - } - - /** - * Represents a useBean action - */ - public static class UseBean extends Node { - - JspAttribute beanName; - - public UseBean(Attributes attrs, Mark start, Node parent) { - this(JSP_USE_BEAN_ACTION, attrs, null, null, start, parent); - } - - public UseBean(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs, - Mark start, Node parent) { - super(qName, USE_BEAN_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public void setBeanName(JspAttribute beanName) { - this.beanName = beanName; - } - - public JspAttribute getBeanName() { - return beanName; - } - } - - /** - * Represents a plugin action - */ - public static class PlugIn extends Node { - - private JspAttribute width; - private JspAttribute height; - - public PlugIn(Attributes attrs, Mark start, Node parent) { - this(JSP_PLUGIN_ACTION, attrs, null, null, start, parent); - } - - public PlugIn(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs, - Mark start, Node parent) { - super(qName, PLUGIN_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public void setHeight(JspAttribute height) { - this.height = height; - } - - public void setWidth(JspAttribute width) { - this.width = width; - } - - public JspAttribute getHeight() { - return height; - } - - public JspAttribute getWidth() { - return width; - } - } - - /** - * Represents an uninterpreted tag, from a Jsp document - */ - public static class UninterpretedTag extends Node { - - private JspAttribute[] jspAttrs; - - public UninterpretedTag(String qName, String localName, - Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, - Mark start, Node parent) { - super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs, - start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public void setJspAttributes(JspAttribute[] jspAttrs) { - this.jspAttrs = jspAttrs; - } - - public JspAttribute[] getJspAttributes() { - return jspAttrs; - } - } - - /** - * Represents a . - */ - public static class JspElement extends Node { - - private JspAttribute[] jspAttrs; - private JspAttribute nameAttr; - - public JspElement(Attributes attrs, Mark start, Node parent) { - this(JSP_ELEMENT_ACTION, attrs, null, null, start, parent); - } - - public JspElement(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, Node parent) { - super(qName, ELEMENT_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public void setJspAttributes(JspAttribute[] jspAttrs) { - this.jspAttrs = jspAttrs; - } - - public JspAttribute[] getJspAttributes() { - return jspAttrs; - } - - /* - * Sets the XML-style 'name' attribute - */ - public void setNameAttribute(JspAttribute nameAttr) { - this.nameAttr = nameAttr; - } - - /* - * Gets the XML-style 'name' attribute - */ - public JspAttribute getNameAttribute() { - return this.nameAttr; - } - } - - /** - * Represents a . - */ - public static class JspOutput extends Node { - - public JspOutput(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, - Mark start, Node parent) { - super(qName, OUTPUT_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Collected information about child elements. Used by nodes like - * CustomTag, JspBody, and NamedAttribute. The information is - * set in the Collector. - */ - public static class ChildInfo { - private boolean scriptless; // true if the tag and its body - // contain no scripting elements. - private boolean hasUseBean; - private boolean hasIncludeAction; - private boolean hasParamAction; - private boolean hasSetProperty; - private boolean hasScriptingVars; - - public void setScriptless(boolean s) { - scriptless = s; - } - - public boolean isScriptless() { - return scriptless; - } - - public void setHasUseBean(boolean u) { - hasUseBean = u; - } - - public boolean hasUseBean() { - return hasUseBean; - } - - public void setHasIncludeAction(boolean i) { - hasIncludeAction = i; - } - - public boolean hasIncludeAction() { - return hasIncludeAction; - } - - public void setHasParamAction(boolean i) { - hasParamAction = i; - } - - public boolean hasParamAction() { - return hasParamAction; - } - - public void setHasSetProperty(boolean s) { - hasSetProperty = s; - } - - public boolean hasSetProperty() { - return hasSetProperty; - } - - public void setHasScriptingVars(boolean s) { - hasScriptingVars = s; - } - - public boolean hasScriptingVars() { - return hasScriptingVars; - } - } - - /** - * Represents a custom tag - */ - public static class CustomTag extends Node { - - private double jspVersion; - private String uri; - private String prefix; - private JspAttribute[] jspAttrs; - private TagData tagData; - private String tagHandlerPoolName; - private TagInfo tagInfo; - private TagFileInfo tagFileInfo; - private Class tagHandlerClass; - private VariableInfo[] varInfos; - private int customNestingLevel; - private ChildInfo childInfo; - private boolean implementsIterationTag; - private boolean implementsBodyTag; - private boolean implementsTryCatchFinally; - private boolean implementsSimpleTag; - private boolean implementsDynamicAttributes; - private ArrayList atBeginScriptingVars; - private ArrayList atEndScriptingVars; - private ArrayList nestedScriptingVars; - private Node.CustomTag customTagParent; - private Integer numCount; - private boolean useTagPlugin; - private TagPluginContext tagPluginContext; - private int jspId; - private HashMap tempVars; - // The temporary name for saving and restoring a scripting var - - /** - * The following two fields are used for holding the Java - * scriptlets that the tag plugins may generate. Meaningful - * only if useTagPlugin is true; - * Could move them into TagPluginContextImpl, but we'll need - * to cast tagPluginContext to TagPluginContextImpl all the time... - */ - private Nodes atSTag; - private Nodes atETag; - - /* - * Constructor for custom action implemented by tag handler. - */ - public CustomTag(String jspVersion, - String qName, String prefix, String localName, - String uri, Attributes attrs, Mark start, Node parent, - TagInfo tagInfo, Class tagHandlerClass) { - this(jspVersion, qName, prefix, localName, uri, attrs, null, null, - start, parent, tagInfo, tagHandlerClass); - } - - /* - * Constructor for custom action implemented by tag handler. - */ - public CustomTag(String jspVersion, String qName, String prefix, - String localName, - String uri, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, - Mark start, Node parent, TagInfo tagInfo, - Class tagHandlerClass) { - super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs, - start, parent); - - this.jspVersion = Double.valueOf(jspVersion).doubleValue(); - this.uri = uri; - this.prefix = prefix; - this.tagInfo = tagInfo; - this.tagHandlerClass = tagHandlerClass; - this.customNestingLevel = makeCustomNestingLevel(); - this.childInfo = new ChildInfo(); - - this.implementsIterationTag = - IterationTag.class.isAssignableFrom(tagHandlerClass); - this.implementsBodyTag = - BodyTag.class.isAssignableFrom(tagHandlerClass); - this.implementsTryCatchFinally = - TryCatchFinally.class.isAssignableFrom(tagHandlerClass); - this.implementsSimpleTag = - SimpleTag.class.isAssignableFrom(tagHandlerClass); - this.implementsDynamicAttributes = - DynamicAttributes.class.isAssignableFrom(tagHandlerClass); - } - - /* - * Constructor for custom action implemented by tag file. - */ - public CustomTag(String jspVersion, - String qName, String prefix, String localName, - String uri, Attributes attrs, Mark start, Node parent, - TagFileInfo tagFileInfo) { - this(jspVersion, qName, prefix, localName, uri, attrs, null, null, - start, parent, tagFileInfo); - } - - /* - * Constructor for custom action implemented by tag file. - */ - public CustomTag(String jspVersion, - String qName, String prefix, String localName, - String uri, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, - Mark start, Node parent, TagFileInfo tagFileInfo) { - - super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs, - start, parent); - - this.jspVersion = Double.valueOf(jspVersion).doubleValue(); - this.uri = uri; - this.prefix = prefix; - this.tagFileInfo = tagFileInfo; - this.tagInfo = tagFileInfo.getTagInfo(); - this.customNestingLevel = makeCustomNestingLevel(); - this.childInfo = new ChildInfo(); - - this.implementsIterationTag = false; - this.implementsBodyTag = false; - this.implementsTryCatchFinally = false; - this.implementsSimpleTag = true; - this.implementsDynamicAttributes = tagInfo.hasDynamicAttributes(); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - /** - * @return The jspVersion of the tag - */ - public double getJspVersion() { - return jspVersion; - } - - /** - * @return The URI namespace that this custom action belongs to - */ - public String getURI() { - return this.uri; - } - - /** - * @return The tag prefix - */ - public String getPrefix() { - return prefix; - } - - public void setJspAttributes(JspAttribute[] jspAttrs) { - this.jspAttrs = jspAttrs; - } - - public JspAttribute[] getJspAttributes() { - return jspAttrs; - } - - public ChildInfo getChildInfo() { - return childInfo; - } - - public void setTagData(TagData tagData) { - this.tagData = tagData; - this.varInfos = tagInfo.getVariableInfo(tagData); - if (this.varInfos == null) { - this.varInfos = ZERO_VARIABLE_INFO; - } - } - - public TagData getTagData() { - return tagData; - } - - public void setTagHandlerPoolName(String s) { - tagHandlerPoolName = s; - } - - public String getTagHandlerPoolName() { - return tagHandlerPoolName; - } - - public TagInfo getTagInfo() { - return tagInfo; - } - - public TagFileInfo getTagFileInfo() { - return tagFileInfo; - } - - /* - * @return true if this custom action is supported by a tag file, - * false otherwise - */ - public boolean isTagFile() { - return tagFileInfo != null; - } - - public Class getTagHandlerClass() { - return tagHandlerClass; - } - - public void setTagHandlerClass(Class hc) { - tagHandlerClass = hc; - } - - public boolean implementsIterationTag() { - return implementsIterationTag; - } - - public boolean implementsBodyTag() { - return implementsBodyTag; - } - - public boolean implementsTryCatchFinally() { - return implementsTryCatchFinally; - } - - public boolean implementsSimpleTag() { - return implementsSimpleTag; - } - - public boolean implementsDynamicAttributes() { - return implementsDynamicAttributes; - } - - public TagVariableInfo[] getTagVariableInfos() { - return tagInfo.getTagVariableInfos(); - } - - public VariableInfo[] getVariableInfos() { - return varInfos; - } - - public void setCustomTagParent(Node.CustomTag n) { - this.customTagParent = n; - } - - public Node.CustomTag getCustomTagParent() { - return this.customTagParent; - } - - public void setNumCount(Integer count) { - this.numCount = count; - } - - public Integer getNumCount() { - return this.numCount; - } - - public void setScriptingVars(ArrayList vec, int scope) { - switch (scope) { - case VariableInfo.AT_BEGIN: - this.atBeginScriptingVars = vec; - break; - case VariableInfo.AT_END: - this.atEndScriptingVars = vec; - break; - case VariableInfo.NESTED: - this.nestedScriptingVars = vec; - break; - } - } - - /* - * Gets the scripting variables for the given scope that need to be - * declared. - */ - public ArrayList getScriptingVars(int scope) { - switch (scope) { - case VariableInfo.AT_BEGIN: - return this.atBeginScriptingVars; - case VariableInfo.AT_END: - return this.atEndScriptingVars; - case VariableInfo.NESTED: - return this.nestedScriptingVars; - } - return null; - } - - /* - * Gets this custom tag's custom nesting level, which is given as - * the number of times this custom tag is nested inside itself. - */ - public int getCustomNestingLevel() { - return customNestingLevel; - } - - /** - * Checks to see if the attribute of the given name is of type - * JspFragment. - */ - public boolean checkIfAttributeIsJspFragment( String name ) { - boolean result = false; - - TagAttributeInfo[] attributes = tagInfo.getAttributes(); - for (int i = 0; i < attributes.length; i++) { - if (attributes[i].getName().equals(name) && - attributes[i].isFragment()) { - result = true; - break; - } - } - - return result; - } - - public void setUseTagPlugin(boolean use) { - useTagPlugin = use; - } - - public boolean useTagPlugin() { - return useTagPlugin; - } - - public void setTagPluginContext(TagPluginContext tagPluginContext) { - this.tagPluginContext = tagPluginContext; - } - - public TagPluginContext getTagPluginContext() { - return tagPluginContext; - } - - public void setAtSTag(Nodes sTag) { - atSTag = sTag; - } - - public Nodes getAtSTag() { - return atSTag; - } - - public void setAtETag(Nodes eTag) { - atETag = eTag; - } - - public Nodes getAtETag() { - return atETag; - } - - public void setJspId(int jspId) { - this.jspId = jspId; - } - - public int getJspId() { - return jspId; - } - - /* - * Computes this custom tag's custom nesting level, which corresponds - * to the number of times this custom tag is nested inside itself. - * - * Example: - * - * - * -- nesting level 0 - * - * - * -- nesting level 1 - * -- nesting level 2 - * - * - * -- nesting level 1 - * - * - * - * - * - * - * @return Custom tag's nesting level - */ - private int makeCustomNestingLevel() { - int n = 0; - Node p = parent; - while (p != null) { - if ((p instanceof Node.CustomTag) - && qName.equals(((Node.CustomTag) p).qName)) { - n++; - } - p = p.parent; - } - return n; - } - - /** - * Returns true if this custom action has an empty body, and false - * otherwise. - * - * A custom action is considered to have an empty body if the - * following holds true: - * - getBody() returns null, or - * - all immediate children are jsp:attribute actions, or - * - the action's jsp:body is empty. - */ - public boolean hasEmptyBody() { - boolean hasEmptyBody = true; - Nodes nodes = getBody(); - if (nodes != null) { - int numChildNodes = nodes.size(); - for (int i=0; i(); - } - tempVars.put(scriptingVar, tempScriptingVar); - } - } - - /** - * Used as a placeholder for the evaluation code of a custom action - * attribute (used by the tag plugin machinery only). - */ - public static class AttributeGenerator extends Node { - String name; // name of the attribute - CustomTag tag; // The tag this attribute belongs to - - public AttributeGenerator(Mark start, String name, CustomTag tag) { - super(start, null); - this.name = name; - this.tag = tag; - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public String getName() { - return name; - } - - public CustomTag getTag() { - return tag; - } - } - - /** - * Represents the body of a <jsp:text> element - */ - public static class JspText extends Node { - - public JspText(String qName, Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, Node parent) { - super(qName, TEXT_ACTION, null, nonTaglibXmlnsAttrs, taglibAttrs, - start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - } - - /** - * Represents a Named Attribute (<jsp:attribute>) - */ - public static class NamedAttribute extends Node { - - // A unique temporary variable name suitable for code generation - private String temporaryVariableName; - - // True if this node is to be trimmed, or false otherwise - private boolean trim = true; - - // omit can be expressions - JspAttribute omit; - - private ChildInfo childInfo; - private String name; - private String localName; - private String prefix; - - public NamedAttribute(Attributes attrs, Mark start, Node parent) { - this(JSP_ATTRIBUTE_ACTION, attrs, null, null, start, parent); - } - - public NamedAttribute(String qName, Attributes attrs, - Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, - Mark start, Node parent) { - - super(qName, ATTRIBUTE_ACTION, attrs, nonTaglibXmlnsAttrs, - taglibAttrs, start, parent); - temporaryVariableName = JspUtil.nextTemporaryVariableName(); - if( "false".equals( this.getAttributeValue( "trim" ) ) ) { - // (if null or true, leave default of true) - trim = false; - } - childInfo = new ChildInfo(); - name = this.getAttributeValue("name"); - if (name != null) { - // Mandatary attribute "name" will be checked in Validator - localName = name; - int index = name.indexOf(':'); - if (index != -1) { - prefix = name.substring(0, index); - localName = name.substring(index+1); - } - } - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public String getName() { - return this.name; - } - - public String getLocalName() { - return this.localName; - } - - public String getPrefix() { - return this.prefix; - } - - public ChildInfo getChildInfo() { - return this.childInfo; - } - - public boolean isTrim() { - return trim; - } - - public void setOmit(JspAttribute ja) { - omit = ja; - } - - public JspAttribute getOmit() { - return omit; - } - - /** - * @return A unique temporary variable name to store the result in. - * (this probably could go elsewhere, but it's convenient here) - */ - public String getTemporaryVariableName() { - return temporaryVariableName; - } - - /* - * Get the attribute value from this named attribute (). - * Since this method is only for attributes that are not rtexpr, - * we can assume the body of the jsp:attribute is a template text. - */ - public String getText() { - - class AttributeVisitor extends Visitor { - String attrValue = null; - public void visit(TemplateText txt) { - attrValue = new String(txt.getText()); - } - - public String getAttrValue() { - return attrValue; - } - } - - // According to JSP 2.0, if the body of the - // action is empty, it is equivalent of specifying "" as the value - // of the attribute. - String text = ""; - if (getBody() != null) { - AttributeVisitor attributeVisitor = new AttributeVisitor(); - try { - getBody().visit(attributeVisitor); - } catch (JasperException e) { - } - text = attributeVisitor.getAttrValue(); - } - - return text; - } - } - - /** - * Represents a JspBody node (<jsp:body>) - */ - public static class JspBody extends Node { - - private ChildInfo childInfo; - - public JspBody(Mark start, Node parent) { - this(JSP_BODY_ACTION, null, null, start, parent); - } - - public JspBody(String qName, Attributes nonTaglibXmlnsAttrs, - Attributes taglibAttrs, Mark start, Node parent) { - super(qName, BODY_ACTION, null, nonTaglibXmlnsAttrs, taglibAttrs, - start, parent); - this.childInfo = new ChildInfo(); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - public ChildInfo getChildInfo() { - return childInfo; - } - } - - /** - * Represents a template text string - */ - public static class TemplateText extends Node { - - private ArrayList extraSmap = null; - - public TemplateText(String text, Mark start, Node parent) { - super(null, null, text, start, parent); - } - - public void accept(Visitor v) throws JasperException { - v.visit(this); - } - - /** - * Trim all whitespace from the left of the template text - */ - public void ltrim() { - int index = 0; - while ((index < text.length()) && (text.charAt(index) <= ' ')) { - index++; - } - text = text.substring(index); - } - - public void setText(String text) { - this.text = text; - } - - /** - * Trim all whitespace from the right of the template text - */ - public void rtrim() { - int index = text.length(); - while( (index > 0) && (text.charAt(index-1) <= ' ') ) { - index--; - } - text = text.substring(0, index); - } - - /** - * Returns true if this template text contains whitespace only. - */ - public boolean isAllSpace() { - boolean isAllSpace = true; - for (int i=0; i(); - } - extraSmap.add(Integer.valueOf(srcLine)); - } - - public ArrayList getExtraSmap() { - return extraSmap; - } - } - - /********************************************************************* - * Auxillary classes used in Node - */ - - /** - * Represents attributes that can be request time expressions. - * - * Can either be a plain attribute, an attribute that represents a - * request time expression value, or a named attribute (specified using - * the jsp:attribute standard action). - */ - - public static class JspAttribute { - - private String qName; - private String uri; - private String localName; - private String value; - private boolean expression; - private boolean dynamic; - private ELNode.Nodes el; - private String expectedType; // for deferred value - private String expectedReturnType; // for deferred method - private String[] expectedParamTypes; // for deferred method - - // If true, this JspAttribute represents a - private boolean namedAttribute; - // The node in the parse tree for the NamedAttribute - private NamedAttribute namedAttributeNode; - - JspAttribute(String qName, String uri, String localName, String value, - boolean expr, ELNode.Nodes el, boolean dyn ) { - this.qName = qName; - this.uri = uri; - this.localName = localName; - this.value = value; - this.namedAttributeNode = null; - this.expression = expr; - this.el = el; - this.dynamic = dyn; - this.namedAttribute = false; - } - - JspAttribute(String qName, String uri, String localName, String value, - ELNode.Nodes el, - String expectedType, - String expectedReturnType, - String[] expectedParamTypes) { - this.qName = qName; - this.uri = uri; - this.localName = localName; - this.value = value; - this.namedAttributeNode = null; - this.expression = false; - this.el = el; - this.dynamic = false; - this.namedAttribute = false; - this.expectedType = expectedType; - this.expectedReturnType = expectedReturnType; - this.expectedParamTypes = expectedParamTypes; - } - - /** - * Use this constructor if the JspAttribute represents a - * named attribute. In this case, we have to store the nodes of - * the body of the attribute. - */ - JspAttribute(NamedAttribute na, boolean dyn) { - this.qName = na.getName(); - this.localName = na.getLocalName(); - this.value = null; - this.namedAttributeNode = na; - this.expression = false; - this.el = null; - this.dynamic = dyn; - this.namedAttribute = true; - } - - /** - * @return The name of the attribute - */ - public String getName() { - return qName; - } - - /** - * @return The local name of the attribute - */ - public String getLocalName() { - return localName; - } - - /** - * @return The namespace of the attribute, or null if in the default - * namespace - */ - public String getURI() { - return uri; - } - - /** - * Only makes sense if namedAttribute is false. - * - * @return the value for the attribute, or the expression string - * (stripped of "<%=", "%>", "%=", or "%" - * but containing "${" and "}" for EL expressions) - */ - public String getValue() { - return value; - } - - public void setValue(String val) { - value = val; - } - - /** - * Only makes sense if namedAttribute is true. - * - * @return the nodes that evaluate to the body of this attribute. - */ - public NamedAttribute getNamedAttributeNode() { - return namedAttributeNode; - } - - /** - * @return true if the value represents a traditional rtexprvalue - */ - public boolean isExpression() { - return expression; - } - - /** - * @return true if the value represents a NamedAttribute value. - */ - public boolean isNamedAttribute() { - return namedAttribute; - } - - /** - * @return true if the value represents an expression that should - * be fed to the expression interpreter - * @return false for string literals or rtexprvalues that should - * not be interpreted or reevaluated - */ - public boolean isELInterpreterInput() { - return el != null; - } - - /** - * @return true if the value is a string literal known at translation - * time. - */ - public boolean isLiteral() { - return !(expression || (el != null && el.containsEL()) || namedAttribute); - } - - /** - * XXX - */ - public boolean isDynamic() { - return dynamic; - } - - public ELNode.Nodes getEL() { - return el; - } - - public String getExpectedType() { - return expectedType; - } - - public String getExpectedReturnType() { - return expectedReturnType; - } - - public String[] getExpectedParamTypes() { - return expectedParamTypes; - } - } - - /** - * An ordered list of Node, used to represent the body of an element, or - * a jsp page of jsp document. - */ - public static class Nodes { - - private List list; - private Node.Root root; // null if this is not a page - private boolean generatedInBuffer; - - public Nodes() { - list = new ArrayList(); - } - - public Nodes(Node.Root root) { - this.root = root; - list = new ArrayList(); - list.add(root); - } - - /** - * Appends a node to the list - * @param n The node to add - */ - public void add(Node n) { - list.add(n); - root = null; - } - - /** - * Removes the given node from the list. - * @param n The node to be removed - */ - public void remove(Node n) { - list.remove(n); - } - - /** - * Visit the nodes in the list with the supplied visitor - * @param v The visitor used - */ - public void visit(Visitor v) throws JasperException { - Iterator iter = list.iterator(); - while (iter.hasNext()) { - Node n = iter.next(); - n.accept(v); - } - } - - public int size() { - return list.size(); - } - - public Node getNode(int index) { - Node n = null; - try { - n = list.get(index); - } catch (ArrayIndexOutOfBoundsException e) { - } - return n; - } - - public Node.Root getRoot() { - return root; - } - - public boolean isGeneratedInBuffer() { - return generatedInBuffer; - } - - public void setGeneratedInBuffer(boolean g) { - generatedInBuffer = g; - } - } - - /** - * A visitor class for visiting the node. This class also provides the - * default action (i.e. nop) for each of the child class of the Node. - * An actual visitor should extend this class and supply the visit - * method for the nodes that it cares. - */ - public static class Visitor { - - /** - * This method provides a place to put actions that are common to - * all nodes. Override this in the child visitor class if need to. - */ - protected void doVisit(Node n) throws JasperException { - } - - /** - * Visit the body of a node, using the current visitor - */ - protected void visitBody(Node n) throws JasperException { - if (n.getBody() != null) { - n.getBody().visit(this); - } - } - - public void visit(Root n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(JspRoot n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(PageDirective n) throws JasperException { - doVisit(n); - } - - public void visit(TagDirective n) throws JasperException { - doVisit(n); - } - - public void visit(IncludeDirective n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(TaglibDirective n) throws JasperException { - doVisit(n); - } - - public void visit(AttributeDirective n) throws JasperException { - doVisit(n); - } - - public void visit(VariableDirective n) throws JasperException { - doVisit(n); - } - - public void visit(Comment n) throws JasperException { - doVisit(n); - } - - public void visit(Declaration n) throws JasperException { - doVisit(n); - } - - public void visit(Expression n) throws JasperException { - doVisit(n); - } - - public void visit(Scriptlet n) throws JasperException { - doVisit(n); - } - - public void visit(ELExpression n) throws JasperException { - doVisit(n); - } - - public void visit(IncludeAction n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(ForwardAction n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(GetProperty n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(SetProperty n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(ParamAction n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(ParamsAction n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(FallBackAction n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(UseBean n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(PlugIn n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(CustomTag n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(UninterpretedTag n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(JspElement n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(JspText n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(NamedAttribute n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(JspBody n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(InvokeAction n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(DoBodyAction n) throws JasperException { - doVisit(n); - visitBody(n); - } - - public void visit(TemplateText n) throws JasperException { - doVisit(n); - } - - public void visit(JspOutput n) throws JasperException { - doVisit(n); - } - - public void visit(AttributeGenerator n) throws JasperException { - doVisit(n); - } - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/NullJavaCompiler.java b/impl/src/main/java/org/apache/jasper/compiler/NullJavaCompiler.java deleted file mode 100644 index 0ad0c42..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/NullJavaCompiler.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -package org.apache.jasper.compiler; - -import java.io.File; -import java.io.IOException; -import java.io.FileOutputStream; -import java.io.Writer; -import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; -import java.util.List; - -import org.apache.jasper.JasperException; -import org.apache.jasper.JspCompilationContext; - -/** - * Java compiler for invoking JSP to java translation only. This only - * implements the part of JavaCompiler that handles the writing of the - * generated Java file. - * - * @author Kin-man Chung - */ - -public class NullJavaCompiler implements JavaCompiler { - - private JspCompilationContext ctxt; - private ErrorDispatcher errDispatcher; - private String javaFileName; - private String javaEncoding; - - public void init(JspCompilationContext ctxt, - ErrorDispatcher errDispatcher, - boolean suppressLogging) { - - this.ctxt = ctxt; - this.errDispatcher = errDispatcher; - } - - public void release() { - } - - public void setExtdirs(String exts) { - throw new UnsupportedOperationException(); - } - - public void setTargetVM(String targetVM) { - throw new UnsupportedOperationException(); - } - - public void setSourceVM(String sourceVM) { - throw new UnsupportedOperationException(); - } - - public void setClassPath(List cpath) { - throw new UnsupportedOperationException(); - } - - public void saveClassFile(String className, String classFileName) { - throw new UnsupportedOperationException(); - } - - public void setDebug(boolean debug) { - throw new UnsupportedOperationException(); - } - - public long getClassLastModified() { - throw new UnsupportedOperationException(); - } - - public Writer getJavaWriter(String javaFileName, - String javaEncoding) - throws JasperException { - - this.javaFileName = javaFileName; - this.javaEncoding = javaEncoding; - - Writer writer = null; - try { - writer = new OutputStreamWriter( - new FileOutputStream(javaFileName), javaEncoding); - } catch (UnsupportedEncodingException ex) { - errDispatcher.jspError("jsp.error.needAlternateJavaEncoding", - javaEncoding); - } catch (IOException ex) { - errDispatcher.jspError("jsp.error.unableToCreateOutputWriter", - javaFileName, ex); - } - return writer; - } - - public JavacErrorDetail[] compile(String className, Node.Nodes pageNodes) - throws JasperException { - throw new UnsupportedOperationException(); - } - - public void doJavaFile(boolean keep) { - if (!keep) { - File javaFile = new File(javaFileName); - javaFile.delete(); - } - } -} - diff --git a/impl/src/main/java/org/apache/jasper/compiler/PageDataImpl.java b/impl/src/main/java/org/apache/jasper/compiler/PageDataImpl.java deleted file mode 100644 index 94104ec..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/PageDataImpl.java +++ /dev/null @@ -1,763 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2011 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.InputStream; -import java.io.ByteArrayInputStream; -import java.io.CharArrayWriter; -import java.nio.charset.Charset; -import java.util.ListIterator; -import javax.servlet.jsp.tagext.PageData; -import org.xml.sax.Attributes; -import org.xml.sax.helpers.AttributesImpl; -import org.apache.jasper.JasperException; - -/** - * An implementation of javax.servlet.jsp.tagext.PageData which - * builds the XML view of a given page. - * - * The XML view is built in two passes: - * - * During the first pass, the FirstPassVisitor collects the attributes of the - * top-level jsp:root and those of the jsp:root elements of any included - * pages, and adds them to the jsp:root element of the XML view. - * In addition, any taglib directives are converted into xmlns: attributes and - * added to the jsp:root element of the XML view. - * This pass ignores any nodes other than JspRoot and TaglibDirective. - * - * During the second pass, the SecondPassVisitor produces the XML view, using - * the combined jsp:root attributes determined in the first pass and any - * remaining pages nodes (this pass ignores any JspRoot and TaglibDirective - * nodes). - * - * @author Jan Luehe - */ -class PageDataImpl extends PageData implements TagConstants { - - private static final String JSP_VERSION = "2.0"; - private static final String CDATA_START_SECTION = "\n"; - private static final Charset CHARSET_UTF8 = Charset.forName("UTF-8"); - - // string buffer used to build XML view - private StringBuilder buf; - - /** - * Constructor. - * - * @param page the page nodes from which to generate the XML view - */ - public PageDataImpl(Node.Nodes page, Compiler compiler) - throws JasperException { - - // First pass - FirstPassVisitor firstPass = new FirstPassVisitor( - page.getRoot(), - compiler.getPageInfo(), - compiler.getErrorDispatcher()); - page.visit(firstPass); - - // Second pass - buf = new StringBuilder(); - SecondPassVisitor secondPass - = new SecondPassVisitor(page.getRoot(), buf, compiler, - firstPass.getJspIdPrefix()); - page.visit(secondPass); - } - - /** - * Returns the input stream of the XML view. - * - * @return the input stream of the XML view - */ - public InputStream getInputStream() { - // Turn StringBuilder into InputStream - return new ByteArrayInputStream(buf.toString().getBytes(CHARSET_UTF8)); - } - - /* - * First-pass Visitor for JspRoot nodes (representing jsp:root elements) - * and TablibDirective nodes, ignoring any other nodes. - * - * The purpose of this Visitor is to collect the attributes of the - * top-level jsp:root and those of the jsp:root elements of any included - * pages, and add them to the jsp:root element of the XML view. - * In addition, this Visitor converts any taglib directives into xmlns: - * attributes and adds them to the jsp:root element of the XML view. - */ - static class FirstPassVisitor - extends Node.Visitor implements TagConstants { - - private Node.Root root; - private AttributesImpl rootAttrs; - private PageInfo pageInfo; - - // Prefix for the 'id' attribute - private String jspIdPrefix; - - private ErrorDispatcher err; - - /* - * Constructor - */ - public FirstPassVisitor(Node.Root root, PageInfo pageInfo, - ErrorDispatcher err) { - this.root = root; - this.pageInfo = pageInfo; - this.err = err; - this.rootAttrs = new AttributesImpl(); - this.rootAttrs.addAttribute("", "", "version", "CDATA", - JSP_VERSION); - this.jspIdPrefix = "jsp"; - } - - public void visit(Node.Root n) throws JasperException { - visitBody(n); - if (n == root) { - /* - * Top-level page. - * - * Add - * xmlns:jsp="http://java.sun.com/JSP/Page" - * attribute only if not already present. - */ - if (!JSP_URI.equals(rootAttrs.getValue("xmlns:jsp"))) { - rootAttrs.addAttribute("", "", "xmlns:jsp", "CDATA", - JSP_URI); - } - - if (pageInfo.isJspPrefixHijacked()) { - /* - * 'jsp' prefix has been hijacked, that is, bound to a - * namespace other than the JSP namespace. This means that - * when adding an 'id' attribute to each element, we can't - * use the 'jsp' prefix. Therefore, create a new prefix - * (one that is unique across the translation unit) for use - * by the 'id' attribute, and bind it to the JSP namespace - */ - jspIdPrefix += "jsp"; - while (pageInfo.containsPrefix(jspIdPrefix)) { - jspIdPrefix += "jsp"; - } - rootAttrs.addAttribute("", "", "xmlns:" + jspIdPrefix, - "CDATA", JSP_URI); - } - - root.setAttributes(rootAttrs); - } - } - - public void visit(Node.JspRoot n) throws JasperException { - addRootAttributes(n.getTaglibAttributes()); - addRootAttributes(n.getNonTaglibXmlnsAttributes()); - addRootAttributes(n.getAttributes()); - - visitBody(n); - } - - /* - * Converts taglib directive into "xmlns:..." attribute of jsp:root - * element. - */ - public void visit(Node.TaglibDirective n) throws JasperException { - Attributes attrs = n.getAttributes(); - if (attrs != null) { - String qName = "xmlns:" + attrs.getValue("prefix"); - /* - * According to javadocs of org.xml.sax.helpers.AttributesImpl, - * the addAttribute method does not check to see if the - * specified attribute is already contained in the list: This - * is the application's responsibility! - */ - if (rootAttrs.getIndex(qName) == -1) { - String location = attrs.getValue("uri"); - if (location != null) { - if (location.startsWith("/")) { - location = URN_JSPTLD + location; - } - rootAttrs.addAttribute("", "", qName, "CDATA", - location); - } else { - location = attrs.getValue("tagdir"); - rootAttrs.addAttribute("", "", qName, "CDATA", - URN_JSPTAGDIR + location); - } - } - } - } - - public String getJspIdPrefix() { - return jspIdPrefix; - } - - private void addRootAttributes(Attributes attrs) - throws JasperException { - if (attrs != null) { - int len = attrs.getLength(); - for (int i=0; i"); - } - buf.append("${"); - buf.append(JspUtil.escapeXml(n.getText())); - buf.append("}"); - if (!n.getRoot().isXmlSyntax()) { - buf.append(JSP_TEXT_ACTION_END); - } - buf.append("\n"); - } - - public void visit(Node.IncludeAction n) throws JasperException { - appendTag(n); - } - - public void visit(Node.ForwardAction n) throws JasperException { - appendTag(n); - } - - public void visit(Node.GetProperty n) throws JasperException { - appendTag(n); - } - - public void visit(Node.SetProperty n) throws JasperException { - appendTag(n); - } - - public void visit(Node.ParamAction n) throws JasperException { - appendTag(n); - } - - public void visit(Node.ParamsAction n) throws JasperException { - appendTag(n); - } - - public void visit(Node.FallBackAction n) throws JasperException { - appendTag(n); - } - - public void visit(Node.UseBean n) throws JasperException { - appendTag(n); - } - - public void visit(Node.PlugIn n) throws JasperException { - appendTag(n); - } - - public void visit(Node.NamedAttribute n) throws JasperException { - appendTag(n); - } - - public void visit(Node.JspBody n) throws JasperException { - appendTag(n); - } - - public void visit(Node.CustomTag n) throws JasperException { - n.setJspId(jspId); - boolean resetDefaultNSSave = resetDefaultNS; - appendTag(n, resetDefaultNS); - resetDefaultNS = resetDefaultNSSave; - } - - public void visit(Node.UninterpretedTag n) throws JasperException { - boolean resetDefaultNSSave = resetDefaultNS; - appendTag(n, resetDefaultNS); - resetDefaultNS = resetDefaultNSSave; - } - - public void visit(Node.JspText n) throws JasperException { - appendTag(n); - } - - public void visit(Node.DoBodyAction n) throws JasperException { - appendTag(n); - } - - public void visit(Node.InvokeAction n) throws JasperException { - appendTag(n); - } - - public void visit(Node.TagDirective n) throws JasperException { - appendTagDirective(n); - } - - public void visit(Node.AttributeDirective n) throws JasperException { - appendTag(n); - } - - public void visit(Node.VariableDirective n) throws JasperException { - appendTag(n); - } - - public void visit(Node.TemplateText n) throws JasperException { - /* - * If the template text came from a JSP page written in JSP syntax, - * create a jsp:text element for it (JSP 5.3.2). - */ - appendText(n.getText(), !n.getRoot().isXmlSyntax()); - } - - /* - * Appends the given tag, including its body, to the XML view. - */ - private void appendTag(Node n) throws JasperException { - appendTag(n, false); - } - - /* - * Appends the given tag, including its body, to the XML view, - * and optionally reset default namespace to "", if none specified. - */ - private void appendTag(Node n, boolean addDefaultNS) - throws JasperException { - - Node.Nodes body = n.getBody(); - String text = n.getText(); - - buf.append("<").append(n.getQName()); - buf.append("\n"); - - printAttributes(n, addDefaultNS); - buf.append(" ").append(jspIdPrefix).append(":id").append("=\""); - buf.append(jspId++).append("\"\n"); - - if (ROOT_ACTION.equals(n.getLocalName()) || body != null - || text != null) { - buf.append(">\n"); - if (ROOT_ACTION.equals(n.getLocalName())) { - if (compiler.getCompilationContext().isTagFile()) { - appendTagDirective(); - } else { - appendPageDirective(); - } - } - if (body != null) { - body.visit(this); - } else { - appendText(text, false); - } - buf.append("\n"); - } else { - buf.append("/>\n"); - } - } - - /* - * Appends the page directive with the given attributes to the XML - * view. - * - * Since the import attribute of the page directive is the only page - * attribute that is allowed to appear multiple times within the same - * document, and since XML allows only single-value attributes, - * the values of multiple import attributes must be combined into one, - * separated by comma. - * - * If the given page directive contains just 'contentType' and/or - * 'pageEncoding' attributes, we ignore it, as we've already appended - * a page directive containing just these two attributes. - */ - private void appendPageDirective(Node.PageDirective n) { - boolean append = false; - Attributes attrs = n.getAttributes(); - int len = (attrs == null) ? 0 : attrs.getLength(); - for (int i=0; i 0) { - // Concatenate names of imported classes/packages - boolean first = true; - ListIterator iter = n.getImports().listIterator(); - while (iter.hasNext()) { - if (first) { - first = false; - buf.append(" import=\""); - } else { - buf.append(","); - } - buf.append(JspUtil.getExprInXml((String) iter.next())); - } - buf.append("\"\n"); - } - buf.append("/>\n"); - } - - /* - * Appends a page directive with 'pageEncoding' and 'contentType' - * attributes. - * - * The value of the 'pageEncoding' attribute is hard-coded - * to UTF-8, whereas the value of the 'contentType' attribute, which - * is identical to what the container will pass to - * ServletResponse.setContentType(), is derived from the pageInfo. - */ - private void appendPageDirective() { - buf.append("<").append(JSP_PAGE_DIRECTIVE_ACTION); - buf.append("\n"); - - // append jsp:id - buf.append(" ").append(jspIdPrefix).append(":id").append("=\""); - buf.append(jspId++).append("\"\n"); - buf.append(" ").append("pageEncoding").append("=\"UTF-8\"\n"); - buf.append(" ").append("contentType").append("=\""); - buf.append(compiler.getPageInfo().getContentType()).append("\"\n"); - buf.append("/>\n"); - } - - /* - * Appends the tag directive with the given attributes to the XML - * view. - * - * If the given tag directive contains just a 'pageEncoding' - * attributes, we ignore it, as we've already appended - * a tag directive containing just this attributes. - */ - private void appendTagDirective(Node.TagDirective n) - throws JasperException { - - boolean append = false; - Attributes attrs = n.getAttributes(); - int len = (attrs == null) ? 0 : attrs.getLength(); - for (int i=0; i\n"); - } - - private void appendText(String text, boolean createJspTextElement) { - if (createJspTextElement) { - buf.append("<").append(JSP_TEXT_ACTION); - buf.append("\n"); - - // append jsp:id - buf.append(" ").append(jspIdPrefix).append(":id").append("=\""); - buf.append(jspId++).append("\"\n"); - buf.append(">\n"); - - appendCDATA(text); - buf.append(JSP_TEXT_ACTION_END); - buf.append("\n"); - } else { - appendCDATA(text); - } - } - - /* - * Appends the given text as a CDATA section to the XML view, unless - * the text has already been marked as CDATA. - */ - private void appendCDATA(String text) { - buf.append(CDATA_START_SECTION); - buf.append(escapeCDATA(text)); - buf.append(CDATA_END_SECTION); - } - - /* - * Escapes any occurrences of "]]>" (by replacing them with "]]>") - * within the given text, so it can be included in a CDATA section. - */ - private String escapeCDATA(String text) { - if( text==null ) return ""; - int len = text.length(); - CharArrayWriter result = new CharArrayWriter(len); - for (int i=0; i')) { - // match found - result.write(']'); - result.write(']'); - result.write('&'); - result.write('g'); - result.write('t'); - result.write(';'); - i += 2; - } else { - result.write(text.charAt(i)); - } - } - return result.toString(); - } - - /* - * Appends the attributes of the given Node to the XML view. - */ - private void printAttributes(Node n, boolean addDefaultNS) { - - /* - * Append "xmlns" attributes that represent tag libraries - */ - Attributes attrs = n.getTaglibAttributes(); - int len = (attrs == null) ? 0 : attrs.getLength(); - for (int i=0; i\n"); - } - } -} - diff --git a/impl/src/main/java/org/apache/jasper/compiler/PageInfo.java b/impl/src/main/java/org/apache/jasper/compiler/PageInfo.java deleted file mode 100644 index 4bcc405..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/PageInfo.java +++ /dev/null @@ -1,801 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.util.*; - -import org.apache.jasper.Constants; -import org.apache.jasper.JasperException; -import javax.servlet.jsp.tagext.TagLibraryInfo; - -/** - * A repository for various info about the translation unit under compilation. - * - * @author Kin-man Chung - */ - -public class PageInfo { - - /** - * These classes/packages are automatically imported by the - * generated code. - */ - private static final String[] STANDARD_IMPORTS = { - "javax.servlet.*", - "javax.servlet.http.*", - "javax.servlet.jsp.*" - }; - - private List imports; - private List dependants; - - private BeanRepository beanRepository; - private HashMap taglibsMap; - private HashMap jspPrefixMapper; - private HashMap> xmlPrefixMapper; - private HashMap nonCustomTagPrefixMap; - private String jspFile; - private String defaultLanguage = "java"; - private String language; - private String defaultExtends = Constants.JSP_SERVLET_BASE; - private String xtends; - private String contentType = null; - private String session; - private boolean isSession = true; - private String bufferValue; - private int buffer = 8*1024; // XXX confirm - private String autoFlush; - private boolean isAutoFlush = true; - private String isThreadSafeValue; - private boolean isThreadSafe = true; - private String isErrorPageValue; - private boolean isErrorPage = false; - private String errorPage = null; - private String info; - - private int maxTagNesting = 0; - private boolean scriptless = false; - private boolean scriptingInvalid = false; - private String isELIgnoredValue; - private boolean isELIgnored = false; - private String omitXmlDecl = null; - private String doctypeName = null; - private String doctypePublic = null; - private String doctypeSystem = null; - private String deferredSyntaxAllowedAsLiteralValue; - private boolean deferredSyntaxAllowedAsLiteral = false; - private String trimDirectiveWhitespacesValue; - private boolean trimDirectiveWhitespaces = false; - private boolean errorOnUndeclaredNamespace = false; - - private boolean isJspPrefixHijacked; - - // Set of all element and attribute prefixes used in this translation unit - private HashSet prefixes; - - private boolean hasJspRoot = false; - private List includePrelude; - private List includeCoda; - private List pluginDcls; // Id's for tagplugin declarations - - // Resource location path of the translation unit's top-level page - private String rootPath; - - - PageInfo(BeanRepository beanRepository, String jspFile) { - - this.jspFile = jspFile; - this.beanRepository = beanRepository; - this.taglibsMap = new HashMap(); - this.jspPrefixMapper = new HashMap(); - this.xmlPrefixMapper = new HashMap>(); - this.nonCustomTagPrefixMap = new HashMap(); - this.imports = new ArrayList(); - this.dependants = new ArrayList(); - this.includePrelude = new ArrayList(); - this.includeCoda = new ArrayList(); - this.pluginDcls = new ArrayList(); - this.prefixes = new HashSet(); - - // Enter standard imports - for(int i = 0; i < STANDARD_IMPORTS.length; i++) - imports.add(STANDARD_IMPORTS[i]); - } - - /** - * Check if the plugin ID has been previously declared. Make a not - * that this Id is now declared. - * @return true if Id has been declared. - */ - public boolean isPluginDeclared(String id) { - if (pluginDcls.contains(id)) - return true; - pluginDcls.add(id); - return false; - } - - public void addImports(List imports) { - this.imports.addAll(imports); - } - - public void addImport(String imp) { - this.imports.add(imp); - } - - public List getImports() { - return imports; - } - - public String getJspFile() { - return jspFile; - } - - public void addDependant(String d) { - if (!dependants.contains(d) && !jspFile.equals(d)) - dependants.add(d); - } - - public List getDependants() { - return dependants; - } - - public BeanRepository getBeanRepository() { - return beanRepository; - } - - public int getMaxTagNesting() { - return maxTagNesting; - } - - public void setMaxTagNesting(int maxTagNesting) { - this.maxTagNesting = maxTagNesting; - } - - public void setScriptless(boolean s) { - scriptless = s; - } - - public boolean isScriptless() { - return scriptless; - } - - public void setScriptingInvalid(boolean s) { - scriptingInvalid = s; - } - - public boolean isScriptingInvalid() { - return scriptingInvalid; - } - - public List getIncludePrelude() { - return includePrelude; - } - - public void setIncludePrelude(List prelude) { - includePrelude = prelude; - } - - public List getIncludeCoda() { - return includeCoda; - } - - public void setIncludeCoda(List coda) { - includeCoda = coda; - } - - public void setHasJspRoot(boolean s) { - hasJspRoot = s; - } - - public boolean hasJspRoot() { - return hasJspRoot; - } - - public String getOmitXmlDecl() { - return omitXmlDecl; - } - - public void setOmitXmlDecl(String omit) { - omitXmlDecl = omit; - } - - public String getDoctypeName() { - return doctypeName; - } - - public void setDoctypeName(String doctypeName) { - this.doctypeName = doctypeName; - } - - public String getDoctypeSystem() { - return doctypeSystem; - } - - public void setDoctypeSystem(String doctypeSystem) { - this.doctypeSystem = doctypeSystem; - } - - public String getDoctypePublic() { - return doctypePublic; - } - - public void setDoctypePublic(String doctypePublic) { - this.doctypePublic = doctypePublic; - } - - /* Tag library and XML namespace management methods */ - - public void setIsJspPrefixHijacked(boolean isHijacked) { - isJspPrefixHijacked = isHijacked; - } - - public boolean isJspPrefixHijacked() { - return isJspPrefixHijacked; - } - - /* - * Adds the given prefix to the set of prefixes of this translation unit. - * - * @param prefix The prefix to add - */ - public void addPrefix(String prefix) { - prefixes.add(prefix); - } - - /* - * Checks to see if this translation unit contains the given prefix. - * - * @param prefix The prefix to check - * - * @return true if this translation unit contains the given prefix, false - * otherwise - */ - public boolean containsPrefix(String prefix) { - return prefixes.contains(prefix); - } - - /* - * Maps the given URI to the given tag library. - * - * @param uri The URI to map - * @param info The tag library to be associated with the given URI - */ - public void addTaglib(String uri, TagLibraryInfo info) { - taglibsMap.put(uri, info); - } - - /* - * Gets the tag library corresponding to the given URI. - * - * @return Tag library corresponding to the given URI - */ - public TagLibraryInfo getTaglib(String uri) { - return taglibsMap.get(uri); - } - - /* - * Gets the collection of tag libraries that are associated with a URI - * - * @return Collection of tag libraries that are associated with a URI - */ - public Collection getTaglibs() { - return taglibsMap.values(); - } - - /* - * Checks to see if the given URI is mapped to a tag library. - * - * @param uri The URI to map - * - * @return true if the given URI is mapped to a tag library, false - * otherwise - */ - public boolean hasTaglib(String uri) { - return taglibsMap.containsKey(uri); - } - - /* - * Maps the given prefix to the given URI. - * - * @param prefix The prefix to map - * @param uri The URI to be associated with the given prefix - */ - public void addPrefixMapping(String prefix, String uri) { - jspPrefixMapper.put(prefix, uri); - } - - /* - * Pushes the given URI onto the stack of URIs to which the given prefix - * is mapped. - * - * @param prefix The prefix whose stack of URIs is to be pushed - * @param uri The URI to be pushed onto the stack - */ - public void pushPrefixMapping(String prefix, String uri) { - LinkedList stack = xmlPrefixMapper.get(prefix); - if (stack == null) { - stack = new LinkedList(); - xmlPrefixMapper.put(prefix, stack); - } - stack.addFirst(uri); - } - - /* - * Removes the URI at the top of the stack of URIs to which the given - * prefix is mapped. - * - * @param prefix The prefix whose stack of URIs is to be popped - */ - public void popPrefixMapping(String prefix) { - LinkedList stack = xmlPrefixMapper.get(prefix); - if (stack == null || stack.size() == 0) { - // XXX throw new Exception("XXX"); - } - stack.removeFirst(); - } - - /* - * Returns the URI to which the given prefix maps. - * - * @param prefix The prefix whose URI is sought - * - * @return The URI to which the given prefix maps - */ - public String getURI(String prefix) { - - String uri = null; - - LinkedList stack = xmlPrefixMapper.get(prefix); - if (stack == null || stack.size() == 0) { - uri = (String) jspPrefixMapper.get(prefix); - } else { - uri = (String) stack.getFirst(); - } - - return uri; - } - - - /* Page/Tag directive attributes */ - - /* - * language - */ - public void setLanguage(String value, Node n, ErrorDispatcher err, - boolean pagedir) - throws JasperException { - - if (!"java".equalsIgnoreCase(value)) { - if (pagedir) - err.jspError(n, "jsp.error.page.language.nonjava"); - else - err.jspError(n, "jsp.error.tag.language.nonjava"); - } - - language = value; - } - - public String getLanguage(boolean useDefault) { - return (language == null && useDefault ? defaultLanguage : language); - } - - public String getLanguage() { - return getLanguage(true); - } - - - /* - * extends - */ - public void setExtends(String value, Node.PageDirective n) { - - xtends = value; - - /* - * If page superclass is top level class (i.e. not in a package) - * explicitly import it. If this is not done, the compiler will assume - * the extended class is in the same pkg as the generated servlet. - */ - if (value.indexOf('.') < 0) - n.addImport(value); - } - - /** - * Gets the value of the 'extends' page directive attribute. - * - * @param useDefault TRUE if the default - * (org.apache.jasper.runtime.HttpJspBase) should be returned if this - * attribute has not been set, FALSE otherwise - * - * @return The value of the 'extends' page directive attribute, or the - * default (org.apache.jasper.runtime.HttpJspBase) if this attribute has - * not been set and useDefault is TRUE - */ - public String getExtends(boolean useDefault) { - return (xtends == null && useDefault ? defaultExtends : xtends); - } - - /** - * Gets the value of the 'extends' page directive attribute. - * - * @return The value of the 'extends' page directive attribute, or the - * default (org.apache.jasper.runtime.HttpJspBase) if this attribute has - * not been set - */ - public String getExtends() { - return getExtends(true); - } - - - /* - * contentType - */ - public void setContentType(String value) { - contentType = value; - } - - public String getContentType() { - return contentType; - } - - - /* - * buffer - */ - public void setBufferValue(String value, Node n, ErrorDispatcher err) - throws JasperException { - - if ("none".equalsIgnoreCase(value)) - buffer = 0; - else { - if (value == null || !value.endsWith("kb")) - if (n == null) - err.jspError("jsp.error.jspproperty.invalid.buffer"); - else - err.jspError(n, "jsp.error.page.invalid.buffer"); - try { - Integer k = new Integer(value.substring(0, value.length()-2)); - buffer = k.intValue() * 1024; - } catch (NumberFormatException e) { - if (n == null) - err.jspError("jsp.error.jspproperty.invalid.buffer"); - else - err.jspError(n, "jsp.error.page.invalid.buffer"); - } - } - - bufferValue = value; - } - - public String getBufferValue() { - return bufferValue; - } - - public int getBuffer() { - return buffer; - } - - public void setBuffer(int size) { - buffer = size; - } - - - /* - * session - */ - public void setSession(String value, Node n, ErrorDispatcher err) - throws JasperException { - - if ("true".equalsIgnoreCase(value)) - isSession = true; - else if ("false".equalsIgnoreCase(value)) - isSession = false; - else - err.jspError(n, "jsp.error.page.invalid.session"); - - session = value; - } - - public String getSession() { - return session; - } - - public boolean isSession() { - return isSession; - } - - - /* - * autoFlush - */ - public void setAutoFlush(String value, Node n, ErrorDispatcher err) - throws JasperException { - - if ("true".equalsIgnoreCase(value)) - isAutoFlush = true; - else if ("false".equalsIgnoreCase(value)) - isAutoFlush = false; - else - err.jspError(n, "jsp.error.autoFlush.invalid"); - - autoFlush = value; - } - - public String getAutoFlush() { - return autoFlush; - } - - public boolean isAutoFlush() { - return isAutoFlush; - } - - - /* - * isThreadSafe - */ - public void setIsThreadSafe(String value, Node n, ErrorDispatcher err) - throws JasperException { - - if ("true".equalsIgnoreCase(value)) - isThreadSafe = true; - else if ("false".equalsIgnoreCase(value)) - isThreadSafe = false; - else - err.jspError(n, "jsp.error.page.invalid.isthreadsafe"); - - isThreadSafeValue = value; - } - - public String getIsThreadSafe() { - return isThreadSafeValue; - } - - public boolean isThreadSafe() { - return isThreadSafe; - } - - - /* - * info - */ - public void setInfo(String value) { - info = value; - } - - public String getInfo() { - return info; - } - - - /* - * errorPage - */ - public void setErrorPage(String value) { - errorPage = value; - } - - public String getErrorPage() { - return errorPage; - } - - - /* - * isErrorPage - */ - public void setIsErrorPage(String value, Node n, ErrorDispatcher err) - throws JasperException { - - if ("true".equalsIgnoreCase(value)) - isErrorPage = true; - else if ("false".equalsIgnoreCase(value)) - isErrorPage = false; - else - err.jspError(n, "jsp.error.page.invalid.iserrorpage"); - - isErrorPageValue = value; - } - - public String getIsErrorPage() { - return isErrorPageValue; - } - - public boolean isErrorPage() { - return isErrorPage; - } - - - /* - * isELIgnored - */ - public void setIsELIgnored(String value, Node n, ErrorDispatcher err, - boolean pagedir) - throws JasperException { - - if ("true".equalsIgnoreCase(value)) - isELIgnored = true; - else if ("false".equalsIgnoreCase(value)) - isELIgnored = false; - else { - if (pagedir) - err.jspError(n, "jsp.error.page.invalid.iselignored"); - else - err.jspError(n, "jsp.error.tag.invalid.iselignored"); - } - - isELIgnoredValue = value; - } - - public void setELIgnored(boolean s) { - isELIgnored = s; - } - - public String getIsELIgnored() { - return isELIgnoredValue; - } - - public boolean isELIgnored() { - return isELIgnored; - } - - - /* - * deferredSyntaxAllowedAsLiteral - */ - public void setDeferredSyntaxAllowedAsLiteral(String value, Node n, - ErrorDispatcher err, boolean pagedir) - throws JasperException { - - if ("true".equalsIgnoreCase(value)) - deferredSyntaxAllowedAsLiteral = true; - else if ("false".equalsIgnoreCase(value)) - deferredSyntaxAllowedAsLiteral = false; - else { - if (pagedir) - err.jspError(n, "jsp.error.page.invalid.deferred"); - else - err.jspError(n, "jsp.error.tag.invalid.deferred"); - } - - deferredSyntaxAllowedAsLiteralValue = value; - } - - public void setDeferredSyntaxAllowedAsLiteral(boolean s) { - deferredSyntaxAllowedAsLiteral = s; - } - - public String getDeferredSyntaxAllowedAsLiteral() { - return deferredSyntaxAllowedAsLiteralValue; - } - - public boolean isDeferredSyntaxAllowedAsLiteral() { - return deferredSyntaxAllowedAsLiteral; - } - - /* - * trimDirectiveWhitespaces - */ - public void setTrimDirectiveWhitespaces(String value, Node n, - ErrorDispatcher err, boolean pagedir) - throws JasperException { - - if ("true".equalsIgnoreCase(value)) - trimDirectiveWhitespaces = true; - else if ("false".equalsIgnoreCase(value)) - trimDirectiveWhitespaces = false; - else { - if (pagedir) - err.jspError(n, "jsp.error.page.invalid.trim"); - else - err.jspError(n, "jsp.error.tag.invalid.trim"); - } - - trimDirectiveWhitespacesValue = value; - } - - public void setTrimDirectiveWhitespaces(boolean s) { - trimDirectiveWhitespaces = s; - } - - public String getTrimDirectiveWhitespaces() { - return trimDirectiveWhitespacesValue; - } - - public boolean isTrimDirectiveWhitespaces() { - return trimDirectiveWhitespaces; - } - - public void setErrorOnUndeclaredNamespace(boolean s) { - errorOnUndeclaredNamespace = s; - } - - public boolean errorOnUndeclaredNamespace() { - return this.errorOnUndeclaredNamespace; - } - - public void putNonCustomTagPrefix(String prefix, Mark where) { - nonCustomTagPrefixMap.put(prefix, where); - } - - public Mark getNonCustomTagPrefix(String prefix) { - return nonCustomTagPrefixMap.get(prefix); - } - - - /** - * Sets the resource location path of the translation unit's top-level - * page. - * - * @param rootPath Resource location path of the translation unit's - * top-level page - */ - void setRootPath(String rootPath) { - this.rootPath = rootPath; - } - - /** - * Gets the resource location path of the translation unit's top-level - * page. - * - * @return Resource location path of the translation unit's top-level - * page - */ - String getRootPath() { - return rootPath; - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/Parser.java b/impl/src/main/java/org/apache/jasper/compiler/Parser.java deleted file mode 100644 index 40b1673..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/Parser.java +++ /dev/null @@ -1,2045 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.CharArrayWriter; -import java.io.FileNotFoundException; -import java.net.URL; -// START GlassFish 750 -import java.util.concurrent.ConcurrentHashMap; -// START GlassFish 750 -import java.util.Iterator; -import java.util.List; - -import javax.servlet.jsp.tagext.TagAttributeInfo; -import javax.servlet.jsp.tagext.TagFileInfo; -import javax.servlet.jsp.tagext.TagInfo; -import javax.servlet.jsp.tagext.TagLibraryInfo; - -import org.apache.jasper.Constants; -import org.apache.jasper.JasperException; -import org.apache.jasper.JspCompilationContext; -import org.xml.sax.Attributes; -import org.xml.sax.helpers.AttributesImpl; - -/** - * This class implements a parser for a JSP page (non-xml view). - * JSP page grammar is included here for reference. The token '#' - * that appears in the production indicates the current input token - * location in the production. - * - * @author Kin-man Chung - * @author Shawn Bayern - * @author Mark Roth - */ - -class Parser implements TagConstants { - - private ParserController parserController; - private JspCompilationContext ctxt; - private JspReader reader; - private Mark start; - private ErrorDispatcher err; - private int scriptlessCount; - private boolean isTagFile; - private boolean directivesOnly; - private URL jarFileUrl; - private PageInfo pageInfo; - private boolean errorOnUndeclaredNamespace; - - // Virtual body content types, to make parsing a little easier. - // These are not accessible from outside the parser. - private static final String JAVAX_BODY_CONTENT_PARAM = - "JAVAX_BODY_CONTENT_PARAM"; - private static final String JAVAX_BODY_CONTENT_PLUGIN = - "JAVAX_BODY_CONTENT_PLUGIN"; - private static final String JAVAX_BODY_CONTENT_TEMPLATE_TEXT = - "JAVAX_BODY_CONTENT_TEMPLATE_TEXT"; - - /** - * The constructor - */ - private Parser(ParserController pc, JspReader reader, boolean isTagFile, - boolean directivesOnly, URL jarFileUrl, boolean hasBom) { - this.parserController = pc; - this.ctxt = pc.getJspCompilationContext(); - this.pageInfo = pc.getCompiler().getPageInfo(); - this.err = pc.getCompiler().getErrorDispatcher(); - this.reader = reader; - this.scriptlessCount = 0; - this.isTagFile = isTagFile; - this.directivesOnly = directivesOnly; - this.jarFileUrl = jarFileUrl; - start = reader.mark(); - } - - /** - * The main entry for Parser - * - * @param pc The ParseController, use for getting other objects in compiler - * and for parsing included pages - * @param reader To read the page - * @param parent The parent node to this page, null for top level page - * @return list of nodes representing the parsed page - */ - public static Node.Nodes parse(ParserController pc, - String path, - JspReader reader, - Node parent, - boolean isTagFile, - boolean directivesOnly, - URL jarFileUrl, - String pageEnc, - String jspConfigPageEnc, - boolean isDefaultPageEncoding, - boolean hasBom) - throws JasperException { - - Parser parser = new Parser(pc, reader, isTagFile, directivesOnly, - jarFileUrl, hasBom); - - Node.Root root = new Node.Root(reader.mark(), parent, false); - root.setPageEncoding(pageEnc); - root.setJspConfigPageEncoding(jspConfigPageEnc); - root.setIsDefaultPageEncoding(isDefaultPageEncoding); - root.setHasBom(hasBom); - - if (hasBom) { - // Consume (remove) BOM, so it won't appear in page output - char bomChar = (char) reader.nextChar(); - if (bomChar != 0xFEFF) { - parser.err.jspError( - reader.mark(), - "jsp.error.invalidBom", - Integer.toHexString(bomChar).toUpperCase()); - } - } - - if (directivesOnly) { - parser.parseTagFileDirectives(root); - return new Node.Nodes(root); - } - - // For the Top level page, add inlcude-prelude and include-coda - PageInfo pageInfo = pc.getCompiler().getPageInfo(); - if (parent == null) { - parser.addInclude(root, pageInfo.getIncludePrelude()); - } - while (reader.hasMoreInput()) { - parser.parseElements(root); - } - if (parent == null) { - parser.addInclude(root, pageInfo.getIncludeCoda()); - parser.pageInfo.setRootPath(path); - } - - Node.Nodes page = new Node.Nodes(root); - return page; - } - - /** - * Attributes ::= (S Attribute)* S? - */ - Attributes parseAttributes() throws JasperException { - AttributesImpl attrs = new AttributesImpl(); - - reader.skipSpaces(); - while (parseAttribute(attrs)) - reader.skipSpaces(); - - return attrs; - } - - /** - * Parse Attributes for a reader, provided for external use - */ - public static Attributes parseAttributes(ParserController pc, - JspReader reader) - throws JasperException { - Parser tmpParser = new Parser(pc, reader, false, false, null, false); - return tmpParser.parseAttributes(); - } - - /** - * Attribute ::= Name S? Eq S? - * ( '"<%=' RTAttributeValueDouble - * | '"' AttributeValueDouble - * | "'<%=" RTAttributeValueSingle - * | "'" AttributeValueSingle - * } - * Note: JSP and XML spec does not allow while spaces around Eq. It is - * added to be backward compatible with Tomcat, and with other xml parsers. - */ - private boolean parseAttribute(AttributesImpl attrs) - throws JasperException { - - // Get the qualified name - String qName = parseName(); - if (qName == null) - return false; - - // Determine prefix and local name components - String localName = qName; - String uri = ""; - int index = qName.indexOf(':'); - if (index != -1) { - String prefix = qName.substring(0, index); - uri = pageInfo.getURI(prefix); - if (uri == null) { - err.jspError(reader.mark(), - "jsp.error.attribute.invalidPrefix", prefix); - } - localName = qName.substring(index+1); - } - - reader.skipSpaces(); - if (!reader.matches("=")) - err.jspError(reader.mark(), "jsp.error.attribute.noequal"); - - reader.skipSpaces(); - char quote = (char) reader.nextChar(); - if (quote != '\'' && quote != '"') - err.jspError(reader.mark(), "jsp.error.attribute.noquote"); - - String watchString = ""; - if (reader.matches("<%=")) - watchString = "%>"; - watchString = watchString + quote; - - String attrValue = parseAttributeValue(watchString); - attrs.addAttribute(uri, localName, qName, "CDATA", attrValue); - return true; - } - - /** - * Name ::= (Letter | '_' | ':') (Letter | Digit | '.' | '_' | '-' | ':')* - */ - private String parseName() throws JasperException { - char ch = (char)reader.peekChar(); - if (Character.isLetter(ch) || ch == '_' || ch == ':') { - StringBuilder buf = new StringBuilder(); - buf.append(ch); - reader.nextChar(); - ch = (char)reader.peekChar(); - while (Character.isLetter(ch) || Character.isDigit(ch) || - ch == '.' || ch == '_' || ch == '-' || ch == ':') { - buf.append(ch); - reader.nextChar(); - ch = (char) reader.peekChar(); - } - return buf.toString(); - } - return null; - } - - /** - * AttributeValueDouble ::= (QuotedChar - '"')* - * ('"' | ) - * RTAttributeValueDouble ::= ((QuotedChar - '"')* - ((QuotedChar-'"')'%>"') - * ('%>"' | TRANSLATION_ERROR) - */ - private String parseAttributeValue(String watch) throws JasperException { - Mark start = reader.mark(); - Mark stop = reader.skipUntilIgnoreEsc(watch); - if (stop == null) { - err.jspError(start, "jsp.error.attribute.unterminated", watch); - } - - String ret = parseQuoted(reader.getText(start, stop)); - if (watch.length() == 1) // quote - return ret; - - // putback delimiter '<%=' and '%>', since they are needed if the - // attribute does not allow RTexpression. - return "<%=" + ret + "%>"; - } - - /** - * QuotedChar ::= ''' - * | '"' - * | '\\' - * | '\"' - * | "\'" - * | '\>' - * | '\$' - * | '\#' - * | Char - */ - // Need to preserve "\$", and "\#" here since they - // may be send to EL processor. - private String parseQuoted(String tx) { - StringBuilder buf = new StringBuilder(); - int size = tx.length(); - int i = 0; - while (i < size) { - char ch = tx.charAt(i); - if (ch == '&') { - if (i+5 < size && tx.charAt(i+1) == 'a' - && tx.charAt(i+2) == 'p' && tx.charAt(i+3) == 'o' - && tx.charAt(i+4) == 's' && tx.charAt(i+5) == ';') { - buf.append('\''); - i += 6; - } else if (i+5 < size && tx.charAt(i+1) == 'q' - && tx.charAt(i+2) == 'u' && tx.charAt(i+3) == 'o' - && tx.charAt(i+4) == 't' && tx.charAt(i+5) == ';') { - buf.append('"'); - i += 6; - } else { - buf.append(ch); - ++i; - } - } else if (ch == '\\' && i+1 < size) { - ch = tx.charAt(i+1); - if (ch == '\\' || ch == '\"' || ch == '\'' || ch == '>') { - buf.append(ch); - i += 2; - } else { - buf.append('\\'); - ++i; - } - } else { - buf.append(ch); - ++i; - } - } - return buf.toString(); - } - - private String parseScriptText(String tx) { - CharArrayWriter cw = new CharArrayWriter(); - int size = tx.length(); - int i = 0; - while (i < size) { - char ch = tx.charAt(i); - if (i+2 < size && ch == '%' && tx.charAt(i+1) == '\\' - && tx.charAt(i+2) == '>') { - cw.write('%'); - cw.write('>'); - i += 3; - } else { - cw.write(ch); - ++i; - } - } - cw.close(); - return cw.toString(); - } - - /* - * Invokes parserController to parse the included page - */ - private void processIncludeDirective(String file, Node parent) - throws JasperException { - if (file == null) { - return; - } - - try { - parserController.parse(file, parent, jarFileUrl); - } catch (FileNotFoundException ex) { - err.jspError(start, "jsp.error.file.not.found", file); - } catch (Exception ex) { - err.jspError(start, ex); - } - } - - /* - * Parses a page directive with the following syntax: - * PageDirective ::= ( S Attribute)* - */ - private void parsePageDirective(Node parent) throws JasperException { - Attributes attrs = parseAttributes(); - Node.PageDirective n = new Node.PageDirective(attrs, start, parent); - - /* - * A page directive may contain multiple 'import' attributes, each of - * which consists of a comma-separated list of package names. - * Store each list with the node, where it is parsed. - */ - for (int i = 0; i < attrs.getLength(); i++) { - if ("import".equals(attrs.getQName(i))) { - n.addImport(attrs.getValue(i)); - } - } - } - - /* - * Parses an include directive with the following syntax: - * IncludeDirective ::= ( S Attribute)* - */ - private void parseIncludeDirective(Node parent) throws JasperException { - Attributes attrs = parseAttributes(); - - // Included file expanded here - Node includeNode = new Node.IncludeDirective(attrs, start, parent); - processIncludeDirective(attrs.getValue("file"), includeNode); - } - - /** - * Add a list of files. This is used for implementing include-prelude - * and include-coda of jsp-config element in web.xml - */ - private void addInclude(Node parent, List files) throws JasperException { - if( files != null ) { - Iterator iter = files.iterator(); - while (iter.hasNext()) { - String file = (String) iter.next(); - AttributesImpl attrs = new AttributesImpl(); - attrs.addAttribute("", "file", "file", "CDATA", file); - - // Create a dummy Include directive node - Node includeNode = new Node.IncludeDirective(attrs, - reader.mark(), parent); - processIncludeDirective(file, includeNode); - } - } - } - - /* - * Parses a taglib directive with the following syntax: - * Directive ::= ( S Attribute)* - */ - private void parseTaglibDirective(Node parent) throws JasperException { - - Attributes attrs = parseAttributes(); - String uri = attrs.getValue("uri"); - String prefix = attrs.getValue("prefix"); - if (prefix != null) { - Mark prevMark = pageInfo.getNonCustomTagPrefix(prefix); - if (prevMark != null) { - err.jspError(reader.mark(), "jsp.error.prefix.use_before_dcl", - prefix, prevMark.getFile(), "" + prevMark.getLineNumber()); - } - if (uri != null) { - String uriPrev = pageInfo.getURI(prefix); - if (uriPrev != null && !uriPrev.equals(uri)) { - err.jspError(reader.mark(), "jsp.error.prefix.refined", - prefix, uri, uriPrev); - } - /* GlassFish 750 - if (pageInfo.getTaglib(uri) == null) { - String[] location = ctxt.getTldLocation(uri); - TagLibraryInfoImpl taglib = null; - try { - taglib = new TagLibraryInfoImpl(ctxt, - parserController, - prefix, - uri, - location, - err); - } catch (JasperException je) { - err.throwException(reader.mark(), je); - } - pageInfo.addTaglib(uri, taglib); - } - */ - // START GlassFish 750 - ConcurrentHashMap taglibs = - ctxt.getTaglibs(); - TagLibraryInfoImpl taglib = taglibs.get(uri); - if (taglib == null) { - synchronized (taglibs) { - taglib = taglibs.get(uri); - if (taglib == null) { - String[] location = ctxt.getTldLocation(uri); - try { - taglib = new TagLibraryInfoImpl( - ctxt, - parserController, - prefix, - uri, - location, - err); - } catch (JasperException je) { - err.throwException(reader.mark(), je); - } - ctxt.addTaglib(uri, taglib); - pageInfo.addTaglib(uri, taglib); - } - } - } - if (pageInfo.getTaglib(uri) == null) { - pageInfo.addTaglib(uri, - new TagLibraryInfoImpl(prefix, - uri, - taglib, - pageInfo)); - } - // END GlassFish 750 - pageInfo.addPrefixMapping(prefix, uri); - } else { - String tagdir = attrs.getValue("tagdir"); - if (tagdir != null) { - String urnTagdir = URN_JSPTAGDIR + tagdir; - if (pageInfo.getTaglib(urnTagdir) == null) { - pageInfo.addTaglib(urnTagdir, - new ImplicitTagLibraryInfo( - ctxt, - parserController, - prefix, - tagdir, - err)); - } - pageInfo.addPrefixMapping(prefix, urnTagdir); - } - } - } - - new Node.TaglibDirective(attrs, start, parent); - } - - /* - * Parses a directive with the following syntax: - * Directive ::= S? ( 'page' PageDirective - * | 'include' IncludeDirective - * | 'taglib' TagLibDirective) - * S? '%>' - * - * TagDirective ::= S? ('tag' PageDirective - * | 'include' IncludeDirective - * | 'taglib' TagLibDirective) - * | 'attribute AttributeDirective - * | 'variable VariableDirective - * S? '%>' - */ - private void parseDirective(Node parent) throws JasperException { - reader.skipSpaces(); - - String directive = null; - if (reader.matches("page")) { - directive = "<%@ page"; - if (isTagFile) { - err.jspError(reader.mark(), "jsp.error.directive.istagfile", - directive); - } - parsePageDirective(parent); - } else if (reader.matches("include")) { - directive = "<%@ include"; - parseIncludeDirective(parent); - } else if (reader.matches("taglib")) { - if (directivesOnly) { - // No need to get the tagLibInfo objects. This alos suppresses - // parsing of any tag files used in this tag file. - return; - } - directive = "<%@ taglib"; - parseTaglibDirective(parent); - } else if (reader.matches("tag")) { - directive = "<%@ tag"; - if (!isTagFile) { - err.jspError(reader.mark(), "jsp.error.directive.isnottagfile", - directive); - } - parseTagDirective(parent); - } else if (reader.matches("attribute")) { - directive = "<%@ attribute"; - if (!isTagFile) { - err.jspError(reader.mark(), "jsp.error.directive.isnottagfile", - directive); - } - parseAttributeDirective(parent); - } else if (reader.matches("variable")) { - directive = "<%@ variable"; - if (!isTagFile) { - err.jspError(reader.mark(), "jsp.error.directive.isnottagfile", - directive); - } - parseVariableDirective(parent); - } else { - err.jspError(reader.mark(), "jsp.error.invalid.directive", - reader.parseToken(false)); - } - - reader.skipSpaces(); - if (!reader.matches("%>")) { - err.jspError(start, "jsp.error.unterminated", directive); - } - } - - /* - * Parses a directive with the following syntax: - * - * XMLJSPDirectiveBody ::= S? ( ( 'page' PageDirectiveAttrList - * S? ( '/>' | ( '>' S? ETag ) ) - * | ( 'include' IncludeDirectiveAttrList - * S? ( '/>' | ( '>' S? ETag ) ) - * | - * - * XMLTagDefDirectiveBody ::= ( ( 'tag' TagDirectiveAttrList - * S? ( '/>' | ( '>' S? ETag ) ) - * | ( 'include' IncludeDirectiveAttrList - * S? ( '/>' | ( '>' S? ETag ) ) - * | ( 'attribute' AttributeDirectiveAttrList - * S? ( '/>' | ( '>' S? ETag ) ) - * | ( 'variable' VariableDirectiveAttrList - * S? ( '/>' | ( '>' S? ETag ) ) - * ) - * | - */ - private void parseXMLDirective(Node parent) throws JasperException { - reader.skipSpaces(); - - String eTag = null; - if (reader.matches("page")) { - eTag = "jsp:directive.page"; - if (isTagFile) { - err.jspError(reader.mark(), "jsp.error.directive.istagfile", - "<" + eTag); - } - parsePageDirective(parent); - } else if (reader.matches("include")) { - eTag = "jsp:directive.include"; - parseIncludeDirective(parent); - } else if (reader.matches("tag")) { - eTag = "jsp:directive.tag"; - if (!isTagFile) { - err.jspError(reader.mark(), "jsp.error.directive.isnottagfile", - "<" + eTag); - } - parseTagDirective(parent); - } else if (reader.matches("attribute")) { - eTag = "jsp:directive.attribute"; - if (!isTagFile) { - err.jspError(reader.mark(), "jsp.error.directive.isnottagfile", - "<" + eTag); - } - parseAttributeDirective(parent); - } else if (reader.matches("variable")) { - eTag = "jsp:directive.variable"; - if (!isTagFile) { - err.jspError(reader.mark(), "jsp.error.directive.isnottagfile", - "<" + eTag); - } - parseVariableDirective(parent); - } else { - err.jspError(reader.mark(), "jsp.error.invalid.directive", - reader.parseToken(false)); - } - - reader.skipSpaces(); - if( reader.matches( ">" ) ) { - reader.skipSpaces(); - if( !reader.matchesETag( eTag ) ) { - err.jspError(start, "jsp.error.unterminated", "<" + eTag ); - } - } - else if( !reader.matches( "/>" ) ) { - err.jspError(start, "jsp.error.unterminated", "<" + eTag ); - } - } - - /* - * Parses a tag directive with the following syntax: - * PageDirective ::= ( S Attribute)* - */ - private void parseTagDirective(Node parent) throws JasperException { - Attributes attrs = parseAttributes(); - Node.TagDirective n = new Node.TagDirective(attrs, start, parent); - - /* - * A page directive may contain multiple 'import' attributes, each of - * which consists of a comma-separated list of package names. - * Store each list with the node, where it is parsed. - */ - for (int i = 0; i < attrs.getLength(); i++) { - if ("import".equals(attrs.getQName(i))) { - n.addImport(attrs.getValue(i)); - } - } - } - - /* - * Parses a attribute directive with the following syntax: - * AttributeDirective ::= ( S Attribute)* - */ - private void parseAttributeDirective(Node parent) throws JasperException { - Attributes attrs = parseAttributes(); - new Node.AttributeDirective(attrs, start, parent); - } - - /* - * Parses a variable directive with the following syntax: - * PageDirective ::= ( S Attribute)* - */ - private void parseVariableDirective(Node parent) throws JasperException { - Attributes attrs = parseAttributes(); - new Node.VariableDirective(attrs, start, parent); - } - - /* - * JSPCommentBody ::= (Char* - (Char* '--%>')) '--%>' - */ - private void parseComment(Node parent) throws JasperException { - start = reader.mark(); - Mark stop = reader.skipUntil("--%>"); - if (stop == null) { - err.jspError(start, "jsp.error.unterminated", "<%--"); - } - - new Node.Comment(reader.getText(start, stop), start, parent); - } - - /* - * DeclarationBody ::= (Char* - (char* '%>')) '%>' - */ - private void parseDeclaration(Node parent) throws JasperException { - start = reader.mark(); - Mark stop = reader.skipUntil("%>"); - if (stop == null) { - err.jspError(start, "jsp.error.unterminated", "<%!"); - } - - new Node.Declaration(parseScriptText(reader.getText(start, stop)), - start, parent); - } - - /* - * XMLDeclarationBody ::= ( S? '/>' ) - * | ( S? '>' (Char* - (char* '<')) CDSect?)* ETag - * | - * CDSect ::= CDStart CData CDEnd - * CDStart ::= '' Char*)) - * CDEnd ::= ']]>' - */ - private void parseXMLDeclaration(Node parent) throws JasperException { - reader.skipSpaces(); - if( !reader.matches( "/>" ) ) { - if( !reader.matches( ">" ) ) { - err.jspError(start, "jsp.error.unterminated", - "<jsp:declaration>"); - } - Mark stop; - String text; - while (true) { - start = reader.mark(); - stop = reader.skipUntil("<"); - if (stop == null) { - err.jspError(start, "jsp.error.unterminated", - "<jsp:declaration>"); - } - text = parseScriptText(reader.getText(start, stop)); - new Node.Declaration(text, start, parent); - if (reader.matches("![CDATA[")) { - start = reader.mark(); - stop = reader.skipUntil("]]>"); - if (stop == null) { - err.jspError(start, "jsp.error.unterminated", "CDATA"); - } - text = parseScriptText(reader.getText(start, stop)); - new Node.Declaration(text, start, parent); - } - else { - break; - } - } - - if (!reader.matchesETagWithoutLessThan( "jsp:declaration" ) ) { - err.jspError(start, "jsp.error.unterminated", - "<jsp:declaration>"); - } - } - } - - /* - * ExpressionBody ::= (Char* - (char* '%>')) '%>' - */ - private void parseExpression(Node parent) throws JasperException { - start = reader.mark(); - Mark stop = reader.skipUntil("%>"); - if (stop == null) { - err.jspError(start, "jsp.error.unterminated", "<%="); - } - - new Node.Expression(parseScriptText(reader.getText(start, stop)), - start, parent); - } - - /* - * XMLExpressionBody ::= ( S? '/>' ) - * | ( S? '>' (Char* - (char* '<')) CDSect?)* ETag ) - * | - */ - private void parseXMLExpression(Node parent) throws JasperException { - reader.skipSpaces(); - if( !reader.matches( "/>" ) ) { - if( !reader.matches( ">" ) ) { - err.jspError(start, "jsp.error.unterminated", - "<jsp:expression>"); - } - Mark stop; - String text; - while (true) { - start = reader.mark(); - stop = reader.skipUntil("<"); - if (stop == null) { - err.jspError(start, "jsp.error.unterminated", - "<jsp:expression>"); - } - text = parseScriptText(reader.getText(start, stop)); - new Node.Expression(text, start, parent); - if (reader.matches("![CDATA[")) { - start = reader.mark(); - stop = reader.skipUntil("]]>"); - if (stop == null) { - err.jspError(start, "jsp.error.unterminated", "CDATA"); - } - text = parseScriptText(reader.getText(start, stop)); - new Node.Expression(text, start, parent); - } - else { - break; - } - } - if (!reader.matchesETagWithoutLessThan( "jsp:expression" )) { - err.jspError(start, "jsp.error.unterminated", - "<jsp:expression>"); - } - } - } - - /* - * ELExpressionBody - * (following "${" or "#{"to first unquoted "}") - * // XXX add formal production and confirm implementation against it, - * // once it's decided - */ - private void parseELExpression(Node parent, String typeEL) - throws JasperException { - start = reader.mark(); - boolean singleQuoted = false, doubleQuoted = false; - int curl = 0; - int currentChar; - do { - // XXX could move this logic to JspReader - currentChar = reader.nextChar(); - if (currentChar == '\\' && (singleQuoted || doubleQuoted)) { - // skip character following '\' within quotes - reader.nextChar(); - currentChar = reader.nextChar(); - } - if (currentChar == -1) - err.jspError(start, "jsp.error.unterminated", typeEL); - if (currentChar == '"') - doubleQuoted = !doubleQuoted; - else if (currentChar == '\'') - singleQuoted = !singleQuoted; - else if (currentChar == '{') - curl++; - else if (currentChar == '}') - curl--; - } while (currentChar != '}' || curl >= 0 || singleQuoted || doubleQuoted); - - String text = typeEL + reader.getText(start, reader.mark()); - new Node.ELExpression(text, start, parent); - } - - /* - * ScriptletBody ::= (Char* - (char* '%>')) '%>' - */ - private void parseScriptlet(Node parent) throws JasperException { - start = reader.mark(); - Mark stop = reader.skipUntil("%>"); - if (stop == null) { - err.jspError(start, "jsp.error.unterminated", "<%"); - } - - new Node.Scriptlet(parseScriptText(reader.getText(start, stop)), - start, parent); - } - - /* - * XMLScriptletBody ::= ( S? '/>' ) - * | ( S? '>' (Char* - (char* '<')) CDSect?)* ETag ) - * | - */ - private void parseXMLScriptlet(Node parent) throws JasperException { - reader.skipSpaces(); - if( !reader.matches( "/>" ) ) { - if( !reader.matches( ">" ) ) { - err.jspError(start, "jsp.error.unterminated", - "<jsp:scriptlet>"); - } - Mark stop; - String text; - while (true) { - start = reader.mark(); - stop = reader.skipUntil("<"); - if (stop == null) { - err.jspError(start, "jsp.error.unterminated", - "<jsp:scriptlet>"); - } - text = parseScriptText(reader.getText(start, stop)); - new Node.Scriptlet(text, start, parent); - if (reader.matches("![CDATA[")) { - start = reader.mark(); - stop = reader.skipUntil("]]>"); - if (stop == null) { - err.jspError(start, "jsp.error.unterminated", "CDATA"); - } - text = parseScriptText(reader.getText(start, stop)); - new Node.Scriptlet(text, start, parent); - } - else { - break; - } - } - - if (!reader.matchesETagWithoutLessThan( "jsp:scriptlet" )) { - err.jspError(start, "jsp.error.unterminated", - "<jsp:scriptlet>"); - } - } - } - - /** - * Param ::= '' S? ( ' ) - * S? ETag - * ) - * | ( '>' S? Param* ETag ) - * - * EmptyBody ::= '/>' - * | ( '>' ETag ) - * | ( '>' S? '' Param* '' - */ - private void parseInclude(Node parent) throws JasperException { - Attributes attrs = parseAttributes(); - reader.skipSpaces(); - - Node includeNode = new Node.IncludeAction( attrs, start, parent ); - - parseOptionalBody(includeNode, "jsp:include", - JAVAX_BODY_CONTENT_PARAM); - } - - /* - * For Forward: - * StdActionContent ::= Attributes ParamBody - */ - private void parseForward(Node parent) throws JasperException { - Attributes attrs = parseAttributes(); - reader.skipSpaces(); - - Node forwardNode = new Node.ForwardAction( attrs, start, parent ); - - parseOptionalBody(forwardNode, "jsp:forward", - JAVAX_BODY_CONTENT_PARAM); - } - - private void parseInvoke(Node parent) throws JasperException { - Attributes attrs = parseAttributes(); - reader.skipSpaces(); - - Node invokeNode = new Node.InvokeAction(attrs, start, parent); - - parseEmptyBody(invokeNode, "jsp:invoke"); - } - - private void parseDoBody(Node parent) throws JasperException { - Attributes attrs = parseAttributes(); - reader.skipSpaces(); - - Node doBodyNode = new Node.DoBodyAction(attrs, start, parent); - - parseEmptyBody(doBodyNode, "jsp:doBody"); - } - - private void parseElement(Node parent) throws JasperException { - Attributes attrs = parseAttributes(); - reader.skipSpaces(); - - Node elementNode = new Node.JspElement(attrs, start, parent); - - parseOptionalBody( elementNode, "jsp:element", - TagInfo.BODY_CONTENT_JSP ); - } - - /* - * For GetProperty: - * StdActionContent ::= Attributes EmptyBody - */ - private void parseGetProperty(Node parent) throws JasperException { - Attributes attrs = parseAttributes(); - reader.skipSpaces(); - - Node getPropertyNode = new Node.GetProperty( attrs, start, parent ); - - parseOptionalBody(getPropertyNode, "jsp:getProperty", - TagInfo.BODY_CONTENT_EMPTY); - } - - /* - * For SetProperty: - * StdActionContent ::= Attributes EmptyBody - */ - private void parseSetProperty(Node parent) throws JasperException { - Attributes attrs = parseAttributes(); - reader.skipSpaces(); - - Node setPropertyNode = new Node.SetProperty( attrs, start, parent ); - - parseOptionalBody(setPropertyNode, "jsp:setProperty", - TagInfo.BODY_CONTENT_EMPTY); - } - - /* - * EmptyBody ::= '/>' - * | ( '>' ETag ) - * | ( '>' S? '") ) { - // Done - } - else if( reader.matches( ">" ) ) { - if( reader.matchesETag( tag ) ) { - // Done - } - else if( reader.matchesOptionalSpacesFollowedBy( - "' ETag ) - * | ( '>' S? '' Body ETag ) - * - * ScriptlessActionBody ::= JspAttributeAndBody - * | ( '>' ScriptlessBody ETag ) - * - * TagDependentActionBody ::= JspAttributeAndBody - * | ( '>' TagDependentBody ETag ) - * - */ - private void parseOptionalBody( Node parent, String tag, String bodyType ) - throws JasperException - { - if (reader.matches("/>")) { - // EmptyBody - return; - } - - if (!reader.matches(">")) { - err.jspError(reader.mark(), "jsp.error.unterminated", - "<" + tag ); - } - - if( reader.matchesETag( tag ) ) { - // EmptyBody - return; - } - - if( !parseJspAttributeAndBody( parent, tag, bodyType ) ) { - // Must be ( '>' # Body ETag ) - parseBody(parent, tag, bodyType ); - } - } - - /** - * Attempts to parse 'JspAttributeAndBody' production. Returns true if - * it matched, or false if not. Assumes EmptyBody is okay as well. - * - * JspAttributeAndBody ::= - * ( '>' # S? ( ' ) - * S? ETag - * ) - */ - private boolean parseJspAttributeAndBody( Node parent, String tag, - String bodyType ) - throws JasperException - { - boolean result = false; - - if( reader.matchesOptionalSpacesFollowedBy( " elements: - parseNamedAttributes( parent ); - - result = true; - } - - if( reader.matchesOptionalSpacesFollowedBy( " but something other than - // or the end tag, translation error. - err.jspError(reader.mark(), "jsp.error.jspbody.required", - "<" + tag ); - } - - return result; - } - - /* - * Params ::= `>' S? - * ( ( `' - * ( ( S? Param+ S? `' ) - * | - * ) - * ) - * | Param+ - * ) - * '' - */ - private void parseJspParams(Node parent) throws JasperException { - Node jspParamsNode = new Node.ParamsAction(start, parent); - parseOptionalBody(jspParamsNode, "jsp:params", - JAVAX_BODY_CONTENT_PARAM ); - } - - /* - * Fallback ::= '/>' - * | ( `>' S? `' - * ( ( S? - * ( Char* - ( Char* `' ) ) - * `' S? - * ) - * | - * ) - * `' - * ) - * | ( '>' - * ( Char* - ( Char* '' ) ) - * '' - * ) - */ - private void parseFallBack(Node parent) throws JasperException { - Node fallBackNode = new Node.FallBackAction(start, parent); - parseOptionalBody(fallBackNode, "jsp:fallback", - JAVAX_BODY_CONTENT_TEMPLATE_TEXT); - } - - /* - * For Plugin: - * StdActionContent ::= Attributes PluginBody - * - * PluginBody ::= EmptyBody - * | ( '>' S? ( ' ) - * S? ETag - * ) - * | ( '>' S? PluginTags ETag ) - * - * EmptyBody ::= '/>' - * | ( '>' ETag ) - * | ( '>' S? ' - * - * Attributes ::= ( S Attribute )* S? - * - * CustomActionEnd ::= CustomActionTagDependent - * | CustomActionJSPContent - * | CustomActionScriptlessContent - * - * CustomActionTagDependent ::= TagDependentOptionalBody - * - * CustomActionJSPContent ::= OptionalBody - * - * CustomActionScriptlessContent ::= ScriptlessOptionalBody - */ - private boolean parseCustomTag(Node parent) throws JasperException { - - if (reader.peekChar() != '<') { - return false; - } - - // Parse 'CustomAction' production (tag prefix and custom action name) - reader.nextChar(); // skip '<' - String tagName = reader.parseToken(false); - int i = tagName.indexOf(':'); - if (i == -1) { - reader.reset(start); - return false; - } - - String prefix = tagName.substring(0, i); - String shortTagName = tagName.substring(i+1); - - // Check if this is a user-defined tag. - String uri = pageInfo.getURI(prefix); - if (uri == null) { - // If error-on-undeclared-namespace is set to true in - // jsp-property-group, then it is an error - if (pageInfo.errorOnUndeclaredNamespace()) { - err.jspError(start, "jsp.error.undeclared.namespace", prefix); - } - - reader.reset(start); - // Remember the prefix for later error checking - pageInfo.putNonCustomTagPrefix(prefix, reader.mark()); - return false; - } - - TagLibraryInfo tagLibInfo = pageInfo.getTaglib(uri); - TagInfo tagInfo = tagLibInfo.getTag(shortTagName); - TagFileInfo tagFileInfo = tagLibInfo.getTagFile(shortTagName); - if (tagInfo == null && tagFileInfo == null) { - err.jspError(start, "jsp.error.bad_tag", shortTagName, prefix); - } - Class tagHandlerClass = null; - if (tagInfo != null) { - // Must be a classic tag, load it here. - // tag files will be loaded later, in TagFileProcessor - String handlerClassName = tagInfo.getTagClassName(); - try { - tagHandlerClass = ctxt.getClassLoader().loadClass(handlerClassName); - } catch (Exception e) { - err.jspError(start, "jsp.error.loadclass.taghandler", - handlerClassName, tagName); - } - } - - // Parse 'CustomActionBody' production: - // At this point we are committed - if anything fails, we produce - // a translation error. - - // Parse 'Attributes' production: - Attributes attrs = parseAttributes(); - reader.skipSpaces(); - - // Parse 'CustomActionEnd' production: - if (reader.matches("/>")) { - if (tagInfo != null) { - new Node.CustomTag(tagLibInfo.getRequiredVersion(), - tagName, prefix, shortTagName, uri, attrs, - start, parent, tagInfo, tagHandlerClass); - } else { - new Node.CustomTag(tagLibInfo.getRequiredVersion(), - tagName, prefix, shortTagName, uri, attrs, - start, parent, tagFileInfo); - } - return true; - } - - // Now we parse one of 'CustomActionTagDependent', - // 'CustomActionJSPContent', or 'CustomActionScriptlessContent'. - // depending on body-content in TLD. - - // Looking for a body, it still can be empty; but if there is a - // a tag body, its syntax would be dependent on the type of - // body content declared in the TLD. - String bc; - if (tagInfo != null) { - bc = tagInfo.getBodyContent(); - } else { - bc = tagFileInfo.getTagInfo().getBodyContent(); - } - - Node tagNode = null; - if (tagInfo != null) { - tagNode = new Node.CustomTag(tagLibInfo.getRequiredVersion(), - tagName, prefix, shortTagName, uri, - attrs, start, parent, tagInfo, - tagHandlerClass); - } else { - tagNode = new Node.CustomTag(tagLibInfo.getRequiredVersion(), - tagName, prefix, shortTagName, uri, - attrs, start, parent, tagFileInfo); - } - - parseOptionalBody( tagNode, tagName, bc ); - - return true; - } - - /* - * Parse for a template text string until '<' or "${" is encountered, - * recognizing escape sequences "\%" ,"\$", and \#. - */ - private void parseTemplateText(Node parent) throws JasperException { - - if (!reader.hasMoreInput()) - return; - - CharArrayWriter ttext = new CharArrayWriter(); - // Output the first character - int ch = reader.nextChar(); - if (ch == '\\') { - reader.pushChar(); - } else { - ttext.write(ch); - } - - while (reader.hasMoreInput()) { - ch = reader.nextChar(); - if (ch == '<') { - reader.pushChar(); - break; - } - else if( ch == '$' || ch == '#') { - if (!reader.hasMoreInput()) { - ttext.write(ch); - break; - } - if (reader.nextChar() == '{') { - reader.pushChar(); - reader.pushChar(); - break; - } - ttext.write(ch); - reader.pushChar(); - continue; - } - else if (ch == '\\') { - if (!reader.hasMoreInput()) { - ttext.write('\\'); - break; - } - char next = (char)reader.peekChar(); - // Looking for \% or \$ - // Note that this behavior can be altered by the attributes - // el-ignored and deferred-syntax-allowed-as-literal and - // similar attributes in a page directive. However, since - // the page direcitve may appear later in the same page, the - // '\' will be regenerated in Generator.java. - if (next == '%' || next == '$' || next == '#') { - ch = reader.nextChar(); - } - } - ttext.write(ch); - } - new Node.TemplateText(ttext.toString(), start, parent); - } - - /* - * XMLTemplateText ::= ( S? '/>' ) - * | ( S? '>' - * ( ( Char* - ( Char* ( '<' | '${' ) ) ) - * ( '${' ELExpressionBody )? - * CDSect? - * )* ETag - * ) - * | - */ - private void parseXMLTemplateText(Node parent) throws JasperException { - reader.skipSpaces(); - if( !reader.matches( "/>" ) ) { - if( !reader.matches( ">" ) ) { - err.jspError(start, "jsp.error.unterminated", - "<jsp:text>" ); - } - CharArrayWriter ttext = new CharArrayWriter(); - while (reader.hasMoreInput()) { - int ch = reader.nextChar(); - if( ch == '<' ) { - // Check for "); - if (stop == null) { - err.jspError(start, "jsp.error.unterminated", "CDATA"); - } - String text = reader.getText(start, stop); - ttext.write(text, 0, text.length()); - } - else if( ch == '\\') { - if (!reader.hasMoreInput()) { - ttext.write('\\'); - break; - } - ch = reader.nextChar(); - if (ch != '$' && ch != '#') { - ttext.write('\\'); - } - ttext.write(ch); - } - else if( ch == '$' || ch == '#') { - if (!reader.hasMoreInput()) { - ttext.write(ch); - break; - } - if (reader.nextChar() != '{') { - ttext.write(ch); - reader.pushChar(); - continue; - } - // Create a template text node - new Node.TemplateText( ttext.toString(), start, parent); - - // Mark and parse the EL expression and create its node: - start = reader.mark(); - parseELExpression(parent, (ch == '$')? "${": "#{"); - - start = reader.mark(); - ttext = new CharArrayWriter(); - } - else { - ttext.write( ch ); - } - } - - new Node.TemplateText( ttext.toString(), start, parent ); - - if (! reader.hasMoreInput()) { - err.jspError( start, "jsp.error.unterminated", - "<jsp:text>" ); - } else if( !reader.matchesETagWithoutLessThan( "jsp:text" ) ) { - err.jspError( start, "jsp.error.jsptext.badcontent"); - } - } - } - - /* - * AllBody ::= ( '<%--' JSPCommentBody ) - * | ( '<%@' DirectiveBody ) - * | ( ' 0 ) { - // vc: ScriptlessBody - // We must follow the ScriptlessBody production if one of - // our parents is ScriptlessBody. - parseElementsScriptless( parent ); - return; - } - - start = reader.mark(); - if (reader.matches("<%--")) { - parseComment(parent); - } else if (reader.matches("<%@")) { - parseDirective(parent); - } else if (reader.matches(" ) - * | ( ' ) - * | ( '<%=' ) - * | ( ' ) - * | ( '<%' ) - * | ( ' ) - * | ( ' ) - * | ( ' ) - * | ( '<%=' ) - * | ( ' ) - * | ( '<%' ) - * | ( ' ) - * | ( ' ) - * | ( '${' ) - * | ( ' ) - * | TemplateText - */ - private void parseElementsTemplateText(Node parent) - throws JasperException - { - start = reader.mark(); - if (reader.matches("<%--")) { - parseComment(parent); - } else if (reader.matches("<%@")) { - parseDirective(parent); - } else if (reader.matches("")) { - if (!reader.matches(">")) { - err.jspError(start, "jsp.error.unterminated", - "<jsp:body"); - } - parseBody( bodyNode, "jsp:body", bodyType ); - } - } - - /* - * Parse the body as JSP content. - * @param tag The name of the tag whose end tag would terminate the body - * @param bodyType One of the TagInfo body types - */ - private void parseBody(Node parent, String tag, String bodyType) - throws JasperException - { - if( bodyType.equalsIgnoreCase( TagInfo.BODY_CONTENT_TAG_DEPENDENT ) ) { - parseTagDependentBody( parent, tag ); - } - else if( bodyType.equalsIgnoreCase( TagInfo.BODY_CONTENT_EMPTY ) ) { - if( !reader.matchesETag( tag ) ) { - err.jspError(start, "jasper.error.emptybodycontent.nonempty", - tag); - } - } - else if( bodyType == JAVAX_BODY_CONTENT_PLUGIN ) { - // (note the == since we won't recognize JAVAX_* - // from outside this module). - parsePluginTags(parent); - if( !reader.matchesETag( tag ) ) { - err.jspError( reader.mark(), "jsp.error.unterminated", - "<" + tag ); - } - } - else if( bodyType.equalsIgnoreCase( TagInfo.BODY_CONTENT_JSP ) || - bodyType.equalsIgnoreCase( TagInfo.BODY_CONTENT_SCRIPTLESS ) || - (bodyType == JAVAX_BODY_CONTENT_PARAM) || - (bodyType == JAVAX_BODY_CONTENT_TEMPLATE_TEXT) ) - { - while (reader.hasMoreInput()) { - if (reader.matchesETag(tag)) { - return; - } - - // Check for nested jsp:body or jsp:attribute - if (tag.equals("jsp:body") || tag.equals("jsp:attribute")) { - if (reader.matches("")) { - if (!reader.matches(">")) { - err.jspError(start, "jsp.error.unterminated", - "<jsp:attribute"); - } - if (namedAttributeNode.isTrim()) { - reader.skipSpaces(); - } - parseBody(namedAttributeNode, "jsp:attribute", - getAttributeBodyType(parent, - attrs.getValue("name"))); - if (namedAttributeNode.isTrim()) { - Node.Nodes subElems = namedAttributeNode.getBody(); - if (subElems != null) { - Node lastNode = subElems.getNode(subElems.size() - 1); - if (lastNode instanceof Node.TemplateText) { - ((Node.TemplateText)lastNode).rtrim(); - } - } - } - } - reader.skipSpaces(); - } while( reader.matches( " from the enclosing node - */ - private String getAttributeBodyType(Node n, String name) { - - if (n instanceof Node.CustomTag) { - TagInfo tagInfo = ((Node.CustomTag)n).getTagInfo(); - TagAttributeInfo[] tldAttrs = tagInfo.getAttributes(); - for (int i=0; i - * The same ParserController instance is used for a JSP page and any JSP - * segments included by it (via an include directive), where each segment may - * be provided in standard or XML syntax. This class selects and invokes the - * appropriate parser for the JSP page and its included segments. - * - * @author Pierre Delisle - * @author Jan Luehe - */ -class ParserController implements TagConstants { - - private static final String CHARSET = "charset="; - - private JspCompilationContext ctxt; - private Compiler compiler; - private ErrorDispatcher err; - - /* - * Indicates the syntax (XML or standard) of the file being processed - */ - private boolean isXml; - - /* - * A stack to keep track of the 'current base directory' - * for include directives that refer to relative paths. - */ - private Stack baseDirStack = new Stack(); - - private boolean isEncodingSpecifiedInProlog; - - private boolean hasBom; - - private String sourceEnc; - - private boolean isDefaultPageEncoding; - private boolean isTagFile; - private boolean directiveOnly; - - /* - * Constructor - */ - public ParserController(JspCompilationContext ctxt, Compiler compiler) { - this.ctxt = ctxt; - this.compiler = compiler; - this.err = compiler.getErrorDispatcher(); - } - - public JspCompilationContext getJspCompilationContext () { - return ctxt; - } - - public Compiler getCompiler () { - return compiler; - } - - /** - * Parses a JSP page or tag file. This is invoked by the compiler. - * - * @param inFileName The path to the JSP page or tag file to be parsed. - */ - public Node.Nodes parse(String inFileName) - throws FileNotFoundException, JasperException, IOException { - // If we're parsing a packaged tag file or a resource included by it - // (using an include directive), ctxt.getTagFileJar() returns the - // JAR file from which to read the tag file or included resource, - // respectively. - isTagFile = ctxt.isTagFile(); - directiveOnly = false; - return doParse(inFileName, null, ctxt.getTagFileJarUrl()); - } - - /** - * Processes an include directive with the given path. - * - * @param inFileName The path to the resource to be included. - * @param parent The parent node of the include directive. - * @param jarFile The JAR file from which to read the included resource, - * or null of the included resource is to be read from the filesystem - */ - public Node.Nodes parse(String inFileName, Node parent, - URL jarFileUrl) - throws FileNotFoundException, JasperException, IOException { - // For files that are statically included, isTagfile and directiveOnly - // remain unchanged. - return doParse(inFileName, parent, jarFileUrl); - } - - /** - * Extracts tag file directive information from the tag file with the - * given name. - * - * This is invoked by the compiler - * - * @param inFileName The name of the tag file to be parsed. - */ - public Node.Nodes parseTagFileDirectives(String inFileName) - throws FileNotFoundException, JasperException, IOException { - boolean isTagFileSave = isTagFile; - boolean directiveOnlySave = directiveOnly; - isTagFile = true; - directiveOnly = true; - Node.Nodes page = doParse(inFileName, null, - (URL) ctxt.getTagFileJarUrls().get(inFileName)); - directiveOnly = directiveOnlySave; - isTagFile = isTagFileSave; - return page; - } - - /** - * Parses the JSP page or tag file with the given path name. - * - * @param inFileName The name of the JSP page or tag file to be parsed. - * @param parent The parent node (non-null when processing an include - * directive) - * @param isTagFile true if file to be parsed is tag file, and false if it - * is a regular JSP page - * @param directivesOnly true if the file to be parsed is a tag file and - * we are only interested in the directives needed for constructing a - * TagFileInfo. - * @param jarFile The JAR file from which to read the JSP page or tag file, - * or null if the JSP page or tag file is to be read from the filesystem - */ - private Node.Nodes doParse(String inFileName, - Node parent, - URL jarFileUrl) - throws FileNotFoundException, JasperException, IOException { - - Node.Nodes parsedPage = null; - isEncodingSpecifiedInProlog = false; - isDefaultPageEncoding = false; - hasBom = false; - - JarFile jarFile = getJarFile(jarFileUrl); - String absFileName = resolveFileName(inFileName); - String jspConfigPageEnc = getJspConfigPageEncoding(absFileName); - - // Figure out what type of JSP document and encoding type we are - // dealing with - determineSyntaxAndEncoding(absFileName, jarFile, jspConfigPageEnc); - - if (parent != null) { - // Included resource, add to dependent list - compiler.getPageInfo().addDependant(absFileName); - } - - comparePageEncodings(jspConfigPageEnc); - - // Dispatch to the appropriate parser - if (isXml) { - // JSP document (XML syntax) - // InputStream for jspx page is created and properly closed in - // JspDocumentParser. - parsedPage = JspDocumentParser.parse(this, absFileName, - jarFile, parent, - isTagFile, directiveOnly, - sourceEnc, - jspConfigPageEnc, - isEncodingSpecifiedInProlog); - } else { - // Standard syntax - InputStreamReader inStreamReader = null; - try { - inStreamReader = JspUtil.getReader(absFileName, sourceEnc, - jarFile, ctxt, err); - JspReader jspReader = new JspReader(ctxt, absFileName, - sourceEnc, inStreamReader, - err); - parsedPage = Parser.parse(this, absFileName, jspReader, parent, - isTagFile, directiveOnly, jarFileUrl, - sourceEnc, jspConfigPageEnc, - isDefaultPageEncoding, hasBom); - } finally { - if (inStreamReader != null) { - try { - inStreamReader.close(); - } catch (Exception any) { - } - } - } - } - - if (jarFile != null) { - try { - jarFile.close(); - } catch (Throwable t) {} - } - - baseDirStack.pop(); - - return parsedPage; - } - - /* - * Ensures that the page encoding specified in the JSP config element - * (with matching URL pattern), if present, matches the page encoding - * specified in the XML prolog of a JSP document (XML syntax) and the - * page encoding derived from the BOM. - * - * @param jspConfigPageEnc Page encoding specified in JSP config element - * - * @throws JasperException if page encoding mismatch - */ - private void comparePageEncodings(String jspConfigPageEnc) - throws JasperException { - - if (jspConfigPageEnc == null) { - return; - } - - if (isXml && isEncodingSpecifiedInProlog) { - /* - * Make sure the encoding specified in the XML prolog matches - * that in the JSP config element, treating "UTF-16", "UTF-16BE", - * and "UTF-16LE" as identical. - */ - if (!jspConfigPageEnc.equalsIgnoreCase(sourceEnc) - && (!jspConfigPageEnc.toLowerCase().startsWith("utf-16") - || !sourceEnc.toLowerCase().startsWith("utf-16"))) { - err.jspError("jsp.error.prolog_config_encoding_mismatch", - sourceEnc, jspConfigPageEnc); - } - } - - if (hasBom) { - /* - * Make sure the encoding specified in the BOM matches - * that in the JSP config element, treating "UTF-16", "UTF-16BE", - * and "UTF-16LE" as identical. - */ - if (!jspConfigPageEnc.equalsIgnoreCase(sourceEnc) - && (!jspConfigPageEnc.toLowerCase().startsWith("utf-16") - || !sourceEnc.toLowerCase().startsWith("utf-16"))) { - err.jspError("jsp.error.bom_config_encoding_mismatch", - sourceEnc, jspConfigPageEnc); - } - } - } - - /* - * Checks to see if the given URI is matched by a URL pattern specified in - * a jsp-property-group in web.xml, and if so, returns the value of the - * element. - * - * @param absFileName The URI to match - * - * @return The value of the attribute of the - * jsp-property-group with matching URL pattern - */ - private String getJspConfigPageEncoding(String absFileName) - throws JasperException { - - JspConfig jspConfig = ctxt.getOptions().getJspConfig(); - JspProperty jspProperty = jspConfig.findJspProperty(absFileName); - return jspProperty.getPageEncoding(); - } - - /** - * Determines the syntax (standard or XML) and page encoding properties - * for the given file, and stores them in the 'isXml' and 'sourceEnc' - * instance variables, respectively. - */ - private void determineSyntaxAndEncoding(String absFileName, - JarFile jarFile, - String jspConfigPageEnc) - throws JasperException, IOException { - - isXml = false; - - /* - * 'true' if the syntax (XML or standard) of the file is given - * from external information: either via a JSP configuration element, - * the ".jspx" suffix, or the enclosing file (for included resources) - */ - boolean isExternal = false; - - /* - * Indicates whether we need to revert from temporary usage of - * "ISO-8859-1" back to "UTF-8" - */ - boolean revert = false; - - JspConfig jspConfig = ctxt.getOptions().getJspConfig(); - JspProperty jspProperty = jspConfig.findJspProperty(absFileName); - if (jspProperty.isXml() != null) { - // If is specified in a , it is used. - isXml = JspUtil.booleanValue(jspProperty.isXml()); - isExternal = true; - } else if (absFileName.endsWith(".jspx") - || absFileName.endsWith(".tagx")) { - isXml = true; - isExternal = true; - } - - if (isExternal && !isXml) { - // JSP (standard) syntax. Use encoding specified in jsp-config - // if provided. - sourceEnc = jspConfigPageEnc; - if (sourceEnc != null) { - return; - } - // We don't know the encoding - sourceEnc = "ISO-8859-1"; - } else { - // XML syntax or unknown, (auto)detect encoding ... - Object[] ret = XMLEncodingDetector.getEncoding(absFileName, - jarFile, ctxt, err); - sourceEnc = (String) ret[0]; - if (((Boolean) ret[1]).booleanValue()) { - isEncodingSpecifiedInProlog = true; - } - if (ret[2] != null && ((Boolean) ret[2]).booleanValue()) { - hasBom = true; - } - - if (!isXml && sourceEnc.equalsIgnoreCase("utf-8") && !hasBom) { - /* - * We don't know if we're dealing with XML or standard syntax. - * Therefore, we need to check to see if the page contains - * a element. - * - * We need to be careful, because the page may be encoded in - * ISO-8859-1 (or something entirely different: UTF-8 was - * chosen as the default, for lack of better alternative), - * and may contain byte sequences that will cause a UTF-8 - * converter to throw exceptions. - * - * It is safe to use a source encoding of ISO-8859-1 in this - * case, as there are no invalid byte sequences in ISO-8859-1, - * and the byte/character sequences we're looking for (i.e., - * ) are identical in either encoding (both UTF-8 - * and ISO-8859-1 are extensions of ASCII). - */ - sourceEnc = "ISO-8859-1"; - revert = true; - } - } - - if (isXml) { - // (This implies 'isExternal' is TRUE.) - // We know we're dealing with a JSP document (via JSP config or - // ".jspx" suffix), so we're done. - return; - } - - /* - * At this point, 'isExternal' or 'isXml' is FALSE. - * Search for jsp:root action, in order to determine if we're dealing - * with XML or standard syntax (unless we already know what we're - * dealing with, i.e., when 'isExternal' is TRUE and 'isXml' is FALSE). - * No check for XML prolog, since nothing prevents a page from - * outputting XML and still using JSP syntax (in this case, the - * XML prolog is treated as template text). - */ - JspReader jspReader = null; - try { - jspReader = new JspReader(ctxt, absFileName, sourceEnc, jarFile, - err); - } catch (FileNotFoundException ex) { - throw new JasperException(ex); - } - jspReader.setSingleFile(true); - Mark startMark = jspReader.mark(); - if (!isExternal) { - jspReader.reset(startMark); - if (hasJspRoot(jspReader)) { - isXml = true; - if (revert) sourceEnc = "UTF-8"; - return; - } else { - isXml = false; - } - } - - /* - * At this point, we know we're dealing with JSP syntax. - * If an XML prolog is provided, it's treated as template text. - * Determine the page encoding from the page directive, unless it's - * specified via JSP config. - */ - if (!hasBom) { - sourceEnc = jspConfigPageEnc; - } - if (sourceEnc == null) { - sourceEnc = getPageEncodingForJspSyntax(jspReader, startMark); - if (sourceEnc == null) { - // Default to "ISO-8859-1" per JSP spec - sourceEnc = "ISO-8859-1"; - isDefaultPageEncoding = true; - } - } - } - - /* - * Determines page source encoding for page or tag file in JSP syntax, - * by reading (in this order) the value of the 'pageEncoding' page - * directive attribute, or the charset value of the 'contentType' page - * directive attribute. - * - * @return The page encoding, or null if not found - */ - private String getPageEncodingForJspSyntax(JspReader jspReader, - Mark startMark) - throws JasperException { - - String encoding = null; - String saveEncoding = null; - - jspReader.reset(startMark); - - /* - * Determine page encoding from directive of the form <%@ page %>, - * <%@ tag %>, or . - */ - while (true) { - if (jspReader.skipUntil("<") == null) { - break; - } - // If this is a comment, skip until its end - if (jspReader.matches("%--")) { - if (jspReader.skipUntil("--%>") == null) { - // error will be caught in Parser - break; - } - continue; - } - boolean isDirective = jspReader.matches("%@"); - if (isDirective) { - jspReader.skipSpaces(); - } - else { - isDirective = jspReader.matches("jsp:directive."); - } - if (!isDirective) { - continue; - } - - // compare for "tag ", so we don't match "taglib" - if (jspReader.matches("tag ") || jspReader.matches("page")) { - - jspReader.skipSpaces(); - Attributes attrs = Parser.parseAttributes(this, jspReader); - encoding = getPageEncodingFromDirective(attrs, "pageEncoding"); - if (encoding != null) { - break; - } - encoding = getPageEncodingFromDirective(attrs, "contentType"); - if (encoding != null) { - saveEncoding = encoding; - } - } - } - - if (encoding == null) { - encoding = saveEncoding; - } - - return encoding; - } - - /* - * Scans the given attributes for the attribute with the given name, - * which is either 'pageEncoding' or 'contentType', and returns the - * specified page encoding. - * - * In the case of 'contentType', the page encoding is taken from the - * content type's 'charset' component. - * - * @param attrs The page directive attributes - * @param attrName The name of the attribute to search for (either - * 'pageEncoding' or 'contentType') - * - * @return The page encoding, or null - */ - private String getPageEncodingFromDirective(Attributes attrs, - String attrName) { - String value = attrs.getValue(attrName); - if (attrName.equals("pageEncoding")) { - return value; - } - - // attrName = contentType - String contentType = value; - String encoding = null; - if (contentType != null) { - int loc = contentType.indexOf(CHARSET); - if (loc != -1) { - encoding = contentType.substring(loc + CHARSET.length()); - } - } - - return encoding; - } - - /* - * Resolve the name of the file and update baseDirStack() to keep track of - * the current base directory for each included file. - * The 'root' file is always an 'absolute' path, so no need to put an - * initial value in the baseDirStack. - */ - private String resolveFileName(String inFileName) { - String fileName = inFileName.replace('\\', '/'); - boolean isAbsolute = fileName.startsWith("/"); - fileName = isAbsolute ? fileName : baseDirStack.peek() + fileName; - String baseDir = fileName.substring(0, fileName.lastIndexOf("/") + 1); - baseDirStack.push(baseDir); - return fileName; - } - - /* - * Checks to see if the given page contains, as its first element, a - * element whose prefix is bound to the JSP namespace, as in: - * - * - * ... - * - * - * @param reader The reader for this page - * - * @return true if this page contains a root element whose prefix is bound - * to the JSP namespace, and false otherwise - */ - private boolean hasJspRoot(JspReader reader) throws JasperException { - - // :root must be the first element - Mark start = null; - while ((start = reader.skipUntil("<")) != null) { - int c = reader.nextChar(); - if (c != '!' && c != '?') break; - } - if (start == null) { - return false; - } - Mark stop = reader.skipUntil(":root"); - if (stop == null) { - return false; - } - // call substring to get rid of leading '<' - String prefix = reader.getText(start, stop).substring(1); - - start = stop; - stop = reader.skipUntil(">"); - if (stop == null) { - return false; - } - - // Determine namespace associated with element's prefix - String root = reader.getText(start, stop); - String xmlnsDecl = "xmlns:" + prefix; - int index = root.indexOf(xmlnsDecl); - if (index == -1) { - return false; - } - index += xmlnsDecl.length(); - while (index < root.length() - && Character.isWhitespace(root.charAt(index))) { - index++; - } - if (index < root.length() && root.charAt(index) == '=') { - index++; - while (index < root.length() - && Character.isWhitespace(root.charAt(index))) { - index++; - } - if (index < root.length() && root.charAt(index++) == '"' - && root.regionMatches(index, JSP_URI, 0, - JSP_URI.length())) { - return true; - } - } - - return false; - } - - private JarFile getJarFile(URL jarFileUrl) throws IOException { - JarFile jarFile = null; - - if (jarFileUrl != null) { - JarURLConnection conn = (JarURLConnection) jarFileUrl.openConnection(); - conn.setUseCaches(false); - conn.connect(); - jarFile = conn.getJarFile(); - } - - return jarFile; - } - -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/ScriptingVariabler.java b/impl/src/main/java/org/apache/jasper/compiler/ScriptingVariabler.java deleted file mode 100644 index 3ce6f5a..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/ScriptingVariabler.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.util.*; -import javax.servlet.jsp.tagext.*; -import org.apache.jasper.JasperException; - -/** - * Class responsible for determining the scripting variables that every - * custom action needs to declare. - * - * @author Jan Luehe - */ -class ScriptingVariabler { - - private static final Integer MAX_SCOPE = Integer.valueOf(Integer.MAX_VALUE); - - /* - * Assigns an identifier (of type integer) to every custom tag, in order - * to help identify, for every custom tag, the scripting variables that it - * needs to declare. - */ - static class CustomTagCounter extends Node.Visitor { - - private int count; - private Node.CustomTag parent; - - public void visit(Node.CustomTag n) throws JasperException { - n.setCustomTagParent(parent); - Node.CustomTag tmpParent = parent; - parent = n; - visitBody(n); - parent = tmpParent; - n.setNumCount(Integer.valueOf(count++)); - } - } - - /* - * For every custom tag, determines the scripting variables it needs to - * declare. - */ - static class ScriptingVariableVisitor extends Node.Visitor { - - private ErrorDispatcher err; - private HashMap scriptVars; - - public ScriptingVariableVisitor(ErrorDispatcher err) { - this.err = err; - scriptVars = new HashMap(); - } - - public void visit(Node.CustomTag n) throws JasperException { - setScriptingVars(n, VariableInfo.AT_BEGIN); - setScriptingVars(n, VariableInfo.NESTED); - visitBody(n); - setScriptingVars(n, VariableInfo.AT_END); - } - - private void setScriptingVars(Node.CustomTag n, int scope) - throws JasperException { - - TagVariableInfo[] tagVarInfos = n.getTagVariableInfos(); - VariableInfo[] varInfos = n.getVariableInfos(); - if (tagVarInfos.length == 0 && varInfos.length == 0) { - return; - } - - ArrayList vec = new ArrayList(); - Integer ownRange = null; - if (scope == VariableInfo.AT_BEGIN - || scope == VariableInfo.AT_END) { - Node.CustomTag parent = n.getCustomTagParent(); - if (parent == null) - ownRange = MAX_SCOPE; - else - ownRange = parent.getNumCount(); - } else { - // NESTED - ownRange = n.getNumCount(); - } - - if (varInfos.length > 0) { - for (int i=0; i 0) { - scriptVars.put(varName, ownRange); - vec.add(varInfos[i]); - } - } - } else { - for (int i=0; i 0) { - scriptVars.put(varName, ownRange); - vec.add(tagVarInfos[i]); - } - } - } - n.setScriptingVars(vec, scope); - } - } - - public static void set(Node.Nodes page, ErrorDispatcher err) - throws JasperException { - page.visit(new CustomTagCounter()); - page.visit(new ScriptingVariableVisitor(err)); - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/ServletWriter.java b/impl/src/main/java/org/apache/jasper/compiler/ServletWriter.java deleted file mode 100644 index af74406..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/ServletWriter.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.IOException; -import java.io.PrintWriter; - -/** - * This is what is used to generate servlets. - * - * @author Anil K. Vijendran - * @author Kin-man Chung - */ -public class ServletWriter { - public static final int TAB_WIDTH = 2; - public static final String SPACES = " "; - - // Current indent level: - private int indent = 0; - private int virtual_indent = 0; - - // The sink writer: - PrintWriter writer; - - // servlet line numbers start from 1 - private int javaLine = 1; - - - public ServletWriter(PrintWriter writer) { - this.writer = writer; - } - - public void close() throws IOException { - writer.close(); - } - - - // -------------------- Access informations -------------------- - - public int getJavaLine() { - return javaLine; - } - - - // -------------------- Formatting -------------------- - - public void pushIndent() { - virtual_indent += TAB_WIDTH; - if (virtual_indent >= 0 && virtual_indent <= SPACES.length()) - indent = virtual_indent; - } - - public void popIndent() { - virtual_indent -= TAB_WIDTH; - if (virtual_indent >= 0 && virtual_indent <= SPACES.length()) - indent = virtual_indent; - } - - /** - * Print a standard comment for echo outputed chunk. - * @param start The starting position of the JSP chunk being processed. - * @param stop The ending position of the JSP chunk being processed. - */ - public void printComment(Mark start, Mark stop, char[] chars) { - if (start != null && stop != null) { - println("// from="+start); - println("// to="+stop); - } - - if (chars != null) - for(int i = 0; i < chars.length;) { - printin(); - print("// "); - while (chars[i] != '\n' && i < chars.length) - writer.print(chars[i++]); - } - } - - /** - * Prints the given string followed by '\n' - */ - public void println(String s) { - javaLine++; - writer.println(s); - } - - /** - * Prints a '\n' - */ - public void println() { - javaLine++; - writer.println(""); - } - - /** - * Prints the current indention - */ - public void printin() { - writer.print(SPACES.substring(0, indent)); - } - - /** - * Prints the current indention, followed by the given string - */ - public void printin(String s) { - writer.print(SPACES.substring(0, indent)); - writer.print(s); - } - - /** - * Prints the current indention, and then the string, and a '\n'. - */ - public void printil(String s) { - javaLine++; - writer.print(SPACES.substring(0, indent)); - writer.println(s); - } - - /** - * Prints the given char. - * - * Use println() to print a '\n'. - */ - public void print(char c) { - writer.print(c); - } - - /** - * Prints the given int. - */ - public void print(int i) { - writer.print(i); - } - - /** - * Prints the given string. - * - * The string must not contain any '\n', otherwise the line count will be - * off. - */ - public void print(String s) { - writer.print(s); - } - - /** - * Prints the given string. - * - * If the string spans multiple lines, the line count will be adjusted - * accordingly. - */ - public void printMultiLn(String s) { - int index = 0; - - // look for hidden newlines inside strings - while ((index=s.indexOf('\n',index)) > -1 ) { - javaLine++; - index++; - } - - writer.print(s); - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/SmapGenerator.java b/impl/src/main/java/org/apache/jasper/compiler/SmapGenerator.java deleted file mode 100644 index 6cca5d6..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/SmapGenerator.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.util.List; -import java.util.ArrayList; - -/** - * Represents a source map (SMAP), which serves to associate lines - * of the input JSP file(s) to lines in the generated servlet in the - * final .class file, according to the JSR-045 spec. - * - * @author Shawn Bayern - */ -public class SmapGenerator { - - //********************************************************************* - // Overview - - /* - * The SMAP syntax is reasonably straightforward. The purpose of this - * class is currently twofold: - * - to provide a simple but low-level Java interface to build - * a logical SMAP - * - to serialize this logical SMAP for eventual inclusion directly - * into a .class file. - */ - - - //********************************************************************* - // Private state - - private String outputFileName; - private String defaultStratum = "Java"; - private List strata = new ArrayList(); - private List embedded = new ArrayList(); - private boolean doEmbedded = true; - - //********************************************************************* - // Methods for adding mapping data - - /** - * Sets the filename (without path information) for the generated - * source file. E.g., "foo$jsp.java". - */ - public synchronized void setOutputFileName(String x) { - outputFileName = x; - } - - /** - * Adds the given SmapStratum object, representing a Stratum with - * logically associated FileSection and LineSection blocks, to - * the current SmapGenerator. If default is true, this - * stratum is made the default stratum, overriding any previously - * set default. - * - * @param stratum the SmapStratum object to add - * @param defaultStratum if true, this SmapStratum is considered - * to represent the default SMAP stratum unless - * overwritten - */ - public synchronized void addStratum(SmapStratum stratum, - boolean defaultStratum) { - strata.add(stratum); - if (defaultStratum) - this.defaultStratum = stratum.getStratumName(); - } - - /** - * Adds the given string as an embedded SMAP with the given stratum name. - * - * @param smap the SMAP to embed - * @param stratumName the name of the stratum output by the compilation - * that produced the smap to be embedded - */ - public synchronized void addSmap(String smap, String stratumName) { - embedded.add("*O " + stratumName + "\n" - + smap - + "*C " + stratumName + "\n"); - } - - /** - * Instructs the SmapGenerator whether to actually print any embedded - * SMAPs or not. Intended for situations without an SMAP resolver. - * - * @param status If false, ignore any embedded SMAPs. - */ - public void setDoEmbedded(boolean status) { - doEmbedded = status; - } - - //********************************************************************* - // Methods for serializing the logical SMAP - - public synchronized String getString() { - // check state and initialize buffer - if (outputFileName == null) - throw new IllegalStateException(); - StringBuilder out = new StringBuilder(); - - // start the SMAP - out.append("SMAP\n"); - out.append(outputFileName + '\n'); - out.append(defaultStratum + '\n'); - - // include embedded SMAPs - if (doEmbedded) { - int nEmbedded = embedded.size(); - for (int i = 0; i < nEmbedded; i++) { - out.append(embedded.get(i)); - } - } - - // print our StratumSections, FileSections, and LineSections - int nStrata = strata.size(); - for (int i = 0; i < nStrata; i++) { - SmapStratum s = strata.get(i); - out.append(s.getString()); - } - - // end the SMAP - out.append("*E\n"); - - return out.toString(); - } - - public String toString() { return getString(); } - - //********************************************************************* - // For testing (and as an example of use)... - - public static void main(String args[]) { - SmapGenerator g = new SmapGenerator(); - g.setOutputFileName("foo.java"); - SmapStratum s = new SmapStratum("JSP"); - s.addFile("foo.jsp"); - s.addFile("bar.jsp", "/foo/foo/bar.jsp"); - s.addLineData(1, "foo.jsp", 1, 1, 1); - s.addLineData(2, "foo.jsp", 1, 6, 1); - s.addLineData(3, "foo.jsp", 2, 10, 5); - s.addLineData(20, "bar.jsp", 1, 30, 1); - g.addStratum(s, true); - System.out.print(g); - - System.out.println("---"); - - SmapGenerator embedded = new SmapGenerator(); - embedded.setOutputFileName("blargh.tier2"); - s = new SmapStratum("Tier2"); - s.addFile("1.tier2"); - s.addLineData(1, "1.tier2", 1, 1, 1); - embedded.addStratum(s, true); - g.addSmap(embedded.toString(), "JSP"); - System.out.println(g); - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/SmapStratum.java b/impl/src/main/java/org/apache/jasper/compiler/SmapStratum.java deleted file mode 100644 index 4b57aa5..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/SmapStratum.java +++ /dev/null @@ -1,377 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.util.List; -import java.util.ArrayList; - -/** - * Represents the line and file mappings associated with a JSR-045 - * "stratum". - * - * @author Jayson Falkner - * @author Shawn Bayern - */ -public class SmapStratum { - - //********************************************************************* - // Class for storing LineInfo data - - /** - * Represents a single LineSection in an SMAP, associated with - * a particular stratum. - */ - public static class LineInfo { - private int inputStartLine = -1; - private int outputStartLine = -1; - private int lineFileID = 0; - private int inputLineCount = 1; - private int outputLineIncrement = 1; - private boolean lineFileIDSet = false; - - /** Sets InputStartLine. */ - public void setInputStartLine(int inputStartLine) { - if (inputStartLine < 0) - throw new IllegalArgumentException("" + inputStartLine); - this.inputStartLine = inputStartLine; - } - - /** Sets OutputStartLine. */ - public void setOutputStartLine(int outputStartLine) { - if (outputStartLine < 0) - throw new IllegalArgumentException("" + outputStartLine); - this.outputStartLine = outputStartLine; - } - - /** - * Sets lineFileID. Should be called only when different from - * that of prior LineInfo object (in any given context) or 0 - * if the current LineInfo has no (logical) predecessor. - * LineInfo will print this file number no matter what. - */ - public void setLineFileID(int lineFileID) { - if (lineFileID < 0) - throw new IllegalArgumentException("" + lineFileID); - this.lineFileID = lineFileID; - this.lineFileIDSet = true; - } - - /** Sets InputLineCount. */ - public void setInputLineCount(int inputLineCount) { - if (inputLineCount < 0) - throw new IllegalArgumentException("" + inputLineCount); - this.inputLineCount = inputLineCount; - } - - /** Sets OutputLineIncrement. */ - public void setOutputLineIncrement(int outputLineIncrement) { - if (outputLineIncrement < 0) - throw new IllegalArgumentException("" + outputLineIncrement); - this.outputLineIncrement = outputLineIncrement; - } - - /** - * Retrieves the current LineInfo as a String, print all values - * only when appropriate (but LineInfoID if and only if it's been - * specified, as its necessity is sensitive to context). - */ - public String getString() { - if (inputStartLine == -1 || outputStartLine == -1) - throw new IllegalStateException(); - StringBuilder out = new StringBuilder(); - out.append(inputStartLine); - if (lineFileIDSet) - out.append("#" + lineFileID); - if (inputLineCount != 1) - out.append("," + inputLineCount); - out.append(":" + outputStartLine); - if (outputLineIncrement != 1) - out.append("," + outputLineIncrement); - out.append('\n'); - return out.toString(); - } - - public String toString() { - return getString(); - } - } - - //********************************************************************* - // Private state - - private String stratumName; - private List fileNameList; - private List filePathList; - private List lineData; - private int lastFileID; - - //********************************************************************* - // Constructor - - /** - * Constructs a new SmapStratum object for the given stratum name - * (e.g., JSP). - * - * @param stratumName the name of the stratum (e.g., JSP) - */ - public SmapStratum(String stratumName) { - this.stratumName = stratumName; - fileNameList = new ArrayList(); - filePathList = new ArrayList(); - lineData = new ArrayList(); - lastFileID = 0; - } - - //********************************************************************* - // Methods to add mapping information - - /** - * Adds record of a new file, by filename. - * - * @param filename the filename to add, unqualified by path. - */ - public void addFile(String filename) { - addFile(filename, filename); - } - - /** - * Adds record of a new file, by filename and path. The path - * may be relative to a source compilation path. - * - * @param filename the filename to add, unqualified by path - * @param filePath the path for the filename, potentially relative - * to a source compilation path - */ - public void addFile(String filename, String filePath) { - int pathIndex = filePathList.indexOf(filePath); - if (pathIndex == -1) { - fileNameList.add(filename); - filePathList.add(filePath); - } - } - - /** - * Combines consecutive LineInfos wherever possible - */ - public void optimizeLineSection() { - -/* Some debugging code - for (int i = 0; i < lineData.size(); i++) { - LineInfo li = lineData.get(i); - System.out.print(li.toString()); - } -*/ - //Incorporate each LineInfo into the previous LineInfo's - //outputLineIncrement, if possible - int i = 0; - while (i < lineData.size() - 1) { - LineInfo li = lineData.get(i); - LineInfo liNext = lineData.get(i + 1); - if (!liNext.lineFileIDSet - && liNext.inputStartLine == li.inputStartLine - && liNext.inputLineCount == 1 - && li.inputLineCount == 1 - && liNext.outputStartLine - == li.outputStartLine - + li.inputLineCount * li.outputLineIncrement) { - li.setOutputLineIncrement( - liNext.outputStartLine - - li.outputStartLine - + liNext.outputLineIncrement); - lineData.remove(i + 1); - } else { - i++; - } - } - - //Incorporate each LineInfo into the previous LineInfo's - //inputLineCount, if possible - i = 0; - while (i < lineData.size() - 1) { - LineInfo li = lineData.get(i); - LineInfo liNext = lineData.get(i + 1); - if (!liNext.lineFileIDSet - && liNext.inputStartLine == li.inputStartLine + li.inputLineCount - && liNext.outputLineIncrement == li.outputLineIncrement - && liNext.outputStartLine - == li.outputStartLine - + li.inputLineCount * li.outputLineIncrement) { - li.setInputLineCount(li.inputLineCount + liNext.inputLineCount); - lineData.remove(i + 1); - } else { - i++; - } - } - } - - /** - * Adds complete information about a simple line mapping. Specify - * all the fields in this method; the back-end machinery takes care - * of printing only those that are necessary in the final SMAP. - * (My view is that fields are optional primarily for spatial efficiency, - * not for programmer convenience. Could always add utility methods - * later.) - * - * @param inputStartLine starting line in the source file - * (SMAP InputStartLine) - * @param inputFileName the filepath (or name) from which the input comes - * (yields SMAP LineFileID) Use unqualified names - * carefully, and only when they uniquely identify a file. - * @param inputLineCount the number of lines in the input to map - * (SMAP LineFileCount) - * @param outputStartLine starting line in the output file - * (SMAP OutputStartLine) - * @param outputLineIncrement number of output lines to map to each - * input line (SMAP OutputLineIncrement). Given the - * fact that the name starts with "output", I continuously have - * the subconscious urge to call this field - * OutputLineExcrement. - */ - public void addLineData( - int inputStartLine, - String inputFileName, - int inputLineCount, - int outputStartLine, - int outputLineIncrement) { - // check the input - what are you doing here?? - int fileIndex = filePathList.indexOf(inputFileName); - if (fileIndex == -1) // still - throw new IllegalArgumentException( - "inputFileName: " + inputFileName); - - //Jasper incorrectly SMAPs certain Nodes, giving them an - //outputStartLine of 0. This can cause a fatal error in - //optimizeLineSection, making it impossible for Jasper to - //compile the JSP. Until we can fix the underlying - //SMAPping problem, we simply ignore the flawed SMAP entries. - if (outputStartLine == 0) - return; - - // build the LineInfo - LineInfo li = new LineInfo(); - li.setInputStartLine(inputStartLine); - li.setInputLineCount(inputLineCount); - li.setOutputStartLine(outputStartLine); - li.setOutputLineIncrement(outputLineIncrement); - if (fileIndex != lastFileID) - li.setLineFileID(fileIndex); - lastFileID = fileIndex; - - // save it - lineData.add(li); - } - - //********************************************************************* - // Methods to retrieve information - - /** - * Returns the name of the stratum. - */ - public String getStratumName() { - return stratumName; - } - - /** - * Returns the given stratum as a String: a StratumSection, - * followed by at least one FileSection and at least one LineSection. - */ - public String getString() { - // check state and initialize buffer - if (fileNameList.size() == 0 || lineData.size() == 0) - return null; - - StringBuilder out = new StringBuilder(); - - // print StratumSection - out.append("*S " + stratumName + "\n"); - - // print FileSection - out.append("*F\n"); - int bound = fileNameList.size(); - for (int i = 0; i < bound; i++) { - if (filePathList.get(i) != null) { - out.append("+ " + i + " " + fileNameList.get(i) + "\n"); - // Source paths must be relative, not absolute, so we - // remove the leading "/", if one exists. - String filePath = filePathList.get(i); - if (filePath.startsWith("/")) { - filePath = filePath.substring(1); - } - out.append(filePath + "\n"); - } else { - out.append(i + " " + fileNameList.get(i) + "\n"); - } - } - - // print LineSection - out.append("*L\n"); - bound = lineData.size(); - for (int i = 0; i < bound; i++) { - LineInfo li = lineData.get(i); - out.append(li.getString()); - } - - return out.toString(); - } - - public String toString() { - return getString(); - } - -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/SmapUtil.java b/impl/src/main/java/org/apache/jasper/compiler/SmapUtil.java deleted file mode 100644 index 00fec74..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/SmapUtil.java +++ /dev/null @@ -1,743 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2011 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.List; - -import org.apache.jasper.JasperException; -import org.apache.jasper.JspCompilationContext; - -/** - * Contains static utilities for generating SMAP data based on the - * current version of Jasper. - * - * @author Jayson Falkner - * @author Shawn Bayern - * @author Robert Field (inner SDEInstaller class) - * @author Mark Roth - * @author Kin-man Chung - */ -public class SmapUtil { - - private JspCompilationContext ctxt; - private List classInfos; - - //********************************************************************* - // Constants - - public static final String SMAP_ENCODING = "UTF-8"; - - //********************************************************************* - // Public entry points - - SmapUtil(JspCompilationContext ctxt) { - this.ctxt = ctxt; - } - - /** - * Generates an appropriate SMAP representing the current compilation - * context. (JSR-045.) - * - * @param ctxt Current compilation context - * @param pageNodes The current JSP page - * @return a SMAP for the page - */ - public void generateSmap(Node.Nodes pageNodes) - throws IOException { - - classInfos = new ArrayList(); - String className = ctxt.getFullClassName(); - - // Instantiate a SmapStratum for the main JSP page. - SmapStratum s = new SmapStratum("JSP"); - classInfos.add(new ClassInfo(className, s)); - - // Map out Node.Nodes and putting LineInfo into SmapStratum - evaluateNodes(pageNodes, s, ctxt.getOptions().getMappedFile()); - - String classFileName = ctxt.getClassFileName(); - for (ClassInfo entry: classInfos) { - // Get SmapStratum - s = entry.getSmapStratum(); - s.optimizeLineSection(); - - // Set up our SMAP generator - SmapGenerator g = new SmapGenerator(); - g.setOutputFileName(unqualify(ctxt.getServletJavaFileName())); - g.addStratum(s, true); - - String name = entry.getClassName(); // class name - // Compute the class name and output file name for inner classes - if (!className.equals(name)) { - classFileName = ctxt.getOutputDir() + - name.substring(name.lastIndexOf('.')+1) + ".class"; - } - entry.setClassFileName(classFileName); - entry.setSmap(g.getString()); - - if (ctxt.getOptions().isSmapDumped()) { - File outSmap = new File(classFileName + ".smap"); - PrintWriter so = - new PrintWriter( - new OutputStreamWriter( - new FileOutputStream(outSmap), - SMAP_ENCODING)); - so.print(g.getString()); - so.close(); - } - } - } - - public void installSmap() throws IOException { - - for (ClassInfo ci: classInfos) { - String className = ci.getClassName(); - byte[] classfile = ctxt.getRuntimeContext().getBytecode(className); - if (classfile == null) { - SDEInstaller.install(new File(ci.getClassFileName()), - ci.getSmap().getBytes(Charset.defaultCharset())); - } - else { - classfile = SDEInstaller.install(classfile, - ci.getSmap().getBytes(Charset.defaultCharset())); - ctxt.getRuntimeContext().setBytecode(className, classfile); - } - } - } - - //********************************************************************* - // Private utilities - - /** - * Returns an unqualified version of the given file path. - */ - private static String unqualify(String path) { - path = path.replace('\\', '/'); - return path.substring(path.lastIndexOf('/') + 1); - } - - //********************************************************************* - // Installation logic (from Robert Field, JSR-045 spec lead) - private static class SDEInstaller { - - static final String nameSDE = "SourceDebugExtension"; - - byte[] orig; - byte[] sdeAttr; - byte[] gen; - - int origPos = 0; - int genPos = 0; - - int sdeIndex; - - public static void main(String[] args) throws IOException { - if (args.length == 2) { - install(new File(args[0]), new File(args[1])); - } else if (args.length == 3) { - install( - new File(args[0]), - new File(args[1]), - new File(args[2])); - } else { - System.err.println( - "Usage: " - + " \n" - + " "); - } - } - - static void install(File inClassFile, File attrFile, File outClassFile) - throws IOException { - new SDEInstaller(inClassFile, attrFile, outClassFile); - } - - static void install(File inOutClassFile, File attrFile) - throws IOException { - File tmpFile = new File(inOutClassFile.getPath() + "tmp"); - new SDEInstaller(inOutClassFile, attrFile, tmpFile); - if (!inOutClassFile.delete()) { - throw new IOException("inOutClassFile.delete() failed"); - } - if (!tmpFile.renameTo(inOutClassFile)) { - throw new IOException("tmpFile.renameTo(inOutClassFile) failed"); - } - } - - static void install(File classFile, byte[] smap) throws IOException { - File tmpFile = new File(classFile.getPath() + "tmp"); - new SDEInstaller(classFile, smap, tmpFile); - if (!classFile.delete()) { - throw new IOException("classFile.delete() failed"); - } - if (!tmpFile.renameTo(classFile)) { - throw new IOException("tmpFile.renameTo(classFile) failed"); - } - } - - static byte[] install(byte[] classfile, byte[] smap) - throws IOException { - SDEInstaller installer = new SDEInstaller(classfile, smap); - byte[] tmp = new byte[installer.genPos]; - System.arraycopy(installer.gen, 0, tmp, 0, installer.genPos); - return tmp; - } - - SDEInstaller(byte[] classfile, byte[] sdeAttr) - throws IOException { - orig = classfile; - this.sdeAttr = sdeAttr; - gen = new byte[orig.length + sdeAttr.length + 100]; - addSDE(); - } - - SDEInstaller(File inClassFile, byte[] sdeAttr, File outClassFile) - throws IOException { - if (!inClassFile.exists()) { - throw new FileNotFoundException("no such file: " + inClassFile); - } - - this.sdeAttr = sdeAttr; - // get the bytes - orig = readWhole(inClassFile); - gen = new byte[orig.length + sdeAttr.length + 100]; - - // do it - addSDE(); - - // write result - FileOutputStream outStream = new FileOutputStream(outClassFile); - outStream.write(gen, 0, genPos); - outStream.close(); - } - - SDEInstaller(File inClassFile, File attrFile, File outClassFile) - throws IOException { - this(inClassFile, readWhole(attrFile), outClassFile); - } - - static byte[] readWhole(File input) throws IOException { - FileInputStream inStream = new FileInputStream(input); - int len = (int)input.length(); - byte[] bytes = new byte[len]; - if (inStream.read(bytes, 0, len) != len) { - throw new IOException("expected size: " + len); - } - inStream.close(); - return bytes; - } - - void addSDE() throws UnsupportedEncodingException, IOException { - int i; - copy(4 + 2 + 2); // magic min/maj version - int constantPoolCountPos = genPos; - int constantPoolCount = readU2(); - writeU2(constantPoolCount); - - // copy old constant pool return index of SDE symbol, if found - sdeIndex = copyConstantPool(constantPoolCount); - if (sdeIndex < 0) { - // if "SourceDebugExtension" symbol not there add it - writeUtf8ForSDE(); - - // increment the countantPoolCount - sdeIndex = constantPoolCount; - ++constantPoolCount; - randomAccessWriteU2(constantPoolCountPos, constantPoolCount); - } - copy(2 + 2 + 2); // access, this, super - int interfaceCount = readU2(); - writeU2(interfaceCount); - copy(interfaceCount * 2); - copyMembers(); // fields - copyMembers(); // methods - int attrCountPos = genPos; - int attrCount = readU2(); - writeU2(attrCount); - // copy the class attributes, return true if SDE attr found (not copied) - if (!copyAttrs(attrCount)) { - // we will be adding SDE and it isn't already counted - ++attrCount; - randomAccessWriteU2(attrCountPos, attrCount); - } - writeAttrForSDE(sdeIndex); - } - - void copyMembers() { - int count = readU2(); - writeU2(count); - for (int i = 0; i < count; ++i) { - copy(6); // access, name, descriptor - int attrCount = readU2(); - writeU2(attrCount); - copyAttrs(attrCount); - } - } - - boolean copyAttrs(int attrCount) { - boolean sdeFound = false; - for (int i = 0; i < attrCount; ++i) { - int nameIndex = readU2(); - // don't write old SDE - if (nameIndex == sdeIndex) { - sdeFound = true; - } else { - writeU2(nameIndex); // name - int len = readU4(); - writeU4(len); - copy(len); - } - } - return sdeFound; - } - - void writeAttrForSDE(int index) { - writeU2(index); - writeU4(sdeAttr.length); - for (int i = 0; i < sdeAttr.length; ++i) { - writeU1(sdeAttr[i]); - } - } - - void randomAccessWriteU2(int pos, int val) { - int savePos = genPos; - genPos = pos; - writeU2(val); - genPos = savePos; - } - - int readU1() { - return ((int)orig[origPos++]) & 0xFF; - } - - int readU2() { - int res = readU1(); - return (res << 8) + readU1(); - } - - int readU4() { - int res = readU2(); - return (res << 16) + readU2(); - } - - void writeU1(int val) { - gen[genPos++] = (byte)val; - } - - void writeU2(int val) { - writeU1(val >> 8); - writeU1(val & 0xFF); - } - - void writeU4(int val) { - writeU2(val >> 16); - writeU2(val & 0xFFFF); - } - - void copy(int count) { - for (int i = 0; i < count; ++i) { - gen[genPos++] = orig[origPos++]; - } - } - - byte[] readBytes(int count) { - byte[] bytes = new byte[count]; - for (int i = 0; i < count; ++i) { - bytes[i] = orig[origPos++]; - } - return bytes; - } - - void writeBytes(byte[] bytes) { - for (int i = 0; i < bytes.length; ++i) { - gen[genPos++] = bytes[i]; - } - } - - int copyConstantPool(int constantPoolCount) - throws UnsupportedEncodingException, IOException { - int sdeIndex = -1; - // copy const pool index zero not in class file - for (int i = 1; i < constantPoolCount; ++i) { - int tag = readU1(); - writeU1(tag); - switch (tag) { - case 7 : // Class - case 8 : // String - copy(2); - break; - case 9 : // Field - case 10 : // Method - case 11 : // InterfaceMethod - case 3 : // Integer - case 4 : // Float - case 12 : // NameAndType - copy(4); - break; - case 5 : // Long - case 6 : // Double - copy(8); - i++; - break; - case 1 : // Utf8 - int len = readU2(); - writeU2(len); - byte[] utf8 = readBytes(len); - String str = new String(utf8, "UTF-8"); - if (str.equals(nameSDE)) { - sdeIndex = i; - } - writeBytes(utf8); - break; - default : - throw new IOException("unexpected tag: " + tag); - } - } - return sdeIndex; - } - - void writeUtf8ForSDE() { - int len = nameSDE.length(); - writeU1(1); // Utf8 tag - writeU2(len); - for (int i = 0; i < len; ++i) { - writeU1(nameSDE.charAt(i)); - } - } - } - - private void evaluateNodes( - Node.Nodes nodes, - SmapStratum s, - boolean breakAtLF) { - try { - nodes.visit(new SmapGenVisitor(s, breakAtLF, classInfos)); - } catch (JasperException ex) { - } - } - - static class SmapGenVisitor extends Node.Visitor { - - private SmapStratum smapStratum; - private boolean breakAtLF; - private List classInfos; - - SmapGenVisitor(SmapStratum s, boolean breakAtLF, - List classInfos) { - this.smapStratum = s; - this.breakAtLF = breakAtLF; - this.classInfos = classInfos; - } - - public void visitBody(Node n) throws JasperException { - SmapStratum smapStratumSave = smapStratum; - String innerClass = n.getInnerClassName(); - if (innerClass != null) { - found: { - for (ClassInfo ci: classInfos) { - if (innerClass.equals(ci.getClassName())) { - smapStratum = ci.getSmapStratum(); - break found; - } - } - smapStratum = new SmapStratum("JSP"); - classInfos.add(new ClassInfo(innerClass, smapStratum)); - } - } - super.visitBody(n); - smapStratum = smapStratumSave; - } - - public void visit(Node.Declaration n) throws JasperException { - doSmapText(n); - } - - public void visit(Node.Expression n) throws JasperException { - doSmapText(n); - } - - public void visit(Node.Scriptlet n) throws JasperException { - doSmapText(n); - } - - public void visit(Node.IncludeAction n) throws JasperException { - doSmap(n); - visitBody(n); - } - - public void visit(Node.ForwardAction n) throws JasperException { - doSmap(n); - visitBody(n); - } - - public void visit(Node.GetProperty n) throws JasperException { - doSmap(n); - visitBody(n); - } - - public void visit(Node.SetProperty n) throws JasperException { - doSmap(n); - visitBody(n); - } - - public void visit(Node.UseBean n) throws JasperException { - doSmap(n); - visitBody(n); - } - - public void visit(Node.PlugIn n) throws JasperException { - doSmap(n); - visitBody(n); - } - - public void visit(Node.CustomTag n) throws JasperException { - doSmap(n); - visitBody(n); - } - - public void visit(Node.UninterpretedTag n) throws JasperException { - doSmap(n); - visitBody(n); - } - - public void visit(Node.JspElement n) throws JasperException { - doSmap(n); - visitBody(n); - } - - public void visit(Node.JspText n) throws JasperException { - doSmap(n); - visitBody(n); - } - - public void visit(Node.NamedAttribute n) throws JasperException { - visitBody(n); - } - - public void visit(Node.JspBody n) throws JasperException { - doSmap(n); - visitBody(n); - } - - public void visit(Node.InvokeAction n) throws JasperException { - doSmap(n); - visitBody(n); - } - - public void visit(Node.DoBodyAction n) throws JasperException { - doSmap(n); - visitBody(n); - } - - public void visit(Node.ELExpression n) throws JasperException { - doSmap(n); - } - - public void visit(Node.TemplateText n) throws JasperException { - Mark mark = n.getStart(); - if (mark == null) { - return; - } - - //Add the file information - String fileName = mark.getFile(); - smapStratum.addFile(unqualify(fileName), fileName); - - //Add a LineInfo that corresponds to the beginning of this node - int iInputStartLine = mark.getLineNumber(); - int iOutputStartLine = n.getBeginJavaLine(); - int iOutputLineIncrement = breakAtLF? 1: 0; - smapStratum.addLineData(iInputStartLine, fileName, 1, - iOutputStartLine, iOutputLineIncrement); - - // Output additional mappings in the text - java.util.ArrayList extraSmap = n.getExtraSmap(); - - if (extraSmap != null) { - for (int i = 0; i < extraSmap.size(); i++) { - iOutputStartLine += iOutputLineIncrement; - smapStratum.addLineData( - iInputStartLine+((Integer)extraSmap.get(i)).intValue(), - fileName, - 1, - iOutputStartLine, - iOutputLineIncrement); - } - } - } - - private void doSmap( - Node n, - int inLineCount, - int outIncrement, - int skippedLines) { - Mark mark = n.getStart(); - if (mark == null) { - return; - } - - String unqualifiedName = unqualify(mark.getFile()); - smapStratum.addFile(unqualifiedName, mark.getFile()); - smapStratum.addLineData( - mark.getLineNumber() + skippedLines, - mark.getFile(), - inLineCount - skippedLines, - n.getBeginJavaLine() + skippedLines, - outIncrement); - } - - private void doSmap(Node n) { - doSmap(n, 1, n.getEndJavaLine() - n.getBeginJavaLine(), 0); - } - - private void doSmapText(Node n) { - String text = n.getText(); - int index = 0; - int next = 0; - int lineCount = 1; - int skippedLines = 0; - boolean slashStarSeen = false; - boolean beginning = true; - - // Count lines inside text, but skipping comment lines at the - // beginning of the text. - while ((next = text.indexOf('\n', index)) > -1) { - if (beginning) { - String line = text.substring(index, next).trim(); - if (!slashStarSeen && line.startsWith("/*")) { - slashStarSeen = true; - } - if (slashStarSeen) { - skippedLines++; - int endIndex = line.indexOf("*/"); - if (endIndex >= 0) { - // End of /* */ comment - slashStarSeen = false; - if (endIndex < line.length() - 2) { - // Some executable code after comment - skippedLines--; - beginning = false; - } - } - } else if (line.length() == 0 || line.startsWith("//")) { - skippedLines++; - } else { - beginning = false; - } - } - lineCount++; - index = next + 1; - } - - doSmap(n, lineCount, 1, skippedLines); - } - } - - /* - * A place to keep some temporary info on a class. More than a class - * may be produced in a compilation, since it may generate inner classes - */ - static public class ClassInfo { - - private String className; - private String classFileName; - private String smap; - private SmapStratum smapStratum; - - public ClassInfo(String className, SmapStratum smapStratum) { - this.className = className; - this.smapStratum = smapStratum; - } - - public String getClassName() { - return className; - } - - public SmapStratum getSmapStratum() { - return smapStratum; - } - - public String getClassFileName() { - return classFileName; - } - - public void setClassFileName(String classFileName) { - this.classFileName = classFileName; - } - - public String getSmap() { - return smap; - } - - public void setSmap(String smap) { - this.smap = smap; - } - } - -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/TagConstants.java b/impl/src/main/java/org/apache/jasper/compiler/TagConstants.java deleted file mode 100644 index b9e72ea..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/TagConstants.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -public interface TagConstants { - - public static final String JSP_URI = "http://java.sun.com/JSP/Page"; - - public static final String DIRECTIVE_ACTION = "directive."; - - public static final String ROOT_ACTION = "root"; - public static final String JSP_ROOT_ACTION = "jsp:root"; - - public static final String PAGE_DIRECTIVE_ACTION = "directive.page"; - public static final String JSP_PAGE_DIRECTIVE_ACTION = "jsp:directive.page"; - - public static final String INCLUDE_DIRECTIVE_ACTION = "directive.include"; - public static final String JSP_INCLUDE_DIRECTIVE_ACTION = "jsp:directive.include"; - - public static final String DECLARATION_ACTION = "declaration"; - public static final String JSP_DECLARATION_ACTION = "jsp:declaration"; - - public static final String SCRIPTLET_ACTION = "scriptlet"; - public static final String JSP_SCRIPTLET_ACTION = "jsp:scriptlet"; - - public static final String EXPRESSION_ACTION = "expression"; - public static final String JSP_EXPRESSION_ACTION = "jsp:expression"; - - public static final String USE_BEAN_ACTION = "useBean"; - public static final String JSP_USE_BEAN_ACTION = "jsp:useBean"; - - public static final String SET_PROPERTY_ACTION = "setProperty"; - public static final String JSP_SET_PROPERTY_ACTION = "jsp:setProperty"; - - public static final String GET_PROPERTY_ACTION = "getProperty"; - public static final String JSP_GET_PROPERTY_ACTION = "jsp:getProperty"; - - public static final String INCLUDE_ACTION = "include"; - public static final String JSP_INCLUDE_ACTION = "jsp:include"; - - public static final String FORWARD_ACTION = "forward"; - public static final String JSP_FORWARD_ACTION = "jsp:forward"; - - public static final String PARAM_ACTION = "param"; - public static final String JSP_PARAM_ACTION = "jsp:param"; - - public static final String PARAMS_ACTION = "params"; - public static final String JSP_PARAMS_ACTION = "jsp:params"; - - public static final String PLUGIN_ACTION = "plugin"; - public static final String JSP_PLUGIN_ACTION = "jsp:plugin"; - - public static final String FALLBACK_ACTION = "fallback"; - public static final String JSP_FALLBACK_ACTION = "jsp:fallback"; - - public static final String TEXT_ACTION = "text"; - public static final String JSP_TEXT_ACTION = "jsp:text"; - public static final String JSP_TEXT_ACTION_END = ""; - - public static final String ATTRIBUTE_ACTION = "attribute"; - public static final String JSP_ATTRIBUTE_ACTION = "jsp:attribute"; - - public static final String BODY_ACTION = "body"; - public static final String JSP_BODY_ACTION = "jsp:body"; - - public static final String ELEMENT_ACTION = "element"; - public static final String JSP_ELEMENT_ACTION = "jsp:element"; - - public static final String OUTPUT_ACTION = "output"; - public static final String JSP_OUTPUT_ACTION = "jsp:output"; - - public static final String TAGLIB_DIRECTIVE_ACTION = "taglib"; - public static final String JSP_TAGLIB_DIRECTIVE_ACTION = "jsp:taglib"; - - /* - * Tag Files - */ - public static final String INVOKE_ACTION = "invoke"; - public static final String JSP_INVOKE_ACTION = "jsp:invoke"; - - public static final String DOBODY_ACTION = "doBody"; - public static final String JSP_DOBODY_ACTION = "jsp:doBody"; - - /* - * Tag File Directives - */ - public static final String TAG_DIRECTIVE_ACTION = "directive.tag"; - public static final String JSP_TAG_DIRECTIVE_ACTION = "jsp:directive.tag"; - - public static final String ATTRIBUTE_DIRECTIVE_ACTION = "directive.attribute"; - public static final String JSP_ATTRIBUTE_DIRECTIVE_ACTION = "jsp:directive.attribute"; - - public static final String VARIABLE_DIRECTIVE_ACTION = "directive.variable"; - public static final String JSP_VARIABLE_DIRECTIVE_ACTION = "jsp:directive.variable"; - - /* - * Directive attributes - */ - public static final String URN_JSPTAGDIR = "urn:jsptagdir:"; - public static final String URN_JSPTLD = "urn:jsptld:"; -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java b/impl/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java deleted file mode 100644 index e92de98..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java +++ /dev/null @@ -1,761 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.Iterator; -import java.util.ArrayList; -import java.util.List; -import java.util.HashMap; - -import javax.servlet.jsp.tagext.TagAttributeInfo; -import javax.servlet.jsp.tagext.TagExtraInfo; -import javax.servlet.jsp.tagext.TagFileInfo; -import javax.servlet.jsp.tagext.TagInfo; -import javax.servlet.jsp.tagext.TagLibraryInfo; -import javax.servlet.jsp.tagext.TagVariableInfo; -import javax.servlet.jsp.tagext.VariableInfo; - -import org.apache.jasper.Constants; -import org.apache.jasper.JasperException; -import org.apache.jasper.JspCompilationContext; -import org.apache.jasper.servlet.JspServletWrapper; -import org.apache.jasper.runtime.JspSourceDependent; - -/** - * 1. Processes and extracts the directive info in a tag file. - * 2. Compiles and loads tag files used in a JSP file. - * - * @author Kin-man Chung - */ - -class TagFileProcessor { - - private ArrayList tempVector; - - /** - * A visitor the tag file - */ - private static class TagFileDirectiveVisitor extends Node.Visitor { - - private static final JspUtil.ValidAttribute[] tagDirectiveAttrs = { - new JspUtil.ValidAttribute("display-name"), - new JspUtil.ValidAttribute("body-content"), - new JspUtil.ValidAttribute("dynamic-attributes"), - new JspUtil.ValidAttribute("small-icon"), - new JspUtil.ValidAttribute("large-icon"), - new JspUtil.ValidAttribute("description"), - new JspUtil.ValidAttribute("example"), - new JspUtil.ValidAttribute("pageEncoding"), - new JspUtil.ValidAttribute("language"), - new JspUtil.ValidAttribute("import"), - new JspUtil.ValidAttribute("isELIgnored"), - new JspUtil.ValidAttribute("deferredSyntaxAllowedAsLiteral"), - new JspUtil.ValidAttribute("trimDirectiveWhitespaces") - }; - - private static final JspUtil.ValidAttribute[] attributeDirectiveAttrs = { - new JspUtil.ValidAttribute("name", true), - new JspUtil.ValidAttribute("required"), - new JspUtil.ValidAttribute("fragment"), - new JspUtil.ValidAttribute("rtexprvalue"), - new JspUtil.ValidAttribute("type"), - new JspUtil.ValidAttribute("description"), - new JspUtil.ValidAttribute("deferredValue"), - new JspUtil.ValidAttribute("deferredValueType"), - new JspUtil.ValidAttribute("deferredMethod"), - new JspUtil.ValidAttribute("deferredMethodSignature") - }; - - private static final JspUtil.ValidAttribute[] variableDirectiveAttrs = { - new JspUtil.ValidAttribute("name-given"), - new JspUtil.ValidAttribute("name-from-attribute"), - new JspUtil.ValidAttribute("alias"), - new JspUtil.ValidAttribute("variable-class"), - new JspUtil.ValidAttribute("scope"), - new JspUtil.ValidAttribute("declare"), - new JspUtil.ValidAttribute("description") - }; - - private ErrorDispatcher err; - private TagLibraryInfo tagLibInfo; - - private String name = null; - private String path = null; - private TagExtraInfo tei = null; - private String bodycontent = null; - private String description = null; - private String displayName = null; - private String smallIcon = null; - private String largeIcon = null; - private String dynamicAttrsMapName; - private String example = null; - - private List attributeVector; - private List variableVector; - - private HashMap nameTable = - new HashMap(); - private HashMap nameFromTable = - new HashMap(); - - // The tag file's JSP version - private Double jspVersionDouble; - - private static enum Name { - ATTR_NAME("name", "attribute"), - VAR_NAME_GIVEN("name-given", "variable"), - VAR_NAME_FROM("name-from-attribute", "variable"), - VAR_ALIAS("alias", "variable"), - TAG_DYNAMIC("dynamic-attributes", "tag"); - - private String attribute; - private String directive; - - String getAttribute() { - return this.attribute; - } - - String getDirective() { - return this.directive; - } - - Name(String attribute, String directive) { - this.attribute = attribute; - this.directive = directive; - } - } - - public TagFileDirectiveVisitor(Compiler compiler, - TagLibraryInfo tagLibInfo, - String name, - String path) { - err = compiler.getErrorDispatcher(); - this.tagLibInfo = tagLibInfo; - this.name = name; - this.path = path; - attributeVector = new ArrayList(); - variableVector = new ArrayList(); - - jspVersionDouble = Double.valueOf(tagLibInfo.getRequiredVersion()); - } - - public void visit(Node.JspRoot n) throws JasperException { - /* - * If a tag file in XML syntax contains a jsp:root element, the - * value of its "version" attribute must match the tag file's JSP - * version. - */ - String jspRootVersion = n.getTextAttribute("version"); - if (jspRootVersion == null) { - err.jspError(n, "jsp.error.mandatory.attribute", n.getQName(), - "version"); - } - if (!jspRootVersion.equals(jspVersionDouble.toString())) { - err.jspError(n, "jsp.error.tagfile.jspVersionMismatch", - jspRootVersion, jspVersionDouble.toString()); - } - visitBody(n); - } - - public void visit(Node.TagDirective n) throws JasperException { - - JspUtil.checkAttributes("Tag directive", n, tagDirectiveAttrs, - err); - - bodycontent = checkConflict(n, bodycontent, "body-content"); - if (bodycontent != null && - !bodycontent.equals(TagInfo.BODY_CONTENT_EMPTY) && - !bodycontent.equals(TagInfo.BODY_CONTENT_TAG_DEPENDENT) && - !bodycontent.equals(TagInfo.BODY_CONTENT_SCRIPTLESS)) { - err.jspError(n, "jsp.error.tagdirective.badbodycontent", - bodycontent); - } - dynamicAttrsMapName = checkConflict(n, dynamicAttrsMapName, - "dynamic-attributes"); - if (dynamicAttrsMapName != null) { - checkUniqueName(dynamicAttrsMapName, Name.TAG_DYNAMIC, n); - } - smallIcon = checkConflict(n, smallIcon, "small-icon"); - largeIcon = checkConflict(n, largeIcon, "large-icon"); - description = checkConflict(n, description, "description"); - displayName = checkConflict(n, displayName, "display-name"); - example = checkConflict(n, example, "example"); - - if (n.getAttributeValue("deferredSyntaxAllowedAsLiteral") != null - && Double.compare(jspVersionDouble, - Constants.JSP_VERSION_2_1) < 0) { - err.jspError("jsp.error.invalidTagDirectiveAttrUnless21", - "deferredSyntaxAllowedAsLiteral"); - } - - // Additional tag directives are validated in Validator - } - - private String checkConflict(Node n, String oldAttrValue, String attr) - throws JasperException { - - String result = oldAttrValue; - String attrValue = n.getAttributeValue(attr); - if (attrValue != null) { - if (oldAttrValue != null && !oldAttrValue.equals(attrValue)) { - err.jspError(n, "jsp.error.tag.conflict.attr", attr, - oldAttrValue, attrValue); - } - result = attrValue; - } - return result; - } - - - public void visit(Node.AttributeDirective n) throws JasperException { - - JspUtil.checkAttributes("Attribute directive", n, - attributeDirectiveAttrs, err); - - String attrName = n.getAttributeValue("name"); - boolean required = JspUtil.booleanValue( - n.getAttributeValue("required")); - boolean rtexprvalue = true; - String rtexprvalueString = n.getAttributeValue("rtexprvalue"); - if (rtexprvalueString != null) { - rtexprvalue = JspUtil.booleanValue( rtexprvalueString ); - } - boolean fragment = JspUtil.booleanValue( - n.getAttributeValue("fragment")); - String type = n.getAttributeValue("type"); - - String deferredValue = n.getAttributeValue("deferredValue"); - String deferredMethod = n.getAttributeValue("deferredMethod"); - String expectedType = n.getAttributeValue("deferredValueType"); - String methodSignature = n.getAttributeValue("deferredMethodSignature"); - if (Double.compare(jspVersionDouble, - Constants.JSP_VERSION_2_1) < 0) { - if (deferredValue != null) { - err.jspError("jsp.error.invalidAttrDirectiveAttrUnless21", - "deferredValue"); - } - if (deferredMethod != null) { - err.jspError("jsp.error.invalidAttrDirectiveAttrUnless21", - "deferredMethod"); - } - if (expectedType != null) { - err.jspError("jsp.error.invalidAttrDirectiveAttrUnless21", - "deferredValueType"); - } - if (methodSignature != null) { - err.jspError("jsp.error.invalidAttrDirectiveAttrUnless21", - "deferredMethodSignature"); - } - } - - boolean isDeferredValue = JspUtil.booleanValue(deferredValue); - boolean isDeferredMethod = JspUtil.booleanValue(deferredMethod); - if (expectedType == null) { - if (isDeferredValue) { - expectedType = "java.lang.Object"; - } - } - else { - if (deferredValue != null && !isDeferredValue) { - err.jspError("jsp.error.deferredvaluewithtype"); - } - isDeferredValue = true; - } - - if (methodSignature == null) { - if (isDeferredMethod) { - methodSignature = "void method()"; - } - } - else { - if (deferredMethod != null && !isDeferredMethod) { - err.jspError("jsp.error.deferredmethodwithsignature"); - } - isDeferredMethod = true; - } - - if (fragment) { - // type is fixed to "JspFragment" and a translation error - // must occur if specified. - if (type != null) { - err.jspError(n, "jsp.error.fragmentwithtype"); - } - // rtexprvalue is fixed to "true" and a translation error - // must occur if specified. - rtexprvalue = true; - if( rtexprvalueString != null ) { - err.jspError(n, "jsp.error.frgmentwithrtexprvalue" ); - } - } else if (type == null) { - if (isDeferredValue) { - type = "javax.el.ValueExpression"; - } else if (isDeferredMethod) { - type = "javax.el.MethodExpression"; - } else { - type = "java.lang.String"; - } - } else if (isDeferredValue || isDeferredMethod) { - err.jspError("jsp.error.deferredwithtype"); - } - - if (isDeferredValue || isDeferredMethod) { - rtexprvalue = false; - } - TagAttributeInfo tagAttributeInfo = - new TagAttributeInfo(attrName, - required, - type, - rtexprvalue, - fragment, - description, - isDeferredValue, - isDeferredMethod, - expectedType, - methodSignature); - attributeVector.add(tagAttributeInfo); - checkUniqueName(attrName, Name.ATTR_NAME, n, tagAttributeInfo); - } - - public void visit(Node.VariableDirective n) throws JasperException { - - JspUtil.checkAttributes("Variable directive", n, - variableDirectiveAttrs, err); - - String nameGiven = n.getAttributeValue("name-given"); - String nameFromAttribute = n.getAttributeValue("name-from-attribute"); - if (nameGiven == null && nameFromAttribute == null) { - err.jspError("jsp.error.variable.either.name"); - } - - if (nameGiven != null && nameFromAttribute != null) { - err.jspError("jsp.error.variable.both.name"); - } - - String alias = n.getAttributeValue("alias"); - if (nameFromAttribute != null && alias == null || - nameFromAttribute == null && alias != null) { - err.jspError("jsp.error.variable.alias"); - } - - String className = n.getAttributeValue("variable-class"); - if (className == null) - className = "java.lang.String"; - - String declareStr = n.getAttributeValue("declare"); - boolean declare = true; - if (declareStr != null) - declare = JspUtil.booleanValue(declareStr); - - int scope = VariableInfo.NESTED; - String scopeStr = n.getAttributeValue("scope"); - if (scopeStr != null) { - if ("NESTED".equals(scopeStr)) { - // Already the default - } else if ("AT_BEGIN".equals(scopeStr)) { - scope = VariableInfo.AT_BEGIN; - } else if ("AT_END".equals(scopeStr)) { - scope = VariableInfo.AT_END; - } - } - - if (nameFromAttribute != null) { - /* - * An alias has been specified. We use 'nameGiven' to hold the - * value of the alias, and 'nameFromAttribute' to hold the - * name of the attribute whose value (at invocation-time) - * denotes the name of the variable that is being aliased - */ - nameGiven = alias; - checkUniqueName(nameFromAttribute, Name.VAR_NAME_FROM, n); - checkUniqueName(alias, Name.VAR_ALIAS, n); - } - else { - // name-given specified - checkUniqueName(nameGiven, Name.VAR_NAME_GIVEN, n); - } - - variableVector.add(new TagVariableInfo( - nameGiven, - nameFromAttribute, - className, - declare, - scope)); - } - - public TagInfo getTagInfo() throws JasperException { - - if (name == null) { - // XXX Get it from tag file name - } - - if (bodycontent == null) { - bodycontent = TagInfo.BODY_CONTENT_SCRIPTLESS; - } - - String tagClassName = JspUtil.getTagHandlerClassName(path, err); - - TagVariableInfo[] tagVariableInfos - = variableVector.toArray(new TagVariableInfo[0]); - - TagAttributeInfo[] tagAttributeInfo - = attributeVector.toArray(new TagAttributeInfo[0]); - - return new JasperTagInfo(name, - tagClassName, - bodycontent, - description, - tagLibInfo, - tei, - tagAttributeInfo, - displayName, - smallIcon, - largeIcon, - tagVariableInfos, - dynamicAttrsMapName); - } - - static class NameEntry { - private Name type; - private Node node; - private TagAttributeInfo attr; - - NameEntry(Name type, Node node, TagAttributeInfo attr) { - this.type = type; - this.node = node; - this.attr = attr; - } - - Name getType() { return type;} - Node getNode() { return node; } - TagAttributeInfo getTagAttributeInfo() { return attr; } - } - - /** - * Reports a translation error if names specified in attributes of - * directives are not unique in this translation unit. - * - * The value of the following attributes must be unique. - * 1. 'name' attribute of an attribute directive - * 2. 'name-given' attribute of a variable directive - * 3. 'alias' attribute of variable directive - * 4. 'dynamic-attributes' of a tag directive - * except that 'dynamic-attributes' can (and must) have the same - * value when it appears in multiple tag directives. - * - * Also, 'name-from' attribute of a variable directive cannot have - * the same value as that from another variable directive. - */ - private void checkUniqueName(String name, Name type, Node n) - throws JasperException { - checkUniqueName(name, type, n, null); - } - - private void checkUniqueName(String name, Name type, Node n, - TagAttributeInfo attr) - throws JasperException { - - HashMap table = - (type == Name.VAR_NAME_FROM)? nameFromTable: nameTable; - NameEntry nameEntry = table.get(name); - if (nameEntry != null) { - if (type != Name.TAG_DYNAMIC - || nameEntry.getType() != Name.TAG_DYNAMIC) { - int line = nameEntry.getNode().getStart().getLineNumber(); - err.jspError(n, "jsp.error.tagfile.nameNotUnique", - type.getAttribute(), type.getDirective(), - nameEntry.getType().getAttribute(), - nameEntry.getType().getDirective(), - Integer.toString(line)); - } - } else { - table.put(name, new NameEntry(type, n, attr)); - } - } - - /** - * Perform miscelleaneous checks after the nodes are visited. - */ - void postCheck() throws JasperException { - // Check that var.name-from-attributes has valid values. - Iterator iter = nameFromTable.keySet().iterator(); - while (iter.hasNext()) { - String nameFrom = (String) iter.next(); - NameEntry nameEntry = nameTable.get(nameFrom); - NameEntry nameFromEntry = nameFromTable.get(nameFrom); - Node nameFromNode = nameFromEntry.getNode(); - if (nameEntry == null) { - err.jspError(nameFromNode, - "jsp.error.tagfile.nameFrom.noAttribute", - nameFrom); - } else { - Node node = nameEntry.getNode(); - TagAttributeInfo tagAttr = nameEntry.getTagAttributeInfo(); - if (! "java.lang.String".equals(tagAttr.getTypeName()) - || ! tagAttr.isRequired() - || tagAttr.canBeRequestTime()){ - err.jspError(nameFromNode, - "jsp.error.tagfile.nameFrom.badAttribute", - nameFrom, - Integer.toString(node.getStart().getLineNumber())); - } - } - } - } - } - - /** - * Parses the tag file, and collects information on the directives included - * in it. The method is used to obtain the info on the tag file, when the - * handler that it represents is referenced. The tag file is not compiled - * here. - * - * @param pc the current ParserController used in this compilation - * @param name the tag name as specified in the TLD - * @param tagfile the path for the tagfile - * @param tagLibInfo the TagLibraryInfo object associated with this TagInfo - * @return a TagInfo object assembled from the directives in the tag file. - */ - public static TagInfo parseTagFileDirectives(ParserController pc, - String name, - String path, - TagLibraryInfo tagLibInfo) - throws JasperException { - - ErrorDispatcher err = pc.getCompiler().getErrorDispatcher(); - - Node.Nodes page = null; - try { - page = pc.parseTagFileDirectives(path); - } catch (FileNotFoundException e) { - err.jspError("jsp.error.file.not.found", path); - } catch (IOException e) { - err.jspError("jsp.error.file.not.found", path); - } - - TagFileDirectiveVisitor tagFileVisitor - = new TagFileDirectiveVisitor(pc.getCompiler(), tagLibInfo, name, - path); - page.visit(tagFileVisitor); - tagFileVisitor.postCheck(); - - return tagFileVisitor.getTagInfo(); - } - - /** - * Compiles and loads a tagfile. - */ - private Class loadTagFile(Compiler compiler, - String tagFilePath, TagInfo tagInfo, - PageInfo parentPageInfo) - throws JasperException { - - JspCompilationContext ctxt = compiler.getCompilationContext(); - JspRuntimeContext rctxt = ctxt.getRuntimeContext(); - - synchronized(rctxt) { - JspServletWrapper wrapper = - (JspServletWrapper) rctxt.getWrapper(tagFilePath); - if (wrapper == null) { - wrapper = new JspServletWrapper(ctxt.getServletContext(), - ctxt.getOptions(), - tagFilePath, - tagInfo, - ctxt.getRuntimeContext(), - (URL) ctxt.getTagFileJarUrls().get(tagFilePath)); - rctxt.addWrapper(tagFilePath,wrapper); - - // Use same classloader and classpath for compiling tag files - wrapper.getJspEngineContext().setClassLoader( - (URLClassLoader) ctxt.getClassLoader()); - wrapper.getJspEngineContext().setClassPath(ctxt.getClassPath()); - } - else { - // Make sure that JspCompilationContext gets the latest TagInfo - // for the tag file. TagInfo instance was created the last - // time the tag file was scanned for directives, and the tag - // file may have been modified since then. - wrapper.getJspEngineContext().setTagInfo(tagInfo); - } - - Class tagClazz; - int tripCount = wrapper.incTripCount(); - try { - if (tripCount > 0) { - // When tripCount is greater than zero, a circular - // dependency exists. The circularily dependant tag - // file is compiled in prototype mode, to avoid infinite - // recursion. - - JspServletWrapper tempWrapper - = new JspServletWrapper(ctxt.getServletContext(), - ctxt.getOptions(), - tagFilePath, - tagInfo, - ctxt.getRuntimeContext(), - (URL) ctxt.getTagFileJarUrls().get(tagFilePath)); - tagClazz = tempWrapper.loadTagFilePrototype(); - tempVector.add( - tempWrapper.getJspEngineContext().getCompiler()); - } else { - tagClazz = wrapper.loadTagFile(); - } - } finally { - wrapper.decTripCount(); - } - - // Add the dependants for this tag file to its parent's - // dependant list. The only reliable dependency information - // can only be obtained from the tag instance. - try { - Object tagIns = tagClazz.newInstance(); - if (tagIns instanceof JspSourceDependent) { - for (String dependant: - ((JspSourceDependent)tagIns).getDependants()) { - parentPageInfo.addDependant(dependant); - } - } - } catch (Exception e) { - // ignore errors - } - - return tagClazz; - } - } - - - /* - * Visitor which scans the page and looks for tag handlers that are tag - * files, compiling (if necessary) and loading them. - */ - private class TagFileLoaderVisitor extends Node.Visitor { - - private Compiler compiler; - private PageInfo pageInfo; - - TagFileLoaderVisitor(Compiler compiler) { - - this.compiler = compiler; - this.pageInfo = compiler.getPageInfo(); - } - - public void visit(Node.CustomTag n) throws JasperException { - TagFileInfo tagFileInfo = n.getTagFileInfo(); - if (tagFileInfo != null) { - String tagFilePath = tagFileInfo.getPath(); - if (tagFilePath.startsWith("/META-INF/")) { - // For tags in JARs, add the TLD and the tag as a dependency - String[] location = - compiler.getCompilationContext().getTldLocation( - tagFileInfo.getTagInfo().getTagLibrary().getURI()); - // Add TLD - pageInfo.addDependant("jar:" + location[0] + "!/" + - location[1]); - // Add Tag - pageInfo.addDependant("jar:" + location[0] + "!" + - tagFilePath); - } else { - pageInfo.addDependant(tagFilePath); - } - Class c = loadTagFile(compiler, tagFilePath, n.getTagInfo(), - pageInfo); - n.setTagHandlerClass(c); - } - visitBody(n); - } - } - - /** - * Implements a phase of the translation that compiles (if necessary) - * the tag files used in a JSP files. The directives in the tag files - * are assumed to have been proccessed and encapsulated as TagFileInfo - * in the CustomTag nodes. - */ - public void loadTagFiles(Compiler compiler, Node.Nodes page) - throws JasperException { - - tempVector = new ArrayList(); - page.visit(new TagFileLoaderVisitor(compiler)); - } - - /** - * Removed the java and class files for the tag prototype - * generated from the current compilation. - * @param classFileName If non-null, remove only the class file with - * with this name. - */ - public void removeProtoTypeFiles(String classFileName) { - Iterator iter = tempVector.iterator(); - while (iter.hasNext()) { - Compiler c = iter.next(); - if (classFileName == null) { - c.removeGeneratedClassFiles(); - } else if (classFileName.equals( - c.getCompilationContext().getClassFileName())) { - c.removeGeneratedClassFiles(); - tempVector.remove(c); - return; - } - } - } -} - diff --git a/impl/src/main/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java b/impl/src/main/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java deleted file mode 100644 index 7b5338b..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java +++ /dev/null @@ -1,965 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.net.JarURLConnection; -import java.net.URL; -import java.util.Collection; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.ArrayList; -import java.util.List; -import java.util.jar.JarFile; -import java.util.zip.ZipEntry; - -import javax.servlet.jsp.tagext.FunctionInfo; -import javax.servlet.jsp.tagext.PageData; -import javax.servlet.jsp.tagext.TagAttributeInfo; -import javax.servlet.jsp.tagext.TagExtraInfo; -import javax.servlet.jsp.tagext.TagFileInfo; -import javax.servlet.jsp.tagext.TagInfo; -import javax.servlet.jsp.tagext.TagLibraryInfo; -import javax.servlet.jsp.tagext.TagLibraryValidator; -import javax.servlet.jsp.tagext.TagVariableInfo; -import javax.servlet.jsp.tagext.ValidationMessage; -import javax.servlet.jsp.tagext.VariableInfo; - -import org.apache.jasper.Constants; -import org.apache.jasper.JasperException; -import org.apache.jasper.JspCompilationContext; -import org.apache.jasper.xmlparser.ParserUtils; -import org.apache.jasper.xmlparser.TreeNode; -import org.apache.jasper.runtime.TldScanner; - -/** - * Implementation of the TagLibraryInfo class from the JSP spec. - * - * @author Anil K. Vijendran - * @author Mandar Raje - * @author Pierre Delisle - * @author Kin-man Chung - * @author Jan Luehe - */ -public class TagLibraryInfoImpl extends TagLibraryInfo implements TagConstants { - private JspCompilationContext ctxt; - private ErrorDispatcher err; - private ParserController parserController; - private PageInfo pageInfo; - - private final void print(String name, String value, PrintWriter w) { - if (value != null) { - w.print(name+" = {\n\t"); - w.print(value); - w.print("\n}\n"); - } - } - - public String toString() { - StringWriter sw = new StringWriter(); - PrintWriter out = new PrintWriter(sw); - print("tlibversion", tlibversion, out); - print("jspversion", jspversion, out); - print("shortname", shortname, out); - print("urn", urn, out); - print("info", info, out); - print("uri", uri, out); - print("tagLibraryValidator", "" + tagLibraryValidator, out); - - for(int i = 0; i < tags.length; i++) - out.println(tags[i].toString()); - - for(int i = 0; i < tagFiles.length; i++) - out.println(tagFiles[i].toString()); - - for(int i = 0; i < functions.length; i++) - out.println(functions[i].toString()); - - return sw.toString(); - } - - // XXX FIXME - // resolveRelativeUri and/or getResourceAsStream don't seem to properly - // handle relative paths when dealing when home and getDocBase are set - // the following is a workaround until these problems are resolved. - private InputStream getResourceAsStream(String uri) - throws JasperException - { - try { - // see if file exists on the filesystem first - String real = ctxt.getRealPath(uri); - if (real == null) { - return ctxt.getResourceAsStream(uri); - } else { - return new FileInputStream(real); - } - } - catch (FileNotFoundException ex) { - // if file not found on filesystem, get the resource through - // the context - return ctxt.getResourceAsStream(uri); - } - - } - - - /** - * Constructor which populates a TagLibraryInfoImpl from a given - * TagLibraryInfoImpl, and associates the new TagLibraryInfoImpl with the - * given translation unit (pageInfo). - * - * @param prefix The taglib's namespace prefix - * @param uri The taglib's uri - * @param delegate The taglib from which the new TagLibraryInfoImpl is - * populated - * @param pageInfo The translation unit with which the new TagLibraryInfoImpl is - * to be associated - */ - public TagLibraryInfoImpl(String prefix, - String uri, - TagLibraryInfoImpl delegate, - PageInfo pageInfo) { - - super(prefix, uri); - - this.pageInfo = pageInfo; - - this.tagFiles = delegate.getTagFiles(); - this.functions = delegate.getFunctions(); - this.jspversion = delegate.getRequiredVersion(); - this.shortname = delegate.getShortName(); - this.urn = delegate.getReliableURN(); - this.info = delegate.getInfoString(); - this.tagLibraryValidator = delegate.getTagLibraryValidator(); - - TagInfo[] otherTags = delegate.getTags(); - if (otherTags != null) { - this.tags = new TagInfo[otherTags.length]; - for (int i=0; i c = pageInfo.getTaglibs(); - if (c != null && c.size() > 0) { - taglibs = c.toArray(new TagLibraryInfo[0]); - } - - return taglibs; - } - - - /* - * @param ctxt The JSP compilation context - * @param uri The TLD's uri - * @param in The TLD's input stream - * @param jarFileUrl The JAR file containing the TLD, or null if the tag - * library is not packaged in a JAR - */ - private void parseTLD(JspCompilationContext ctxt, - String uri, InputStream in, URL jarFileUrl) - throws JasperException - { - List tagVector = new ArrayList(); - List tagFileVector = new ArrayList(); - HashMap functionTable = - new HashMap(); - - // Create an iterator over the child elements of our element - boolean blockExternal = Boolean.parseBoolean(ctxt.getServletContext() - .getInitParameter(Constants.XML_BLOCK_EXTERNAL_INIT_PARAM)); - ParserUtils pu = new ParserUtils(blockExternal); - TreeNode tld = pu.parseXMLDocument(uri, in, - ctxt.getOptions().isValidationEnabled()); - - // Check to see if the root element contains a 'version' - // attribute, which was added in JSP 2.0 to replace the - // subelement - this.jspversion = tld.findAttribute("version"); - - // Process each child element of our element - Iterator list = tld.findChildren(); - - while (list.hasNext()) { - TreeNode element = (TreeNode) list.next(); - String tname = element.getName(); - - if ("tlibversion".equals(tname) // JSP 1.1 - || "tlib-version".equals(tname)) { // JSP 1.2 - this.tlibversion = element.getBody(); - } else if ("jspversion".equals(tname) - || "jsp-version".equals(tname)) { - this.jspversion = element.getBody(); - } else if ("shortname".equals(tname) || - "short-name".equals(tname)) - this.shortname = element.getBody(); - else if ("uri".equals(tname)) - this.urn = element.getBody(); - else if ("info".equals(tname) || - "description".equals(tname)) - this.info = element.getBody(); - else if ("validator".equals(tname)) - this.tagLibraryValidator = createValidator(element); - else if ("tag".equals(tname)) - tagVector.add(createTagInfo(element, jspversion)); - else if ("tag-file".equals(tname)) { - TagFileInfo tagFileInfo = createTagFileInfo(element, uri, - jarFileUrl); - tagFileVector.add(tagFileInfo); - } else if ("function".equals(tname)) { // JSP2.0 - FunctionInfo funcInfo = createFunctionInfo(element); - String funcName = funcInfo.getName(); - if (functionTable.containsKey(funcName)) { - err.jspError("jsp.error.tld.fn.duplicate.name", - funcName, uri); - - } - functionTable.put(funcName, funcInfo); - } else if ("display-name".equals(tname) || // Ignored elements - "small-icon".equals(tname) || - "large-icon".equals(tname) || - "listener".equals(tname)) { - ; - } else if ("taglib-extension".equals(tname)) { - // Recognized but ignored - } else { - err.jspError("jsp.error.unknown.element.in.taglib", tname); - } - } - - if (tlibversion == null) { - err.jspError("jsp.error.tld.mandatory.element.missing", - "tlib-version"); - } - if (jspversion == null) { - err.jspError("jsp.error.tld.mandatory.element.missing", - "jsp-version"); - } - - this.tags = tagVector.toArray(new TagInfo[0]); - this.tagFiles = tagFileVector.toArray(new TagFileInfo[0]); - - this.functions = new FunctionInfo[functionTable.size()]; - int i=0; - for (FunctionInfo funcInfo: functionTable.values()) { - this.functions[i++] = funcInfo; - } - } - - /* - * @param uri The uri of the TLD - * @param ctxt The compilation context - * - * @return String array whose first element denotes the path to the TLD. - * If the path to the TLD points to a jar file, then the second element - * denotes the name of the TLD entry in the jar file, which is hardcoded - * to META-INF/taglib.tld. - */ - private String[] generateTLDLocation(String uri, - JspCompilationContext ctxt) - throws JasperException { - - int uriType = TldScanner.uriType(uri); - if (uriType == TldScanner.ABS_URI) { - err.jspError("jsp.error.taglibDirective.absUriCannotBeResolved", - uri); - } else if (uriType == TldScanner.NOROOT_REL_URI) { - uri = ctxt.resolveRelativeUri(uri); - } - - String[] location = new String[2]; - location[0] = uri; - if (location[0].endsWith("jar")) { - URL url = null; - try { - url = ctxt.getResource(location[0]); - } catch (Exception ex) { - err.jspError("jsp.error.tld.unable_to_get_jar", location[0], - ex.toString()); - } - if (url == null) { - err.jspError("jsp.error.tld.missing_jar", location[0]); - } - location[0] = url.toString(); - location[1] = "META-INF/taglib.tld"; - } - - return location; - } - - private TagInfo createTagInfo(TreeNode elem, String jspVersion) - throws JasperException { - String tagName = null; - String tagClassName = null; - String teiClassName = null; - - /* - * Default body content for JSP 1.2 tag handlers ( has - * become mandatory in JSP 2.0, because the default would be invalid - * for simple tag handlers) - */ - String bodycontent = "JSP"; - - String info = null; - String displayName = null; - String smallIcon = null; - String largeIcon = null; - boolean dynamicAttributes = false; - - List attributeVector = - new ArrayList(); - List variableVector = new ArrayList(); - Iterator list = elem.findChildren(); - while (list.hasNext()) { - TreeNode element = list.next(); - String tname = element.getName(); - - if ("name".equals(tname)) { - tagName = element.getBody(); - } else if ("tagclass".equals(tname) || - "tag-class".equals(tname)) { - tagClassName = element.getBody(); - } else if ("teiclass".equals(tname) || - "tei-class".equals(tname)) { - teiClassName = element.getBody(); - } else if ("bodycontent".equals(tname) || - "body-content".equals(tname)) { - bodycontent = element.getBody(); - if (bodycontent == null) { - bodycontent = "null"; // An error will be raised later - } - } else if ("display-name".equals(tname)) { - displayName = element.getBody(); - } else if ("small-icon".equals(tname)) { - smallIcon = element.getBody(); - } else if ("large-icon".equals(tname)) { - largeIcon = element.getBody(); - } else if ("icon".equals(tname)) { - TreeNode icon = element.findChild("small-icon"); - if (icon != null) { - smallIcon = icon.getBody(); - } - icon = element.findChild("large-icon"); - if (icon != null) { - largeIcon = icon.getBody(); - } - } else if ("info".equals(tname) || - "description".equals(tname)) { - info = element.getBody(); - } else if ("variable".equals(tname)) { - variableVector.add(createVariable(element)); - } else if ("attribute".equals(tname)) { - attributeVector.add(createAttribute(element, jspVersion)); - } else if ("dynamic-attributes".equals(tname)) { - dynamicAttributes = JspUtil.booleanValue(element.getBody()); - } else if ("example".equals(tname)) { - // Ignored elements - } else if ("tag-extension".equals(tname)) { - // Ignored - } else { - err.jspError("jsp.error.unknown.element.in.tag", tname); - } - } - - // JSP 2.0 removed the capital versions of TAGDEPENDENT, EMPTY, and - // SCRIPTLESS enumerations in body-contentType, see JSP.E.2 ("Changes - // between JSP 2.0 PFD2 and JSP 2.0 PFD3"), section "Changes to Tag - // Library Descriptor (TLD)". Enforce that from JSP 2.0 and up, only - // "JSP", "tagdependent", "empty", and "scriptless" may be specified - // as body-content values. - Double jspVersionDouble = Double.valueOf(jspversion); - if (Double.compare(jspVersionDouble, Constants.JSP_VERSION_2_0) >= 0) { - if (!bodycontent.equals(TagInfo.BODY_CONTENT_JSP) - && !bodycontent.equals(TagInfo.BODY_CONTENT_EMPTY) - && !bodycontent.equals(TagInfo.BODY_CONTENT_TAG_DEPENDENT) - && !bodycontent.equals(TagInfo.BODY_CONTENT_SCRIPTLESS)) { - err.jspError("jsp.error.tld.badbodycontent", - bodycontent, tagName); - } - } - - TagExtraInfo tei = null; - if (teiClassName != null && !teiClassName.equals("")) { - try { - Class teiClass = ctxt.getClassLoader().loadClass(teiClassName); - tei = (TagExtraInfo) teiClass.newInstance(); - } catch (Exception e) { - err.jspError("jsp.error.teiclass.instantiation", teiClassName, - e); - } - } - - TagAttributeInfo[] tagAttributeInfo - = attributeVector.toArray(new TagAttributeInfo[0]); - TagVariableInfo[] tagVariableInfos - = variableVector.toArray(new TagVariableInfo[0]); - - TagInfo taginfo = new TagInfo(tagName, - tagClassName, - bodycontent, - info, - this, - tei, - tagAttributeInfo, - displayName, - smallIcon, - largeIcon, - tagVariableInfos, - dynamicAttributes); - return taginfo; - } - - /* - * Parses the tag file directives of the given TagFile and turns them into - * a TagInfo. - * - * @param elem The element in the TLD - * @param uri The location of the TLD, in case the tag file is specified - * relative to it - * @param jarFile The JAR file, in case the tag file is packaged in a JAR - * - * @return TagInfo correspoding to tag file directives - */ - private TagFileInfo createTagFileInfo(TreeNode elem, String uri, - URL jarFileUrl) - throws JasperException { - - String name = null; - String path = null; - String description = null; - String displayName = null; - String icon = null; - boolean checkConflict = false; - - Iterator list = elem.findChildren(); - while (list.hasNext()) { - TreeNode child = (TreeNode) list.next(); - String tname = child.getName(); - if ("name".equals(tname)) { - name = child.getBody(); - } else if ("path".equals(tname)) { - path = child.getBody(); - } else if ("description".equals(tname)) { - checkConflict = true; - description = child.getBody(); - } else if ("display-name".equals(tname)) { - checkConflict = true; - displayName = child.getBody(); - } else if ("icon".equals(tname)) { - checkConflict = true; - icon = child.getBody(); - } else if ("example".equals(tname)) { - // Ignore element: Bugzilla 33538 - } else if ("tag-extension".equals(tname)) { - // Ignore element: Bugzilla 33538 - } else { - err.jspError("jsp.error.unknown.element.in.tagfile", tname); - } - } - - if (path.startsWith("/META-INF/tags")) { - // Tag file packaged in JAR - if (jarFileUrl != null) { - ctxt.getTagFileJarUrls().put(path, jarFileUrl); - } - } else if (!path.startsWith("/WEB-INF/tags")) { - err.jspError("jsp.error.tagfile.illegalPath", path); - } - - JasperTagInfo tagInfo = (JasperTagInfo) - TagFileProcessor.parseTagFileDirectives(parserController, name, - path, this); - if (checkConflict) { - String tstring = tagInfo.getInfoString(); - if (tstring != null && !"".equals(tstring)) { - description = tstring; - } - tstring = tagInfo.getDisplayName(); - if (tstring != null && !"".equals(tstring)) { - displayName = tstring; - } - tstring = tagInfo.getSmallIcon(); - if (tstring != null && !"".equals(tstring)) { - icon = tstring; - } - tagInfo = new JasperTagInfo( - tagInfo.getTagName(), - tagInfo.getTagClassName(), - tagInfo.getBodyContent(), - description, - tagInfo.getTagLibrary(), - tagInfo.getTagExtraInfo(), - tagInfo.getAttributes(), - displayName, - icon, - tagInfo.getLargeIcon(), - tagInfo.getTagVariableInfos(), - tagInfo.getDynamicAttributesMapName()); - } - return new TagFileInfo(name, path, tagInfo); - } - - private TagAttributeInfo createAttribute(TreeNode elem, String jspVersion) - throws JasperException { - - String name = null; - String type = null; - boolean required = false, rtexprvalue = false, reqTime = false, - isFragment = false; - boolean deferredValue = false; - boolean deferredMethod = false; - String expectedType = "java.lang.Object"; - String methodSignature = "void method()"; - String description = null; - - Iterator list = elem.findChildren(); - while (list.hasNext()) { - TreeNode element = (TreeNode) list.next(); - String tname = element.getName(); - - if ("name".equals(tname)) { - name = element.getBody(); - } else if ("required".equals(tname)) { - String s = element.getBody(); - if (s != null) - required = JspUtil.booleanValue(s); - } else if ("rtexprvalue".equals(tname)) { - String s = element.getBody(); - if (s != null) - rtexprvalue = JspUtil.booleanValue(s); - } else if ("type".equals(tname)) { - type = element.getBody(); - if ("1.2".equals(jspVersion) - && (type.equals("Boolean") - || type.equals("Byte") - || type.equals("Character") - || type.equals("Double") - || type.equals("Float") - || type.equals("Integer") - || type.equals("Long") - || type.equals("Object") - || type.equals("Short") - || type.equals("String"))) { - type = "java.lang." + type; - } - } else if ("fragment".equals(tname)) { - String s = element.getBody(); - if (s != null) { - isFragment = JspUtil.booleanValue(s); - } - } else if ("description".equals(tname)) { - description = element.getBody(); - } else if ("deferred-value".equals(tname)) { - deferredValue = true; - Iterator iter = element.findChildren(); - if (iter.hasNext()) { - TreeNode element2 = (TreeNode) iter.next(); - tname = element2.getName(); - if ("type".equals(tname)) { - String s = element2.getBody(); - if (s != null) { - expectedType = s; - } - } else { - err.jspError( - "jsp.error.unknown.element.in.attribute", - tname); - } - } - } else if ("deferred-method".equals(tname)) { - deferredMethod = true; - Iterator iter = element.findChildren(); - if (iter.hasNext()) { - TreeNode element2 = (TreeNode) iter.next(); - tname = element2.getName(); - if ("method-signature".equals(tname)) { - String s = element2.getBody(); - if (s != null) { - methodSignature = s; - } - } else { - err.jspError( - "jsp.error.unknown.element.in.attribute", - tname); - } - } - } else { - err.jspError("jsp.error.unknown.element.in.attribute", - tname); - } - } - - if (isFragment) { - /* - * According to JSP.C-3 ("TLD Schema Element Structure - tag"), - * 'type' and 'rtexprvalue' must not be specified if 'fragment' - * has been specified (this will be enforced by validating parser). - * Also, if 'fragment' is TRUE, 'type' is fixed at - * javax.servlet.jsp.tagext.JspFragment, and 'rtexprvalue' is - * fixed at true. See also JSP.8.5.2. - */ - type = "javax.servlet.jsp.tagext.JspFragment"; - rtexprvalue = true; - } - - if (!rtexprvalue) { - // According to JSP spec, for static values (those determined at - // translation time) the type is fixed at java.lang.String. - type = "java.lang.String"; - } - - return new TagAttributeInfo(name, required, type, rtexprvalue, - isFragment, description, deferredValue, - deferredMethod, expectedType, - methodSignature); - } - - private TagVariableInfo createVariable(TreeNode elem) - throws JasperException { - - String nameGiven = null; - String nameFromAttribute = null; - String className = "java.lang.String"; - boolean declare = true; - int scope = VariableInfo.NESTED; - - Iterator list = elem.findChildren(); - while (list.hasNext()) { - TreeNode element = (TreeNode) list.next(); - String tname = element.getName(); - if ("name-given".equals(tname)) - nameGiven = element.getBody(); - else if ("name-from-attribute".equals(tname)) - nameFromAttribute = element.getBody(); - else if ("variable-class".equals(tname)) - className = element.getBody(); - else if ("declare".equals(tname)) { - String s = element.getBody(); - if (s != null) - declare = JspUtil.booleanValue(s); - } else if ("scope".equals(tname)) { - String s = element.getBody(); - if (s != null) { - if ("NESTED".equals(s)) { - scope = VariableInfo.NESTED; - } else if ("AT_BEGIN".equals(s)) { - scope = VariableInfo.AT_BEGIN; - } else if ("AT_END".equals(s)) { - scope = VariableInfo.AT_END; - } - } - } else if ("description".equals(tname) || // Ignored elements - false ) { - } else { - err.jspError("jsp.error.unknown.element.in.variable", - tname); - } - } - return new TagVariableInfo(nameGiven, nameFromAttribute, - className, declare, scope); - } - - private TagLibraryValidator createValidator(TreeNode elem) - throws JasperException { - - String validatorClass = null; - Map initParams = new HashMap(); - - Iterator list = elem.findChildren(); - while (list.hasNext()) { - TreeNode element = (TreeNode) list.next(); - String tname = element.getName(); - if ("validator-class".equals(tname)) - validatorClass = element.getBody(); - else if ("init-param".equals(tname)) { - String[] initParam = createInitParam(element); - initParams.put(initParam[0], initParam[1]); - } else if ("description".equals(tname) || // Ignored elements - false ) { - } else { - err.jspError("jsp.error.unknown.element.in.validator", - tname); - } - } - - TagLibraryValidator tlv = null; - if (validatorClass != null && !validatorClass.equals("")) { - try { - Class tlvClass = - ctxt.getClassLoader().loadClass(validatorClass); - tlv = (TagLibraryValidator)tlvClass.newInstance(); - } catch (Exception e) { - err.jspError("jsp.error.tlvclass.instantiation", - validatorClass, e); - } - } - if (tlv != null) { - tlv.setInitParameters(initParams); - } - return tlv; - } - - private String[] createInitParam(TreeNode elem) throws JasperException { - - String[] initParam = new String[2]; - - Iterator list = elem.findChildren(); - while (list.hasNext()) { - TreeNode element = (TreeNode) list.next(); - String tname = element.getName(); - if ("param-name".equals(tname)) { - initParam[0] = element.getBody(); - } else if ("param-value".equals(tname)) { - initParam[1] = element.getBody(); - } else if ("description".equals(tname)) { - ; // Do nothing - } else { - err.jspError("jsp.error.unknown.element.in.initParam", - tname); - } - } - return initParam; - } - - private FunctionInfo createFunctionInfo(TreeNode elem) - throws JasperException { - - String name = null; - String klass = null; - String signature = null; - - Iterator list = elem.findChildren(); - while (list.hasNext()) { - TreeNode element = (TreeNode) list.next(); - String tname = element.getName(); - - if ("name".equals(tname)) { - name = element.getBody(); - } else if ("function-class".equals(tname)) { - klass = element.getBody(); - } else if ("function-signature".equals(tname)) { - signature = element.getBody(); - } else if ("display-name".equals(tname) || // Ignored elements - "small-icon".equals(tname) || - "large-icon".equals(tname) || - "description".equals(tname) || - "example".equals(tname)) { - } else { - err.jspError("jsp.error.unknown.element.in.function", - tname); - } - } - - return new FunctionInfo(name, klass, signature); - } - - - //********************************************************************* - // Until javax.servlet.jsp.tagext.TagLibraryInfo is fixed - - /** - * The instance (if any) for the TagLibraryValidator class. - * - * @return The TagLibraryValidator instance, if any. - */ - public TagLibraryValidator getTagLibraryValidator() { - return tagLibraryValidator; - } - - /** - * Translation-time validation of the XML document - * associated with the JSP page. - * This is a convenience method on the associated - * TagLibraryValidator class. - * - * @param thePage The JSP page object - * @return A string indicating whether the page is valid or not. - */ - public ValidationMessage[] validate(PageData thePage) { - TagLibraryValidator tlv = getTagLibraryValidator(); - if (tlv == null) return null; - - String uri = getURI(); - if (uri.startsWith("/")) { - uri = URN_JSPTLD + uri; - } - - ValidationMessage[] messages = tlv.validate(getPrefixString(), uri, - thePage); - tlv.release(); - - return messages; - } - - protected TagLibraryValidator tagLibraryValidator; -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/TagPluginManager.java b/impl/src/main/java/org/apache/jasper/compiler/TagPluginManager.java deleted file mode 100644 index 7bfb6c7..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/TagPluginManager.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.util.*; -import java.io.*; -import javax.servlet.ServletContext; - -import org.apache.jasper.Constants; -import org.apache.jasper.JasperException; -import org.apache.jasper.xmlparser.ParserUtils; -import org.apache.jasper.xmlparser.TreeNode; -import org.apache.jasper.compiler.tagplugin.TagPlugin; -import org.apache.jasper.compiler.tagplugin.TagPluginContext; - -/** - * Manages tag plugin optimizations. - * @author Kin-man Chung - */ - -public class TagPluginManager { - - private static final String TAG_PLUGINS_XML = "/WEB-INF/tagPlugins.xml"; - private static final String TAG_PLUGINS_ROOT_ELEM = "tag-plugins"; - - private boolean initialized = false; - private HashMap tagPlugins = null; - private ServletContext ctxt; - private PageInfo pageInfo; - - public TagPluginManager(ServletContext ctxt) { - this.ctxt = ctxt; - } - - public void apply(Node.Nodes page, ErrorDispatcher err, PageInfo pageInfo) - throws JasperException { - - init(err); - if (tagPlugins == null || tagPlugins.size() == 0) { - return; - } - - this.pageInfo = pageInfo; - - page.visit(new Node.Visitor() { - public void visit(Node.CustomTag n) - throws JasperException { - invokePlugin(n); - visitBody(n); - } - }); - - } - - private void init(ErrorDispatcher err) throws JasperException { - if (initialized) - return; - - InputStream is = ctxt.getResourceAsStream(TAG_PLUGINS_XML); - if (is == null) - return; - - boolean blockExternal = Boolean.parseBoolean(ctxt.getInitParameter( - Constants.XML_BLOCK_EXTERNAL_INIT_PARAM)); - TreeNode root = (new ParserUtils(blockExternal)).parseXMLDocument(TAG_PLUGINS_XML, - is); - if (root == null) { - return; - } - - if (!TAG_PLUGINS_ROOT_ELEM.equals(root.getName())) { - err.jspError("jsp.error.plugin.wrongRootElement", TAG_PLUGINS_XML, - TAG_PLUGINS_ROOT_ELEM); - } - - tagPlugins = new HashMap(); - Iterator pluginList = root.findChildren("tag-plugin"); - while (pluginList.hasNext()) { - TreeNode pluginNode = (TreeNode) pluginList.next(); - TreeNode tagClassNode = pluginNode.findChild("tag-class"); - if (tagClassNode == null) { - // Error - return; - } - String tagClass = tagClassNode.getBody().trim(); - TreeNode pluginClassNode = pluginNode.findChild("plugin-class"); - if (pluginClassNode == null) { - // Error - return; - } - - String pluginClassStr = pluginClassNode.getBody(); - TagPlugin tagPlugin = null; - try { - Class pluginClass = - Class.forName(pluginClassStr).asSubclass(TagPlugin.class); - tagPlugin = pluginClass.newInstance(); - } catch (Exception e) { - throw new JasperException(e); - } - if (tagPlugin == null) { - return; - } - tagPlugins.put(tagClass, tagPlugin); - } - initialized = true; - } - - /** - * Invoke tag plugin for the given custom tag, if a plugin exists for - * the custom tag's tag handler. - * - * The given custom tag node will be manipulated by the plugin. - */ - private void invokePlugin(Node.CustomTag n) { - TagPlugin tagPlugin = tagPlugins.get(n.getTagHandlerClass().getName()); - if (tagPlugin == null) { - return; - } - - TagPluginContext tagPluginContext = new TagPluginContextImpl(n, pageInfo); - n.setTagPluginContext(tagPluginContext); - tagPlugin.doTag(tagPluginContext); - } - - static class TagPluginContextImpl implements TagPluginContext { - private Node.CustomTag node; - private Node.Nodes curNodes; - private PageInfo pageInfo; - private HashMap pluginAttributes; - - TagPluginContextImpl(Node.CustomTag n, PageInfo pageInfo) { - this.node = n; - this.pageInfo = pageInfo; - curNodes = new Node.Nodes(); - n.setAtETag(curNodes); - curNodes = new Node.Nodes(); - n.setAtSTag(curNodes); - n.setUseTagPlugin(true); - pluginAttributes = new HashMap(); - } - - public TagPluginContext getParentContext() { - Node parent = node.getParent(); - if (! (parent instanceof Node.CustomTag)) { - return null; - } - return ((Node.CustomTag) parent).getTagPluginContext(); - } - - public void setPluginAttribute(String key, Object value) { - pluginAttributes.put(key, value); - } - - public Object getPluginAttribute(String key) { - return pluginAttributes.get(key); - } - - public boolean isScriptless() { - return node.getChildInfo().isScriptless(); - } - - public boolean isConstantAttribute(String attribute) { - Node.JspAttribute attr = getNodeAttribute(attribute); - if (attr == null) - return false; - return attr.isLiteral(); - } - - public String getConstantAttribute(String attribute) { - Node.JspAttribute attr = getNodeAttribute(attribute); - if (attr == null) - return null; - return attr.getValue(); - } - - public boolean isAttributeSpecified(String attribute) { - return getNodeAttribute(attribute) != null; - } - - public String getTemporaryVariableName() { - return JspUtil.nextTemporaryVariableName(); - } - - public void generateImport(String imp) { - pageInfo.addImport(imp); - } - - public void generateDeclaration(String id, String text) { - if (pageInfo.isPluginDeclared(id)) { - return; - } - curNodes.add(new Node.Declaration(text, node.getStart(), null)); - } - - public void generateJavaSource(String sourceCode) { - curNodes.add(new Node.Scriptlet(sourceCode, node.getStart(), - null)); - } - - public void generateAttribute(String attributeName) { - curNodes.add(new Node.AttributeGenerator(node.getStart(), - attributeName, - node)); - } - - public void dontUseTagPlugin() { - node.setUseTagPlugin(false); - } - - public void generateBody() { - // Since we'll generate the body anyway, this is really a nop, - // except for the fact that it lets us put the Java sources the - // plugins produce in the correct order (w.r.t the body). - curNodes = node.getAtETag(); - } - - private Node.JspAttribute getNodeAttribute(String attribute) { - Node.JspAttribute[] attrs = node.getJspAttributes(); - for (int i=0; attrs != null && i < attrs.length; i++) { - if (attrs[i].getName().equals(attribute)) { - return attrs[i]; - } - } - return null; - } - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/TextOptimizer.java b/impl/src/main/java/org/apache/jasper/compiler/TextOptimizer.java deleted file mode 100644 index 8422142..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/TextOptimizer.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import org.apache.jasper.JasperException; -import org.apache.jasper.Options; - -/** - */ -public class TextOptimizer { - - /** - * A visitor to concatenate contiguous template texts. - */ - static class TextCatVisitor extends Node.Visitor { - - private int textNodeCount = 0; - private Node.TemplateText firstTextNode = null; - private StringBuilder textBuffer; - private final String emptyText = new String(""); - private boolean prePass; - private boolean trim; - - public TextCatVisitor(boolean prePass, boolean trim){ - this.prePass = prePass; - this.trim = trim; - } - - public void doVisit(Node n) throws JasperException { - collectText(); - } - - /* - * The following directives are ignored in text concatenation - * except in the pre pass phase. - */ - - public void visit(Node.PageDirective n) throws JasperException { - if (prePass) { - collectText(); - } - } - - public void visit(Node.TagDirective n) throws JasperException { - if (prePass) { - collectText(); - } - } - - public void visit(Node.TaglibDirective n) throws JasperException { - if (prePass) { - collectText(); - } - } - - public void visit(Node.AttributeDirective n) throws JasperException { - if (prePass) { - collectText(); - } - } - - public void visit(Node.VariableDirective n) throws JasperException { - if (prePass) { - collectText(); - } - } - - /* - * Don't concatenate text across body boundaries - */ - public void visitBody(Node n) throws JasperException { - super.visitBody(n); - collectText(); - } - - public void visit(Node.TemplateText n) throws JasperException { - - if ((trim) && ! prePass && n.isAllSpace()) { - n.setText(emptyText); - return; - } - - if (textNodeCount++ == 0) { - firstTextNode = n; - textBuffer = new StringBuilder(n.getText()); - } else { - // Append text to text buffer - textBuffer.append(n.getText()); - n.setText(emptyText); - } - } - - /** - * This method breaks concatenation mode. As a side effect it copies - * the concatenated string to the first text node - */ - private void collectText() { - - if (textNodeCount > 1) { - // Copy the text in buffer into the first template text node. - firstTextNode.setText(textBuffer.toString()); - } - textNodeCount = 0; - } - - } - - public static void concatenate(Compiler compiler, Node.Nodes page) - throws JasperException { - - Options options = compiler.getCompilationContext().getOptions(); - PageInfo pageInfo = compiler.getPageInfo(); - boolean trim = - options.getTrimSpaces() || pageInfo.isTrimDirectiveWhitespaces(); - - if (trim) { - TextCatVisitor v = new TextCatVisitor(true, trim); - page.visit(v); - v.collectText(); - } - TextCatVisitor v = new TextCatVisitor(false, trim); - page.visit(v); - - // Cleanup, in case the page ends with a template text - v.collectText(); - } -} diff --git a/impl/src/main/java/org/apache/jasper/compiler/Validator.java b/impl/src/main/java/org/apache/jasper/compiler/Validator.java deleted file mode 100644 index 9601edc..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/Validator.java +++ /dev/null @@ -1,1955 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler; - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Iterator; - -import javax.el.FunctionMapper; -import javax.servlet.jsp.tagext.FunctionInfo; -import javax.servlet.jsp.tagext.JspFragment; -import javax.servlet.jsp.tagext.PageData; -import javax.servlet.jsp.tagext.TagAttributeInfo; -import javax.servlet.jsp.tagext.TagData; -import javax.servlet.jsp.tagext.TagExtraInfo; -import javax.servlet.jsp.tagext.TagInfo; -import javax.servlet.jsp.tagext.TagLibraryInfo; -import javax.servlet.jsp.tagext.ValidationMessage; - -import org.apache.jasper.Constants; -import org.apache.jasper.JasperException; -import org.apache.jasper.JspCompilationContext; -import org.apache.jasper.runtime.JspRuntimeLibrary; - -import org.xml.sax.Attributes; - -/** - * Performs validation on the page elements. Attributes are checked for - * mandatory presence, entry value validity, and consistency. As a - * side effect, some page global value (such as those from page directives) - * are stored, for later use. - * - * @author Kin-man Chung - * @author Jan Luehe - * @author Shawn Bayern - * @author Mark Roth - */ -class Validator { - - /** - * A visitor to validate and extract page directive info - */ - static class DirectiveVisitor extends Node.Visitor { - - private PageInfo pageInfo; - private ErrorDispatcher err; - - private static final JspUtil.ValidAttribute[] pageDirectiveAttrs = { - new JspUtil.ValidAttribute("language"), - new JspUtil.ValidAttribute("extends"), - new JspUtil.ValidAttribute("import"), - new JspUtil.ValidAttribute("session"), - new JspUtil.ValidAttribute("buffer"), - new JspUtil.ValidAttribute("autoFlush"), - new JspUtil.ValidAttribute("isThreadSafe"), - new JspUtil.ValidAttribute("info"), - new JspUtil.ValidAttribute("errorPage"), - new JspUtil.ValidAttribute("isErrorPage"), - new JspUtil.ValidAttribute("contentType"), - new JspUtil.ValidAttribute("pageEncoding"), - new JspUtil.ValidAttribute("isELIgnored"), - new JspUtil.ValidAttribute("deferredSyntaxAllowedAsLiteral"), - new JspUtil.ValidAttribute("trimDirectiveWhitespaces") - }; - - private boolean pageEncodingSeen = false; - - /* - * Constructor - */ - DirectiveVisitor(Compiler compiler) throws JasperException { - this.pageInfo = compiler.getPageInfo(); - this.err = compiler.getErrorDispatcher(); - } - - public void visit(Node.IncludeDirective n) throws JasperException { - // Since pageDirectiveSeen flag only applies to the Current page - // save it here and restore it after the file is included. - boolean pageEncodingSeenSave = pageEncodingSeen; - pageEncodingSeen = false; - visitBody(n); - pageEncodingSeen = pageEncodingSeenSave; - } - - public void visit(Node.PageDirective n) throws JasperException { - - JspUtil.checkAttributes("Page directive", n, - pageDirectiveAttrs, err); - - // JSP.2.10.1 - Attributes attrs = n.getAttributes(); - for (int i = 0; attrs != null && i < attrs.getLength(); i++) { - String attr = attrs.getQName(i); - String value = attrs.getValue(i); - - if ("language".equals(attr)) { - if (pageInfo.getLanguage(false) == null) { - pageInfo.setLanguage(value, n, err, true); - } else if (!pageInfo.getLanguage(false).equals(value)) { - err.jspError(n, "jsp.error.page.conflict.language", - pageInfo.getLanguage(false), value); - } - } else if ("extends".equals(attr)) { - if (pageInfo.getExtends(false) == null) { - pageInfo.setExtends(value, n); - } else if (!pageInfo.getExtends(false).equals(value)) { - err.jspError(n, "jsp.error.page.conflict.extends", - pageInfo.getExtends(false), value); - } - } else if ("contentType".equals(attr)) { - if (pageInfo.getContentType() == null) { - pageInfo.setContentType(value); - } else if (!pageInfo.getContentType().equals(value)) { - err.jspError(n, "jsp.error.page.conflict.contenttype", - pageInfo.getContentType(), value); - } - } else if ("session".equals(attr)) { - if (pageInfo.getSession() == null) { - pageInfo.setSession(value, n, err); - } else if (!pageInfo.getSession().equals(value)) { - err.jspError(n, "jsp.error.page.conflict.session", - pageInfo.getSession(), value); - } - } else if ("buffer".equals(attr)) { - if (pageInfo.getBufferValue() == null) { - pageInfo.setBufferValue(value, n, err); - } else if (!pageInfo.getBufferValue().equals(value)) { - err.jspError(n, "jsp.error.page.conflict.buffer", - pageInfo.getBufferValue(), value); - } - } else if ("autoFlush".equals(attr)) { - if (pageInfo.getAutoFlush() == null) { - pageInfo.setAutoFlush(value, n, err); - } else if (!pageInfo.getAutoFlush().equals(value)) { - err.jspError(n, "jsp.error.page.conflict.autoflush", - pageInfo.getAutoFlush(), value); - } - } else if ("isThreadSafe".equals(attr)) { - if (pageInfo.getIsThreadSafe() == null) { - pageInfo.setIsThreadSafe(value, n, err); - } else if (!pageInfo.getIsThreadSafe().equals(value)) { - err.jspError(n, "jsp.error.page.conflict.isthreadsafe", - pageInfo.getIsThreadSafe(), value); - } - } else if ("isELIgnored".equals(attr)) { - if (pageInfo.getIsELIgnored() == null) { - pageInfo.setIsELIgnored(value, n, err, true); - } else if (!pageInfo.getIsELIgnored().equals(value)) { - err.jspError(n, "jsp.error.page.conflict.iselignored", - pageInfo.getIsELIgnored(), value); - } - } else if ("isErrorPage".equals(attr)) { - if (pageInfo.getIsErrorPage() == null) { - pageInfo.setIsErrorPage(value, n, err); - } else if (!pageInfo.getIsErrorPage().equals(value)) { - err.jspError(n, "jsp.error.page.conflict.iserrorpage", - pageInfo.getIsErrorPage(), value); - } - } else if ("errorPage".equals(attr)) { - if (pageInfo.getErrorPage() == null) { - pageInfo.setErrorPage(value); - } else if (!pageInfo.getErrorPage().equals(value)) { - err.jspError(n, "jsp.error.page.conflict.errorpage", - pageInfo.getErrorPage(), value); - } - } else if ("info".equals(attr)) { - if (pageInfo.getInfo() == null) { - pageInfo.setInfo(value); - } else if (!pageInfo.getInfo().equals(value)) { - err.jspError(n, "jsp.error.page.conflict.info", - pageInfo.getInfo(), value); - } - } else if ("pageEncoding".equals(attr)) { - if (pageEncodingSeen) - err.jspError(n, "jsp.error.page.multi.pageencoding"); - // 'pageEncoding' can occur at most once per file - pageEncodingSeen = true; - /* - * Report any encoding conflict, treating "UTF-16", - * "UTF-16BE", and "UTF-16LE" as identical. - */ - comparePageEncodings(value, n); - } else if ("deferredSyntaxAllowedAsLiteral".equals(attr)) { - if (pageInfo.getDeferredSyntaxAllowedAsLiteral() == null) { - pageInfo.setDeferredSyntaxAllowedAsLiteral(value, n, err, true); - } else if (!pageInfo.getDeferredSyntaxAllowedAsLiteral().equals(value)) { - err.jspError(n, "jsp.error.page.conflict.deferred", - pageInfo.getDeferredSyntaxAllowedAsLiteral(), value); - } - } else if ("trimDirectiveWhitespaces".equals(attr)) { - if (pageInfo.getTrimDirectiveWhitespaces() == null) { - pageInfo.setTrimDirectiveWhitespaces(value, n, err, true); - } else if (!pageInfo.getTrimDirectiveWhitespaces().equals(value)) { - err.jspError(n, "jsp.error.page.conflict.trim", - pageInfo.getTrimDirectiveWhitespaces(), value); - } - } - } - - // Check for bad combinations - if (pageInfo.getBuffer() == 0 && !pageInfo.isAutoFlush()) - err.jspError(n, "jsp.error.page.badCombo"); - - // Error pages must not be self-referencing - if (pageInfo.isErrorPage() && pageInfo.getErrorPage() != null) { - String rootPath = pageInfo.getRootPath(); - String errorPath = pageInfo.getErrorPage(); - if (!errorPath.startsWith("/")) { - // Error page location is relative to root path - String baseRootPath = - rootPath.substring(0, rootPath.lastIndexOf('/')); - errorPath = baseRootPath + '/' + errorPath; - } - if (rootPath.equals(errorPath)) { - err.jspError(n, "jsp.error.page.selfreferencing", - rootPath); - } - } - - // Attributes for imports for this node have been processed by - // the parsers, just add them to pageInfo. - pageInfo.addImports(n.getImports()); - } - - public void visit(Node.TagDirective n) throws JasperException { - // Note: Most of the validation is done in TagFileProcessor - // when it created a TagInfo object from the - // tag file in which the directive appeared. - - // This method does additional processing to collect page info - - Attributes attrs = n.getAttributes(); - for (int i = 0; attrs != null && i < attrs.getLength(); i++) { - String attr = attrs.getQName(i); - String value = attrs.getValue(i); - - if ("language".equals(attr)) { - if (pageInfo.getLanguage(false) == null) { - pageInfo.setLanguage(value, n, err, false); - } else if (!pageInfo.getLanguage(false).equals(value)) { - err.jspError(n, "jsp.error.tag.conflict.language", - pageInfo.getLanguage(false), value); - } - } else if ("isELIgnored".equals(attr)) { - if (pageInfo.getIsELIgnored() == null) { - pageInfo.setIsELIgnored(value, n, err, false); - } else if (!pageInfo.getIsELIgnored().equals(value)) { - err.jspError(n, "jsp.error.tag.conflict.iselignored", - pageInfo.getIsELIgnored(), value); - } - } else if ("pageEncoding".equals(attr)) { - if (pageEncodingSeen) - err.jspError(n, "jsp.error.tag.multi.pageencoding"); - pageEncodingSeen = true; - // Make sure that if tag file is preceded by BOM, the - // BOM encoding matches the value of the pageEncoding - // attribute of the tag directive - if (n.getRoot().hasBom()) { - String bom = n.getRoot().getPageEncoding(); - // Treat "UTF-16", "UTF-16BE", and "UTF-16LE" as - // identical. - if (value != null - && !value.equalsIgnoreCase(bom) - && (!value.toLowerCase().startsWith("utf-16") - || !bom.toLowerCase().startsWith("utf-16"))) { - err.jspError( - n, - "jsp.error.bom_tagdir_encoding_mismatch", - bom, value); - } - } - n.getRoot().setPageEncoding(value); - } else if ("deferredSyntaxAllowedAsLiteral".equals(attr)) { - if (pageInfo.getDeferredSyntaxAllowedAsLiteral() == null) { - pageInfo.setDeferredSyntaxAllowedAsLiteral(value, n, err, false); - } else if (!pageInfo.getDeferredSyntaxAllowedAsLiteral().equals(value)) { - err.jspError(n, "jsp.error.tag.conflict.deferred", - pageInfo.getDeferredSyntaxAllowedAsLiteral(), value); - } - } else if ("trimDirectiveWhitespaces".equals(attr)) { - if (pageInfo.getTrimDirectiveWhitespaces() == null) { - pageInfo.setTrimDirectiveWhitespaces(value, n, err, false); - } else if (!pageInfo.getTrimDirectiveWhitespaces().equals(value)) { - err.jspError(n, "jsp.error.tag.conflict.trim", - pageInfo.getTrimDirectiveWhitespaces(), value); - } - } - } - - // Attributes for imports for this node have been processed by - // the parsers, just add them to pageInfo. - pageInfo.addImports(n.getImports()); - } - - public void visit(Node.AttributeDirective n) throws JasperException { - // Do nothing, since this attribute directive has already been - // validated by TagFileProcessor when it created a TagInfo object - // from the tag file in which the directive appeared - } - - public void visit(Node.VariableDirective n) throws JasperException { - // Do nothing, since this variable directive has already been - // validated by TagFileProcessor when it created a TagInfo object - // from the tag file in which the directive appeared - } - - /* - * Ensures that the page encoding specified in the 'pageEncoding' - * attribute of the page directive matches the page encodings specified - * in other applicable authoritative page encoding sources. - * - * @param pageDirEnc The value of the pageEncoding attribute of the - * page directive - * @param pageDir The page directive node - * - * @throws JasperException if page encodings do not match - */ - private void comparePageEncodings(String pageDirEnc, - Node.PageDirective pageDir) - throws JasperException { - - Node.Root root = pageDir.getRoot(); - String configEnc = root.getJspConfigPageEncoding(); - - /* - * Compare the 'pageEncoding' attribute of the page directive with - * the encoding specified in the JSP config element whose URL - * pattern matches this page. - * Treat "UTF-16", "UTF-16BE", and "UTF-16LE" as identical. - */ - if (configEnc != null && !pageDirEnc.equalsIgnoreCase(configEnc) - && (!pageDirEnc.toLowerCase().startsWith("utf-16") - || !configEnc.toLowerCase().startsWith("utf-16"))) { - err.jspError(pageDir, - "jsp.error.config_pagedir_encoding_mismatch", - configEnc, pageDirEnc); - } - - /* - * Compare the 'pageEncoding' attribute of the page directive with - * the encoding specified in the XML prolog (only for XML syntax, - * and only if JSP document contains XML prolog with encoding - * declaration). - * Treat "UTF-16", "UTF-16BE", and "UTF-16LE" as identical. - */ - if (root.isXmlSyntax() && root.isEncodingSpecifiedInProlog()) { - String pageEnc = root.getPageEncoding(); - if (!pageDirEnc.equalsIgnoreCase(pageEnc) - && (!pageDirEnc.toLowerCase().startsWith("utf-16") - || !pageEnc.toLowerCase().startsWith("utf-16"))) { - err.jspError(pageDir, - "jsp.error.prolog_pagedir_encoding_mismatch", - pageEnc, pageDirEnc); - } - } - - /* - * Compare the 'pageEncoding' attribute of the page directive with - * the encoding declared by BOM (if present). - * Treat "UTF-16", "UTF-16BE", and "UTF-16LE" as identical. - */ - if (root.hasBom()) { - String pageEnc = root.getPageEncoding(); - if (!pageDirEnc.equalsIgnoreCase(pageEnc) - && (!pageDirEnc.toLowerCase().startsWith("utf-16") - || !pageEnc.toLowerCase().startsWith("utf-16"))) { - err.jspError(pageDir, - "jsp.error.bom_pagedir_encoding_mismatch", - pageEnc, pageDirEnc); - } - } - } - } - - /** - * A visitor for validating nodes other than page directives - */ - static class ValidateVisitor extends Node.Visitor { - - private PageInfo pageInfo; - private ErrorDispatcher err; - private ClassLoader loader; - private JspCompilationContext ctxt; - - private static final JspUtil.ValidAttribute[] jspRootAttrs = { - new JspUtil.ValidAttribute("xsi:schemaLocation"), - new JspUtil.ValidAttribute("version", true) }; - - private static final JspUtil.ValidAttribute[] includeDirectiveAttrs = { - new JspUtil.ValidAttribute("file", true) }; - - private static final JspUtil.ValidAttribute[] taglibDirectiveAttrs = { - new JspUtil.ValidAttribute("uri"), - new JspUtil.ValidAttribute("tagdir"), - new JspUtil.ValidAttribute("prefix", true) }; - - private static final JspUtil.ValidAttribute[] includeActionAttrs = { - new JspUtil.ValidAttribute("page", true), - new JspUtil.ValidAttribute("flush") }; - - private static final JspUtil.ValidAttribute[] paramActionAttrs = { - new JspUtil.ValidAttribute("name", true), - new JspUtil.ValidAttribute("value", true) }; - - private static final JspUtil.ValidAttribute[] forwardActionAttrs = { - new JspUtil.ValidAttribute("page", true) }; - - private static final JspUtil.ValidAttribute[] getPropertyAttrs = { - new JspUtil.ValidAttribute("name", true), - new JspUtil.ValidAttribute("property", true) }; - - private static final JspUtil.ValidAttribute[] setPropertyAttrs = { - new JspUtil.ValidAttribute("name", true), - new JspUtil.ValidAttribute("property", true), - new JspUtil.ValidAttribute("value", false), - new JspUtil.ValidAttribute("param") }; - - private static final JspUtil.ValidAttribute[] useBeanAttrs = { - new JspUtil.ValidAttribute("id", true), - new JspUtil.ValidAttribute("scope"), - new JspUtil.ValidAttribute("class"), - new JspUtil.ValidAttribute("type"), - new JspUtil.ValidAttribute("beanName", false) }; - - private static final JspUtil.ValidAttribute[] plugInAttrs = { - new JspUtil.ValidAttribute("type",true), - new JspUtil.ValidAttribute("code", true), - new JspUtil.ValidAttribute("codebase"), - new JspUtil.ValidAttribute("align"), - new JspUtil.ValidAttribute("archive"), - new JspUtil.ValidAttribute("height", false), - new JspUtil.ValidAttribute("hspace"), - new JspUtil.ValidAttribute("jreversion"), - new JspUtil.ValidAttribute("name"), - new JspUtil.ValidAttribute("vspace"), - new JspUtil.ValidAttribute("width", false), - new JspUtil.ValidAttribute("nspluginurl"), - new JspUtil.ValidAttribute("iepluginurl") }; - - private static final JspUtil.ValidAttribute[] attributeAttrs = { - new JspUtil.ValidAttribute("name", true), - new JspUtil.ValidAttribute("trim"), - new JspUtil.ValidAttribute("omit")}; - - private static final JspUtil.ValidAttribute[] invokeAttrs = { - new JspUtil.ValidAttribute("fragment", true), - new JspUtil.ValidAttribute("var"), - new JspUtil.ValidAttribute("varReader"), - new JspUtil.ValidAttribute("scope") }; - - private static final JspUtil.ValidAttribute[] doBodyAttrs = { - new JspUtil.ValidAttribute("var"), - new JspUtil.ValidAttribute("varReader"), - new JspUtil.ValidAttribute("scope") }; - - private static final JspUtil.ValidAttribute[] jspOutputAttrs = { - new JspUtil.ValidAttribute("omit-xml-declaration"), - new JspUtil.ValidAttribute("doctype-root-element"), - new JspUtil.ValidAttribute("doctype-public"), - new JspUtil.ValidAttribute("doctype-system") }; - - /* - * Constructor - */ - ValidateVisitor(Compiler compiler) { - this.pageInfo = compiler.getPageInfo(); - this.err = compiler.getErrorDispatcher(); - this.ctxt = compiler.getCompilationContext(); - this.loader = ctxt.getClassLoader(); - } - - public void visit(Node.JspRoot n) throws JasperException { - JspUtil.checkAttributes("Jsp:root", n, - jspRootAttrs, err); - String version = n.getTextAttribute("version"); - if (!version.equals("1.2") && !version.equals("2.0") && !version.equals("2.1")) { - err.jspError(n, "jsp.error.jsproot.version.invalid", version); - } - visitBody(n); - } - - public void visit(Node.IncludeDirective n) throws JasperException { - JspUtil.checkAttributes("Include directive", n, - includeDirectiveAttrs, err); - visitBody(n); - } - - public void visit(Node.TaglibDirective n) throws JasperException { - JspUtil.checkAttributes("Taglib directive", n, - taglibDirectiveAttrs, err); - // Either 'uri' or 'tagdir' attribute must be specified - String uri = n.getAttributeValue("uri"); - String tagdir = n.getAttributeValue("tagdir"); - if (uri == null && tagdir == null) { - err.jspError(n, "jsp.error.taglibDirective.missing.location"); - } - if (uri != null && tagdir != null) { - err.jspError(n, "jsp.error.taglibDirective.both_uri_and_tagdir"); - } - } - - public void visit(Node.ParamAction n) throws JasperException { - JspUtil.checkAttributes("Param action", n, - paramActionAttrs, err); - // make sure the value of the 'name' attribute is not a - // request-time expression - throwErrorIfExpression(n, "name", "jsp:param"); - n.setValue(getJspAttribute("value", null, null, - n.getAttributeValue("value"), - n, false, null)); - visitBody(n); - } - - public void visit(Node.ParamsAction n) throws JasperException { - // Make sure we've got at least one nested jsp:param - Node.Nodes subElems = n.getBody(); - if (subElems == null) { - err.jspError(n, "jsp.error.params.emptyBody"); - } - visitBody(n); - } - - public void visit(Node.IncludeAction n) throws JasperException { - JspUtil.checkAttributes("Include action", n, - includeActionAttrs, err); - n.setPage(getJspAttribute("page", null, null, - n.getAttributeValue("page"), - n, false, null)); - visitBody(n); - }; - - public void visit(Node.ForwardAction n) throws JasperException { - JspUtil.checkAttributes("Forward", n, - forwardActionAttrs, err); - n.setPage(getJspAttribute("page", null, null, - n.getAttributeValue("page"), - n, false, null)); - visitBody(n); - } - - public void visit(Node.GetProperty n) throws JasperException { - JspUtil.checkAttributes("GetProperty", n, - getPropertyAttrs, err); - } - - public void visit(Node.SetProperty n) throws JasperException { - JspUtil.checkAttributes("SetProperty", n, - setPropertyAttrs, err); - String property = n.getTextAttribute("property"); - String param = n.getTextAttribute("param"); - String value = n.getAttributeValue("value"); - - n.setValue(getJspAttribute("value", null, null, value, - n, false, null)); - - boolean valueSpecified = n.getValue() != null; - - if ("*".equals(property)) { - if (param != null || valueSpecified) - err.jspError(n, "jsp.error.setProperty.invalid"); - - } else if (param != null && valueSpecified) { - err.jspError(n, "jsp.error.setProperty.invalid"); - } - - visitBody(n); - } - - public void visit(Node.UseBean n) throws JasperException { - JspUtil.checkAttributes("UseBean", n, - useBeanAttrs, err); - - String name = n.getTextAttribute ("id"); - String scope = n.getTextAttribute ("scope"); - JspUtil.checkScope(scope, n, err); - String className = n.getTextAttribute ("class"); - String type = n.getTextAttribute ("type"); - BeanRepository beanInfo = pageInfo.getBeanRepository(); - - if (className == null && type == null) - err.jspError(n, "jsp.error.usebean.missingType"); - - if (beanInfo.checkVariable(name)) - err.jspError(n, "jsp.error.usebean.duplicate", name); - - if ("session".equals(scope) && !pageInfo.isSession()) - err.jspError(n, "jsp.error.usebean.noSession"); - - Node.JspAttribute jattr - = getJspAttribute("beanName", null, null, - n.getAttributeValue("beanName"), - n, false, null); - n.setBeanName(jattr); - if (className != null && jattr != null) - err.jspError(n, "jsp.error.usebean.notBoth"); - - if (className == null) - className = type; - - beanInfo.addBean(n, name, className, scope); - - visitBody(n); - } - - public void visit(Node.PlugIn n) throws JasperException { - JspUtil.checkAttributes("Plugin", n, plugInAttrs, err); - - throwErrorIfExpression(n, "type", "jsp:plugin"); - throwErrorIfExpression(n, "code", "jsp:plugin"); - throwErrorIfExpression(n, "codebase", "jsp:plugin"); - throwErrorIfExpression(n, "align", "jsp:plugin"); - throwErrorIfExpression(n, "archive", "jsp:plugin"); - throwErrorIfExpression(n, "hspace", "jsp:plugin"); - throwErrorIfExpression(n, "jreversion", "jsp:plugin"); - throwErrorIfExpression(n, "name", "jsp:plugin"); - throwErrorIfExpression(n, "vspace", "jsp:plugin"); - throwErrorIfExpression(n, "nspluginurl", "jsp:plugin"); - throwErrorIfExpression(n, "iepluginurl", "jsp:plugin"); - - String type = n.getTextAttribute("type"); - if (type == null) - err.jspError(n, "jsp.error.plugin.notype"); - if (!type.equals("bean") && !type.equals("applet")) - err.jspError(n, "jsp.error.plugin.badtype"); - if (n.getTextAttribute("code") == null) - err.jspError(n, "jsp.error.plugin.nocode"); - - Node.JspAttribute width - = getJspAttribute("width", null, null, - n.getAttributeValue("width"), - n, false, null); - n.setWidth( width ); - - Node.JspAttribute height - = getJspAttribute("height", null, null, - n.getAttributeValue("height"), - n, false, null); - n.setHeight( height ); - - visitBody(n); - } - - public void visit(Node.NamedAttribute n) throws JasperException { - JspUtil.checkAttributes("Attribute", n, - attributeAttrs, err); - String omit = n.getAttributeValue("omit"); - if (omit != null) { - n.setOmit(getJspAttribute("omit", null, null, omit, - n, false, null)); - } - visitBody(n); - } - - public void visit(Node.JspBody n) throws JasperException { - visitBody(n); - } - - public void visit(Node.Declaration n) throws JasperException { - if (pageInfo.isScriptingInvalid()) { - err.jspError(n.getStart(), "jsp.error.no.scriptlets"); - } - } - - public void visit(Node.Expression n) throws JasperException { - if (pageInfo.isScriptingInvalid()) { - err.jspError(n.getStart(), "jsp.error.no.scriptlets"); - } - } - - public void visit(Node.Scriptlet n) throws JasperException { - if (pageInfo.isScriptingInvalid()) { - err.jspError(n.getStart(), "jsp.error.no.scriptlets"); - } - } - - public void visit(Node.ELExpression n) throws JasperException { - if (pageInfo.isELIgnored()) { - return; - } - String expressions = n.getText(); - if (expressions.charAt(0) == '#') { - if (pageInfo.isDeferredSyntaxAllowedAsLiteral()) { - return; - } - // For tag files, if the Jsp version for tag library is 2.0 or - // less, #{} is not an error - if (ctxt.isTagFile()) { - String versionString = - ctxt.getTagInfo().getTagLibrary().getRequiredVersion(); - Double version = Double.valueOf(versionString).doubleValue(); - if (version < 2.1) { - return; - } - } - - err.jspError(n.getStart(), "jsp.error.not.in.template", - "#{...}"); - } - ELNode.Nodes el = ELParser.parse(expressions); - validateFunctions(el, n); - JspUtil.validateExpressions( - n.getStart(), - expressions, - getFunctionMapper(el), - err); - n.setEL(el); - } - - public void visit(Node.UninterpretedTag n) throws JasperException { - if (n.getNamedAttributeNodes().size() != 0) { - err.jspError(n, "jsp.error.namedAttribute.invalidUse"); - } - - Attributes attrs = n.getAttributes(); - if (attrs != null) { - int attrSize = attrs.getLength(); - Node.JspAttribute[] jspAttrs = new Node.JspAttribute[attrSize]; - for (int i=0; i < attrSize; i++) { - jspAttrs[i] = getJspAttribute(attrs.getQName(i), - attrs.getURI(i), - attrs.getLocalName(i), - attrs.getValue(i), - n, - false, null); - } - n.setJspAttributes(jspAttrs); - } - - visitBody(n); - } - - public void visit(Node.CustomTag n) throws JasperException { - - TagInfo tagInfo = n.getTagInfo(); - if (tagInfo == null) { - err.jspError(n, "jsp.error.missing.tagInfo", n.getQName()); - } - - /* - * The bodycontent of a SimpleTag cannot be JSP. - */ - if (n.implementsSimpleTag() && - tagInfo.getBodyContent().equals(TagInfo.BODY_CONTENT_JSP)) { - err.jspError(n, "jsp.error.simpletag.badbodycontent", - tagInfo.getTagClassName()); - } - - /* - * If the tag handler declares in the TLD that it supports dynamic - * attributes, it also must implement the DynamicAttributes - * interface. - */ - if (tagInfo.hasDynamicAttributes() - && !n.implementsDynamicAttributes()) { - err.jspError(n, "jsp.error.dynamic.attributes.not.implemented", - n.getQName()); - } - - /* - * Make sure all required attributes are present, either as - * attributes or named attributes (). - * Also make sure that the same attribute is not specified in - * both attributes or named attributes. - */ - TagAttributeInfo[] tldAttrs = tagInfo.getAttributes(); - String customActionUri = n.getURI(); - Attributes attrs = n.getAttributes(); - int attrsSize = (attrs == null) ? 0 : attrs.getLength(); - for (int i=0; i 0) { - jspAttrs = new Node.JspAttribute[jspAttrsSize]; - } - Hashtable tagDataAttrs = - new Hashtable(attrsSize); - - checkXmlAttributes(n, jspAttrs, tagDataAttrs); - checkNamedAttributes(n, jspAttrs, attrsSize, tagDataAttrs); - - TagData tagData = new TagData(tagDataAttrs); - - // JSP.C1: It is a (translation time) error for an action that - // has one or more variable subelements to have a TagExtraInfo - // class that returns a non-null object. - TagExtraInfo tei = tagInfo.getTagExtraInfo(); - if (tei != null - && tei.getVariableInfo(tagData) != null - && tei.getVariableInfo(tagData).length > 0 - && tagInfo.getTagVariableInfos().length > 0) { - err.jspError("jsp.error.non_null_tei_and_var_subelems", - n.getQName()); - } - - n.setTagData(tagData); - n.setJspAttributes(jspAttrs); - - visitBody(n); - } - - public void visit(Node.JspElement n) throws JasperException { - - Attributes attrs = n.getAttributes(); - if (attrs == null) { - err.jspError(n, "jsp.error.jspelement.missing.name"); - } - int xmlAttrLen = attrs.getLength(); - - Node.Nodes namedAttrs = n.getNamedAttributeNodes(); - - // XML-style 'name' attribute, which is mandatory, must not be - // included in JspAttribute array - int jspAttrSize = xmlAttrLen-1 + namedAttrs.size(); - - Node.JspAttribute[] jspAttrs = new Node.JspAttribute[jspAttrSize]; - int jspAttrIndex = 0; - - // Process XML-style attributes - for (int i=0; i, the action - * - * "test" and its attributes "a", "b", and "c" all belong to the - * namespace identified by the prefix "my". The above invocation would - * be equivalent to: - * - * - * - * An action attribute may have a prefix different from that of the - * action invocation only if the underlying tag handler supports - * dynamic attributes, in which case the attribute with the different - * prefix is considered a dynamic attribute. - */ - private void checkXmlAttributes(Node.CustomTag n, - Node.JspAttribute[] jspAttrs, - Hashtable tagDataAttrs) - throws JasperException { - - TagInfo tagInfo = n.getTagInfo(); - if (tagInfo == null) { - err.jspError(n, "jsp.error.missing.tagInfo", n.getQName()); - } - TagAttributeInfo[] tldAttrs = tagInfo.getAttributes(); - Attributes attrs = n.getAttributes(); - - for (int i=0; attrs != null && i= 2.1 && - !isLiteral){ - err.jspError(n, - "jsp.error.el.nondeferred.pound", - tldAttrs[j].getName()); - } else { - isLiteral = true; - } - } - if (isLiteral) { - // #{} needs to be escaped before - // sending it to EL interpreter - jspAttrs[i].setValue(escapePound( - jspAttrs[i].getValue())); - } - } else if (pageInfo.isDeferredSyntaxAllowedAsLiteral()){ - // The literal is of the form \#{} - jspAttrs[i].setValue(escapePound( - jspAttrs[i].getValue())); - } - } - } else { - // Attribute does not accept any expressions. - // Make sure its value does not contain any. - String litAttr = getLiteral(n, attrs.getValue(i)); - if (litAttr == null) { - err.jspError(n, - "jsp.error.attribute.custom.non_rt_with_expr", - tldAttrs[j].getName()); - } - jspAttrs[i] - = new Node.JspAttribute(attrs.getQName(i), - attrs.getURI(i), - attrs.getLocalName(i), - litAttr, - false, - null, - false); - } - if (jspAttrs[i].isExpression()) { - tagDataAttrs.put(attrs.getQName(i), - TagData.REQUEST_TIME_VALUE); - } else { - tagDataAttrs.put(attrs.getQName(i), - attrs.getValue(i)); - } - found = true; - break; - } - } - if (!found) { - if (tagInfo.hasDynamicAttributes()) { - jspAttrs[i] = getJspAttribute(attrs.getQName(i), - attrs.getURI(i), - attrs.getLocalName(i), - attrs.getValue(i), - n, - true, null); - } else { - err.jspError(n, "jsp.error.bad_attribute", - attrs.getQName(i), n.getLocalName()); - } - } - } - } - - /* - * Make sure the given custom action does not have any invalid named - * attributes - */ - private void checkNamedAttributes(Node.CustomTag n, - Node.JspAttribute[] jspAttrs, - int start, - Hashtable tagDataAttrs) - throws JasperException { - - TagInfo tagInfo = n.getTagInfo(); - if (tagInfo == null) { - err.jspError(n, "jsp.error.missing.tagInfo", n.getQName()); - } - TagAttributeInfo[] tldAttrs = tagInfo.getAttributes(); - Node.Nodes naNodes = n.getNamedAttributeNodes(); - - for (int i=0; i - * If value is null, checks if there are any - * NamedAttribute subelements in the tree node, and if so, - * constructs a JspAttribute out of a child NamedAttribute node. - */ - private Node.JspAttribute getJspAttribute(String qName, - String uri, - String localName, - String value, - Node n, - boolean dynamic, - TagAttributeInfo tagAttr) - throws JasperException { - - Node.JspAttribute result = null; - - // XXX Is it an error to see "%=foo%" in non-Xml page? - // (We won't see "<%=foo%> in xml page because '<' is not a - // valid attribute value in xml). - - if (value != null) { - if (n.getRoot().isXmlSyntax() && value.startsWith("%=")) { - result = new Node.JspAttribute( - qName, - uri, - localName, - value.substring(2, value.length()-1), - true, - null, - dynamic); - } - else if(!n.getRoot().isXmlSyntax() && value.startsWith("<%=")) { - result = new Node.JspAttribute( - qName, - uri, - localName, - value.substring(3, value.length()-2), - true, - null, - dynamic); - } - else { - // The attribute can contain expressions but is not a - // scriptlet expression; thus, we want to run it through - // the expression interpreter - - // validate expression syntax if string contains - // expression(s) - ELNode.Nodes el = ELParser.parse(value); - if (el.hasPoundExpression() && tagAttr == null && !dynamic){ - // Action attributes cannot have #{...}, unless - // explicitly allowed - if (pageInfo.isELIgnored() || - pageInfo.isDeferredSyntaxAllowedAsLiteral()) { - result = new Node.JspAttribute(qName, uri, localName, - getLiteral(n, value), - false, null, false); - } - else { - err.jspError(n, "jsp.error.el.action.pound"); - } - } - else if ((el.containsEL() && !pageInfo.isELIgnored()) - || ((tagAttr !=null) - && (( tagAttr.isDeferredValue() - && !tagAttr.canBeRequestTime()) - || tagAttr.isDeferredMethod() - ) - ) - ) { - validateFunctions(el, n); - JspUtil.validateExpressions( - n.getStart(), - value, - getFunctionMapper(el), - this.err); - - if (tagAttr != null && tagAttr.isDeferredValue()) { - String expectedType = - tagAttr.getExpectedTypeName(); - result = new Node.JspAttribute( - qName, uri, localName, - value, el, - expectedType, - null, null); - } - else if (tagAttr != null && tagAttr.isDeferredMethod()){ - String methodSignature = - tagAttr.getMethodSignature(); - String returnType = getReturnType(methodSignature); - // It is an error to specify a string literal - // as a value for MethodExpression if the literal - // cannot be coerced to the return type - if (!el.containsEL()) { - try { - Class typeClass = - JspUtil.toClass(returnType, loader); - JspUtil.coerce(typeClass, value); - } catch (ClassNotFoundException ex) { - err.jspError(n, "jsp.error.el.method.type", - qName, returnType); - } catch (Exception ex) { - err.jspError(n, - "jsp.error.el.method.literal", qName); - } - } - - result = new Node.JspAttribute( - qName, uri, localName, - value, el, - null, - getReturnType(methodSignature), - getParameters(methodSignature)); - } - else { - result = new Node.JspAttribute( - qName, uri, localName, - value, false, el, dynamic); - } - } else { - result = new Node.JspAttribute(qName, uri, localName, - getLiteral(n, value), - false, null, dynamic); - } - } - } - else { - // Value is null. Check for any NamedAttribute subnodes - // that might contain the value for this attribute. - // Otherwise, the attribute wasn't found so we return null. - - Node.NamedAttribute namedAttributeNode = - n.getNamedAttributeNode( qName ); - if( namedAttributeNode != null ) { - result = new Node.JspAttribute(namedAttributeNode, - dynamic); - } - } - - return result; - } - - /* - * Checks to see if the given attribute value represents a string - * or an expression (runtime or EL). If it is a literal, also process - * escape sequences as a side-effect. Note that the treatment of the - * EL syntax "#{}" depends on the JSP version in the TLD. - * - * - * @return null, if the attribute is an expression - * otherwise, the literal string for the attribute - */ - private String getLiteral(Node n, String value) { - if (n.getRoot().isXmlSyntax() && value.startsWith("%=")) { - return null; - } - if (!n.getRoot().isXmlSyntax() && value.startsWith("<%=")) { - return null; - } - if (pageInfo.isELIgnored()) { - return value; - } - boolean poundExpressionIgnored = (n instanceof Node.CustomTag) && - ((((Node.CustomTag)n).getJspVersion() < 2.1) || - pageInfo.isDeferredSyntaxAllowedAsLiteral()); - int size = value.length(); - StringBuilder buf = new StringBuilder(size); - char p = ' '; - for (int i = 0; i < size; i++) { - char c = value.charAt(i); - if (p == '$' && c == '{') { - return null; - } - if (p == '#' && c == '{' && !poundExpressionIgnored) { - return null; - } - if (p == '\\') { - if (c == '\\' || c == '$' || - (c == '#' && !poundExpressionIgnored)) { - // If "#{..}" is not recognized as an El expression, - // then "\#" is not an escape sequence. - buf.append(c); - p = ' '; - } else { - buf.append(p).append(c); - p = c; - } - } else { - p = c; - if (p != '\\') { - buf.append(c); - } - } - } - return buf.toString(); - } - - /* - * Throws exception if the value of the attribute with the given - * name in the given node is given as an RT or EL expression, but the - * spec requires a static value. - */ - private void throwErrorIfExpression(Node n, String attrName, - String actionName) - throws JasperException { - if (n.getAttributes() != null - && n.getAttributes().getValue(attrName) != null - && getLiteral(n, n.getAttributes().getValue(attrName))==null) { - err.jspError(n, - "jsp.error.attribute.standard.non_rt_with_expr", - attrName, actionName); - } - } - - /* - * Since the EL engine reconginizes escape sequence for #{ }, literals - * sent to it must be properly escaped, so "#{}" becomes "\#{}", and - * "\#{}" becomes "\\\#{}" etc. - */ - private String escapePound(String value) { - if (value.indexOf("#{") < 0) { - return value; - } - StringBuilder buf = new StringBuilder(value.length() + 2); - for (int i = 0; i < value.length(); i++) { - if (value.charAt(i) == '#') { - if (((i+1) < value.length()) && (value.charAt(i+1) == '{')){ - if (((i-1) >= 0) && (value.charAt(i-1) == '\\')) { - buf.append('\\'); - } - buf.append('\\'); - } - } - buf.append(value.charAt(i)); - } - return buf.toString(); - } - - private static class NamedAttributeVisitor extends Node.Visitor { - private boolean hasDynamicContent; - - public void doVisit(Node n) throws JasperException { - if (!(n instanceof Node.JspText) - && !(n instanceof Node.TemplateText)) { - hasDynamicContent = true; - } - visitBody(n); - } - - public boolean hasDynamicContent() { - return hasDynamicContent; - } - } - - private String findUri(String prefix, Node n) { - - for (Node p = n; p != null; p = p.getParent()) { - Attributes attrs = p.getTaglibAttributes(); - if (attrs == null) { - continue; - } - for (int i = 0; i < attrs.getLength(); i++) { - String name = attrs.getQName(i); - int k = name.indexOf(':'); - if (prefix == null && k < 0) { - // prefix not specified and a default ns found - return attrs.getValue(i); - } - if (prefix != null && k >= 0 && - prefix.equals(name.substring(k+1))) { - return attrs.getValue(i); - } - } - } - return null; - } - - /** - * Validate functions in EL expressions - */ - private void validateFunctions(ELNode.Nodes el, Node n) - throws JasperException { - - class FVVisitor extends ELNode.Visitor { - - Node n; - - FVVisitor(Node n) { - this.n = n; - } - - public void visit(ELNode.Function func) throws JasperException { - String prefix = func.getPrefix(); - String function = func.getName(); - String uri = null; - - if (n.getRoot().isXmlSyntax()) { - uri = findUri(prefix, n); - } else if (prefix != null) { - uri = pageInfo.getURI(prefix); - } - - if (uri == null) { - if (prefix == null) { - // in EL 3.0, this can be a lambda expression call. - return; - /* - err.jspError(n, "jsp.error.noFunctionPrefix", - function); - */ - } - else { - err.jspError(n, - "jsp.error.attribute.invalidPrefix", prefix); - } - } - TagLibraryInfo taglib = pageInfo.getTaglib(uri); - FunctionInfo funcInfo = null; - if (taglib != null) { - funcInfo = taglib.getFunction(function); - } - if (funcInfo == null) { - err.jspError(n, "jsp.error.noFunction", function); - } - // Skip TLD function uniqueness check. Done by Schema ? - func.setUri(uri); - func.setFunctionInfo(funcInfo); - processSignature(func); - } - } - - el.visit(new FVVisitor(n)); - } - - private void processSignature(ELNode.Function func) - throws JasperException { - FunctionInfo funcInfo = func.getFunctionInfo(); - String signature = funcInfo.getFunctionSignature(); - func.setMethodName(getMethod(signature)); - func.setParameters(getParameters(signature)); - } - - /** - * Get the return type from the signature. - */ - private String getReturnType(String signature) - throws JasperException { - - int start = signature.indexOf(' '); - if (start < 0) { - err.jspError("jsp.error.tld.invalid.signature", signature); - } - return signature.substring(0, start); - } - - /** - * Get the method name from the signature. - */ - private String getMethod(String signature) - throws JasperException { - - int start = signature.indexOf(' '); - if (start < 0) { - err.jspError("jsp.error.tld.invalid.signature", signature); - } - int end = signature.indexOf('('); - if (end < 0) { - err.jspError("jsp.error.tld.invalid.signature", signature); - } - return signature.substring(start+1, end).trim(); - } - - /** - * Get the parameters types from the function signature. - * @return An array of parameter class names - */ - private String[] getParameters(String signature) - throws JasperException { - - ArrayList params = new ArrayList(); - // Signature is of the form - // S ( ',' )* )? ')' - int start = signature.indexOf('(') + 1; - boolean lastArg = false; - while (true) { - int p = signature.indexOf(',', start); - if (p < 0) { - p = signature.indexOf(')', start); - if (p < 0) { - err.jspError("jsp.error.tld.invalid.signature", signature); - } - lastArg = true; - } - String arg = signature.substring(start, p).trim(); - if (!"".equals(arg)) { - params.add(arg); - } - if (lastArg) { - break; - } - start = p+1; - } - return params.toArray(new String[params.size()]); - } - - private FunctionMapper getFunctionMapper(ELNode.Nodes el) - throws JasperException { - - class ValidateFunctionMapper extends FunctionMapper { - - private HashMap fnmap = - new HashMap(); - public void mapFunction(String fnQName, Method method) { - fnmap.put(fnQName, method); - } - - public Method resolveFunction(String prefix, - String localName) { - return (Method) this.fnmap.get(prefix + ":" + localName); - } - } - - class MapperELVisitor extends ELNode.Visitor { - ValidateFunctionMapper fmapper; - - MapperELVisitor(ValidateFunctionMapper fmapper) { - this.fmapper = fmapper; - } - - public void visit(ELNode.Function n) throws JasperException { - - if (n.getUri() == null) { - // Can be a lambda expression call - return; - } - Class c = null; - Method method = null; - try { - c = loader.loadClass( - n.getFunctionInfo().getFunctionClass()); - } catch (ClassNotFoundException e) { - err.jspError("jsp.error.function.classnotfound", - n.getFunctionInfo().getFunctionClass(), - n.getPrefix() + ':' + n.getName(), - e.getMessage()); - } - String paramTypes[] = n.getParameters(); - int size = paramTypes.length; - Class params[] = new Class[size]; - int i = 0; - try { - for (i = 0; i < size; i++) { - params[i] = JspUtil.toClass(paramTypes[i], loader); - } - method = c.getDeclaredMethod(n.getMethodName(), - params); - } catch (ClassNotFoundException e) { - err.jspError("jsp.error.signature.classnotfound", - paramTypes[i], - n.getPrefix() + ':' + n.getName(), - e.getMessage()); - } catch (NoSuchMethodException e ) { - err.jspError("jsp.error.noFunctionMethod", - n.getMethodName(), n.getName(), - c.getName()); - } - // Make sure that this method is public - if (! Modifier.isPublic(method.getModifiers())) { - err.jspError("jsp.error.nonPublicFunction", - c.getName() + '.' + method.getName()); - } - // Make sure that this method is static - if (! Modifier.isStatic(method.getModifiers())) { - err.jspError("jsp.error.nonStaticFunction", - c.getName() + '.' + method.getName()); - } - fmapper.mapFunction(n.getPrefix() + ':' + n.getName(), - method); - } - } - - ValidateFunctionMapper fmapper = new ValidateFunctionMapper(); - el.visit(new MapperELVisitor(fmapper)); - return fmapper; - } - } // End of ValidateVisitor - - /** - * A visitor for validating TagExtraInfo classes of all tags - */ - static class TagExtraInfoVisitor extends Node.Visitor { - - private ErrorDispatcher err; - - /* - * Constructor - */ - TagExtraInfoVisitor(Compiler compiler) { - this.err = compiler.getErrorDispatcher(); - } - - public void visit(Node.CustomTag n) throws JasperException { - TagInfo tagInfo = n.getTagInfo(); - if (tagInfo == null) { - err.jspError(n, "jsp.error.missing.tagInfo", n.getQName()); - } - - ValidationMessage[] errors = tagInfo.validate(n.getTagData()); - if (errors != null && errors.length != 0) { - StringBuilder errMsg = new StringBuilder(); - errMsg.append("

    "); - errMsg.append(Localizer.getMessage("jsp.error.tei.invalid.attributes", - n.getQName())); - errMsg.append("

    "); - for (int i=0; i"); - if (errors[i].getId() != null) { - errMsg.append(errors[i].getId()); - errMsg.append(": "); - } - errMsg.append(errors[i].getMessage()); - errMsg.append("

    "); - } - - err.jspError(n, errMsg.toString()); - } - - visitBody(n); - } - } - - public static void validate(Compiler compiler, - Node.Nodes page) throws JasperException { - - /* - * Visit the page/tag directives first, as they are global to the page - * and are position independent. - */ - page.visit(new DirectiveVisitor(compiler)); - - PageInfo pageInfo = compiler.getPageInfo(); - - JspCompilationContext ctxt = compiler.getCompilationContext(); - JspConfig jspConfig = ctxt.getOptions().getJspConfig(); - JspProperty jspProperty = jspConfig.findJspProperty(ctxt.getJspFile()); - - // If the buffer size is not specified in a page directive, use the - // default buffer specified in jsp config property - if (pageInfo.getBufferValue() == null && - jspProperty.getBuffer() != null) { - pageInfo.setBufferValue(jspProperty.getBuffer(), null, - compiler.getErrorDispatcher()); - } - - // Determine the default output content type - String contentType = pageInfo.getContentType(); - - // If the contentType is not specified in a page directive, use the - // contentType specified in a jsp config property - if (contentType == null) { - contentType = jspProperty.getDefaultContentType(); - } - - if (contentType == null || contentType.indexOf("charset=") < 0) { - boolean isXml = page.getRoot().isXmlSyntax(); - String defaultType; - if (contentType == null) { - defaultType = isXml? "text/xml": "text/html"; - } else { - defaultType = contentType; - } - - String charset = null; - if (isXml) { - charset = "UTF-8"; - } else { - if (!page.getRoot().isDefaultPageEncoding()) { - charset = page.getRoot().getPageEncoding(); - } - } - - if (charset != null) { - pageInfo.setContentType(defaultType + ";charset=" + charset); - } else { - pageInfo.setContentType(defaultType); - } - } - - /* - * Validate all other nodes. - * This validation step includes checking a custom tag's mandatory and - * optional attributes against information in the TLD (first validation - * step for custom tags according to JSP.10.5). - */ - page.visit(new ValidateVisitor(compiler)); - - /* - * Invoke TagLibraryValidator classes of all imported tags - * (second validation step for custom tags according to JSP.10.5). - */ - validateXmlView(new PageDataImpl(page, compiler), compiler); - - /* - * Invoke TagExtraInfo method isValid() for all imported tags - * (third validation step for custom tags according to JSP.10.5). - */ - page.visit(new TagExtraInfoVisitor(compiler)); - - } - - - //********************************************************************* - // Private (utility) methods - - /** - * Validate XML view against the TagLibraryValidator classes of all - * imported tag libraries. - */ - private static void validateXmlView(PageData xmlView, Compiler compiler) - throws JasperException { - - StringBuilder errMsg = null; - ErrorDispatcher errDisp = compiler.getErrorDispatcher(); - - for (Iterator iter = - compiler.getPageInfo().getTaglibs().iterator(); - iter.hasNext(); ) { - - TagLibraryInfo o = iter.next(); - if (!(o instanceof TagLibraryInfoImpl)) - continue; - TagLibraryInfoImpl tli = (TagLibraryInfoImpl) o; - - ValidationMessage[] errors = tli.validate(xmlView); - if ((errors != null) && (errors.length != 0)) { - if (errMsg == null) { - errMsg = new StringBuilder(); - } - errMsg.append("

    "); - errMsg.append(Localizer.getMessage("jsp.error.tlv.invalid.page", - tli.getShortName())); - errMsg.append("

    "); - for (int i=0; i"); - errMsg.append(errors[i].getId()); - errMsg.append(": "); - errMsg.append(errors[i].getMessage()); - errMsg.append("

    "); - } - } - } - } - - if (errMsg != null) { - errDisp.jspError(errMsg.toString()); - } - } -} - diff --git a/impl/src/main/java/org/apache/jasper/compiler/tagplugin/TagPlugin.java b/impl/src/main/java/org/apache/jasper/compiler/tagplugin/TagPlugin.java deleted file mode 100644 index 66eaadb..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/tagplugin/TagPlugin.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler.tagplugin; - -/** - * This interface is to be implemented by the plugin author, to supply - * an alternate implementation of the tag handlers. It can be used to - * specify the Java codes to be generated when a tag is invoked. - * - * An implementation of this interface must be registered in a file - * named "tagPlugins.xml" under WEB-INF. - */ - -public interface TagPlugin { - - /** - * Generate codes for a custom tag. - * @param ctxt a TagPluginContext for accessing Jasper functions - */ - void doTag(TagPluginContext ctxt); -} - diff --git a/impl/src/main/java/org/apache/jasper/compiler/tagplugin/TagPluginContext.java b/impl/src/main/java/org/apache/jasper/compiler/tagplugin/TagPluginContext.java deleted file mode 100644 index 17cabd7..0000000 --- a/impl/src/main/java/org/apache/jasper/compiler/tagplugin/TagPluginContext.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.compiler.tagplugin; - -import org.apache.jasper.compiler.ServletWriter; - -/** - * This interface allows the plugin author to make inqueries about the - * properties of the current tag, and to use Jasper resources to generate - * direct Java codes in place of tag handler invocations. - */ - -public interface TagPluginContext { - /** - * @return true if the body of the tag is scriptless. - */ - boolean isScriptless(); - - /** - * @param attribute Name of the attribute - * @return true if the attribute is specified in the tag - */ - boolean isAttributeSpecified(String attribute); - - /** - * @return An unique temporary variable name that the plugin can use. - */ - String getTemporaryVariableName(); - - /** - * Generate an import statement - * @param s Name of the import class, '*' allowed. - */ - void generateImport(String s); - - /** - * Generate a declaration in the of the generated class. This can be - * used to declare an innter class, a method, or a class variable. - * @param id An unique ID identifying the declaration. It is not - * part of the declaration, and is used to ensure that the - * declaration will only appear once. If this method is - * invoked with the same id more than once in the translation - * unit, only the first declaration will be taken. - * @param text The text of the declaration. - **/ - void generateDeclaration(String id, String text); - - /** - * Generate Java source codes - */ - void generateJavaSource(String s); - - /** - * @return true if the attribute is specified and its value is a - * translation-time constant. - */ - boolean isConstantAttribute(String attribute); - - /** - * @return A string that is the value of a constant attribute. Undefined - * if the attribute is not a (translation-time) constant. - * null if the attribute is not specified. - */ - String getConstantAttribute(String attribute); - - /** - * Generate codesto evaluate value of a attribute in the custom tag - * The codes is a Java expression. - * NOTE: Currently cannot handle attributes that are fragments. - * @param attribute The specified attribute - */ - void generateAttribute(String attribute); - - /* - * Generate codes for the body of the custom tag - */ - void generateBody(); - - /** - * Abandon optimization for this tag handler, and instruct - * Jasper to generate the tag handler calls, as usual. - * Should be invoked if errors are detected, or when the tag body - * is deemed too compilicated for optimization. - */ - void dontUseTagPlugin(); - - /** - * Get the PluginContext for the parent of this custom tag. NOTE: - * The operations available for PluginContext so obtained is limited - * to getPluginAttribute and setPluginAttribute, and queries (e.g. - * isScriptless(). There should be no calls to generate*(). - * @return The pluginContext for the parent node. - * null if the parent is not a custom tag, or if the pluginConxt - * if not available (because useTagPlugin is false, e.g). - */ - TagPluginContext getParentContext(); - - /** - * Associate the attribute with a value in the current tagplugin context. - * The plugin attributes can be used for communication among tags that - * must work together as a group. See for an example. - */ - void setPluginAttribute(String attr, Object value); - - /** - * Get the value of an attribute in the current tagplugin context. - */ - Object getPluginAttribute(String attr); -} - diff --git a/impl/src/main/java/org/apache/jasper/resources/messages.properties b/impl/src/main/java/org/apache/jasper/resources/messages.properties deleted file mode 100644 index 725e5ee..0000000 --- a/impl/src/main/java/org/apache/jasper/resources/messages.properties +++ /dev/null @@ -1,512 +0,0 @@ -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. -# -# Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. -# -# The contents of this file are subject to the terms of either the GNU -# General Public License Version 2 only ("GPL") or the Common Development -# and Distribution License("CDDL") (collectively, the "License"). You -# may not use this file except in compliance with the License. You can -# obtain a copy of the License at -# https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html -# or packager/legal/LICENSE.txt. See the License for the specific -# language governing permissions and limitations under the License. -# -# When distributing the software, include this License Header Notice in each -# file and include the License file at packager/legal/LICENSE.txt. -# -# GPL Classpath Exception: -# Oracle designates this particular file as subject to the "Classpath" -# exception as provided by Oracle in the GPL Version 2 section of the License -# file that accompanied this code. -# -# Modifications: -# If applicable, add the following below the License Header, with the fields -# enclosed by brackets [] replaced by your own identifying information: -# "Portions Copyright [year] [name of copyright owner]" -# -# Contributor(s): -# If you wish your version of this file to be governed by only the CDDL or -# only the GPL Version 2, indicate your decision by adding "[Contributor] -# elects to include this software in this distribution under the [CDDL or GPL -# Version 2] license." If you don't indicate a single choice of license, a -# recipient has the option to distribute your version of this file under -# either the CDDL, the GPL Version 2 or to extend the choice of license to -# its licensees as provided above. However, if you add GPL Version 2 code -# and therefore, elected the GPL Version 2 license, then the option applies -# only if the new code is made subject to such option by the copyright -# holder. -# -# -# This file incorporates work covered by the following copyright and -# permission notice: -# -# Copyright 2004 The Apache Software Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# Message IDs reserved for this file: PWC5960-PWC6599 -# -# $Id: messages.properties,v 1.48 2007/05/05 05:32:53 tcfujii Exp $ -# -# Default localized string information -# Localized this the Default Locale as is en_US - -jsp.error.bad.servlet.engine=PWC5960: Incorrect servlet engine version! -jsp.error.no.scratch.dir=PWC5961: The JSP engine is not configured with a scratch dir.\ -\n Please add \"jsp.initparams=scratchdir=\" \ -\n in the servlets.properties file for this context. -jsp.error.bad.scratch.dir=PWC5963: The scratchDir you specified: {0} is unusable. -jsp.message.scratch.dir.is=PWC5964: Scratch dir for the JSP engine is: {0} -jsp.message.parent_class_loader_is=PWC5965: Parent class loader is: {0} -jsp.message.dont.modify.servlets=PWC5966: IMPORTANT: Do not modify the generated servlets -jsp.error.not.impl.comments=PWC5967: Internal error: Comments not implemented -jsp.error.not.impl.directives=PWC5968: Internal error: Directives not implemented -jsp.error.not.impl.declarations=PWC5969: Internal error: Declarations not implemented -jsp.error.not.impl.expressions=PWC5970: Internal error: Expressions not implemented -jsp.error.not.impl.scriptlets=PWC5971: Internal error: Scriptlets not implemented -jsp.error.not.impl.usebean=PWC5972: Internal error: useBean not implemented -jsp.error.not.impl.getp=PWC5973: Internal error: getProperty not implemented -jsp.error.not.impl.setp=PWC5974: Internal error: setProperty not implemented -jsp.error.not.impl.plugin=PWC5975: Internal error: plug-in not implemented -jsp.error.not.impl.forward=PWC5976: Internal error: forward not implemented -jsp.error.not.impl.include=PWC5977: Internal error: include not implemented -# By intention, the following message doesn't have an ID. Http status message -# should not include a message ID. -jsp.error.unavailable=JSP has been marked unavailable -jsp.error.usebean.missingType=PWC5979: useBean: Either class or type attribute must be specified -jsp.error.usebean.duplicate=PWC5980: useBean: Duplicate bean name: {0} -jsp.error.usebean.notBoth=PWC5981: useBean: Can't specify both class and beanName attributes -jsp.error.usebean.noSession=PWC5982: useBean: Illegal for useBean to use session scope when JSP page declares (via page directive) that it does not participate in sessions -jsp.error.invalid.scope=PWC5983: Illegal value of ''scope'' attribute: {0} (must be one of \"page\", \"request\", \"session\", or \"application\") -jsp.error.classname=PWC5984: Can't determine classname from .class file -jsp.warning.bad.type=PWC5985: Bad type in .class file -jsp.error.data.file.write=PWC5986: Error while writing data file -jsp.error.page.invalid.buffer=PWC5987: Page directive: invalid buffer size -jsp.error.page.conflict.contenttype=PWC5988: Page directive: illegal to have multiple occurrences of ''contentType'' with different values (old: {0}, new: {1}) -jsp.error.page.invalid.contenttype=PWC5989: Page directive: invalid value for contentType -jsp.error.page.conflict.session=PWC5990: Page directive: illegal to have multiple occurrences of ''session'' with different values (old: {0}, new: {1}) -jsp.error.page.invalid.session=PWC5991: Page directive: invalid value for session -jsp.error.page.conflict.buffer=PWC5992: Page directive: illegal to have multiple occurrences of ''buffer'' with different values (old: {0}, new: {1}) -jsp.error.page.invalid.buffer=PWC5993: Page directive: invalid value for buffer -jsp.error.page.conflict.autoflush=PWC5994: Page directive: illegal to have multiple occurrences of ''autoFlush'' with different values (old: {0}, new: {1}) -jsp.error.page.invalid.autoflush=PWC5995: Page directive: invalid value for autoFlush -jsp.error.page.conflict.isthreadsafe=PWC5996: Page directive: illegal to have multiple occurrences of ''isThreadSafe'' with different values (old: {0}, new: {1}) -jsp.error.page.invalid.isthreadsafe=PWC5997: Page directive: invalid value for isThreadSafe -jsp.error.page.conflict.info=PWC5998: Page directive: illegal to have multiple occurrences of ''info'' with different values (old: {0}, new: {1}) -jsp.error.page.invalid.info=PWC5999: Page directive: invalid value for info -jsp.error.page.conflict.iserrorpage=PWC6000: Page directive: illegal to have multiple occurrences of ''isErrorPage'' with different values (old: {0}, new: {1}) -jsp.error.page.invalid.iserrorpage=PWC6001: Page directive: invalid value for isErrorPage -jsp.error.page.conflict.errorpage=PWC6002: Page directive: illegal to have multiple occurrences of ''errorPage'' with different values (old: {0}, new: {1}) -jsp.error.page.conflict.language=PWC6003: Page directive: illegal to have multiple occurrences of ''language'' with different values (old: {0}, new: {1}) -jsp.error.tag.conflict.language=PWC6004: Tag directive: illegal to have multiple occurrences of ''language'' with different values (old: {0}, new: {1}) -jsp.error.page.language.nonjava=PWC6005: Page directive: invalid language attribute -jsp.error.tag.language.nonjava=PWC6006: Tag directive: invalid language attribute -jsp.error.page.defafteruse.language=PWC6007: Page directive: can't define language after a scriptlet -jsp.error.page.nomapping.language=PWC6008: Page directive: No mapping for language: -jsp.error.page.conflict.extends=PWC6009: Page directive: illegal to have multiple occurrences of ''extends'' with different values (old: {0}, new: {1}) -jsp.error.page.conflict.iselignored=PWC6010: Page directive: illegal to have multiple occurrences of ''isELIgnored'' with different values (old: {0}, new: {1}) -jsp.error.tag.conflict.iselignored=PWC6011: Tag directive: illegal to have multiple occurrences of ''isELIgnored'' with different values (old: {0}, new: {1}) -jsp.error.page.invalid.iselignored=PWC6012: Page directive: invalid value for isELIgnored -jsp.error.tag.invalid.iselignored=PWC6013: Tag directive: invalid value for isELIgnored -jsp.error.page.multi.pageencoding=PWC6014: Page directive must not have multiple occurrences of pageEncoding -jsp.error.tag.conflict.attr=PWC6015: Tag directive: illegal to have multiple occurrences of the attribute \"{0}\" with different values (old: {1}, new: {2}) -jsp.error.tag.multi.pageencoding=PWC6016: Tag directive must not have multiple occurrences of pageEncoding -jsp.error.page.bad_b_and_a_combo=PWC6017: Page directive: Illegal combination of buffer=\"none\" && autoFlush=\"false\" -jsp.error.not.impl.taglib=PWC6018: Internal error: Tag extensions not implemented -jsp.error.include.missing.file=PWC6019: Missing file argument to include -jsp.error.include.bad.file=PWC6020: Bad file argument to include -jsp.error.include.exception=PWC6021: Unable to include {0} -jsp.error.stream.closed=PWC6022: Stream closed -jsp.error.invalid.forward=PWC6023: Invalid forward tag -jsp.error.unknownException=PWC6024: Unhandled error! You might want to consider having an error page \ -to report such errors more gracefully -jsp.error.invalid.directive=PWC6025: Invalid directive: {0} -jsp.error.directive.istagfile=PWC6026: {0} directive cannot be used in a tag file -jsp.error.directive.isnottagfile=PWC6027: {0} directive can only be used in a tag file -jsp.error.tagfile.tld.name=PWC6028: The \"name\" attribute of the tag directive has a value {0} while the \"name\" tag of the \"tag-file\" element in the TLD is {1} -jsp.error.action.istagfile=PWC6029: {0} action cannot be used in a tag file -jsp.error.action.isnottagfile=PWC6030: {0} action can be used in tag files only -jsp.error.unterminated=PWC6031: Unterminated {0} tag -jsp.error.loadclass.taghandler=PWC6032: Unable to load tag handler class \"{0}\" for tag \"{1}\" -jsp.error.unable.compile=PWC6033: Error in Javac compilation for JSP -jsp.error.unable.load=PWC6034: Unable to load class for JSP -jsp.error.unable.rename=PWC6035: Unable to rename class file {0} to {1} -jsp.error.mandatory.attribute=PWC6036: {0}: Mandatory attribute {1} missing -jsp.engine.info=Jasper JSP 2.1 Engine -jsp.error.invalid.expression=PWC6038: "{0}" contains invalid expression(s): {1} -jsp.error.invalid.attribute=PWC6039: {0} has invalid attribute: {1} -jsp.error.file.cannot.read=PWC6040: Cannot read file: {0} -jsp.error.file.already.registered=PWC6041: Recursive include of file {0} -jsp.error.file.not.registered=PWC6042: file {0} not seen in include -jsp.error.quotes.unterminated=PWC6043: Unterminated quotes -jsp.error.attr.quoted=PWC6044: Attribute value should be quoted -jsp.error.attr.novalue=PWC6045: Attribute {0} has no value -jsp.error.tag.attr.unterminated=PWC6046: Unterminated tag attribute list -jsp.error.param.noname=PWC6047: No name in PARAM tag -jsp.error.param.novalue=PWC6048: No value in PARAM tag -jsp.error.beans.nullbean=PWC6049: Attempted a bean operation on a null object. -jsp.error.beans.nobeaninfo=PWC6050: No BeanInfo for the bean of type ''{0}'' could be found, the class likely does not exist. -jsp.error.beans.introspection=PWC6051: An exception occurred while introspecting the read method of property ''{0}'' in a bean of type ''{1}'':\n{2} -jsp.error.beans.nomethod=PWC6052: Cannot find a method to read property ''{0}'' in a bean of type ''{1}'' -jsp.error.beans.nomethod.setproperty=PWC6053: Can''t find a method to write property ''{0}'' of type ''{1}'' in a bean of type ''{2}'' -jsp.error.beans.noproperty=PWC6054: Cannot find any information on property ''{0}'' in a bean of type ''{1}'' -jsp.error.beans.setproperty.noindexset=PWC6055: Cannot set indexed property -jsp.error.include.tag=PWC6056: Invalid jsp:include tag -jsp.error.include.noflush=PWC6057: jsp:include needs to have \"flush=true\" -jsp.error.include.badflush=PWC6058: jsp:include page=\"...\" flush=\"true\" is the only valid combination in JSP 1.0 -jsp.error.attempt_to_clear_flushed_buffer=PWC6059: Error: Attempt to clear a buffer that's already been flushed -jsp.error.overflow=PWC6060: Error: JSP Buffer overflow -jsp.error.paramexpected=PWC6061: Expecting \"jsp:param\" standard action with \"name\" and \"value\" attributes -jsp.error.param.invalidUse=PWC6062: The jsp:param action must not be used outside the jsp:include, jsp:forward, or jsp:params elements -jsp.error.params.invalidUse=PWC6063: jsp:params must be a direct child of jsp:plugin -jsp.error.fallback.invalidUse=PWC6064: jsp:fallback must be a direct child of jsp:plugin -jsp.error.namedAttribute.invalidUse=PWC6065: jsp:attribute must be the subelement of a standard or custom action -jsp.error.jspbody.invalidUse=PWC6066: jsp:body must be the subelement of a standard or custom action -jsp.error.closeindividualparam=PWC6067: param tag needs to be closed with \"/>\" -jsp.error.closeparams=PWC6068: param tag needs to be closed with /params -jsp.error.params.emptyBody=PWC6069: jsp:params must contain at least one nested jsp:param -jsp.error.params.illegalChild=PWC6070: jsp:params must not have any nested elements other than jsp:param -jsp.error.plugin.notype=PWC6071: type not declared in jsp:plugin -jsp.error.plugin.badtype=PWC6072: Illegal value for 'type' attribute in jsp:plugin: must be 'bean' or 'applet' -jsp.error.plugin.nocode=PWC6073: code not declared in jsp:plugin -jsp.error.ise_on_clear=PWC6074: Illegal to clear() when buffer size == 0 -jsp.error.setproperty.beanNotFound=PWC6075: setProperty: Bean {0} not found -jsp.error.getproperty.beanNotFound=PWC6076: getProperty: Bean {0} not found -jsp.error.setproperty.ClassNotFound=PWC6077: setProperty: Class {0} not found -jsp.error.setproperty.invalidSyntax=PWC6078: setProperty: can't have non-null value when property=* -jsp.error.setproperty.beanInfoNotFound=PWC6079: setProperty: beanInfo for bean {0} not found -jsp.error.setproperty.paramOrValue=PWC6080: setProperty: either param or value can be present -jsp.error.setproperty.arrayVal=PWC6081: setProperty: can''t set array property {0} through a string constant value -jsp.warning.reloadInterval=PWC6084: Invalid value for the initParam reloadInterval. Using default of \"0\" -jsp.warning.unsupportedJavaCompiler=PWC6085: Unsupported compiler ({0}), using default -jsp.warning.initialCapacity=PWC6086: Invalid value {0} specified for initial-capacity of HashMap for compiled JSPs. Using default value of {1} -jsp.warning.usePrecompiled=PWC6087: Invalid value for the initParam usePrecompiled. Will use the default value of \"false\" -jsp.warning.invalidTagPoolSize=PWC6089: Invalid value for the init parameter named tagPoolSize. Will use default size of {0} -jsp.warning.checkInterval=PWC6093: Invalid value for the initParam checkInterval. Will use the default value of \"0\" seconds -jsp.warning.modificationTestInterval=PWC6094: Invalid value for the initParam modificationTestInterval. Will use the default value of \"0\" seconds -jsp.error.badtaglib=PWC6101: Unable to open taglibrary {0} : {1} -jsp.error.badGetReader=PWC6102: Cannot create a reader when the stream is not buffered -jsp.error.unknown.element.in.taglib=PWC6103: Unknown element ({0}) in taglib -jsp.error.unknown.element.in.tag=PWC6104: Unknown element ({0}) in tag -jsp.error.unknown.element.in.tagfile=PWC6105: Unknown element ({0}) in tag-file -jsp.error.unknown.element.in.attribute=PWC6106: Unknown element ({0}) in attribute -jsp.error.unknown.element.in.variable=PWC6107: Unknown element ({0}) in variable -jsp.error.unknown.element.in.validator=PWC6108: Unknown element ({0}) in validator -jsp.error.unknown.element.in.initParam=PWC6109: Unknown element ({0}) in validator''s init-param -jsp.error.unknown.element.in.function=PWC6110: Unknown element ({0}) in function -jsp.error.more.than.one.taglib=PWC6111: More than one taglib in the TLD: {0} -jsp.error.teiclass.instantiation=PWC6112: Failed to load or instantiate TagExtraInfo class: {0} -jsp.error.non_null_tei_and_var_subelems=PWC6113: Tag {0} has one or more variable subelements and a TagExtraInfo class that returns one or more VariableInfo -jsp.error.parse.error.in.TLD=PWC6114: Parse Error in the tag library descriptor: {0} -jsp.error.unable.to.open.TLD=PWC6115: Unable to open the tag library descriptor: {0} -jsp.buffer.size.zero=PWC6116: Buffer size <= 0 -jsp.error.file.not.found=PWC6117: File \"{0}\" not found -jsp.message.copyinguri=PWC6118: Copying {0} into {1} -jsp.message.htmlcomment=PWC6119: \nStripping Comment: \t{0} -jsp.message.handling_directive=PWC6120: \nHandling Directive: {0}\t{1} -jsp.message.handling_plugin=PWC6121: \nPlug-in: {0} -jsp.message.package_name_is=PWC6122: Package name is: {0} -jsp.message.class_name_is=PWC6123: Class name is: {0} -jsp.message.java_file_name_is=PWC6124: Java file name is: {0} -jsp.message.class_file_name_is=PWC6125: Class file name is: {0} -jsp.message.accepted=PWC6126: Accepted {0} at {1} -jsp.message.adding_jar=PWC6127: Adding jar {0} to my classpath -jsp.message.compiling_with=PWC6128: Compiling with: {0} -jsp.message.template_text=PWC6129: template text -jsp.error.missing_attribute=PWC6130: According to the TLD or the tag file, attribute {0} is mandatory for tag {1} -jsp.error.bad_attribute=PWC6131: Attribute {0} invalid for tag {1} according to TLD -jsp.error.tld.unable_to_read=PWC6132: Unable to read TLD \"{1}\" from JAR file \"{0}\": {2} -jsp.error.tld.unable_to_get_jar=PWC6133: Unable to get JAR resource \"{0}\" containing TLD: {1} -jsp.error.tld.missing_jar=PWC6134: Missing JAR resource \"{0}\" containing TLD -jsp.error.webxml_not_found=PWC6135: Could not locate web.xml -jsp.cmd_line.usage=PWC6136: Usage: jsptoservlet [-dd ] [-keepgenerated] \ -<.jsp files> -jsp.message.cp_is=PWC6137: Classpath {0} is: {1} -jsp.error.unable.to_load_taghandler_class=PWC6138: Unable to load tag handler class {0} because of {1} -jsp.error.unable.to_find_method=PWC6139: Unable to find setter method for attribute: {0} -jsp.error.unable.to_convert_string=PWC6140: Unable to convert a String to {0} for attribute {1} -jsp.error.unable.to_introspect=PWC6141: Unable to introspect on tag handler class: {0} because of {1} -jsp.error.bad_tag=PWC6142: No tag \"{0}\" defined in tag library imported with prefix \"{1}\" -jsp.error.xml.bad_tag=PWC6143: No tag \"{0}\" defined in tag library associated with uri \"{1}\" -jsp.error.bad_string_Character=PWC6144: Cannot extract a Character from a zero length array -jsp.error.bad_string_char=PWC6145: Cannot extract a char from a zero length array -jsp.warning.compiler.class.cantcreate=PWC6146: Can''t create an instance of specified compiler plug-in class {0} due to {1}. Will default to Sun Java Compiler. -jsp.warning.compiler.class.notfound=PWC6147: Specified compiler plug-in class {0} not found. Will default to Sun Java Compiler. -jsp.warning.compiler.path.notfound=PWC6148: Specified compiler path {0} not found. Will default to system PATH. -jsp.error.jspc.uriroot_not_dir=PWC6149: The -uriroot option must specify a pre-existing directory -jsp.error.jspc.missingTarget=PWC6150: Missing target: Must specify -webapp or -uriroot, or one or more JSP pages -jsp.error.jspc.no_uriroot=PWC6151: The uriroot is not specified and cannot be located with the specified JSP file(s) -jspc.implicit.uriRoot=PWC6152: uriRoot implicitly set to "{0}" -jspc.usage=Usage: jspc [--] \n\ -where jsp files is\n\ -\ -webapp A directory containing a web-app, whose JSP pages\n\ -\ will be processed recursively\n\ -or any number of\n\ -\ A file to be parsed as a JSP page\n\ -where options include:\n\ -\ -help Print this help message\n\ -\ -v Verbose mode\n\ -\ -d Output Directory (default -Djava.io.tmpdir)\n\ -\ -l Outputs the name of the JSP page upon failure\n\ -\ -s Outputs the name of the JSP page upon success\n\ -\ -p Name of target package (default org.apache.jsp)\n\ -\ -c Name of target class name (only applies to first JSP page)\n\ -\ -mapped Generates separate write() calls for each HTML line in the JSP\n\ -\ -die[#] Generates an error return code (#) on fatal errors (default 1)\n\ -\ -uribase The uri directory compilations should be relative to\n\ -\ (default "/")\n\ -\ -uriroot Same as -webapp\n\ -\ -compile Compiles generated servlets\n\ -\ -genclass Same as -compile\n\ -\ -webinc Creates a partial servlet mappings in the file\n\ -\ -webxml Creates a complete web.xml in the file\n\ -\ -ieplugin Java Plug-in classid for Internet Explorer\n\ -\ -classpath Appends path to java.class.path system property\n\ -\ -xpoweredBy Add X-Powered-By response header\n\ -\ -trimSpaces Trim spaces in template text between actions, directives\n\ -\ -smap Generate SMAP info for JSR45 debugging\n\ -\ -dumpsmap Dump SMAP info for JSR45 debugging into a file\n\ -\ -validate Validate .tld and web.xml files against their schemas and dtds\n\ -\ -compilerSourceVM Provides source compatibility with specified JDK release\n\ -\ \n\ -\ -compilerTargetVM Generates class files for specified VM version\n\ -\ \n\ -\ -ignoreJspFragmentErrors Ignore compilation errors of JSP fragments\n\ -\ -disablePooling Disable custom tag pooling - -jspc.webxml.header=\n\ -\n\ -\n\ -\n -jspc.webxml.footer=\n\ -\n\ -\n -jspc.webinc.header=\n\ -\n -jspc.webinc.footer=\n\ -\n -jspc.webinc.insertEnd= -jspc.webinc.insertStart= -jspc.error.jasperException=PWC6164: error-the file ''{0}'' generated the following parse exception: {1} -jspc.error.generalException=PWC6165: ERROR-the file ''{0}'' generated the following general exception: -jspc.error.fileDoesNotExist=PWC6166: The file argument ''{0}'' does not exist -jspc.error.emptyWebApp=PWC6167: -webapp requires a trailing file argument -jsp.error.library.invalid=PWC6168: JSP page is invalid according to library {0}: {1} -jsp.error.tlvclass.instantiation=PWC6169: Failed to load or instantiate TagLibraryValidator class: {0} -jsp.error.tlv.invalid.page=PWC6170: Validation error messages from TagLibraryValidator for {0} -jsp.error.tei.invalid.attributes=PWC6171: Validation error messages from TagExtraInfo for {0} -jsp.parser.sax.propertynotsupported=PWC6172: SAX property not supported: {0} -jsp.parser.sax.propertynotrecognized=PWC6173: SAX property not recognized: {0} -jsp.parser.sax.featurenotsupported=PWC6174: SAX feature not supported: {0} -jsp.parser.sax.featurenotrecognized=PWC6175: SAX feature not recognized: {0} -jsp.error.no.more.content=PWC6176: End of content reached while more parsing required: tag nesting error? -jsp.error.parse.xml=PWC6177: XML parsing error on file {0} -jsp.error.parse.xml.line=PWC6178: XML parsing error on file {0}: (line {1}, col {2}) -jsp.error.parse.xml.scripting.invalid.body=PWC6179: Body of {0} element must not contain any XML elements -jsp.error.internal.tldinit=PWC6180: Unable to initialize TldScanner -jsp.error.internal.filenotfound=PWC6181: File {0} not found -jsp.error.internal.evaluator_not_found=PWC6182: Internal error: unable to load expression evaluator -jsp.error.parse.xml.invalidPublicId=PWC6183: Invalid PUBLIC ID: {0} -jsp.error.include.flush.invalid.value=PWC6184: Invalid value for the flush attribute: {0} -jsp.error.unsupported.encoding=PWC6185: Unsupported encoding: {0} -tld.error.variableNotAllowed=PWC6186: It is an error for a tag that has one or more variable subelements to have a TagExtraInfo class that returns a non-null object. -jsp.error.tldInWebDotXmlNotFound=PWC6187: Could not locate TLD {1} for URI {0} specified in web.xml -jsp.error.taglibDirective.absUriCannotBeResolved=PWC6188: The absolute uri: {0} cannot be resolved in either web.xml or the jar files deployed with this application -jsp.error.taglibDirective.missing.location=PWC6189: Neither \'uri\' nor \'tagdir\' attribute specified -jsp.error.taglibDirective.both_uri_and_tagdir=PWC6190: Both \'uri\' and \'tagdir\' attributes specified -jsp.error.invalid.tagdir=PWC6191: Tag file directory {0} does not start with \"/WEB-INF/tags\" -jsp.error.unterminated.user.tag=PWC6192: Unterminated user-defined tag: ending tag {0} not found or incorrectly nested -#jspx.error.templateDataNotInJspCdata=Validation Error: Element <{0}> cannot have template data. Template data must be encapsulated within a <jsp:cdata> element. [JSP1.2 PFD section 5.1.9]\nTemplate data in error: {1} -jspx.error.templateDataNotInJspCdata=PWC6193: Validation Error: Element <{0}> cannot have template data. Template data must be encapsulated within a <jsp:text> element. [JSP1.2 PFD section 5.1.9]\nTemplate data in error: {1} -#Error while processing taglib jar file {0}: {1} -jsp.error.taglib.reserved.prefix=PWC6194: The taglib prefix {0} is reserved -jsp.error.invalid.javaEncoding=PWC6195: Invalid java encodings. Tried {0} and then {1}. Both failed. -jsp.error.needAlternateJavaEncoding=PWC6196: Default java encoding {0} is invalid on your java platform. An alternate can be specified via the ''javaEncoding'' parameter of JspServlet. -#Error when compiling, used for jsp line number error messages -jsp.error.single.line.number=PWC6197: An error occurred at line: {0} in the jsp file: {1} -jsp.error.multiple.line.number=PWC6198: \n\nAn error occurred between lines: {0} and {1} in the jsp file: {2}\n\n -jsp.error.corresponding.servlet=PWC6199: Generated servlet error:\n -jsp.error.empty.body.not.allowed=PWC6200: Empty body not allowed for {0} -jsp.error.jspbody.required=PWC6201: Must use jsp:body to specify tag body for {0} if jsp:attribute is used. -jsp.error.jspbody.emptybody.only=PWC6202: The {0} tag can only have jsp:attribute in its body. -jsp.error.no.scriptlets=PWC6203: Scripting elements ( <%!, <jsp:declaration, <%=, <jsp:expression, <%, <jsp:scriptlet ) are disallowed here. -jsp.error.internal.unexpected_node_type=PWC6204: Internal Error: Unexpected node type encountered -jsp.error.tld.fn.invalid.signature=PWC6205: Invalid syntax for function signature in TLD. Tag Library: {0}, Function: {1} -jsp.error.tld.fn.duplicate.name=PWC6206: Duplicate function name {0} in tag library {1} -jsp.error.tld.fn.invalid.signature.commaexpected=PWC6207: Invalid syntax for function signature in TLD. Comma '','' expected. Tag Library: {0}, Function: {1}. -jsp.error.tld.fn.invalid.signature.parenexpected=PWC6208: Invalid syntax for function signature in TLD. Parenthesis ''('' expected. Tag Library: {0}, Function: {1}. -jsp.error.tld.mandatory.element.missing=PWC6209: Mandatory TLD element missing or empty: {0} -jsp.error.dynamic.attributes.not.implemented=PWC6210: The {0} tag declares that it accepts dynamic attributes but does not implement the required interface -jsp.error.nomatching.fragment=PWC6211: Cannot find an attribute directive (with name={0} and fragment=true) prior to the fragment directive. -jsp.error.attribute.noequal=PWC6212: equal symbol expected -jsp.error.attribute.noquote=PWC6213: quote symbol expected -jsp.error.attribute.unterminated=PWC6214: attribute for {0} is not properly terminated -jsp.error.missing.tagInfo=PWC6215: TagInfo object for {0} is missing from TLD -jsp.error.fragmentwithtype=PWC6216: Cannot specify both 'fragment' and 'type' attributes. If 'fragment' is present, 'type' is fixed as 'javax.servlet.jsp.tagext.JspFragment' -jsp.error.fragmentwithrtexprvalue=PWC6217: Cannot specify both 'fragment' and 'rtexprvalue' attributes. If 'fragment' is present, 'rtexprvalue' is fixed as 'true' -jsp.error.fragmentWithDeclareOrScope=PWC6218: Both 'fragment' and 'declare' or 'scope' attributes specified in variable directive -jsp.error.var_and_varReader=PWC6219: Only one of \'var\' or \'varReader\' may be specified -jsp.error.missing_var_or_varReader=PWC6220: Missing \'var\' or \'varReader\' attribute -jsp.warning.bad.urlpattern.propertygroup=PWC6221: Bad value {0} in the url-pattern subelement in web.xml -jsp.error.unknown_attribute_type=PWC6222: Unknown attribute type ({1}) for attribute {0}. -jsp.error.jspelement.missing.name=PWC6223: Mandatory XML-style \'name\' attribute missing -jsp.error.jspAttribute.missing.name=PWC6224: Mandatory XML-style \'name\' attribute missing -jsp.error.xmlns.redefinition.notimplemented=PWC6225: Internal error: Attempt to redefine xmlns:{0}. Redefinition of namespaces is not implemented. -jsp.error.could.not.add.taglibraries=PWC6226: Could not add one or more tag libraries. -jsp.error.duplicate.name.jspattribute=PWC6227: The attribute {0} specified in the standard or custom action also appears as the value of the name attribute in the enclosed jsp:attribute -jsp.error.not.in.template=PWC6228: {0} not allowed in a template text body. -jsp.error.badStandardAction=PWC6229: Invalid standard action -jsp.error.xml.badStandardAction=PWC6230: Invalid standard action: {0} -jsp.error.tagdirective.badbodycontent=PWC6231: Invalid body-content ({0}) in tag directive -jsp.error.simpletag.badbodycontent=PWC6232: The TLD for the class {0} specifies an invalid body-content (JSP) for a SimpleTag. -jsp.error.config_pagedir_encoding_mismatch=PWC6233: Page-encoding specified in jsp-property-group ({0}) is different from that specified in page directive ({1}) -jsp.error.prolog_pagedir_encoding_mismatch=PWC6234: Page-encoding specified in XML prolog ({0}) is different from that specified in page directive ({1}) -jsp.error.prolog_config_encoding_mismatch=PWC6235: Page-encoding specified in XML prolog ({0}) is different from that specified in jsp-property-group ({1}) -jsp.error.attribute.custom.non_rt_with_expr=PWC6236: According to TLD or attribute directive in tag file, attribute {0} does not accept any expressions -jsp.error.attribute.standard.non_rt_with_expr=PWC6237: The {0} attribute of the {1} standard action does not accept any expressions -jsp.error.scripting.variable.missing_name=PWC6238: Unable to determine scripting variable name from attribute {0} -jasper.error.emptybodycontent.nonempty=PWC6239: According to TLD, tag {0} must be empty, but is not -jsp.error.tagfile.nameNotUnique=PWC6240: The value of the {0} attribute of the {1} directive and the value of the {2} attribute of the {3} directive in line {4} are the same. -jsp.error.tagfile.nameFrom.noAttribute=PWC6241: Cannot find an attribute directive with a name attribute with a value \"{0}\", the value of this name-from-attribute attribute. -jsp.error.tagfile.nameFrom.badAttribute=PWC6242: The attribute directive (declared in line {1} and whose name attribute is \"{0}\", the value of this name-from-attribute attribute) must be of type java.lang.String, is \"required\" and not a \"rtexprvalue\". -jsp.error.page.noSession=PWC6243: Cannot access session scope in page that does not participate in any session -jsp.error.xml.encodingByteOrderUnsupported =PWC6244: Given byte order for encoding \"{0}\" is not supported. -jsp.error.xml.encodingDeclInvalid =PWC6245: Invalid encoding name \"{0}\". -jsp.error.xml.encodingDeclRequired =PWC6246: The encoding declaration is required in the text declaration. -jsp.error.xml.morePseudoAttributes =PWC6247: More pseudo attributes is expected. -jsp.error.xml.noMorePseudoAttributes =PWC6248: No more pseudo attributes is allowed. -jsp.error.xml.versionInfoRequired =PWC6249: The version is required in the XML declaration. -jsp.error.xml.xmlDeclUnterminated =PWC6250: The XML declaration must end with \"?>\". -jsp.error.xml.reservedPITarget =PWC6251: The processing instruction target matching \"[xX][mM][lL]\" is not allowed. -jsp.error.xml.spaceRequiredInPI =PWC6252: White space is required between the processing instruction target and data. -jsp.error.xml.invalidCharInContent =PWC6253: An invalid XML character (Unicode: 0x{0}) was found in the element content of the document. -jsp.error.xml.spaceRequiredBeforeStandalone =PWC6254: White space is required before the encoding pseudo attribute in the XML declaration. -jsp.error.xml.sdDeclInvalid =PWC6255: The standalone document declaration value must be \"yes\" or \"no\", not \"{0}\". -jsp.error.xml.invalidCharInPI =PWC6256: An invalid XML character (Unicode: 0x{0}) was found in the processing instruction. -jsp.error.xml.versionNotSupported =PWC6257: XML version \"{0}\" is not supported, only XML 1.0 is supported. -jsp.error.xml.pseudoAttrNameExpected =PWC6258: A pseudo attribute name is expected. -jsp.error.xml.expectedByte =PWC6259: Expected byte {0} of {1}-byte UTF-8 sequence. -jsp.error.xml.invalidByte =PWC6260: Invalid byte {0} of {1}-byte UTF-8 sequence. -jsp.error.xml.operationNotSupported =PWC6261: Operation \"{0}\" not supported by {1} reader. -jsp.error.xml.invalidHighSurrogate =PWC6262: High surrogate bits in UTF-8 sequence must not exceed 0x10 but found 0x{0}. -jsp.error.xml.invalidASCII =PWC6263: Byte \"{0}\" not 7-bit ASCII. -jsp.error.xml.spaceRequiredBeforeEncodingInXMLDecl =PWC6264: White space is required before the encoding pseudo attribute in the XML declaration. -jsp.error.xml.spaceRequiredBeforeEncodingInTextDecl =PWC6265: White space is required before the encoding pseudo attribute in the text declaration. -jsp.error.xml.spaceRequiredBeforeVersionInTextDecl =PWC6266: White space is required before the version pseudo attribute in the text declaration. -jsp.error.xml.spaceRequiredBeforeVersionInXMLDecl =PWC6267: White space is required before the version pseudo attribute in the XML declaration. -jsp.error.xml.eqRequiredInXMLDecl =PWC6268: The '' = '' character must follow \"{0}\" in the XML declaration. -jsp.error.xml.eqRequiredInTextDecl =PWC6269: The '' = '' character must follow \"{0}\" in the text declaration. -jsp.error.xml.quoteRequiredInTextDecl =PWC6270: The value following \"{0}\" in the text declaration must be a quoted string. -jsp.error.xml.quoteRequiredInXMLDecl =PWC6271: The value following \"{0}\" in the XML declaration must be a quoted string. -jsp.error.xml.invalidCharInTextDecl =PWC6272: An invalid XML character (Unicode: 0x{0}) was found in the text declaration. -jsp.error.xml.invalidCharInXMLDecl =PWC6273: An invalid XML character (Unicode: 0x{0}) was found in the XML declaration. -jsp.error.xml.closeQuoteMissingInTextDecl =PWC6274: Closing quote in the value following \"{0}\" in the text declaration is missing. -jsp.error.xml.closeQuoteMissingInXMLDecl =PWC6275: Closing quote in the value following \"{0}\" in the XML declaration is missing. -jsp.error.xml.invalidHighSurrogate =PWC6276: High surrogate bits in UTF-8 sequence must not exceed 0x10 but found 0x{0}. -jsp.error.multiple.jsp =PWC6277: Cannot have multiple specifications of -jsp.error.jspoutput.conflict=PWC6278: <jsp:output>: illegal to have multiple occurrences of \"{0}\" with different values (old: {1}, new: {2}) -jsp.error.jspoutput.doctypenamesystem=PWC6279: <jsp:output>: 'doctype-root-element' and 'doctype-system' attributes must appear together -jsp.error.jspoutput.doctypepulicsystem=PWC6280: <jsp:output>: 'doctype-system' attribute must appear if 'doctype-public' attribute appears -jsp.error.jspoutput.nonemptybody=PWC6281: <jsp:output> must not have a body -jsp.error.jspoutput.invalidUse=PWC6282: <jsp:output> must not be used in standard syntax -jsp.error.attributes.not.allowed =PWC6283: {0} must not have any attributes -jsp.error.tagfile.badSuffix=PWC6284: Missing \".tag\" suffix in tag file path {0} -jsp.error.tagfile.illegalPath=PWC6285: Illegal tag file path: {0}, must start with \"/WEB-INF/tags\" or \"/META-INF/tags\" -jsp.error.plugin.wrongRootElement=PWC6286: Name of root element in {0} different from {1} -jsp.error.attribute.invalidPrefix=PWC6287: The attribute prefix {0} does not correspond to any imported tag library -jsp.error.nested.jspattribute=PWC6288: A jsp:attribute standard action cannot be nested within another jsp:attribute standard action -jsp.error.nested.jspbody=PWC6289: A jsp:body standard action cannot be nested within another jsp:body or jsp:attribute standard action -jsp.error.variable.either.name=PWC6290: Either name-given or name-from-attribute attribute must be specified in a variable directive -jsp.error.variable.both.name=PWC6291: Cannot specify both name-given or name-from-attribute attributes in a variable directive -jsp.error.variable.alias=PWC6292: Both or none of the name-from-attribute and alias attributes must be specified in a variable directive -jsp.error.attribute.null_name=PWC6293: Null attribute name -jsp.error.jsptext.badcontent=PWC6294: \'<\', when appears in the body of <jsp:text>, must be encapsulated within a CDATA -jsp.error.jsproot.version.invalid=PWC6295: Invalid version number: \"{0}\", must be \"1.2\", \"2.0\", or \"2.1\" -jsp.error.noFunctionPrefix=PWC6296: The function {0} must be used with a prefix when a default namespace is not specified -jsp.error.noFunction=PWC6297: The function {0} cannot be located with the specified prefix -jsp.error.noFunctionMethod=PWC6298: Method \"{0}\" for function \"{1}\" not found in class \"{2}\" -jsp.error.function.classnotfound=PWC6299: The class {0} specified in TLD for the function {1} cannot be found: {2} -jsp.error.signature.classnotfound=PWC6300: The class {0} specified in the method signature in TLD for the function {1} cannot be found. {2} -jsp.error.text.has_subelement=PWC6301: <jsp:text> must not have any subelements -jsp.error.data.file.read=PWC6302: Error reading file \"{0}\" -jsp.error.prefix.refined=PWC6303: Attempt to redefine the prefix {0} to {1}, when it was already defined as {2} in the current scope. -jsp.error.nested_jsproot=PWC6304: Nested <jsp:root> -jsp.error.unbalanced.endtag=PWC6305: The end tag \"</{0}\" is unbalanced -jsp.error.invalid.bean=PWC6306: The value for the useBean class attribute {0} is invalid. -jsp.error.prefix.use_before_dcl=PWC6307: The prefix {0} specified in this tag directive has been previously used by an action in file {1} line {2}. -jsp.error.badpath=PWC6308: The path {0} specifies a resouce outside the web application -jspc.illegalCompilerSourceVM=PWC6309: Illegal compilerSourceVM: {0} -jspc.illegalCompilerTargetVM=PWC6310: Illegal compilerTargetVM: {0} -jspc.compilerTargetVMTooHigh=PWC6311: compilerTargetVM {0} too high -jsp.error.invalidBom=PWC6312: Invalid BOM: 0x{0}, must be: 0xFEFF -jsp.error.el.deferred.dollar=PWC6313: According to the TLD, the attribute {0} is a deferred-value or deferred-method, but the specified value contains a $-expression -jsp.error.el.nondeferred.pound=PWC6314: According to the TLD, the attribute {0} is not a deferred-value or deferred-method, but the specified value contains a #-expression -jsp.error.el.method.literal=PWC6315: Cannot use a string literal as a MethodExpression -for the attribute {0} when the the literal cannot be coerced to the return type -specified in the TLD method signature -jsp.error.el.method.type=PWC6316: Cannot load the class {1} specified in the method signature associated with the attribute {0}. Be sure to use fully qualified class names -jsp.error.el.action.pound=PWC6317: The attributes for a standard action or an uninterpreted tag cannot be deferred expressions -jsp.error.deferredvaluewithtype=PWC6318: When both deferredValue and deferredValueType attributes are specified, deferredValue must be true -jsp.error.deferredmethodwithsignature=PWC6319: When both deferredMethod and deferredMethodSignature attributes are specified, deferredMethod must be true -jsp.error.deferredwithtype=PWC6320: The type attribute cannot be used when the tag attribute is a deferredValue or deferredMethod -jsp.error.invalidAttrDirectiveAttrUnless21=PWC6321: {0} attribute directive attribute not supported if JSP version is less than 2.1 -jsp.error.invalidTagDirectiveAttrUnless21=PWC6322: {0} tag directive attribute not supported if JSP version is less than 2.1 -jsp.error.implicitTld.additionalElements=PWC6323: {0} contains element (\"{1}\") other than \"jsp-version\", \"tlib-version\", and \"short-name\" -jsp.error.implicitTld.jspVersion=PWC6324: {0} has JSP version ({1}) that is less than 2.0 -jsp.error.parse.unknownTldSchemaLocation=PWC6325: {0} references invalid schema location: {1} -jsp.warning.dtdValidationNotSupported=PWC6326: Validation of TLDs against DTDs not supported -jsp.error.tagfile.jspVersionMismatch=PWC6327: JSP version {0} in tag file''s <jsp:root> element does not match that of the tag file''s associated taglib ({1}) - -jsp.error.nonPublicFunction=PWC6328: The method {0} is not public -jsp.error.tld.badbodycontent=PWC6329: TLD specifies invalid body-content ({0}) for custom tag {1} -jsp.error.bom_config_encoding_mismatch=PWC6330: Page-encoding specified in BOM ({0}) is different from that specified in jsp-property-group ({1}) -jsp.error.bom_pagedir_encoding_mismatch=PWC6331: Page-encoding specified in BOM ({0}) is different from that specified in page directive ({1}) -jsp.error.bom_tagdir_encoding_mismatch=PWC6332: Page-encoding specified in BOM ({0}) is different from that specified in tag directive ({1}) -jsp.error.page.selfreferencing=PWC6333: Error page \"{0}\" is self-referencing -jsp.error.nonStaticFunction=PWC6334: The method {0} must be static -jsp.error.xmlview.attribute.redefined=PWC6335: Invalid XML view: Attribute {0} with value {1} redefined with different value {2} in the same node -jsp.error.tldinit.tldInWebInfTags=PWC6336: Illegal TLD path {0}, must not start with \"/WEB-INF/tags\" -jsp.warning.boolean=PWC6337: Invalid value for the initParam {0}. Will use the default value of \"{1}\" -jsp.error.beans.property.conversion=PWC6338: Cannot convert \"{0}\" for the attribute {2} of the bean {1}: {3} -jsp.error.setter.none=PWC6339: Cannot find a setter method for the attribute {1} of the tag handler {0} -jsp.error.setter.notobject=PWC6340: According to the TLD, rtexprvalue is true, and deferred-value is specified for the attribute {1} of the tag handler {0}, but the argument for the setter method is not a java.lang.Object -jsp.error.setter.notvalueexpression= PWC6341: According to the TLD, deferred-value is specified for the attribute {1} of the tag handler {0}, but the argument for the setter method is not a javax.el.ValueExpression -jsp.error.setter.notmethodexpression=PWC6342: According to the TLD, deferred-method is specified for the attribute {1} of the tag handler {0}, but the argument for the setter method is not a javax.el.MethodExpression -jsp.error.setter.notequal=PWC6343: The type in the TLD for attribute {1} of the tag handler {0} does not match the argument type of its setter method -jsp.error.unableToCreateOutputWriter=PWC6344: Unable to create output writer for file {0} -jsp.error.nojdk=PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required -jsp.error.jspproperty.invalid.buffer=PWC6346: Invalid buffer size in a jsp-property-group -jsp.error.undeclared.namespace=PWC6347: The prefix {0} must be specified in a taglib directive -jsp.error.beans.propertyeditor.notregistered=PWC6348: Property editor not registered with the PropertyEditorManager -jsp.error.nojavac=PWC6349: Cannot find a java compiler for compilation. If running with JDK 5 or before, Ant or JDT compiler can be used, if the corresponding jars and bridge classes (org.apache.jasper.compiler.AntJavaCompiler or org.apache.jasper.compiler.JDTJavaCompiler) are included -jsp.error.jar.io=PWC6350: In TLD scanning, an IOException occurred during the processing of {0} -jsp.warn.nojar=PWC6351: In TLD scanning, the supplied resource {0} does not exist -jsp.error.javac.exception=PWC6352: Javac exception -jsp.error.javac.env=PWC6353: Env: {0} -jsp.error.compiling=PWC6354: Error occurred while compiling JSP files. -jsp.error.recompile=PWC6355: Exception occurred while recompiling JSP files in the background. -jsp.error.background.compile=PWC6356: Background compilation failed. diff --git a/impl/src/main/java/org/apache/jasper/runtime/BodyContentImpl.java b/impl/src/main/java/org/apache/jasper/runtime/BodyContentImpl.java deleted file mode 100644 index 36856a7..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/BodyContentImpl.java +++ /dev/null @@ -1,655 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import java.io.CharArrayReader; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.Reader; -import java.io.Writer; -import java.io.OutputStreamWriter; -import javax.servlet.ServletResponse; -import javax.servlet.jsp.JspWriter; -import javax.servlet.jsp.tagext.BodyContent; -import org.apache.jasper.Constants; - -/** - * Write text to a character-output stream, buffering characters so as - * to provide for the efficient writing of single characters, arrays, - * and strings. - * - * Provide support for discarding for the output that has been buffered. - * - * @author Rajiv Mordani - * @author Jan Luehe - */ -public class BodyContentImpl extends BodyContent { - - private static final String LINE_SEPARATOR = System.getProperty( - "line.separator"); - - private char[] cb; - private int nextChar; - private boolean closed; - - // Enclosed writer to which any output is written - private Writer writer; - - // See comment in setWriter() - private int bufferSizeSave; - - /** - * Constructor. - */ - public BodyContentImpl(JspWriter enclosingWriter) { - super(enclosingWriter); - bufferSize = Constants.DEFAULT_TAG_BUFFER_SIZE; - cb = new char[bufferSize]; - nextChar = 0; - closed = false; - } - - /** - * Write a single character. - */ - public void write(int c) throws IOException { - if (writer != null) { - writer.write(c); - } else { - ensureOpen(); - if (nextChar >= bufferSize) { - reAllocBuff (1); - } - cb[nextChar++] = (char) c; - } - } - - /** - * Write a portion of an array of characters. - * - *

    Ordinarily this method stores characters from the given array into - * this stream's buffer, flushing the buffer to the underlying stream as - * needed. If the requested length is at least as large as the buffer, - * however, then this method will flush the buffer and write the characters - * directly to the underlying stream. Thus redundant - * DiscardableBufferedWriters will not copy data - * unnecessarily. - * - * @param cbuf A character array - * @param off Offset from which to start reading characters - * @param len Number of characters to write - */ - public void write(char[] cbuf, int off, int len) throws IOException { - if (writer != null) { - writer.write(cbuf, off, len); - } else { - ensureOpen(); - - if ((off < 0) || (off > cbuf.length) || (len < 0) || - ((off + len) > cbuf.length) || ((off + len) < 0)) { - throw new IndexOutOfBoundsException(); - } else if (len == 0) { - return; - } - - if (len >= bufferSize - nextChar) - reAllocBuff (len); - - System.arraycopy(cbuf, off, cb, nextChar, len); - nextChar+=len; - } - } - - /** - * Write an array of characters. This method cannot be inherited from the - * Writer class because it must suppress I/O exceptions. - */ - public void write(char[] buf) throws IOException { - if (writer != null) { - writer.write(buf); - } else { - write(buf, 0, buf.length); - } - } - - /** - * Write a portion of a String. - * - * @param s String to be written - * @param off Offset from which to start reading characters - * @param len Number of characters to be written - */ - public void write(String s, int off, int len) throws IOException { - if (writer != null) { - writer.write(s, off, len); - } else { - ensureOpen(); - if (len >= bufferSize - nextChar) - reAllocBuff(len); - - s.getChars(off, off + len, cb, nextChar); - nextChar += len; - } - } - - /** - * Write a string. This method cannot be inherited from the Writer class - * because it must suppress I/O exceptions. - */ - public void write(String s) throws IOException { - if (writer != null) { - writer.write(s); - } else { - write(s, 0, s.length()); - } - } - - /** - * Write a line separator. The line separator string is defined by the - * system property line.separator, and is not necessarily a single - * newline ('\n') character. - * - * @throws IOException If an I/O error occurs - */ - public void newLine() throws IOException { - if (writer != null) { - writer.write(LINE_SEPARATOR); - } else { - write(LINE_SEPARATOR); - } - } - - /** - * Print a boolean value. The string produced by {@link - * java.lang.String#valueOf(boolean)} is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the {@link - * #write(int)} method. - * - * @param b The boolean to be printed - * @throws IOException - */ - public void print(boolean b) throws IOException { - if (writer != null) { - writer.write(b ? "true" : "false"); - } else { - write(b ? "true" : "false"); - } - } - - /** - * Print a character. The character is translated into one or more bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the {@link - * #write(int)} method. - * - * @param c The char to be printed - * @throws IOException - */ - public void print(char c) throws IOException { - if (writer != null) { - writer.write(String.valueOf(c)); - } else { - write(String.valueOf(c)); - } - } - - /** - * Print an integer. The string produced by {@link - * java.lang.String#valueOf(int)} is translated into bytes according - * to the platform's default character encoding, and these bytes are - * written in exactly the manner of the {@link #write(int)} - * method. - * - * @param i The int to be printed - * @throws IOException - */ - public void print(int i) throws IOException { - if (writer != null) { - writer.write(String.valueOf(i)); - } else { - write(String.valueOf(i)); - } - } - - /** - * Print a long integer. The string produced by {@link - * java.lang.String#valueOf(long)} is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the - * {@link #write(int)} method. - * - * @param l The long to be printed - * @throws IOException - */ - public void print(long l) throws IOException { - if (writer != null) { - writer.write(String.valueOf(l)); - } else { - write(String.valueOf(l)); - } - } - - /** - * Print a floating-point number. The string produced by {@link - * java.lang.String#valueOf(float)} is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the - * {@link #write(int)} method. - * - * @param f The float to be printed - * @throws IOException - */ - public void print(float f) throws IOException { - if (writer != null) { - writer.write(String.valueOf(f)); - } else { - write(String.valueOf(f)); - } - } - - /** - * Print a double-precision floating-point number. The string produced by - * {@link java.lang.String#valueOf(double)} is translated into - * bytes according to the platform's default character encoding, and these - * bytes are written in exactly the manner of the {@link - * #write(int)} method. - * - * @param d The double to be printed - * @throws IOException - */ - public void print(double d) throws IOException { - if (writer != null) { - writer.write(String.valueOf(d)); - } else { - write(String.valueOf(d)); - } - } - - /** - * Print an array of characters. The characters are converted into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the - * {@link #write(int)} method. - * - * @param s The array of chars to be printed - * - * @throws NullPointerException If s is null - * @throws IOException - */ - public void print(char[] s) throws IOException { - if (writer != null) { - writer.write(s); - } else { - write(s); - } - } - - /** - * Print a string. If the argument is null then the string - * "null" is printed. Otherwise, the string's characters are - * converted into bytes according to the platform's default character - * encoding, and these bytes are written in exactly the manner of the - * {@link #write(int)} method. - * - * @param s The String to be printed - * @throws IOException - */ - public void print(String s) throws IOException { - if (s == null) s = "null"; - if (writer != null) { - writer.write(s); - } else { - write(s); - } - } - - /** - * Print an object. The string produced by the {@link - * java.lang.String#valueOf(Object)} method is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the - * {@link #write(int)} method. - * - * @param obj The Object to be printed - * @throws IOException - */ - public void print(Object obj) throws IOException { - if (writer != null) { - writer.write(String.valueOf(obj)); - } else { - write(String.valueOf(obj)); - } - } - - /** - * Terminate the current line by writing the line separator string. The - * line separator string is defined by the system property - * line.separator, and is not necessarily a single newline - * character ('\n'). - * - * @throws IOException - */ - public void println() throws IOException { - newLine(); - } - - /** - * Print a boolean value and then terminate the line. This method behaves - * as though it invokes {@link #print(boolean)} and then - * {@link #println()}. - * - * @throws IOException - */ - public void println(boolean x) throws IOException { - print(x); - println(); - } - - /** - * Print a character and then terminate the line. This method behaves as - * though it invokes {@link #print(char)} and then - * {@link #println()}. - * - * @throws IOException - */ - public void println(char x) throws IOException { - print(x); - println(); - } - - /** - * Print an integer and then terminate the line. This method behaves as - * though it invokes {@link #print(int)} and then - * {@link #println()}. - * - * @throws IOException - */ - public void println(int x) throws IOException { - print(x); - println(); - } - - /** - * Print a long integer and then terminate the line. This method behaves - * as though it invokes {@link #print(long)} and then - * {@link #println()}. - * - * @throws IOException - */ - public void println(long x) throws IOException { - print(x); - println(); - } - - /** - * Print a floating-point number and then terminate the line. This method - * behaves as though it invokes {@link #print(float)} and then - * {@link #println()}. - * - * @throws IOException - */ - public void println(float x) throws IOException { - print(x); - println(); - } - - /** - * Print a double-precision floating-point number and then terminate the - * line. This method behaves as though it invokes {@link - * #print(double)} and then {@link #println()}. - * - * @throws IOException - */ - public void println(double x) throws IOException{ - print(x); - println(); - } - - /** - * Print an array of characters and then terminate the line. This method - * behaves as though it invokes {@link #print(char[])} and - * then {@link #println()}. - * - * @throws IOException - */ - public void println(char x[]) throws IOException { - print(x); - println(); - } - - /** - * Print a String and then terminate the line. This method behaves as - * though it invokes {@link #print(String)} and then - * {@link #println()}. - * - * @throws IOException - */ - public void println(String x) throws IOException { - print(x); - println(); - } - - /** - * Print an Object and then terminate the line. This method behaves as - * though it invokes {@link #print(Object)} and then - * {@link #println()}. - * - * @throws IOException - */ - public void println(Object x) throws IOException { - print(x); - println(); - } - - /** - * Clear the contents of the buffer. If the buffer has been already - * been flushed then the clear operation shall throw an IOException - * to signal the fact that some data has already been irrevocably - * written to the client response stream. - * - * @throws IOException If an I/O error occurs - */ - public void clear() throws IOException { - if (writer != null) { - throw new IOException(); - } else { - nextChar = 0; - } - } - - /** - * Clears the current contents of the buffer. Unlike clear(), this - * mehtod will not throw an IOException if the buffer has already been - * flushed. It merely clears the current content of the buffer and - * returns. - * - * @throws IOException If an I/O error occurs - */ - public void clearBuffer() throws IOException { - if (writer == null) { - this.clear(); - } - } - - /** - * Close the stream, flushing it first. Once a stream has been closed, - * further write() or flush() invocations will cause an IOException to be - * thrown. Closing a previously-closed stream, however, has no effect. - * - * @throws IOException If an I/O error occurs - */ - public void close() throws IOException { - if (writer != null) { - writer.close(); - } else { - cb = null; - closed = true; - } - } - - /** - * @return the number of bytes unused in the buffer - */ - public int getRemaining() { - return (writer == null) ? bufferSize-nextChar : 0; - } - - /** - * Return the value of this BodyJspWriter as a Reader. - * Note: this is after evaluation!! There are no scriptlets, - * etc in this stream. - * - * @return the value of this BodyJspWriter as a Reader - */ - public Reader getReader() { - return (writer == null) ? new CharArrayReader (cb, 0, nextChar) : null; - } - - /** - * Return the value of the BodyJspWriter as a String. - * Note: this is after evaluation!! There are no scriptlets, - * etc in this stream. - * - * @return the value of the BodyJspWriter as a String - */ - public String getString() { - return (writer == null) ? new String(cb, 0, nextChar) : null; - } - - /** - * Write the contents of this BodyJspWriter into a Writer. - * Subclasses are likely to do interesting things with the - * implementation so some things are extra efficient. - * - * @param out The writer into which to place the contents of this body - * evaluation - */ - public void writeOut(Writer out) throws IOException { - if (writer == null) { - out.write(cb, 0, nextChar); - // Flush not called as the writer passed could be a BodyContent and - // it doesn't allow to flush. - } - } - - public static void main (String[] args) throws Exception { - char[] buff = {'f','o','o','b','a','r','b','a','z','y'}; - BodyContentImpl bodyContent - = new BodyContentImpl(new JspWriterImpl(null, 100, false)); - bodyContent.println (buff); - System.out.println (bodyContent.getString ()); - bodyContent.writeOut (new PrintWriter( - new OutputStreamWriter(System.out,"UTF-8"))); - } - - /** - * Sets the writer to which all output is written. - */ - void setWriter(Writer writer) { - this.writer = writer; - if (writer != null) { - // According to the spec, the JspWriter returned by - // JspContext.pushBody(java.io.Writer writer) must behave as - // though it were unbuffered. This means that its getBufferSize() - // must always return 0. The implementation of - // JspWriter.getBufferSize() returns the value of JspWriter's - // 'bufferSize' field, which is inherited by this class. - // Therefore, we simply save the current 'bufferSize' (so we can - // later restore it should this BodyContentImpl ever be reused by - // a call to PageContext.pushBody()) before setting it to 0. - if (bufferSize != 0) { - bufferSizeSave = bufferSize; - bufferSize = 0; - } - } else { - bufferSize = bufferSizeSave; - clearBody(); - } - } - - private void ensureOpen() throws IOException { - if (closed) throw new IOException("Stream closed"); - } - - /** - * Reallocates buffer since the spec requires it to be unbounded. - */ - private void reAllocBuff(int len) { - - if (bufferSize + len <= cb.length) { - bufferSize = cb.length; - return; - } - - if (len < cb.length) { - len = cb.length; - } - - bufferSize = cb.length + len; - char[] tmp = new char[bufferSize]; - - System.arraycopy(cb, 0, tmp, 0, cb.length); - cb = tmp; - tmp = null; - - } - - -} diff --git a/impl/src/main/java/org/apache/jasper/runtime/ELContextImpl.java b/impl/src/main/java/org/apache/jasper/runtime/ELContextImpl.java deleted file mode 100644 index 9b7068d..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/ELContextImpl.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import javax.el.ELContext; -import javax.el.ELResolver; -import javax.el.FunctionMapper; -import javax.el.VariableMapper; - -/** - * Concrete implementation of {@link javax.el.ELContext}. - * ELContext's constructor is protected to control creation of ELContext - * objects through their appropriate factory methods. This version of - * ELContext forces construction through JspApplicationContextImpl. - * - * @author Mark Roth - * @author Kin-man Chung - */ -public class ELContextImpl - extends ELContext -{ - /** - * Constructs a new ELContext associated with the given ELResolver. - */ - public ELContextImpl(ELResolver resolver) { - this.resolver = resolver; - } - - public ELResolver getELResolver() { - return resolver; - } - - public void setFunctionMapper(FunctionMapper fnMapper) { - functionMapper = fnMapper; - } - - public FunctionMapper getFunctionMapper() { - return functionMapper; - } - - public void setVariableMapper(VariableMapper varMapper) { - variableMapper = varMapper; - } - - public VariableMapper getVariableMapper() { - return variableMapper; - } - - private FunctionMapper functionMapper; - private VariableMapper variableMapper; - private ELResolver resolver; -} diff --git a/impl/src/main/java/org/apache/jasper/runtime/ExpressionEvaluatorImpl.java b/impl/src/main/java/org/apache/jasper/runtime/ExpressionEvaluatorImpl.java deleted file mode 100644 index 4852fc2..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/ExpressionEvaluatorImpl.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import java.util.Iterator; - -import javax.el.ELContext; -import javax.el.ELResolver; -import javax.el.ValueExpression; -import javax.el.ExpressionFactory; - -import javax.servlet.jsp.PageContext; -import javax.servlet.jsp.el.Expression; -import javax.servlet.jsp.el.ELException; -import javax.servlet.jsp.el.FunctionMapper; -import javax.servlet.jsp.el.ExpressionEvaluator; -import javax.servlet.jsp.el.VariableResolver; - -/** - *

    This is the implementation of ExpreesioEvaluator - * using implementation of JSP2.1. - * - * @author Kin-man Chung - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class ExpressionEvaluatorImpl extends ExpressionEvaluator -{ - private PageContext pageContext; - - //------------------------------------- - /** - * Constructor - **/ - public ExpressionEvaluatorImpl (PageContext pageContext) { - this.pageContext = pageContext; - } - - //------------------------------------- - public Expression parseExpression(String expression, - Class expectedType, - FunctionMapper fMapper ) - throws ELException { - - ExpressionFactory fac = ExpressionFactory.newInstance(); - javax.el.ValueExpression expr; - ELContextImpl elContext = new ELContextImpl(null); - javax.el.FunctionMapper fm = new FunctionMapperWrapper(fMapper); - elContext.setFunctionMapper(fm); - try { - expr = fac.createValueExpression( - elContext, - expression, expectedType); - } catch (javax.el.ELException ex) { - throw new ELException(ex); - } - return new ExpressionImpl(expr, pageContext); - } - - public Object evaluate(String expression, - Class expectedType, - VariableResolver vResolver, - FunctionMapper fMapper ) - throws ELException { - - ELContextImpl elContext; - if (vResolver instanceof VariableResolverImpl) { - elContext = (ELContextImpl) pageContext.getELContext(); - } - else { - // The provided variable Resolver is a custom resolver, - // wrap it with a ELResolver - elContext = new ELContextImpl(new ELResolverWrapper(vResolver)); - } - - javax.el.FunctionMapper fm = new FunctionMapperWrapper(fMapper); - elContext.setFunctionMapper(fm); - ExpressionFactory fac = ExpressionFactory.newInstance(); - Object value; - try { - ValueExpression expr = fac.createValueExpression( - elContext, - expression, - expectedType); - value = expr.getValue(elContext); - } catch (javax.el.ELException ex) { - throw new ELException(ex); - } - return value; - } - - static private class ExpressionImpl extends Expression { - - private ValueExpression valueExpr; - private PageContext pageContext; - - ExpressionImpl(ValueExpression valueExpr, - PageContext pageContext) { - this.valueExpr = valueExpr; - this.pageContext = pageContext; - } - - public Object evaluate(VariableResolver vResolver) throws ELException { - - ELContext elContext; - if (vResolver instanceof VariableResolverImpl) { - elContext = pageContext.getELContext(); - } - else { - // The provided variable Resolver is a custom resolver, - // wrap it with a ELResolver - elContext = new ELContextImpl(new ELResolverWrapper(vResolver)); - } - try { - return valueExpr.getValue(elContext); - } catch (javax.el.ELException ex) { - throw new ELException(ex); - } - } - } - - private static class FunctionMapperWrapper - extends javax.el.FunctionMapper { - - private FunctionMapper mapper; - - FunctionMapperWrapper(FunctionMapper mapper) { - this.mapper = mapper; - } - - public java.lang.reflect.Method resolveFunction(String prefix, - String localName) { - return mapper.resolveFunction(prefix, localName); - } - } - - private static class ELResolverWrapper extends ELResolver { - private VariableResolver vResolver; - - ELResolverWrapper(VariableResolver vResolver) { - this.vResolver = vResolver; - } - - public Object getValue(ELContext context, - Object base, - Object property) - throws javax.el.ELException { - if (base == null) { - context.setPropertyResolved(true); - try { - return vResolver.resolveVariable(property.toString()); - } catch (ELException ex) { - throw new javax.el.ELException(ex); - } - } - return null; - } - - public Class getType(ELContext context, - Object base, - Object property) - throws javax.el.ELException { - return null; - } - - public void setValue(ELContext context, - Object base, - Object property, - Object value) - throws javax.el.ELException { - } - - public boolean isReadOnly(ELContext context, - Object base, - Object property) - throws javax.el.ELException { - return false; - } - - public Iterator - getFeatureDescriptors(ELContext context, Object base) { - return null; - } - - public Class getCommonPropertyType(ELContext context, - Object base) { - return null; - } - } -} diff --git a/impl/src/main/java/org/apache/jasper/runtime/HttpJspBase.java b/impl/src/main/java/org/apache/jasper/runtime/HttpJspBase.java deleted file mode 100644 index aed33fe..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/HttpJspBase.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import java.io.IOException; -import java.io.FileInputStream; -import java.io.InputStreamReader; - -import java.net.URL; -import java.net.MalformedURLException; -import java.util.List; - -import javax.servlet.*; -import javax.servlet.http.*; -import javax.servlet.jsp.*; - -import org.apache.jasper.JasperException; -import org.apache.jasper.compiler.Localizer; - -/** - * This is the super class of all JSP-generated servlets. - * - * @author Anil K. Vijendran - */ -public abstract class HttpJspBase - extends HttpServlet - implements HttpJspPage -{ - protected HttpJspBase() { - } - - public final void init(ServletConfig config) - throws ServletException - { - super.init(config); - jspInit(); - _jspInit(); - } - - public String getServletInfo() { - return Localizer.getMessage("jsp.engine.info"); - } - - public final void destroy() { - jspDestroy(); - _jspDestroy(); - } - - /** - * Entry point into service. - */ - public final void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException - { - _jspService(request, response); - } - - public void jspInit() { - } - - public void _jspInit() { - } - - public void jspDestroy() { - } - - protected void _jspDestroy() { - } - - public abstract void _jspService(HttpServletRequest request, - HttpServletResponse response) - throws ServletException, IOException; -} diff --git a/impl/src/main/java/org/apache/jasper/runtime/JspApplicationContextImpl.java b/impl/src/main/java/org/apache/jasper/runtime/JspApplicationContextImpl.java deleted file mode 100644 index 61cc336..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/JspApplicationContextImpl.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2011 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -/** - * Implements javax.servlet.jsp.JspApplication - */ - -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Collections; - -import javax.servlet.ServletContext; -import javax.servlet.jsp.JspApplicationContext; - -import javax.el.ELException; -import javax.el.ELResolver; -import javax.el.ELContext; -import javax.el.ExpressionFactory; -import javax.el.ELContextListener; -import javax.el.ELContextEvent; - -import org.apache.jasper.Constants; - -public class JspApplicationContextImpl implements JspApplicationContext { - - public JspApplicationContextImpl(ServletContext context) { - this.context = context; - - // Add system defined ELResolver, as defined in JSR 299 - ELResolver beanManagerELResolver = (ELResolver) - context.getAttribute("org.glassfish.jsp.beanManagerELResolver"); - if (beanManagerELResolver != null) { - elResolvers.add(beanManagerELResolver); - } - } - - public void addELResolver(ELResolver resolver) { - if ("true".equals(context.getAttribute(Constants.FIRST_REQUEST_SEEN))) { - throw new IllegalStateException("Attempt to invoke addELResolver " - + "after the application has already received a request"); - } - - elResolvers.add(0, resolver); - } - - public ExpressionFactory getExpressionFactory() { - if (expressionFactory == null) { - expressionFactory = ExpressionFactory.newInstance(); - } - return expressionFactory; - } - - public void setExpressionFactory(ExpressionFactory expressionFactory) { - this.expressionFactory = expressionFactory; - } - - public void addELContextListener(ELContextListener listener) { - listeners.add(listener); - } - - protected ELContext createELContext(ELResolver resolver) { - - ELContext elContext = new ELContextImpl(resolver); - - // Notify the listeners - Iterator iter = listeners.iterator(); - while (iter.hasNext()) { - ELContextListener elcl = iter.next(); - elcl.contextCreated(new ELContextEvent(elContext)); - } - return elContext; - } - - protected static JspApplicationContextImpl findJspApplicationContext(ServletContext context) { - - JspApplicationContextImpl jaContext = map.get(context); - if (jaContext == null) { - jaContext = new JspApplicationContextImpl(context); - map.put(context, jaContext); - } - return jaContext; - } - - public static void removeJspApplicationContext(ServletContext context) { - map.remove(context); - } - - protected Iterator getELResolvers() { - return elResolvers.iterator(); - } - - private static Map map = - Collections.synchronizedMap( - new HashMap()); - - private ArrayList elResolvers = new ArrayList(); - private ArrayList listeners = - new ArrayList(); - private ServletContext context; - private ExpressionFactory expressionFactory; -} - diff --git a/impl/src/main/java/org/apache/jasper/runtime/JspContextWrapper.java b/impl/src/main/java/org/apache/jasper/runtime/JspContextWrapper.java deleted file mode 100644 index dd54fb5..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/JspContextWrapper.java +++ /dev/null @@ -1,509 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import java.io.IOException; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Map; - -import javax.el.ELException; -import javax.el.ELContext; - -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpSession; -import javax.servlet.jsp.JspContext; -import javax.servlet.jsp.JspWriter; -import javax.servlet.jsp.PageContext; -import javax.servlet.jsp.tagext.BodyContent; -import javax.servlet.jsp.tagext.VariableInfo; -import javax.servlet.jsp.el.VariableResolver; -import javax.servlet.jsp.el.ExpressionEvaluator; - -import org.apache.jasper.compiler.Localizer; - -/** - * Implementation of a JSP Context Wrapper. - * - * The JSP Context Wrapper is a JspContext created and maintained by a tag - * handler implementation. It wraps the Invoking JSP Context, that is, the - * JspContext instance passed to the tag handler by the invoking page via - * setJspContext(). - * - * @author Kin-man Chung - * @author Jan Luehe - */ -public class JspContextWrapper extends PageContext { - - // Invoking JSP context - private PageContext invokingJspCtxt; - - private Hashtable pageAttributes; - - // ArrayList of NESTED scripting variables - private ArrayList nestedVars; - - // ArrayList of AT_BEGIN scripting variables - private ArrayList atBeginVars; - - // ArrayList of AT_END scripting variables - private ArrayList atEndVars; - - private Map aliases; - private HashMap originalNestedVars; - private ELContext elContext; - - public JspContextWrapper(JspContext jspContext, - ArrayList nestedVars, - ArrayList atBeginVars, - ArrayList atEndVars, - Map aliases) { - this.invokingJspCtxt = (PageContext) jspContext; - this.nestedVars = nestedVars; - this.atBeginVars = atBeginVars; - this.atEndVars = atEndVars; - this.pageAttributes = new Hashtable(16); - this.aliases = aliases; - - if (nestedVars != null) { - this.originalNestedVars = - new HashMap(nestedVars.size()); - } - syncBeginTagFile(); - } - - public void initialize(Servlet servlet, ServletRequest request, - ServletResponse response, String errorPageURL, - boolean needsSession, int bufferSize, - boolean autoFlush) - throws IOException, IllegalStateException, IllegalArgumentException - { - } - - public Object getAttribute(String name) { - - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - return pageAttributes.get(name); - } - - public Object getAttribute(String name, int scope) { - - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - if (scope == PAGE_SCOPE) { - return pageAttributes.get(name); - } - - return invokingJspCtxt.getAttribute(name, scope); - } - - public void setAttribute(String name, Object value) { - - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - if (value != null) { - pageAttributes.put(name, value); - } else { - removeAttribute(name, PAGE_SCOPE); - } - } - - public void setAttribute(String name, Object value, int scope) { - - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - if (scope == PAGE_SCOPE) { - if (value != null) { - pageAttributes.put(name, value); - } else { - removeAttribute(name, PAGE_SCOPE); - } - } else { - invokingJspCtxt.setAttribute(name, value, scope); - } - } - - public Object findAttribute(String name) { - - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - Object o = pageAttributes.get(name); - if (o == null) { - o = invokingJspCtxt.getAttribute(name, REQUEST_SCOPE); - if (o == null) { - if (getSession() != null) { - o = invokingJspCtxt.getAttribute(name, SESSION_SCOPE); - } - if (o == null) { - o = invokingJspCtxt.getAttribute(name, APPLICATION_SCOPE); - } - } - } - - return o; - } - - public void removeAttribute(String name) { - - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - pageAttributes.remove(name); - invokingJspCtxt.removeAttribute(name, REQUEST_SCOPE); - if (getSession() != null) { - invokingJspCtxt.removeAttribute(name, SESSION_SCOPE); - } - invokingJspCtxt.removeAttribute(name, APPLICATION_SCOPE); - } - - public void removeAttribute(String name, int scope) { - - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - if (scope == PAGE_SCOPE){ - pageAttributes.remove(name); - } else { - invokingJspCtxt.removeAttribute(name, scope); - } - } - - public int getAttributesScope(String name) { - - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - if (pageAttributes.get(name) != null) { - return PAGE_SCOPE; - } else { - return invokingJspCtxt.getAttributesScope(name); - } - } - - public Enumeration getAttributeNamesInScope(int scope) { - if (scope == PAGE_SCOPE) { - return pageAttributes.keys(); - } - - return invokingJspCtxt.getAttributeNamesInScope(scope); - } - - public void release() { - invokingJspCtxt.release(); - } - - public JspWriter getOut() { - return invokingJspCtxt.getOut(); - } - - public HttpSession getSession() { - return invokingJspCtxt.getSession(); - } - - public Object getPage() { - return invokingJspCtxt.getPage(); - } - - public ServletRequest getRequest() { - return invokingJspCtxt.getRequest(); - } - - public ServletResponse getResponse() { - return invokingJspCtxt.getResponse(); - } - - public Exception getException() { - return invokingJspCtxt.getException(); - } - - public ServletConfig getServletConfig() { - return invokingJspCtxt.getServletConfig(); - } - - public ServletContext getServletContext() { - return invokingJspCtxt.getServletContext(); - } - - static public PageContext getRootPageContext(PageContext pc) { - while (pc instanceof JspContextWrapper) { - pc = ((JspContextWrapper)pc).invokingJspCtxt; - } - return pc; - } - - public ELContext getELContext() { - if (elContext == null) { - PageContext pc = invokingJspCtxt; - while (pc instanceof JspContextWrapper) { - pc = ((JspContextWrapper)pc).invokingJspCtxt; - } - PageContextImpl pci = (PageContextImpl) pc; - elContext = pci.getJspApplicationContext().createELContext( - invokingJspCtxt.getELContext().getELResolver()); - elContext.putContext(javax.servlet.jsp.JspContext.class, this); - ((ELContextImpl)elContext).setVariableMapper( - new VariableMapperImpl()); - } - return elContext; - } - - public void forward(String relativeUrlPath) - throws ServletException, IOException - { - invokingJspCtxt.forward(relativeUrlPath); - } - - public void include(String relativeUrlPath) - throws ServletException, IOException - { - invokingJspCtxt.include(relativeUrlPath); - } - - public void include(String relativeUrlPath, boolean flush) - throws ServletException, IOException { - invokingJspCtxt.include(relativeUrlPath, flush); - } - - public VariableResolver getVariableResolver() { - return null; - } - - public BodyContent pushBody() { - return invokingJspCtxt.pushBody(); - } - - public JspWriter pushBody(Writer writer) { - return invokingJspCtxt.pushBody(writer); - } - - public JspWriter popBody() { - return invokingJspCtxt.popBody(); - } - - public ExpressionEvaluator getExpressionEvaluator() { - return invokingJspCtxt.getExpressionEvaluator(); - } - - public void handlePageException(Exception ex) - throws IOException, ServletException - { - // Should never be called since handleException() called with a - // Throwable in the generated servlet. - handlePageException((Throwable) ex); - } - - public void handlePageException(Throwable t) - throws IOException, ServletException - { - invokingJspCtxt.handlePageException(t); - } - - /** - * Synchronize variables at begin of tag file - */ - public void syncBeginTagFile() { - saveNestedVariables(); - } - - /** - * Synchronize variables before fragment invokation - */ - public void syncBeforeInvoke() { - copyTagToPageScope(VariableInfo.NESTED); - copyTagToPageScope(VariableInfo.AT_BEGIN); - } - - /** - * Synchronize variables at end of tag file - */ - public void syncEndTagFile() { - copyTagToPageScope(VariableInfo.AT_BEGIN); - copyTagToPageScope(VariableInfo.AT_END); - restoreNestedVariables(); - } - - /** - * Copies the variables of the given scope from the virtual page scope of - * this JSP context wrapper to the page scope of the invoking JSP context. - * - * @param scope variable scope (one of NESTED, AT_BEGIN, or AT_END) - */ - private void copyTagToPageScope(int scope) { - Iterator iter = null; - - switch (scope) { - case VariableInfo.NESTED: - if (nestedVars != null) { - iter = nestedVars.iterator(); - } - break; - case VariableInfo.AT_BEGIN: - if (atBeginVars != null) { - iter = atBeginVars.iterator(); - } - break; - case VariableInfo.AT_END: - if (atEndVars != null) { - iter = atEndVars.iterator(); - } - break; - } - - while ((iter != null) && iter.hasNext()) { - String varName = iter.next(); - Object obj = getAttribute(varName); - varName = findAlias(varName); - if (obj != null) { - invokingJspCtxt.setAttribute(varName, obj); - } else { - invokingJspCtxt.removeAttribute(varName, PAGE_SCOPE); - } - } - } - - /** - * Saves the values of any NESTED variables that are present in - * the invoking JSP context, so they can later be restored. - */ - private void saveNestedVariables() { - if (nestedVars != null) { - Iterator iter = nestedVars.iterator(); - while (iter.hasNext()) { - String varName = iter.next(); - varName = findAlias(varName); - Object obj = invokingJspCtxt.getAttribute(varName); - if (obj != null) { - originalNestedVars.put(varName, obj); - } - } - } - } - - /** - * Restores the values of any NESTED variables in the invoking JSP - * context. - */ - private void restoreNestedVariables() { - if (nestedVars != null) { - Iterator iter = nestedVars.iterator(); - while (iter.hasNext()) { - String varName = iter.next(); - varName = findAlias(varName); - Object obj = originalNestedVars.get(varName); - if (obj != null) { - invokingJspCtxt.setAttribute(varName, obj); - } else { - invokingJspCtxt.removeAttribute(varName, PAGE_SCOPE); - } - } - } - } - - /** - * Checks to see if the given variable name is used as an alias, and if so, - * returns the variable name for which it is used as an alias. - * - * @param varName The variable name to check - * @return The variable name for which varName is used as an alias, or - * varName if it is not being used as an alias - */ - private String findAlias(String varName) { - - if (aliases == null) - return varName; - - String alias = aliases.get(varName); - if (alias == null) { - return varName; - } - return alias; - } -} - diff --git a/impl/src/main/java/org/apache/jasper/runtime/JspFactoryImpl.java b/impl/src/main/java/org/apache/jasper/runtime/JspFactoryImpl.java deleted file mode 100644 index 1ea8bf6..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/JspFactoryImpl.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.LinkedList; -import java.util.logging.Logger; -import java.util.logging.Level; - -import javax.servlet.Servlet; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.ServletContext; -import javax.servlet.jsp.JspFactory; -import javax.servlet.jsp.JspEngineInfo; -import javax.servlet.jsp.PageContext; -import javax.servlet.jsp.JspApplicationContext; - -import org.apache.jasper.Constants; - -/** - * Implementation of JspFactory. - * - * @author Anil K. Vijendran - * @author Kin-man Chung - */ -public class JspFactoryImpl extends JspFactory { - - // Logger - private static Logger log = - Logger.getLogger(JspFactoryImpl.class.getName()); - - private static final String SPEC_VERSION = "2.1"; - - // Pooling PageContextImpl intances are known to leak memories, see - // https://glassfish.dev.java.net/issues/show_bug.cgi?id=8601 - // So pooling is off by default. If for any reason, backwards - // compatibility is required, set the system property to true. - private static final boolean USE_POOL = - Boolean.getBoolean( - "org.apache.jasper.runtime.JspFactoryImpl.USE_POOL"); - - // Per-thread pool of PageContext objects - private ThreadLocal> pool = - new ThreadLocal>() { - protected synchronized LinkedList initialValue() { - return new LinkedList(); - } - }; - - public PageContext getPageContext(Servlet servlet, - ServletRequest request, - ServletResponse response, - String errorPageURL, - boolean needsSession, - int bufferSize, - boolean autoflush) { - - if (Constants.IS_SECURITY_ENABLED) { - PrivilegedGetPageContext dp = - new PrivilegedGetPageContext( - this, servlet, request, response, errorPageURL, - needsSession, bufferSize, autoflush); - return AccessController.doPrivileged(dp); - } else { - return internalGetPageContext(servlet, request, response, - errorPageURL, needsSession, - bufferSize, autoflush); - } - } - - public void releasePageContext(PageContext pc) { - if( pc == null ) - return; - if (Constants.IS_SECURITY_ENABLED) { - PrivilegedReleasePageContext dp = - new PrivilegedReleasePageContext(this, pc); - AccessController.doPrivileged(dp); - } else { - internalReleasePageContext(pc); - } - } - - public JspEngineInfo getEngineInfo() { - return new JspEngineInfo() { - public String getSpecificationVersion() { - return SPEC_VERSION; - } - }; - } - - public JspApplicationContext getJspApplicationContext - (ServletContext context) { - return JspApplicationContextImpl.findJspApplicationContext(context); - } - - private PageContext internalGetPageContext(Servlet servlet, - ServletRequest request, - ServletResponse response, - String errorPageURL, - boolean needsSession, - int bufferSize, - boolean autoflush) { - try { - PageContext pc = null; - if( USE_POOL ) { - LinkedList pcPool = pool.get(); - if (!pcPool.isEmpty()) { - pc = pcPool.removeFirst(); - } - if (pc == null) { - pc = new PageContextImpl(this); - } - } else { - pc = new PageContextImpl(this); - } - pc.initialize(servlet, request, response, errorPageURL, - needsSession, bufferSize, autoflush); - return pc; - } catch (Throwable ex) { - /* FIXME: need to do something reasonable here!! */ - log.log(Level.SEVERE, "Exception initializing page context", ex); - return null; - } - } - - private void internalReleasePageContext(PageContext pc) { - pc.release(); - if (USE_POOL && (pc instanceof PageContextImpl)) { - LinkedList pcPool = pool.get(); - pcPool.addFirst(pc); - } - } - - private class PrivilegedGetPageContext - implements PrivilegedAction { - - private JspFactoryImpl factory; - private Servlet servlet; - private ServletRequest request; - private ServletResponse response; - private String errorPageURL; - private boolean needsSession; - private int bufferSize; - private boolean autoflush; - - PrivilegedGetPageContext(JspFactoryImpl factory, - Servlet servlet, - ServletRequest request, - ServletResponse response, - String errorPageURL, - boolean needsSession, - int bufferSize, - boolean autoflush) { - this.factory = factory; - this.servlet = servlet; - this.request = request; - this.response = response; - this.errorPageURL = errorPageURL; - this.needsSession = needsSession; - this.bufferSize = bufferSize; - this.autoflush = autoflush; - } - - public PageContext run() { - return factory.internalGetPageContext(servlet, - request, - response, - errorPageURL, - needsSession, - bufferSize, - autoflush); - } - } - - private class PrivilegedReleasePageContext - implements PrivilegedAction { - - private JspFactoryImpl factory; - private PageContext pageContext; - - PrivilegedReleasePageContext(JspFactoryImpl factory, - PageContext pageContext) { - this.factory = factory; - this.pageContext = pageContext; - } - - public Object run() { - factory.internalReleasePageContext(pageContext); - return null; - } - } -} diff --git a/impl/src/main/java/org/apache/jasper/runtime/JspFragmentHelper.java b/impl/src/main/java/org/apache/jasper/runtime/JspFragmentHelper.java deleted file mode 100644 index bba4fd2..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/JspFragmentHelper.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import javax.servlet.jsp.JspContext; -import javax.servlet.jsp.PageContext; -import javax.servlet.jsp.tagext.JspTag; -import javax.servlet.jsp.tagext.JspFragment; - -/** - * Helper class from which all Jsp Fragment helper classes extend. - * This class allows for the emulation of numerous fragments within - * a single class, which in turn reduces the load on the class loader - * since there are potentially many JspFragments in a single page. - *

    - * The class also provides various utility methods for JspFragment - * implementations. - * - * @author Mark Roth - */ -public abstract class JspFragmentHelper - extends JspFragment -{ - - protected int discriminator; - protected JspContext jspContext; - protected PageContext _jspx_page_context; - protected JspTag parentTag; - - public JspFragmentHelper( int discriminator, JspContext jspContext, - JspTag parentTag ) - { - this.discriminator = discriminator; - this.jspContext = jspContext; - this._jspx_page_context = null; - if( jspContext instanceof PageContext ) { - _jspx_page_context = (PageContext)jspContext; - } - this.parentTag = parentTag; - } - - public JspContext getJspContext() { - return this.jspContext; - } - - public JspTag getParentTag() { - return this.parentTag; - } - -} diff --git a/impl/src/main/java/org/apache/jasper/runtime/JspRuntimeLibrary.java b/impl/src/main/java/org/apache/jasper/runtime/JspRuntimeLibrary.java deleted file mode 100644 index 4dece74..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/JspRuntimeLibrary.java +++ /dev/null @@ -1,944 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import java.beans.PropertyEditor; -import java.beans.PropertyEditorManager; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.lang.reflect.Method; -import java.util.Enumeration; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.jsp.JspWriter; -import javax.servlet.jsp.PageContext; -import javax.servlet.jsp.tagext.BodyContent; - -import org.apache.jasper.JasperException; -import org.apache.jasper.compiler.Localizer; - -/** - * Bunch of util methods that are used by code generated for useBean, - * getProperty and setProperty. - * - * The __begin, __end stuff is there so that the JSP engine can - * actually parse this file and inline them if people don't want - * runtime dependencies on this class. However, I'm not sure if that - * works so well right now. It got forgotten at some point. -akv - * - * @author Mandar Raje - * @author Shawn Bayern - */ -public class JspRuntimeLibrary { - - private static final String SERVLET_EXCEPTION - = "javax.servlet.error.exception"; - private static final String JSP_EXCEPTION - = "javax.servlet.jsp.jspException"; - - /** - * Returns the value of the javax.servlet.error.exception request - * attribute value, if present, otherwise the value of the - * javax.servlet.jsp.jspException request attribute value. - * - * This method is called at the beginning of the generated servlet code - * for a JSP error page, when the "exception" implicit scripting language - * variable is initialized. - */ - public static Throwable getThrowable(ServletRequest request) { - Throwable error = (Throwable) request.getAttribute(SERVLET_EXCEPTION); - if (error == null) { - error = (Throwable) request.getAttribute(JSP_EXCEPTION); - if (error != null) { - /* - * The only place that sets JSP_EXCEPTION is - * PageContextImpl.handlePageException(). It really should set - * SERVLET_EXCEPTION, but that would interfere with the - * ErrorReportValve. Therefore, if JSP_EXCEPTION is set, we - * need to set SERVLET_EXCEPTION. - */ - request.setAttribute(SERVLET_EXCEPTION, error); - } - } - - return error; - } - - public static boolean coerceToBoolean(String s) { - if (s == null || s.length() == 0) - return false; - else - return Boolean.valueOf(s).booleanValue(); - } - - public static byte coerceToByte(String s) { - if (s == null || s.length() == 0) - return (byte) 0; - else - return Byte.valueOf(s).byteValue(); - } - - public static char coerceToChar(String s) { - if (s == null || s.length() == 0) { - return (char) 0; - } else { - // this trick avoids escaping issues - return (char)(int) s.charAt(0); - } - } - - public static double coerceToDouble(String s) { - if (s == null || s.length() == 0) - return (double) 0; - else - return Double.valueOf(s).doubleValue(); - } - - public static float coerceToFloat(String s) { - if (s == null || s.length() == 0) - return (float) 0; - else - return Float.valueOf(s).floatValue(); - } - - public static int coerceToInt(String s) { - if (s == null || s.length() == 0) - return 0; - else - return Integer.valueOf(s).intValue(); - } - - public static short coerceToShort(String s) { - if (s == null || s.length() == 0) - return (short) 0; - else - return Short.valueOf(s).shortValue(); - } - - public static long coerceToLong(String s) { - if (s == null || s.length() == 0) - return (long) 0; - else - return Long.valueOf(s).longValue(); - } - - @SuppressWarnings("unchecked") - public static T coerce(String s, Class target) { - - boolean isNullOrEmpty = (s == null || s.length() == 0); - - if (target == Boolean.class) { - if (isNullOrEmpty) { - s = "false"; - } - return (T) Boolean.valueOf(s); - } else if (target == Byte.class) { - if (isNullOrEmpty) - return (T) Byte.valueOf((byte) 0); - else - return (T) Byte.valueOf(s); - } else if (target == Character.class) { - if (isNullOrEmpty) - return (T) Character.valueOf((char) 0); - else - return (T) Character.valueOf(s.charAt(0)); - } else if (target == Double.class) { - if (isNullOrEmpty) - return (T) Double.valueOf(0); - else - return (T) Double.valueOf(s); - } else if (target == Float.class) { - if (isNullOrEmpty) - return (T) Float.valueOf(0); - else - return (T) Float.valueOf(s); - } else if (target == Integer.class) { - if (isNullOrEmpty) - return (T) Integer.valueOf(0); - else - return (T) Integer.valueOf(s); - } else if (target == Short.class) { - if (isNullOrEmpty) - return (T) Short.valueOf((short) 0); - else - return (T) Short.valueOf(s); - } else if (target == Long.class) { - if (isNullOrEmpty) - return (T) Long.valueOf(0); - else - return (T) Long.valueOf(s); - } else if (target.isEnum()) { - if (isNullOrEmpty) - return null; - return (T) Enum.valueOf((Class)target, s); - } else { - return null; - } - } - - // __begin convertMethod - public static Object convert(String propertyName, String s, Class t, - Class propertyEditorClass) - throws JasperException - { - try { - if (s == null) { - if (t.equals(Boolean.class) || t.equals(Boolean.TYPE)) - s = "false"; - else - return null; - } - if (propertyEditorClass != null) { - return getValueFromBeanInfoPropertyEditor( - t, propertyName, s, propertyEditorClass); - } else if ( t.equals(Boolean.class) || t.equals(Boolean.TYPE) ) { - if (s.equalsIgnoreCase("on") || s.equalsIgnoreCase("true")) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } else if ( t.equals(Byte.class) || t.equals(Byte.TYPE) ) { - return Byte.valueOf(s); - } else if (t.equals(Character.class) || t.equals(Character.TYPE)) { - return s.length() > 0 ? Character.valueOf(s.charAt(0)) : null; - } else if ( t.equals(Short.class) || t.equals(Short.TYPE) ) { - return Short.valueOf(s); - } else if ( t.equals(Integer.class) || t.equals(Integer.TYPE) ) { - return Integer.valueOf(s); - } else if ( t.equals(Float.class) || t.equals(Float.TYPE) ) { - return Float.valueOf(s); - } else if ( t.equals(Long.class) || t.equals(Long.TYPE) ) { - return Long.valueOf(s); - } else if ( t.equals(Double.class) || t.equals(Double.TYPE) ) { - return Double.valueOf(s); - } else if ( t.equals(String.class) ) { - return s; - } else if ( t.equals(java.io.File.class) ) { - return new java.io.File(s); - } else if (t.getName().equals("java.lang.Object")) { - return new Object[] {s}; - } else { - return getValueFromPropertyEditorManager( - t, propertyName, s); - } - } catch (Exception ex) { - throw new JasperException(ex); - } - } - // __end convertMethod - - // __begin introspectMethod - public static void introspect(Object bean, ServletRequest request) - throws JasperException - { - Enumeration e = request.getParameterNames(); - while ( e.hasMoreElements() ) { - String name = (String) e.nextElement(); - String value = request.getParameter(name); - introspecthelper(bean, name, value, request, name, true); - } - } - // __end introspectMethod - - // __begin introspecthelperMethod - public static void introspecthelper(Object bean, String prop, - String value, ServletRequest request, - String param, boolean ignoreMethodNF) - throws JasperException - { - Method method = null; - Class type = null; - Class propertyEditorClass = null; - try { - java.beans.BeanInfo info - = java.beans.Introspector.getBeanInfo(bean.getClass()); - if ( info != null ) { - java.beans.PropertyDescriptor pd[] - = info.getPropertyDescriptors(); - for (int i = 0 ; i < pd.length ; i++) { - if ( pd[i].getName().equals(prop) ) { - method = pd[i].getWriteMethod(); - type = pd[i].getPropertyType(); - propertyEditorClass = pd[i].getPropertyEditorClass(); - break; - } - } - } - if ( method != null ) { - if (type.isArray()) { - if (request == null) { - throw new JasperException( - Localizer.getMessage("jsp.error.beans.setproperty.noindexset")); - } - Class t = type.getComponentType(); - String[] values = request.getParameterValues(param); - //XXX Please check. - if(values == null) return; - if(t.equals(String.class)) { - method.invoke(bean, new Object[] { values }); - } else { - Object tmpval = null; - createTypedArray (prop, bean, method, values, t, - propertyEditorClass); - } - } else { - if(value == null || (param != null && value.equals(""))) return; - Object oval = convert(prop, value, type, propertyEditorClass); - if ( oval != null ) - method.invoke(bean, new Object[] { oval }); - } - } - } catch (Exception ex) { - throw new JasperException(ex); - } - if (!ignoreMethodNF && (method == null)) { - if (type == null) { - throw new JasperException( - Localizer.getMessage("jsp.error.beans.noproperty", - prop, - bean.getClass().getName())); - } else { - throw new JasperException( - Localizer.getMessage("jsp.error.beans.nomethod.setproperty", - prop, - type.getName(), - bean.getClass().getName())); - } - } - } - // __end introspecthelperMethod - - //------------------------------------------------------------------- - // functions to convert builtin Java data types to string. - //------------------------------------------------------------------- - // __begin toStringMethod - public static String toString(Object o) { - return String.valueOf(o); - } - - public static String toString(byte b) { - return Byte.toString(b); - } - - public static String toString(boolean b) { - return Boolean.toString(b); - } - - public static String toString(short s) { - return Short.toString(s); - } - - public static String toString(int i) { - return Integer.toString(i); - } - - public static String toString(float f) { - return Float.toString(f); - } - - public static String toString(long l) { - return Long.toString(l); - } - - public static String toString(double d) { - return Double.toString(d); - } - - public static String toString(char c) { - return Character.toString(c); - } - // __end toStringMethod - - - /** - * Create a typed array. - * This is a special case where params are passed through - * the request and the property is indexed. - */ - public static void createTypedArray(String propertyName, - Object bean, - Method method, - String[] values, - Class t, - Class propertyEditorClass) - throws JasperException { - - try { - if (propertyEditorClass != null) { - Object[] tmpval = new Integer[values.length]; - for (int i=0; i^()[]{}$\\\n"; - - for(int index=0; index with EL expression for 'value' attribute -/** Use proprietaryEvaluate - public static void handleSetPropertyExpression(Object bean, - String prop, String expression, PageContext pageContext, - VariableResolver variableResolver, FunctionMapper functionMapper ) - throws JasperException - { - try { - Method method = getWriteMethod(bean.getClass(), prop); - method.invoke(bean, new Object[] { - pageContext.getExpressionEvaluator().evaluate( - expression, - method.getParameterTypes()[0], - variableResolver, - functionMapper, - null ) - }); - } catch (Exception ex) { - throw new JasperException(ex); - } - } -**/ - public static void handleSetPropertyExpression(Object bean, - String prop, String expression, PageContext pageContext, - ProtectedFunctionMapper functionMapper ) - throws JasperException - { - try { - Method method = getWriteMethod(bean.getClass(), prop); - method.invoke(bean, new Object[] { - PageContextImpl.evaluateExpression( - expression, - method.getParameterTypes()[0], - pageContext, - functionMapper) - }); - } catch (Exception ex) { - throw new JasperException(ex); - } - } - - public static void handleSetProperty(Object bean, String prop, - Object value) - throws JasperException - { - try { - Method method = getWriteMethod(bean.getClass(), prop); - method.invoke(bean, new Object[] { value }); - } catch (Exception ex) { - throw new JasperException(ex); - } - } - - public static void handleSetProperty(Object bean, String prop, - int value) - throws JasperException - { - try { - Method method = getWriteMethod(bean.getClass(), prop); - method.invoke(bean, new Object[] { Integer.valueOf(value) }); - } catch (Exception ex) { - throw new JasperException(ex); - } - } - - public static void handleSetProperty(Object bean, String prop, - short value) - throws JasperException - { - try { - Method method = getWriteMethod(bean.getClass(), prop); - method.invoke(bean, new Object[] { Short.valueOf(value) }); - } catch (Exception ex) { - throw new JasperException(ex); - } - } - - public static void handleSetProperty(Object bean, String prop, - long value) - throws JasperException - { - try { - Method method = getWriteMethod(bean.getClass(), prop); - method.invoke(bean, new Object[] { Long.valueOf(value) }); - } catch (Exception ex) { - throw new JasperException(ex); - } - } - - public static void handleSetProperty(Object bean, String prop, - double value) - throws JasperException - { - try { - Method method = getWriteMethod(bean.getClass(), prop); - method.invoke(bean, new Object[] { Double.valueOf(value) }); - } catch (Exception ex) { - throw new JasperException(ex); - } - } - - public static void handleSetProperty(Object bean, String prop, - float value) - throws JasperException - { - try { - Method method = getWriteMethod(bean.getClass(), prop); - method.invoke(bean, new Object[] { Float.valueOf(value) }); - } catch (Exception ex) { - throw new JasperException(ex); - } - } - - public static void handleSetProperty(Object bean, String prop, - char value) - throws JasperException - { - try { - Method method = getWriteMethod(bean.getClass(), prop); - method.invoke(bean, new Object[] { Character.valueOf(value) }); - } catch (Exception ex) { - throw new JasperException(ex); - } - } - - public static void handleSetProperty(Object bean, String prop, - byte value) - throws JasperException - { - try { - Method method = getWriteMethod(bean.getClass(), prop); - method.invoke(bean, new Object[] { Byte.valueOf(value) }); - } catch (Exception ex) { - throw new JasperException(ex); - } - } - - public static void handleSetProperty(Object bean, String prop, - boolean value) - throws JasperException - { - try { - Method method = getWriteMethod(bean.getClass(), prop); - method.invoke(bean, new Object[] { Boolean.valueOf(value) }); - } catch (Exception ex) { - throw new JasperException(ex); - } - } - - public static Method getWriteMethod(Class beanClass, String prop) - throws JasperException { - Method method = null; - Class type = null; - try { - java.beans.BeanInfo info - = java.beans.Introspector.getBeanInfo(beanClass); - if ( info != null ) { - java.beans.PropertyDescriptor pd[] - = info.getPropertyDescriptors(); - for (int i = 0 ; i < pd.length ; i++) { - if ( pd[i].getName().equals(prop) ) { - method = pd[i].getWriteMethod(); - type = pd[i].getPropertyType(); - break; - } - } - } else { - // just in case introspection silently fails. - throw new JasperException( - Localizer.getMessage("jsp.error.beans.nobeaninfo", - beanClass.getName())); - } - } catch (Exception ex) { - throw new JasperException (ex); - } - if (method == null) { - if (type == null) { - throw new JasperException( - Localizer.getMessage("jsp.error.beans.noproperty", - prop, - beanClass.getName())); - } else { - throw new JasperException( - Localizer.getMessage("jsp.error.beans.nomethod.setproperty", - prop, - type.getName(), - beanClass.getName())); - } - } - return method; - } - - public static Method getReadMethod(Class beanClass, String prop) - throws JasperException { - - Method method = null; - Class type = null; - try { - java.beans.BeanInfo info - = java.beans.Introspector.getBeanInfo(beanClass); - if ( info != null ) { - java.beans.PropertyDescriptor pd[] - = info.getPropertyDescriptors(); - for (int i = 0 ; i < pd.length ; i++) { - if ( pd[i].getName().equals(prop) ) { - method = pd[i].getReadMethod(); - type = pd[i].getPropertyType(); - break; - } - } - } else { - // just in case introspection silently fails. - throw new JasperException( - Localizer.getMessage("jsp.error.beans.nobeaninfo", - beanClass.getName())); - } - } catch (Exception ex) { - throw new JasperException (ex); - } - if (method == null) { - if (type == null) { - throw new JasperException( - Localizer.getMessage("jsp.error.beans.noproperty", prop, - beanClass.getName())); - } else { - throw new JasperException( - Localizer.getMessage("jsp.error.beans.nomethod", prop, - beanClass.getName())); - } - } - - return method; - } - - //********************************************************************* - // PropertyEditor Support - - public static Object getValueFromBeanInfoPropertyEditor( - Class attrClass, String attrName, String attrValue, - Class propertyEditorClass) - throws JasperException - { - try { - PropertyEditor pe = (PropertyEditor)propertyEditorClass.newInstance(); - pe.setAsText(attrValue); - return pe.getValue(); - } catch (Exception ex) { - throw new JasperException( - Localizer.getMessage("jsp.error.beans.property.conversion", - attrValue, attrClass.getName(), attrName, - ex.getMessage())); - } - } - - public static Object getValueFromPropertyEditorManager( - Class attrClass, String attrName, String attrValue) - throws JasperException - { - try { - PropertyEditor propEditor = - PropertyEditorManager.findEditor(attrClass); - if (propEditor != null) { - propEditor.setAsText(attrValue); - return propEditor.getValue(); - } else { - throw new IllegalArgumentException( - Localizer.getMessage("jsp.error.beans.propertyeditor.notregistered")); - } - } catch (IllegalArgumentException ex) { - throw new JasperException( - Localizer.getMessage("jsp.error.beans.property.conversion", - attrValue, attrClass.getName(), attrName, - ex.getMessage())); - } - } - - - // ************************************************************************ - // General Purpose Runtime Methods - // ************************************************************************ - - - /** - * Convert a possibly relative resource path into a context-relative - * resource path that starts with a '/'. - * - * @param request The servlet request we are processing - * @param relativePath The possibly relative resource path - */ - public static String getContextRelativePath(ServletRequest request, - String relativePath) { - - if (relativePath.startsWith("/")) - return (relativePath); - if (!(request instanceof HttpServletRequest)) - return (relativePath); - HttpServletRequest hrequest = (HttpServletRequest) request; - String uri = (String) - request.getAttribute("javax.servlet.include.servlet_path"); - if (uri != null) { - String pathInfo = (String) - request.getAttribute("javax.servlet.include.path_info"); - if (pathInfo == null) { - if (uri.lastIndexOf('/') >= 0) { - uri = uri.substring(0, uri.lastIndexOf('/')); - } - } - } - else { - uri = hrequest.getServletPath(); - if (uri.lastIndexOf('/') >= 0) { - uri = uri.substring(0, uri.lastIndexOf('/')); - } - } - return uri + '/' + relativePath; - - } - - - /** - * Perform a RequestDispatcher.include() operation, with optional flushing - * of the response beforehand. - * - * @param request The servlet request we are processing - * @param response The servlet response we are processing - * @param relativePath The relative path of the resource to be included - * @param out The Writer to whom we are currently writing - * @param flush Should we flush before the include is processed? - * - * @exception IOException if thrown by the included servlet - * @exception ServletException if thrown by the included servlet - */ - public static void include(ServletRequest request, - ServletResponse response, - String relativePath, - JspWriter out, - boolean flush) - throws IOException, ServletException { - - if (flush && !(out instanceof BodyContent)) - out.flush(); - - // FIXME - It is tempting to use request.getRequestDispatcher() to - // resolve a relative path directly, but Catalina currently does not - // take into account whether the caller is inside a RequestDispatcher - // include or not. Whether Catalina *should* take that into account - // is a spec issue currently under review. In the mean time, - // replicate Jasper's previous behavior - - String resourcePath = getContextRelativePath(request, relativePath); - RequestDispatcher rd = request.getRequestDispatcher(resourcePath); - - rd.include(request, - new ServletResponseWrapperInclude(response, out)); - - } - - public static String URLEncode(String s, String enc) { - - if (s == null) { - return "null"; - } - - if (enc == null) { - enc = "ISO-8859-1"; // The default request encoding - } - - try { - return java.net.URLEncoder.encode(s, enc); - } catch (java.io.UnsupportedEncodingException ex) { - } - return s; - } -} diff --git a/impl/src/main/java/org/apache/jasper/runtime/JspSourceDependent.java b/impl/src/main/java/org/apache/jasper/runtime/JspSourceDependent.java deleted file mode 100644 index b2ed1db..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/JspSourceDependent.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -/** - * Interface for tracking the source files dependencies, for the purpose - * of compiling out of date pages. This is used for - * 1) files that are included by page directives - * 2) files that are included by include-prelude and include-coda in jsp:config - * 3) files that are tag files and referenced - * 4) TLDs referenced - */ - -public interface JspSourceDependent { - - /** - * Returns a list of files names that the current page has a source - * dependency on. - */ - public java.util.List getDependants(); -} diff --git a/impl/src/main/java/org/apache/jasper/runtime/JspWriterImpl.java b/impl/src/main/java/org/apache/jasper/runtime/JspWriterImpl.java deleted file mode 100644 index ead4f5e..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/JspWriterImpl.java +++ /dev/null @@ -1,802 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import java.io.IOException; -import java.io.Writer; -import java.security.AccessController; -import java.security.PrivilegedAction; - -import javax.servlet.ServletResponse; -import javax.servlet.jsp.JspWriter; - -import org.apache.jasper.Constants; -import org.apache.jasper.compiler.Localizer; -import org.apache.jasper.security.SecurityUtil; - -import org.glassfish.jsp.api.ByteWriter; - - -/** - * Write text to a character-output stream, buffering characters so as - * to provide for the efficient writing of single characters, arrays, - * and strings. - * - * Provide support for discarding for the output that has been - * buffered. - * - * This needs revisiting when the buffering problems in the JSP spec - * are fixed -akv What buffering problems? -kmc - * - * Add method for writing bytes. This allows static texts to be pre-encoded, - * for performance. Note that this can be done only if the page is unbuffered. - * -kmc - * - * @author Anil K. Vijendran - * @author Kin-man Chung - * @author Dongbin Nie - */ -public class JspWriterImpl extends JspWriter { - - private static final int MAX_BUFFER_SIZE = Integer.getInteger( - "org.apache.jasper.runtime.JspWriterImpl.MAX_THREAD_LOCAL_BUFFER_SIZE", - 32 * 1024); - - private static final ThreadLocal - charBufferPools = new ThreadLocal(); - - private Writer out; - private ServletResponse response; - private CharBuffer buf; - private boolean flushed = false; - private boolean closed = false; - protected boolean implementsByteWriter = true; - protected ByteWriter byteOut; - - public JspWriterImpl() { - super( Constants.DEFAULT_BUFFER_SIZE, true ); - } - - /** - * Create a buffered character-output stream that uses a default-sized - * output buffer. - * - * @param response A Servlet Response - */ - public JspWriterImpl(ServletResponse response) { - this(response, Constants.DEFAULT_BUFFER_SIZE, true); - } - - /** - * Create a new buffered character-output stream that uses an output - * buffer of the given size. - * - * @param response A Servlet Response - * @param sz Output-buffer size, a positive integer - * - * @exception IllegalArgumentException If sz is <= 0 - */ - public JspWriterImpl(ServletResponse response, int sz, - boolean autoFlush) { - super(sz, autoFlush); - if (sz < 0) - throw new IllegalArgumentException("Buffer size <= 0"); - this.response = response; - allocateCharBuffer(); - // START OF IASRI 4641975/6172992 - try { - response.setBufferSize(sz); - } catch (IllegalStateException ise) { - // ignore - } - // END OF IASRI 4641975/6172992 - } - - void init( ServletResponse response, int sz, boolean autoFlush ) { - this.response= response; - this.autoFlush=autoFlush; - this.bufferSize=sz; - allocateCharBuffer(); - // START OF IASRI 4641975/6172992 - try { - response.setBufferSize(sz); - } catch (IllegalStateException ise) { - // ignore - } - // END OF IASRI 4641975/6172992 - } - - /** Package-level access - */ - void recycle() { - flushed = false; - closed = false; - out = null; - byteOut = null; - releaseCharBuffer(); - response = null; - } - - /** - * Flush the output buffer to the underlying character stream, without - * flushing the stream itself. This method is non-private only so that it - * may be invoked by PrintStream. - */ - protected final void flushBuffer() throws IOException { - if (bufferSize == 0) - return; - flushed = true; - ensureOpen(); - if (buf.pos == buf.offset) - return; - initOut(); - out.write(buf.buf, buf.offset, buf.pos - buf.offset); - buf.pos = buf.offset; - } - - private void initOut() throws IOException { - if (out == null) { - out = response.getWriter(); - } - } - - private String getLocalizeMessage(final String message){ - if (SecurityUtil.isPackageProtectionEnabled()){ - return AccessController.doPrivileged( - new PrivilegedAction(){ - public String run(){ - return Localizer.getMessage(message); - } - }); - } else { - return Localizer.getMessage(message); - } - } - - /** - * Discard the output buffer. - */ - public final void clear() throws IOException { - if ((bufferSize == 0) && (out != null)) - // clear() is illegal after any unbuffered output (JSP.5.5) - throw new IllegalStateException( - getLocalizeMessage("jsp.error.ise_on_clear")); - if (flushed) - throw new IOException( - getLocalizeMessage("jsp.error.attempt_to_clear_flushed_buffer")); - ensureOpen(); - if (buf != null) - buf.pos = buf.offset; - } - - public void clearBuffer() throws IOException { - if (bufferSize == 0) - throw new IllegalStateException( - getLocalizeMessage("jsp.error.ise_on_clear")); - ensureOpen(); - buf.pos = buf.offset; - } - - private final void bufferOverflow() throws IOException { - throw new IOException(getLocalizeMessage("jsp.error.overflow")); - } - - /** - * Flush the stream. - * - */ - public void flush() throws IOException { - flushBuffer(); - if (out != null) { - out.flush(); - } - // START 6426898 - else { - // Set the default character encoding if there isn't any present, - // see CR 6699416 - response.setCharacterEncoding(response.getCharacterEncoding()); - - // Cause response headers to be sent - response.flushBuffer(); - } - // END 6426898 - } - - /** - * Close the stream. - * - */ - public void close() throws IOException { - if (response == null || closed) - // multiple calls to close is OK - return; - flush(); - if (out != null) - out.close(); - out = null; - byteOut = null; - closed = true; - } - - /** - * @return the number of bytes unused in the buffer - */ - public int getRemaining() { - return buf == null ? 0 : buf.lim - buf.pos; - } - - /** check to make sure that the stream has not been closed */ - private void ensureOpen() throws IOException { - if (response == null || closed) - throw new IOException("Stream closed"); - } - - - /** - * Attempt to write a String pre-encoded with the page encoding. - * - * @param bytesOK If true, write out the byte array, - * else, write out the String. - * @param buf The text encoded with the page encoding - * @param str The original text - */ - public void write(boolean bytesOK, byte buf[], String str) - throws IOException { - - ensureOpen(); - if (bufferSize == 0 && bytesOK) { - initByteOut(); - if (implementsByteWriter) { - write(buf, 0, buf.length); - return; - } - } - write(str); - } - - /* Returns true if bytes should be outputted. - * Used by ServletResponseWrapperInclude. - */ - boolean shouldOutputBytes() { - if (bufferSize > 0) { - return false; - } - try { - initByteOut(); - } catch (IOException ex) { - } - return implementsByteWriter; - } - - private void initByteOut() throws IOException { - initOut(); - if (byteOut == null) { - try { - byteOut = (ByteWriter) out; - implementsByteWriter = true; - } catch (ClassCastException ex) { - implementsByteWriter = false; - } - } - } - - public void write(byte buf[], int off, int len) - throws IOException { - byteOut.write(buf, off, len); - } - - - /** - * Write a single character. - */ - public void write(int c) throws IOException { - ensureOpen(); - if (bufferSize == 0) { - initOut(); - out.write(c); - } - else { - if (getRemaining() == 0) - if (autoFlush) - flushBuffer(); - else - bufferOverflow(); - buf.buf[buf.pos++] = (char) c; - } - } - - /** - * Our own little min method, to avoid loading java.lang.Math if we've run - * out of file descriptors and we're trying to print a stack trace. - */ - private int min(int a, int b) { - if (a < b) return a; - return b; - } - - /** - * Write a portion of an array of characters. - * - *

    Ordinarily this method stores characters from the given array into - * this stream's buffer, flushing the buffer to the underlying stream as - * needed. If the requested length is at least as large as the buffer, - * however, then this method will flush the buffer and write the characters - * directly to the underlying stream. Thus redundant - * DiscardableBufferedWriters will not copy data unnecessarily. - * - * @param cbuf A character array - * @param off Offset from which to start reading characters - * @param len Number of characters to write - */ - public void write(char cbuf[], int off, int len) - throws IOException - { - ensureOpen(); - - if (bufferSize == 0) { - initOut(); - out.write(cbuf, off, len); - return; - } - - if ((off < 0) || (off > cbuf.length) || (len < 0) || - ((off + len) > cbuf.length) || ((off + len) < 0)) { - throw new IndexOutOfBoundsException(); - } else if (len == 0) { - return; - } - - if (len >= bufferSize) { - /* If the request length exceeds the size of the output buffer, - flush the buffer and then write the data directly. In this - way buffered streams will cascade harmlessly. */ - if (autoFlush) - flushBuffer(); - else - bufferOverflow(); - initOut(); - out.write(cbuf, off, len); - return; - } - - int b = off, t = off + len; - while (b < t) { - int d = min(getRemaining(), t - b); - System.arraycopy(cbuf, b, buf.buf, buf.pos, d); - b += d; - buf.pos += d; - if (getRemaining() == 0) - if (autoFlush) - flushBuffer(); - else - bufferOverflow(); - } - - } - - /** - * Write an array of characters. This method cannot be inherited from the - * Writer class because it must suppress I/O exceptions. - */ - public void write(char buf[]) throws IOException { - write(buf, 0, buf.length); - } - - /** - * Write a portion of a String. - * - * @param s String to be written - * @param off Offset from which to start reading characters - * @param len Number of characters to be written - */ - public void write(String s, int off, int len) throws IOException { - ensureOpen(); - if (bufferSize == 0) { - initOut(); - out.write(s, off, len); - return; - } - int b = off, t = off + len; - while (b < t) { - int d = min(getRemaining(), t - b); - s.getChars(b, b + d, buf.buf, buf.pos); - b += d; - buf.pos += d; - if (getRemaining() == 0) - if (autoFlush) - flushBuffer(); - else - bufferOverflow(); - } - } - - /** - * Write a string. This method cannot be inherited from the Writer class - * because it must suppress I/O exceptions. - */ - public void write(String s) throws IOException { - // Simple fix for Bugzilla 35410 - // Calling the other write function so as to init the buffer anyways - write(s, 0, (s != null) ? s.length() : 0); - } - - - static String lineSeparator = System.getProperty("line.separator"); - - /** - * Write a line separator. The line separator string is defined by the - * system property line.separator, and is not necessarily a single - * newline ('\n') character. - * - * @exception IOException If an I/O error occurs - */ - - public void newLine() throws IOException { - write(lineSeparator); - } - - - /* Methods that do not terminate lines */ - - /** - * Print a boolean value. The string produced by {@link - * java.lang.String#valueOf(boolean)} is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the {@link - * #write(int)} method. - * - * @param b The boolean to be printed - */ - public void print(boolean b) throws IOException { - write(b ? "true" : "false"); - } - - /** - * Print a character. The character is translated into one or more bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the {@link - * #write(int)} method. - * - * @param c The char to be printed - */ - public void print(char c) throws IOException { - write(String.valueOf(c)); - } - - /** - * Print an integer. The string produced by {@link - * java.lang.String#valueOf(int)} is translated into bytes according - * to the platform's default character encoding, and these bytes are - * written in exactly the manner of the {@link #write(int)} - * method. - * - * @param i The int to be printed - */ - public void print(int i) throws IOException { - write(String.valueOf(i)); - } - - /** - * Print a long integer. The string produced by {@link - * java.lang.String#valueOf(long)} is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the {@link #write(int)} - * method. - * - * @param l The long to be printed - */ - public void print(long l) throws IOException { - write(String.valueOf(l)); - } - - /** - * Print a floating-point number. The string produced by {@link - * java.lang.String#valueOf(float)} is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the {@link #write(int)} - * method. - * - * @param f The float to be printed - */ - public void print(float f) throws IOException { - write(String.valueOf(f)); - } - - /** - * Print a double-precision floating-point number. The string produced by - * {@link java.lang.String#valueOf(double)} is translated into - * bytes according to the platform's default character encoding, and these - * bytes are written in exactly the manner of the {@link - * #write(int)} method. - * - * @param d The double to be printed - */ - public void print(double d) throws IOException { - write(String.valueOf(d)); - } - - /** - * Print an array of characters. The characters are converted into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the {@link #write(int)} - * method. - * - * @param s The array of chars to be printed - * - * @throws NullPointerException If s is null - */ - public void print(char s[]) throws IOException { - write(s); - } - - /** - * Print a string. If the argument is null then the string - * "null" is printed. Otherwise, the string's characters are - * converted into bytes according to the platform's default character - * encoding, and these bytes are written in exactly the manner of the - * {@link #write(int)} method. - * - * @param s The String to be printed - */ - public void print(String s) throws IOException { - if (s == null) { - s = "null"; - } - write(s); - } - - /** - * Print an object. The string produced by the {@link - * java.lang.String#valueOf(Object)} method is translated into bytes - * according to the platform's default character encoding, and these bytes - * are written in exactly the manner of the {@link #write(int)} - * method. - * - * @param obj The Object to be printed - */ - public void print(Object obj) throws IOException { - write(String.valueOf(obj)); - } - - /* Methods that do terminate lines */ - - /** - * Terminate the current line by writing the line separator string. The - * line separator string is defined by the system property - * line.separator, and is not necessarily a single newline - * character ('\n'). - * - * Need to change this from PrintWriter because the default - * println() writes to the sink directly instead of through the - * write method... - */ - public void println() throws IOException { - newLine(); - } - - /** - * Print a boolean value and then terminate the line. This method behaves - * as though it invokes {@link #print(boolean)} and then - * {@link #println()}. - */ - public void println(boolean x) throws IOException { - print(x); - println(); - } - - /** - * Print a character and then terminate the line. This method behaves as - * though it invokes {@link #print(char)} and then {@link - * #println()}. - */ - public void println(char x) throws IOException { - print(x); - println(); - } - - /** - * Print an integer and then terminate the line. This method behaves as - * though it invokes {@link #print(int)} and then {@link - * #println()}. - */ - public void println(int x) throws IOException { - print(x); - println(); - } - - /** - * Print a long integer and then terminate the line. This method behaves - * as though it invokes {@link #print(long)} and then - * {@link #println()}. - */ - public void println(long x) throws IOException { - print(x); - println(); - } - - /** - * Print a floating-point number and then terminate the line. This method - * behaves as though it invokes {@link #print(float)} and then - * {@link #println()}. - */ - public void println(float x) throws IOException { - print(x); - println(); - } - - /** - * Print a double-precision floating-point number and then terminate the - * line. This method behaves as though it invokes {@link - * #print(double)} and then {@link #println()}. - */ - public void println(double x) throws IOException { - print(x); - println(); - } - - /** - * Print an array of characters and then terminate the line. This method - * behaves as though it invokes {@link #print(char[])} and then - * {@link #println()}. - */ - public void println(char x[]) throws IOException { - print(x); - println(); - } - - /** - * Print a String and then terminate the line. This method behaves as - * though it invokes {@link #print(String)} and then - * {@link #println()}. - */ - public void println(String x) throws IOException { - print(x); - println(); - } - - /** - * Print an Object and then terminate the line. This method behaves as - * though it invokes {@link #print(Object)} and then - * {@link #println()}. - */ - public void println(Object x) throws IOException { - print(x); - println(); - } - - - // START PWC 6512276 - public boolean hasData() { - if (bufferSize != 0 && buf.pos != buf.offset) { - return true; - } - - return false; - } - // END PWC 6512276 - - private void allocateCharBuffer() { - if (bufferSize == 0) return; - - if (bufferSize > MAX_BUFFER_SIZE) { - buf = new CharBuffer(new char[bufferSize], 0, bufferSize); - } else { - buf = getCharBufferThreadLocalPool().allocate(bufferSize); - } - } - - private void releaseCharBuffer() { - if (buf == null) return; - - if ((buf.lim - buf.offset) <= MAX_BUFFER_SIZE) { - getCharBufferThreadLocalPool().release(buf); - } - buf = null; - } - - private CharBufferThreadLocalPool getCharBufferThreadLocalPool() { - CharBufferThreadLocalPool pool = charBufferPools.get(); - if (pool == null) { - pool = new CharBufferThreadLocalPool(); - charBufferPools.set(pool); - } - return pool; - } - - private static class CharBuffer { - char[] buf; - int offset; - int pos; - int lim; - - CharBuffer(char[] buffer, int offset, int length) { - this.buf = buffer; - this.offset = offset; - this.pos = offset; - this.lim = offset + length; - } - } - - private static class CharBufferThreadLocalPool { - private char[] pool; - private int pos; - - public CharBuffer allocate(int size) { - if (remaining() < size) { - pool = new char[MAX_BUFFER_SIZE]; - pos = 0; - } - - CharBuffer allocated = new CharBuffer(pool, pos, size); - pos += size; - - return allocated; - } - - public void release(CharBuffer buffer) { - if (buffer.buf == pool && buffer.lim == pos) { - pos = buffer.offset; - } - } - - public int remaining() { - return pool == null ? 0 : pool.length - pos; - } - } -} diff --git a/impl/src/main/java/org/apache/jasper/runtime/PageContextImpl.java b/impl/src/main/java/org/apache/jasper/runtime/PageContextImpl.java deleted file mode 100644 index 3365f42..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/PageContextImpl.java +++ /dev/null @@ -1,1067 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import java.io.IOException; -import java.io.Writer; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.logging.Logger; -import java.util.logging.Level; - -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.JspFactory; -import javax.servlet.jsp.JspWriter; -import javax.servlet.jsp.PageContext; -import javax.servlet.jsp.JspApplicationContext; -import javax.servlet.jsp.tagext.BodyContent; -import javax.servlet.jsp.el.ExpressionEvaluator; -import javax.servlet.jsp.el.VariableResolver; -import javax.servlet.jsp.el.ImplicitObjectELResolver; -import javax.servlet.jsp.el.ScopedAttributeELResolver; - -import javax.el.ELException; -import javax.el.ELResolver; -import javax.el.ELContext; -import javax.el.BeanELResolver; -import javax.el.ArrayELResolver; -import javax.el.MapELResolver; -import javax.el.ResourceBundleELResolver; -import javax.el.ListELResolver; -import javax.el.CompositeELResolver; -import javax.el.ValueExpression; -import javax.el.FunctionMapper; -import javax.el.MethodExpression; -import javax.el.ExpressionFactory; -import javax.el.StaticFieldELResolver; - -import org.apache.jasper.Constants; -import org.apache.jasper.compiler.Localizer; -import org.apache.jasper.security.SecurityUtil; - -/** - * Implementation of the PageContext class from the JSP spec. - * - * @author Anil K. Vijendran - * @author Larry Cable - * @author Hans Bergsten - * @author Pierre Delisle - * @author Mark Roth - * @author Jan Luehe - * @author Kin-man Chung - */ -public class PageContextImpl extends PageContext { - - // Logger - private static Logger log = Logger.getLogger(PageContextImpl.class.getName()); - - // per-servlet state - private BodyContentImpl[] outs; - private int depth; - private Servlet servlet; - private ServletConfig config; - private ServletContext context; - private JspFactory factory; - private boolean needsSession; - private String errorPageURL; - private int bufferSize; - private JspApplicationContextImpl jspApplicationContext; - private ELResolver elResolver; - private ELContext elContext; - - // page-scope attributes - private HashMap attributes; - private boolean isNametableInitialized; - - // per-request state - private ServletRequest request; - private ServletResponse response; - private HttpSession session; - - // initial output stream - private JspWriter out; - private JspWriterImpl baseOut; - - /* - * Constructor. - */ - PageContextImpl(JspFactory factory) { - this.factory = factory; - this.outs = new BodyContentImpl[0]; - this.attributes = new HashMap(16); - this.depth = -1; - } - - public void initialize(Servlet servlet, - ServletRequest request, - ServletResponse response, - String errorPageURL, - boolean needsSession, - int bufferSize, - boolean autoFlush) throws IOException { - - _initialize(servlet, request, response, errorPageURL, needsSession, - bufferSize, autoFlush); - } - - private void _initialize(Servlet servlet, - ServletRequest request, - ServletResponse response, - String errorPageURL, - boolean needsSession, - int bufferSize, - boolean autoFlush) throws IOException { - - // initialize state - this.servlet = servlet; - this.config = servlet.getServletConfig(); - this.context = config.getServletContext(); - this.needsSession = needsSession; - this.errorPageURL = errorPageURL; - this.bufferSize = bufferSize; - this.request = request; - this.response = response; - - // Setup session (if required) - if (request instanceof HttpServletRequest && needsSession) - this.session = ((HttpServletRequest)request).getSession(); - if (needsSession && session == null) - throw new IllegalStateException - ("Page needs a session and none is available"); - - // initialize the initial out ... - depth = -1; - if (this.baseOut == null) { - this.baseOut = new JspWriterImpl(response, bufferSize, autoFlush); - } else { - this.baseOut.init(response, bufferSize, autoFlush); - } - this.out = baseOut; - - this.isNametableInitialized = false; - setAttribute(Constants.FIRST_REQUEST_SEEN, "true", APPLICATION_SCOPE); - - } - - private void initializePageScopeNameTable() { - isNametableInitialized = true; - // register names/values as per spec - setAttribute(OUT, this.out); - setAttribute(REQUEST, request); - setAttribute(RESPONSE, response); - - if (session != null) - setAttribute(SESSION, session); - - setAttribute(PAGE, servlet); - setAttribute(CONFIG, config); - setAttribute(PAGECONTEXT, this); - setAttribute(APPLICATION, context); - } - - public void release() { - out = baseOut; - try { - // Do not flush the buffer even if we're not included (i.e. - // we are the main page. The servlet will flush it and close - // the stream. - ((JspWriterImpl)out).flushBuffer(); - } catch (IOException ex) { - log.warning("Internal error flushing the buffer in release()"); - } - - servlet = null; - config = null; - context = null; - elContext = null; - elResolver = null; - jspApplicationContext = null; - needsSession = false; - errorPageURL = null; - bufferSize = JspWriter.DEFAULT_BUFFER; - request = null; - response = null; - depth = -1; - baseOut.recycle(); - session = null; - - attributes.clear(); - } - - public Object getAttribute(final String name) { - - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - if (SecurityUtil.isPackageProtectionEnabled()){ - return AccessController.doPrivileged(new PrivilegedAction(){ - public Object run(){ - return doGetAttribute(name); - } - }); - } else { - return doGetAttribute(name); - } - - } - - private Object doGetAttribute(String name){ - if (!isNametableInitialized) { - initializePageScopeNameTable(); - } - return attributes.get(name); - } - - public Object getAttribute(final String name, final int scope) { - - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - if (SecurityUtil.isPackageProtectionEnabled()){ - return AccessController.doPrivileged(new PrivilegedAction(){ - public Object run(){ - return doGetAttribute(name, scope); - } - }); - } else { - return doGetAttribute(name, scope); - } - - } - - private Object doGetAttribute(String name, int scope){ - switch (scope) { - case PAGE_SCOPE: - if (!isNametableInitialized) { - initializePageScopeNameTable(); - } - return attributes.get(name); - - case REQUEST_SCOPE: - return request.getAttribute(name); - - case SESSION_SCOPE: - if (session == null) { - throw new IllegalStateException( - Localizer.getMessage("jsp.error.page.noSession")); - } - return session.getAttribute(name); - - case APPLICATION_SCOPE: - return context.getAttribute(name); - - default: - throw new IllegalArgumentException("Invalid scope"); - } - } - - public void setAttribute(final String name, final Object attribute) { - - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - if (SecurityUtil.isPackageProtectionEnabled()){ - AccessController.doPrivileged(new PrivilegedAction(){ - public Object run(){ - doSetAttribute(name, attribute); - return null; - } - }); - } else { - doSetAttribute(name, attribute); - } - } - - private void doSetAttribute(String name, Object attribute){ - if (attribute != null) { - if (!isNametableInitialized) { - initializePageScopeNameTable(); - } - attributes.put(name, attribute); - } else { - removeAttribute(name, PAGE_SCOPE); - } - } - - public void setAttribute(final String name, final Object o, final int scope) { - - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - if (SecurityUtil.isPackageProtectionEnabled()){ - AccessController.doPrivileged(new PrivilegedAction(){ - public Object run(){ - doSetAttribute(name, o, scope); - return null; - } - }); - } else { - doSetAttribute(name, o, scope); - } - - } - - private void doSetAttribute(String name, Object o, int scope ){ - if (o != null) { - switch (scope) { - case PAGE_SCOPE: - if (!isNametableInitialized) { - initializePageScopeNameTable(); - } - attributes.put(name, o); - break; - - case REQUEST_SCOPE: - request.setAttribute(name, o); - break; - - case SESSION_SCOPE: - if (session == null) { - throw new IllegalStateException( - Localizer.getMessage("jsp.error.page.noSession")); - } - session.setAttribute(name, o); - break; - - case APPLICATION_SCOPE: - context.setAttribute(name, o); - break; - - default: - throw new IllegalArgumentException("Invalid scope"); - } - } else { - removeAttribute(name, scope); - } - } - - public void removeAttribute(final String name, final int scope) { - - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - if (SecurityUtil.isPackageProtectionEnabled()){ - AccessController.doPrivileged(new PrivilegedAction(){ - public Object run(){ - doRemoveAttribute(name, scope); - return null; - } - }); - } else { - doRemoveAttribute(name, scope); - } - } - - private void doRemoveAttribute(String name, int scope){ - switch (scope) { - case PAGE_SCOPE: - if (!isNametableInitialized) { - initializePageScopeNameTable(); - } - attributes.remove(name); - break; - - case REQUEST_SCOPE: - request.removeAttribute(name); - break; - - case SESSION_SCOPE: - if (session == null) { - throw new IllegalStateException( - Localizer.getMessage("jsp.error.page.noSession")); - } - session.removeAttribute(name); - break; - - case APPLICATION_SCOPE: - context.removeAttribute(name); - break; - - default: - throw new IllegalArgumentException("Invalid scope"); - } - } - - public int getAttributesScope(final String name) { - - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - if (SecurityUtil.isPackageProtectionEnabled()){ - return (AccessController.doPrivileged(new PrivilegedAction(){ - public Integer run(){ - return Integer.valueOf(doGetAttributeScope(name)); - } - })).intValue(); - } else { - return doGetAttributeScope(name); - } - } - - private int doGetAttributeScope(String name){ - - if (!isNametableInitialized) { - initializePageScopeNameTable(); - } - - if (attributes.get(name) != null) - return PAGE_SCOPE; - - if (request.getAttribute(name) != null) - return REQUEST_SCOPE; - - if (session != null) { - try { - if (session.getAttribute(name) != null) - return SESSION_SCOPE; - } catch (IllegalStateException ex) { - // Session has been invalidated. - // Ignore and fall through to application scope. - } - } - - if (context.getAttribute(name) != null) - return APPLICATION_SCOPE; - - return 0; - } - - public Object findAttribute(final String name) { - if (SecurityUtil.isPackageProtectionEnabled()){ - return AccessController.doPrivileged(new PrivilegedAction(){ - public Object run(){ - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - return doFindAttribute(name); - } - }); - } else { - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - return doFindAttribute(name); - } - } - - private Object doFindAttribute(String name){ - - if (!isNametableInitialized) { - initializePageScopeNameTable(); - } - - Object o = attributes.get(name); - if (o != null) - return o; - - o = request.getAttribute(name); - if (o != null) - return o; - - if (session != null) { - try { - o = session.getAttribute(name); - } catch (IllegalStateException ex) { - // Session has been invalidated. - // Ignore and fall through to application scope. - } - - if (o != null) return o; - } - - return context.getAttribute(name); - } - - - public Enumeration getAttributeNamesInScope(final int scope) { - if (SecurityUtil.isPackageProtectionEnabled()){ - return AccessController.doPrivileged( - new PrivilegedAction>(){ - public Enumeration run(){ - return doGetAttributeNamesInScope(scope); - } - }); - } else { - return doGetAttributeNamesInScope(scope); - } - } - - private Enumeration doGetAttributeNamesInScope(int scope){ - switch (scope) { - case PAGE_SCOPE: - if (!isNametableInitialized) { - initializePageScopeNameTable(); - } - return Collections.enumeration(attributes.keySet()); - - case REQUEST_SCOPE: - return request.getAttributeNames(); - - case SESSION_SCOPE: - if (session == null) { - throw new IllegalStateException( - Localizer.getMessage("jsp.error.page.noSession")); - } - return session.getAttributeNames(); - - case APPLICATION_SCOPE: - return context.getAttributeNames(); - - default: - throw new IllegalArgumentException("Invalid scope"); - } - } - - public void removeAttribute(final String name) { - - if (name == null) { - throw new NullPointerException( - Localizer.getMessage("jsp.error.attribute.null_name")); - } - - if (SecurityUtil.isPackageProtectionEnabled()){ - AccessController.doPrivileged(new PrivilegedAction(){ - public Object run(){ - doRemoveAttribute(name); - return null; - } - }); - } else { - doRemoveAttribute(name); - } - } - - private void doRemoveAttribute(String name){ - removeAttribute(name, PAGE_SCOPE); - removeAttribute(name, REQUEST_SCOPE); - if( session != null ) { - try { - removeAttribute(name, SESSION_SCOPE); - } catch (IllegalStateException ex) { - // Session has been invalidated. - // Ignore and fall through to application scope. - } - } - removeAttribute(name, APPLICATION_SCOPE); - } - - public JspWriter getOut() { - return out; - } - - public HttpSession getSession() { return session; } - public Servlet getServlet() { return servlet; } - public ServletConfig getServletConfig() { return config; } - public ServletContext getServletContext() { - return config.getServletContext(); - } - public ServletRequest getRequest() { return request; } - public ServletResponse getResponse() { return response; } - - - /** - * Returns the exception associated with this page context, if any. - * - * Added wrapping for Throwables to avoid ClassCastException - * (see Bugzilla 31171 for details). - * - * @return The Exception associated with this page context, if any. - */ - public Exception getException() { - - Throwable t = JspRuntimeLibrary.getThrowable(request); - - // Only wrap if needed - if((t != null) && (! (t instanceof Exception))) { - t = new JspException(t); - } - - return (Exception) t; - } - - - public Object getPage() { return servlet; } - - - private final String getAbsolutePathRelativeToContext(String relativeUrlPath) { - String path = relativeUrlPath; - - if (!path.startsWith("/")) { - String uri = (String) - request.getAttribute("javax.servlet.include.servlet_path"); - if (uri == null) - uri = ((HttpServletRequest) request).getServletPath(); - String baseURI = uri.substring(0, uri.lastIndexOf('/')); - path = baseURI+'/'+path; - } - - return path; - } - - public void include(String relativeUrlPath) - throws ServletException, IOException { - JspRuntimeLibrary.include(request, response, relativeUrlPath, out, - true); - } - - /* - * No need to execute include inside a privileged block, since it calls - * ApplicationDispatcher include, which in turn is executed inside a - * privileged block - */ - public void include(String relativeUrlPath, boolean flush) - throws ServletException, IOException { - JspRuntimeLibrary.include(request, response, relativeUrlPath, out, - flush); - } - - public VariableResolver getVariableResolver() { - return new VariableResolverImpl(this); - } - - private ELResolver getELResolver() { - - if (elResolver == null) { - // Create a CompositeELResolver - CompositeELResolver celResolver = new CompositeELResolver(); - - celResolver.add(new ImplicitObjectELResolver()); - // Add ELResolvers registered in JspApplicationContext - JspApplicationContextImpl jaContext = getJspApplicationContext(); - Iterator it = jaContext.getELResolvers(); - while (it.hasNext()) { - celResolver.add(it.next()); - } - ELResolver streamELResolver = - getExpressionFactory(this).getStreamELResolver(); - if (streamELResolver != null) { - celResolver.add(streamELResolver); - } - celResolver.add(new StaticFieldELResolver()); - celResolver.add(new MapELResolver()); - celResolver.add(new ResourceBundleELResolver()); - celResolver.add(new ListELResolver()); - celResolver.add(new ArrayELResolver()); - celResolver.add(new BeanELResolver()); - celResolver.add(new ScopedAttributeELResolver()); - elResolver = celResolver; - } - return elResolver; - } - - public ELContext getELContext() { - if (elContext == null) { - elContext = getJspApplicationContext().createELContext( - getELResolver()); - elContext.putContext(javax.servlet.jsp.JspContext.class, this); - ((ELContextImpl)elContext).setVariableMapper( - new VariableMapperImpl()); - } - return elContext; - } - - JspApplicationContextImpl getJspApplicationContext() { - if (jspApplicationContext == null) { - jspApplicationContext = - JspApplicationContextImpl.findJspApplicationContext(context); - } - return jspApplicationContext; - } - - /* - * No need to execute forward inside a privileged block, since it calls - * ApplicationDispatcher forward, which in turn is executed inside a - * privileged block - */ - public void forward(String relativeUrlPath) - throws ServletException, IOException{ - - // JSP.4.5 If the buffer was flushed, throw IllegalStateException - try { - out.clear(); - } catch (IOException ex) { - IllegalStateException ise = - new IllegalStateException(Localizer.getMessage( - "jsp.error.attempt_to_clear_flushed_buffer")); - ise.initCause(ex); - throw ise; - } - - // Make sure that the response object is not the wrapper for include - while (response instanceof ServletResponseWrapperInclude) { - response = ((ServletResponseWrapperInclude)response).getResponse(); - } - - final String path = getAbsolutePathRelativeToContext(relativeUrlPath); - String includeUri - = (String) request.getAttribute(Constants.INC_SERVLET_PATH); - - final ServletResponse fresponse = response; - final ServletRequest frequest = request; - - if (includeUri != null) - request.removeAttribute(Constants.INC_SERVLET_PATH); - try { - context.getRequestDispatcher(path).forward(request, response); - } finally { - if (includeUri != null) - request.setAttribute(Constants.INC_SERVLET_PATH, includeUri); - request.setAttribute(Constants.FORWARD_SEEN, "true"); - } - } - - public BodyContent pushBody() { - return (BodyContent) pushBody(null); - } - - // Note that there is a potential memory leak with way BodyContentImpl - // are pooled. The "outs" array is extended in pushBody, but not shrinked - // in popBody; and BodyContentImpl.cb can gets arbritarily large. - // See https://glassfish.dev.java.net/issues/show_bug.cgi?id=8601 - // Setting FactoryImpl.USE_POOL to false eliminates most of the leak, - // but not all -- kchung 6/29/2009 - public JspWriter pushBody(Writer writer) { - depth++; - if (depth >= outs.length) { - BodyContentImpl[] newOuts = new BodyContentImpl[depth + 1]; - for (int i=0; i= 0) { - out = outs[depth]; - } else { - out = baseOut; - } - - // Update the value of the "out" attribute in the page scope - // attribute namespace of this PageContext - setAttribute(OUT, out); - - return out; - } - - /** - * Provides programmatic access to the ExpressionEvaluator. - * The JSP Container must return a valid instance of an - * ExpressionEvaluator that can parse EL expressions. - */ - public ExpressionEvaluator getExpressionEvaluator() { - return new ExpressionEvaluatorImpl(this); - } - - public void handlePageException(Exception ex) - throws IOException, ServletException - { - // Should never be called since handleException() called with a - // Throwable in the generated servlet. - handlePageException((Throwable) ex); - } - - public void handlePageException(final Throwable t) - throws IOException, ServletException - { - if (t == null) - throw new NullPointerException("null Throwable"); - - if (SecurityUtil.isPackageProtectionEnabled()){ - try{ - AccessController.doPrivileged(new PrivilegedExceptionAction(){ - public Object run() throws Exception{ - doHandlePageException(t); - return null; - } - }); - } catch (PrivilegedActionException e){ - Exception ex = e.getException(); - if (ex instanceof IOException){ - throw (IOException)ex; - } else { - throw (ServletException)ex; - } - } - } else { - doHandlePageException(t); - } - - } - - private void doHandlePageException(Throwable t) - throws IOException, ServletException { - - if (errorPageURL != null && !errorPageURL.equals("")) { - - /* - * Set request attributes. - * Do not set the javax.servlet.error.exception attribute here - * (instead, set in the generated servlet code for the error page) - * in order to prevent the ErrorReportValve, which is invoked as - * part of forwarding the request to the error page, from - * throwing it if the response has not been committed (the response - * will have been committed if the error page is a JSP page). - */ - request.setAttribute("javax.servlet.jsp.jspException", t); - request.setAttribute("javax.servlet.error.status_code", - Integer.valueOf(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); - request.setAttribute("javax.servlet.error.request_uri", - ((HttpServletRequest) request).getRequestURI()); - request.setAttribute("javax.servlet.error.servlet_name", - config.getServletName()); - try { - forward(errorPageURL); - } catch (IllegalStateException ise) { - include(errorPageURL); - } - - // The error page could be inside an include. - - Object newException = request.getAttribute("javax.servlet.error.exception"); - - // t==null means the attribute was not set. - if( (newException!= null) && (newException==t) ) { - request.removeAttribute("javax.servlet.error.exception"); - request.setAttribute(Constants.JSP_ERROR_HANDLED, Boolean.TRUE); - } - - // now clear the error code - to prevent double handling. - request.removeAttribute("javax.servlet.error.status_code"); - request.removeAttribute("javax.servlet.error.request_uri"); - request.removeAttribute("javax.servlet.jsp.jspException"); - - } else { - - // Otherwise throw the exception wrapped inside a ServletException. - // Set the exception as the root cause in the ServletException - // to get a stack trace for the real problem - if (t instanceof IOException) throw (IOException)t; - if (t instanceof ServletException) throw (ServletException)t; - if (t instanceof RuntimeException) throw (RuntimeException)t; - if (t instanceof Error) throw (Error)t; - - Throwable rootCause = null; - if (t instanceof JspException) { - rootCause = ((JspException) t).getRootCause(); - } else if (t instanceof ELException) { - rootCause = t.getCause(); - } - - if (rootCause != null) { - throw new ServletException(t.getMessage(), rootCause); - } - - throw new ServletException(t); - } - } - - private static ExpressionFactory getExpressionFactory( - PageContext pageContext) { - - PageContextImpl pc = - (PageContextImpl) JspContextWrapper.getRootPageContext(pageContext); - return pc.getJspApplicationContext().getExpressionFactory(); - } - - /** - * Evaluates an EL expression - * - * @param expression The expression to be evaluated - * @param expectedType The expected resulting type - * @param pageContext The page context - * @param functionMap Maps prefix and name to Method - * @return The result of the evaluation - */ - public static Object evaluateExpression(final String expression, - final Class expectedType, - final PageContext pageContext, - final ProtectedFunctionMapper functionMap) - throws ELException - { - Object retValue; - if (SecurityUtil.isPackageProtectionEnabled()){ - try { - retValue = AccessController.doPrivileged( - new PrivilegedExceptionAction(){ - - public Object run() throws Exception{ - ELContextImpl elContext = - (ELContextImpl) pageContext.getELContext(); - elContext.setFunctionMapper(functionMap); - ExpressionFactory expFactory = getExpressionFactory(pageContext); - ValueExpression expr = - expFactory.createValueExpression( - elContext, - expression, - expectedType); - return expr.getValue(elContext); - } - }); - } catch (PrivilegedActionException ex) { - Exception realEx = ex.getException(); - if (realEx instanceof ELException) { - throw (ELException) realEx; - } else { - throw new ELException(realEx); - } - } - } else { - ELContextImpl elContext = (ELContextImpl)pageContext.getELContext(); - elContext.setFunctionMapper(functionMap); - ExpressionFactory expFactory = getExpressionFactory(pageContext); - ValueExpression expr = expFactory.createValueExpression( - elContext, - expression, - expectedType); - retValue = expr.getValue(elContext); - } - return retValue; - } - - public static ValueExpression getValueExpression(String expression, - PageContext pageContext, - Class expectedType, - FunctionMapper functionMap) - { - // ELResolvers are not used in createValueExpression - ELContextImpl elctxt = (ELContextImpl)pageContext.getELContext(); - elctxt.setFunctionMapper(functionMap); - ExpressionFactory expFactory = getExpressionFactory(pageContext); - return expFactory.createValueExpression(elctxt, - expression, - expectedType); - } - - public static MethodExpression getMethodExpression( - String expression, - PageContext pageContext, - FunctionMapper functionMap, - Class expectedType, - Class[] paramTypes) { - - ELContextImpl elctxt = (ELContextImpl)pageContext.getELContext(); - elctxt.setFunctionMapper(functionMap); - ExpressionFactory expFactory = getExpressionFactory(pageContext); - return expFactory.createMethodExpression( - elctxt, - expression, - expectedType, - paramTypes); - } - - public static void setValueVariable(PageContext pageContext, - String variable, - ValueExpression expression) { - ELContextImpl elctxt = (ELContextImpl)pageContext.getELContext(); - elctxt.getVariableMapper().setVariable(variable, expression); - } - - public static void setMethodVariable(PageContext pageContext, - String variable, - MethodExpression expression) { - ExpressionFactory expFactory = getExpressionFactory(pageContext); - ValueExpression exp = - expFactory.createValueExpression(expression, Object.class); - setValueVariable(pageContext, variable, exp); - } -} diff --git a/impl/src/main/java/org/apache/jasper/runtime/PerThreadTagHandlerPool.java b/impl/src/main/java/org/apache/jasper/runtime/PerThreadTagHandlerPool.java deleted file mode 100644 index d22b157..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/PerThreadTagHandlerPool.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -import javax.servlet.ServletConfig; -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.tagext.JspTag; - -import org.apache.jasper.Constants; - -/** - * Thread-local based pool of tag handlers that can be reused. - * - * @author Jan Luehe - * @author Costin Manolache - */ -public class PerThreadTagHandlerPool extends TagHandlerPool { - - private int maxSize; - - // For cleanup - private Vector perThreadDataVector; - - private ThreadLocal perThread; - - private static class PerThreadData { - JspTag handlers[]; - int current; - } - - /** - * Constructs a tag handler pool with the default capacity. - */ - public PerThreadTagHandlerPool() { - super(); - perThreadDataVector = new Vector(); - } - - protected void init(ServletConfig config) { - maxSize = Constants.MAX_POOL_SIZE; - String maxSizeS = getOption(config, OPTION_MAXSIZE, null); - if (maxSizeS != null) { - maxSize = Integer.parseInt(maxSizeS); - if (maxSize < 0) { - maxSize = Constants.MAX_POOL_SIZE; - } - } - - perThread = new ThreadLocal() { - protected PerThreadData initialValue() { - PerThreadData ptd = new PerThreadData(); - ptd.handlers = new Tag[maxSize]; - ptd.current = -1; - perThreadDataVector.addElement(ptd); - return ptd; - } - }; - } - - /** - * Gets the next available tag handler from this tag handler pool, - * instantiating one if this tag handler pool is empty. - * - * @param handlerClass Tag handler class - * - * @return Reused or newly instantiated tag handler - * - * @throws JspException if a tag handler cannot be instantiated - */ - public Tag get(Class handlerClass) throws JspException { - PerThreadData ptd = perThread.get(); - if(ptd.current >=0 ) { - return ptd.handlers[ptd.current--]; - } else { - try { - return (Tag) handlerClass.newInstance(); - } catch (Exception e) { - throw new JspException(e.getMessage(), e); - } - } - } - - /** - * Adds the given tag handler to this tag handler pool, unless this tag - * handler pool has already reached its capacity, in which case the tag - * handler's release() method is called. - * - * @param handler Tag handler to add to this tag handler pool - */ - public void reuse(Tag handler) { - PerThreadData ptd=perThread.get(); - if (ptd.current < (ptd.handlers.length - 1)) { - ptd.handlers[++ptd.current] = handler; - } else { - handler.release(); - } - } - - /** - * Calls the release() method of all tag handlers in this tag handler pool. - */ - public void release() { - Enumeration enumeration = perThreadDataVector.elements(); - while (enumeration.hasMoreElements()) { - PerThreadData ptd = enumeration.nextElement(); - if (ptd.handlers != null) { - for (int i=ptd.current; i>=0; i--) { - if (ptd.handlers[i] != null) { - ptd.handlers[i].release(); - } - } - } - } - } -} - diff --git a/impl/src/main/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java b/impl/src/main/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java deleted file mode 100644 index 065c7da..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import java.util.HashMap; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.security.PrivilegedExceptionAction; -import java.security.PrivilegedActionException; -import java.lang.reflect.Method; -import javax.el.FunctionMapper; -import org.apache.jasper.security.SecurityUtil; -/** - * Maps EL functions to their Java method counterparts. Keeps the - * actual Method objects protected so that JSP pages can't indirectly - * do reflection. - * - * @author Mark Roth - * @author Kin-man Chung - */ -public final class ProtectedFunctionMapper extends FunctionMapper { - - /** - * Maps "prefix:name" to java.lang.Method objects. - */ - private HashMap fnmap = null; - - /** - * If there is only one function in the map, this is the Method for it. - */ - private Method theMethod = null; - - /** - * Constructor has protected access. - */ - private ProtectedFunctionMapper() { - } - - /** - * Generated Servlet and Tag Handler implementations call this - * method to retrieve an instance of the ProtectedFunctionMapper. - * This is necessary since generated code does not have access to - * create instances of classes in this package. - * - * @return A new protected function mapper. - */ - public static ProtectedFunctionMapper getInstance() { - ProtectedFunctionMapper funcMapper; - if (SecurityUtil.isPackageProtectionEnabled()) { - funcMapper = AccessController.doPrivileged( - new PrivilegedAction() { - public ProtectedFunctionMapper run() { - return new ProtectedFunctionMapper(); - } - } ); - } else { - funcMapper = new ProtectedFunctionMapper(); - } - funcMapper.fnmap = new java.util.HashMap(); - return funcMapper; - } - - /** - * Stores a mapping from the given EL function prefix and name to - * the given Java method. - * - * @param fnQName The EL function qualified name (including prefix) - * @param c The class containing the Java method - * @param methodName The name of the Java method - * @param args The arguments of the Java method - * @throws RuntimeException if no method with the given signature - * could be found. - */ - public void mapFunction(String fnQName, final Class c, - final String methodName, final Class[] args ) - { - java.lang.reflect.Method method; - if (SecurityUtil.isPackageProtectionEnabled()){ - try{ - method = AccessController.doPrivileged( - new PrivilegedExceptionAction(){ - public Method run() throws Exception{ - return c.getDeclaredMethod(methodName, args); - } - }); - } catch (PrivilegedActionException ex){ - throw new RuntimeException( - "Invalid function mapping - no such method: " - + ex.getException().getMessage()); - } - } else { - try { - method = c.getDeclaredMethod(methodName, args); - } catch( NoSuchMethodException e ) { - throw new RuntimeException( - "Invalid function mapping - no such method: " - + e.getMessage()); - } - } - - this.fnmap.put(fnQName, method ); - } - - /** - * Creates an instance for this class, and stores the Method for - * the given EL function prefix and name. This method is used for - * the case when there is only one function in the EL expression. - * - * @param fnQName The EL function qualified name (including prefix) - * @param c The class containing the Java method - * @param methodName The name of the Java method - * @param args The arguments of the Java method - * @throws RuntimeException if no method with the given signature - * could be found. - */ - public static ProtectedFunctionMapper getMapForFunction( - String fnQName, final Class c, - final String methodName, final Class[] args ) - { - java.lang.reflect.Method method; - ProtectedFunctionMapper funcMapper; - if (SecurityUtil.isPackageProtectionEnabled()){ - funcMapper = AccessController.doPrivileged( - new PrivilegedAction(){ - public ProtectedFunctionMapper run() { - return new ProtectedFunctionMapper(); - } - }); - - try{ - method = AccessController.doPrivileged( - new PrivilegedExceptionAction(){ - public Method run() throws Exception{ - return c.getDeclaredMethod(methodName, args); - } - }); - } catch (PrivilegedActionException ex){ - throw new RuntimeException( - "Invalid function mapping - no such method: " - + ex.getException().getMessage()); - } - } else { - funcMapper = new ProtectedFunctionMapper(); - try { - method = c.getDeclaredMethod(methodName, args); - } catch( NoSuchMethodException e ) { - throw new RuntimeException( - "Invalid function mapping - no such method: " - + e.getMessage()); - } - } - funcMapper.theMethod = method; - return funcMapper; - } - - /** - * Resolves the specified local name and prefix into a Java.lang.Method. - * Returns null if the prefix and local name are not found. - * - * @param prefix the prefix of the function - * @param localName the short name of the function - * @return the result of the method mapping. Null means no entry found. - **/ - public Method resolveFunction(String prefix, String localName) { - if (this.fnmap != null) { - return this.fnmap.get(prefix + ":" + localName); - } - return theMethod; - } -} - diff --git a/impl/src/main/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java b/impl/src/main/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java deleted file mode 100644 index 36043ab..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import java.lang.IllegalStateException; -import java.io.Writer; -import java.io.PrintWriter; -import java.io.IOException; - -import javax.servlet.*; -import javax.servlet.http.*; -import javax.servlet.jsp.JspWriter; - -import org.glassfish.jsp.api.ByteWriter; - -/** - * ServletResponseWrapper used by the JSP 'include' action. - * - * This wrapper response object is passed to RequestDispatcher.include(), so - * that the output of the included resource is appended to that of the - * including page. - * - * @author Pierre Delisle - */ - -public class ServletResponseWrapperInclude extends HttpServletResponseWrapper { - - /** - * PrintWriter which appends to the JspWriter of the including page. - */ - private PrintWriter printWriter; - - private JspWriter jspWriter; - - // START CR 6466049 - /** - * Indicates whether or not the wrapped JspWriter can be flushed. - */ - private boolean canFlushWriter; - // END CR 6466049 - - - public ServletResponseWrapperInclude(ServletResponse response, - JspWriter jspWriter) { - super((HttpServletResponse)response); - - this.jspWriter = jspWriter; - if (jspWriter instanceof JspWriterImpl && - ((JspWriterImpl)jspWriter).shouldOutputBytes()) { - this.printWriter = new PrintWriterWrapper((JspWriterImpl)jspWriter); - } else { - this.printWriter = new PrintWriter(jspWriter); - } - - // START CR 6466049 - this.canFlushWriter = (jspWriter instanceof JspWriterImpl); - // END CR 6466049 - } - - /** - * Returns a wrapper around the JspWriter of the including page. - */ - public PrintWriter getWriter() throws IOException { - return printWriter; - } - - public ServletOutputStream getOutputStream() throws IOException { - throw new IllegalStateException(); - } - - /** - * Clears the output buffer of the JspWriter associated with the including - * page. - */ - public void resetBuffer() { - try { - jspWriter.clearBuffer(); - } catch (IOException ioe) { - } - } - - // START CR 6421712 - /** - * Flush the wrapper around the JspWriter of the including page. - */ - public void flushBuffer() throws IOException { - printWriter.flush(); - } - // END CR 6421712 - - - // START CR 6466049 - /** - * Indicates whether or not the wrapped JspWriter can be flushed. - * (BodyContent objects cannot be flushed) - */ - public boolean canFlush() { - return canFlushWriter; - } - // END CR 6466049 - - - // START PWC 6512276 - /** - * Are there any data to be flushed ? - */ - public boolean hasData() { - if (!canFlushWriter || ((JspWriterImpl)jspWriter).hasData()) { - return true; - } - - return false; - } - // END PWC 6512276 - - static private class PrintWriterWrapper - extends PrintWriter implements ByteWriter { - - private JspWriterImpl jspWriter; - - PrintWriterWrapper(JspWriterImpl jspWriter) { - super(jspWriter); - this.jspWriter = jspWriter; - } - - public void write(byte[] buff, int off, int len) - throws IOException { - jspWriter.write(buff, off, len); - } - } -} diff --git a/impl/src/main/java/org/apache/jasper/runtime/TagHandlerPool.java b/impl/src/main/java/org/apache/jasper/runtime/TagHandlerPool.java deleted file mode 100644 index cc6e0b5..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/TagHandlerPool.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.tagext.JspTag; -import javax.servlet.jsp.tagext.Tag; -import javax.servlet.ServletConfig; -import org.apache.jasper.Constants; -import org.glassfish.jsp.api.ResourceInjector; - -/** - * Pool of tag handlers that can be reused. - * - * @author Jan Luehe - */ -public class TagHandlerPool { - - public static final String OPTION_TAGPOOL="tagpoolClassName"; - public static final String OPTION_MAXSIZE="tagpoolMaxSize"; - - private JspTag[] handlers; - private ResourceInjector resourceInjector; - - // index of next available tag handler - private int current; - - public static TagHandlerPool getTagHandlerPool( ServletConfig config) { - TagHandlerPool result=null; - - String tpClassName=getOption( config, OPTION_TAGPOOL, null); - if( tpClassName != null ) { - try { - Class c = - Class.forName(tpClassName).asSubclass(TagHandlerPool.class); - result = c.newInstance(); - } catch (Exception e) { - e.printStackTrace(); - result=null; - } - } - if( result==null ) result=new TagHandlerPool(); - result.init(config); - - return result; - } - - protected void init( ServletConfig config ) { - int maxSize=-1; - String maxSizeS=getOption(config, OPTION_MAXSIZE, null); - if( maxSizeS != null ) { - try { - maxSize=Integer.parseInt(maxSizeS); - } catch( Exception ex) { - maxSize=-1; - } - } - if( maxSize <0 ) { - maxSize=Constants.MAX_POOL_SIZE; - } - this.handlers = new JspTag[maxSize]; - this.current = -1; - - this.resourceInjector = (ResourceInjector) - config.getServletContext().getAttribute( - Constants.JSP_RESOURCE_INJECTOR_CONTEXT_ATTRIBUTE); - } - - /** - * Constructs a tag handler pool with the default capacity. - */ - public TagHandlerPool() { - // Nothing - jasper generated servlets call the other constructor, - // this should be used in future + init . - } - - /** - * Constructs a tag handler pool with the given capacity. - * - * @param capacity Tag handler pool capacity - * @deprecated Use static getTagHandlerPool - */ - public TagHandlerPool(int capacity) { - this.handlers = new JspTag[capacity]; - this.current = -1; - } - - /** - * Gets the next available tag handler from this tag handler pool, - * instantiating one if this tag handler pool is empty. - * - * @param handlerClass Tag handler class - * - * @return Reused or newly instantiated tag handler - * - * @throws JspException if a tag handler cannot be instantiated - */ - public JspTag get(Class handlerClass) - throws JspException { - synchronized( this ) { - if (current >= 0) { - return handlers[current--]; - } - } - - // Out of sync block - there is no need for other threads to - // wait for us to construct a tag for this thread. - JspTag tagHandler = null; - try { - if (resourceInjector != null) { - tagHandler = resourceInjector.createTagHandlerInstance( - handlerClass); - } else { - tagHandler = handlerClass.newInstance(); - } - } catch (Exception e) { - throw new JspException(e.getMessage(), e); - } - - return tagHandler; - } - - /** - * Adds the given tag handler to this tag handler pool, unless this tag - * handler pool has already reached its capacity, in which case the tag - * handler's release() method is called. - * - * @param handler JspTag handler to add to this tag handler pool - */ - public void reuse(JspTag handler) { - synchronized( this ) { - if (current < (handlers.length - 1)) { - handlers[++current] = handler; - return; - } - } - // There is no need for other threads to wait for us to release - if (handler instanceof Tag) { - ((Tag)handler).release(); - } - - if (resourceInjector != null) { - resourceInjector.preDestroy(handler); - } - } - - /** - * Calls the release() method of all available tag handlers in this tag - * handler pool. - */ - public synchronized void release() { - for (int i=current; i>=0; i--) { - if (handlers[i] instanceof Tag) { - ((Tag)handlers[i]).release(); - } - if (resourceInjector != null) { - resourceInjector.preDestroy(handlers[i]); - } - } - } - - protected static String getOption( ServletConfig config, String name, String defaultV) { - if( config == null ) return defaultV; - - String value=config.getInitParameter(name); - if( value != null ) return value; - if( config.getServletContext() ==null ) - return defaultV; - value=config.getServletContext().getInitParameter(name); - if( value!=null ) return value; - return defaultV; - } - -} - diff --git a/impl/src/main/java/org/apache/jasper/runtime/TldScanner.java b/impl/src/main/java/org/apache/jasper/runtime/TldScanner.java deleted file mode 100644 index 0d3e9c8..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/TldScanner.java +++ /dev/null @@ -1,825 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.io.IOException; -import java.net.JarURLConnection; -import java.net.URI; -import java.net.URL; -import java.net.URLClassLoader; -import java.net.URLConnection; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.ArrayList; -import java.util.concurrent.ConcurrentHashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.StringTokenizer; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import java.util.jar.Manifest; -import java.util.logging.Logger; -import java.util.logging.Level; - -import javax.servlet.ServletContext; -import javax.servlet.ServletRegistration; -import javax.servlet.ServletContainerInitializer; -import javax.servlet.ServletException; -import javax.servlet.descriptor.JspPropertyGroupDescriptor; -import javax.servlet.descriptor.TaglibDescriptor; -import javax.servlet.descriptor.JspConfigDescriptor; - -import org.apache.jasper.Constants; -import org.apache.jasper.JasperException; -import org.apache.jasper.Options; -import org.apache.jasper.xmlparser.ParserUtils; -import org.apache.jasper.xmlparser.TreeNode; -import org.apache.jasper.compiler.Localizer; - -/** - * A container for all tag libraries that are defined "globally" - * for the web application. - * - * Tag Libraries can be defined globally in one of two ways: - * 1. Via elements in web.xml: - * the uri and location of the tag-library are specified in - * the element. - * 2. Via packaged jar files that contain .tld files - * within the META-INF directory, or some subdirectory - * of it. The taglib is 'global' if it has the - * element defined. - * - * A mapping between the taglib URI and its associated TaglibraryInfoImpl - * is maintained in this container. - * Actually, that's what we'd like to do. However, because of the - * way the classes TagLibraryInfo and TagInfo have been defined, - * it is not currently possible to share an instance of TagLibraryInfo - * across page invocations. A bug has been submitted to the spec lead. - * In the mean time, all we do is save the 'location' where the - * TLD associated with a taglib URI can be found. - * - * When a JSP page has a taglib directive, the mappings in this container - * are first searched (see method getLocation()). - * If a mapping is found, then the location of the TLD is returned. - * If no mapping is found, then the uri specified - * in the taglib directive is to be interpreted as the location for - * the TLD of this tag library. - * - * @author Pierre Delisle - * @author Jan Luehe - * @author Kin-man Chung servlet 3.0 JSP plugin, tld cache etc - */ - -public class TldScanner implements ServletContainerInitializer { - - // Logger - private static Logger log = - Logger.getLogger(TldScanner.class.getName()); - - /** - * The types of URI one may specify for a tag library - */ - public static final int ABS_URI = 0; - public static final int ROOT_REL_URI = 1; - public static final int NOROOT_REL_URI = 2; - - private static final String WEB_XML = "/WEB-INF/web.xml"; - private static final String FILE_PROTOCOL = "file:"; - private static final String JAR_FILE_SUFFIX = ".jar"; - - // Names of system Uri's that are ignored if referred in WEB-INF/web.xml - private static HashSet systemUris = new HashSet(); - private static HashSet systemUrisJsf = new HashSet(); - - // A Cache is used for system jar files. - // The key is the name of the jar file, the value is an array of - // TldInfo, one for each of the TLD in the jar file - private static Map jarTldCache = - new ConcurrentHashMap(); - - private static final String EAR_LIB_CLASSLOADER = - "org.glassfish.javaee.full.deployment.EarLibClassLoader"; - - private static final String IS_STANDALONE_ATTRIBUTE_NAME = - "org.glassfish.jsp.isStandaloneWebapp"; - - /** - * The mapping of the 'global' tag library URI (as defined in the tld) to - * the location (resource path) of the TLD associated with that tag library. - * The location is returned as a String array: - * [0] The location of the tld file or the jar file that contains the tld - * [1] If the location is a jar file, this is the location of the tld. - */ - private HashMap mappings; - - /** - * A local cache for keeping track which jars have been scanned. - */ - private Map jarTldCacheLocal = - new HashMap(); - - private ServletContext ctxt; - private boolean isValidationEnabled; - private boolean useMyFaces = false; - private boolean scanListeners; // true if scan tlds for listeners - private boolean doneScanning; // true if all tld scanning done - private boolean blockExternal; // Don't allow external entities - - - //********************************************************************* - // Constructor and Initilizations - - /* - * Initializes the set of JARs that are known not to contain any TLDs - */ - static { - systemUrisJsf.add("http://java.sun.com/jsf/core"); - systemUrisJsf.add("http://java.sun.com/jsf/html"); - systemUris.add("http://java.sun.com/jsp/jstl/core"); - } - - /** - * Default Constructor. - * This is only used for implementing ServletContainerInitializer. - * ServletContext will be supplied in the method onStartUp; - */ - public TldScanner() { - } - - /** - * Constructor used in Jasper - */ - public TldScanner(ServletContext ctxt, boolean isValidationEnabled) { - this.ctxt = ctxt; - this.isValidationEnabled = isValidationEnabled; - Boolean b = (Boolean) ctxt.getAttribute("com.sun.faces.useMyFaces"); - if (b != null) { - useMyFaces = b.booleanValue(); - } - blockExternal = Boolean.parseBoolean(ctxt.getInitParameter( - Constants.XML_BLOCK_EXTERNAL_INIT_PARAM)); - } - - - public void onStartup(java.util.Set> c, - ServletContext ctxt) throws ServletException { - this.ctxt = ctxt; - Boolean b = (Boolean) ctxt.getAttribute("com.sun.faces.useMyFaces"); - if (b != null) { - useMyFaces = b.booleanValue(); - } - ServletRegistration reg = ctxt.getServletRegistration("jsp"); - if (reg == null) { - return; - } - String validating = reg.getInitParameter("validating"); - isValidationEnabled = "true".equals(validating); - - scanListeners = true; - scanTlds(); - - ctxt.setAttribute(Constants.JSP_TLD_URI_TO_LOCATION_MAP, mappings); - } - - /** - * Gets the 'location' of the TLD associated with the given taglib 'uri'. - * - * Returns null if the uri is not associated with any tag library 'exposed' - * in the web application. A tag library is 'exposed' either explicitly in - * web.xml or implicitly via the uri tag in the TLD of a taglib deployed - * in a jar file (WEB-INF/lib). - * - * @param uri The taglib uri - * - * @return An array of two Strings: The first element denotes the real - * path to the TLD. If the path to the TLD points to a jar file, then the - * second element denotes the name of the TLD entry in the jar file. - * Returns null if the uri is not associated with any tag library 'exposed' - * in the web application. - * - * This method may be called when the scanning is in one of states: - * 1. Called from jspc script, then a full tld scan is required. - * 2. The is the first call after servlet initialization, then system jars - * that are knwon to have tlds but not listeners need to be scanned. - * 3. Sebsequent calls, no need to scans. - */ - - @SuppressWarnings("unchecked") - public String[] getLocation(String uri) throws JasperException { - - if (mappings == null) { - // Recovering the map done in onStart. - mappings = (HashMap) ctxt.getAttribute( - Constants.JSP_TLD_URI_TO_LOCATION_MAP); - } - - if (mappings != null && mappings.get(uri) != null) { - // if the uri is in, return that, and dont bother to do full scan - return mappings.get(uri); - } - - if (! doneScanning) { - scanListeners = false; - scanTlds(); - doneScanning = true; - } - if (mappings == null) { - // Should never happend - return null; - } - return mappings.get(uri); - } - - @SuppressWarnings("unchecked") - Map> getTldMap() { - /* - * System jars with tlds may be passed as a special - * ServletContext attribute - * Map key: a JarURI - * Map value: list of tlds in the jar file - */ - return (Map>) - ctxt.getAttribute("com.sun.appserv.tld.map"); - } - - @SuppressWarnings("unchecked") - Map> getTldListenerMap() { - /* - * System jars with tlds that are known to contain a listener, and - * may be passed as a special ServletContext attribute - * Map key: a JarURI - * Map value: list of tlds in the jar file - */ - return (Map>) - ctxt.getAttribute("com.sun.appserv.tldlistener.map"); - } - - /** - * Returns the type of a URI: - * ABS_URI - * ROOT_REL_URI - * NOROOT_REL_URI - */ - public static int uriType(String uri) { - if (uri.indexOf(':') != -1) { - return ABS_URI; - } else if (uri.startsWith("/")) { - return ROOT_REL_URI; - } else { - return NOROOT_REL_URI; - } - } - - /** - * Scan the all the tlds accessible in the web app. - * For performance reasons, this is done in two stages. At servlet - * initialization time, we only scan the jar files for listeners. The - * container passes a list of system jar files that are known to contain - * tlds with listeners. The rest of the jar files will be scanned when - * a JSP page with a tld referenced is compiled. - */ - private void scanTlds() throws JasperException { - - mappings = new HashMap(); - - // Make a local copy of the system jar cache - jarTldCacheLocal.putAll(jarTldCache); - - try { - processWebDotXml(); - scanJars(); - processTldsInFileSystem("/WEB-INF/"); - } catch (JasperException ex) { - throw ex; - } catch (Exception ex) { - throw new JasperException( - Localizer.getMessage("jsp.error.internal.tldinit"), - ex); - } - } - - /* - * Populates taglib map described in web.xml. - */ - private void processWebDotXml() throws Exception { - - - // Skip if we are only looking for listeners - if (scanListeners) { - return; - } - - JspConfigDescriptor jspConfig = ctxt.getJspConfigDescriptor(); - if (jspConfig == null) { - return; - } - - for (TaglibDescriptor taglib: jspConfig.getTaglibs()) { - - if (taglib == null) { - continue; - } - String tagUri = taglib.getTaglibURI(); - String tagLoc = taglib.getTaglibLocation(); - if (tagUri == null || tagLoc == null) { - continue; - } - // Ignore system tlds in web.xml, for backward compatibility - if (systemUris.contains(tagUri) - || (!useMyFaces && systemUrisJsf.contains(tagUri))) { - continue; - } - // Save this location if appropriate - if (uriType(tagLoc) == NOROOT_REL_URI) - tagLoc = "/WEB-INF/" + tagLoc; - String tagLoc2 = null; - if (tagLoc.endsWith(JAR_FILE_SUFFIX)) { - tagLoc = ctxt.getResource(tagLoc).toString(); - tagLoc2 = "META-INF/taglib.tld"; - } - if (log.isLoggable(Level.FINE)) { - log.fine( "Add tld map from web.xml: " + tagUri + "=>" + tagLoc+ "," + tagLoc2); - } - mappings.put(tagUri, new String[] { tagLoc, tagLoc2 }); - } - } - - /** - * Scans the given JarURLConnection for TLD files located in META-INF - * (or a subdirectory of it). If the scanning in is done as part of the - * ServletContextInitializer, the listeners in the tlds in this jar file - * are added to the servlet context, and for any TLD that has a - * element, an implicit map entry is added to the taglib map. - * - * @param conn The JarURLConnection to the JAR file to scan - * @param tldNames the list of tld element to scan. The null value - * indicates all the tlds in this case. - * @param isLocal True if the jar file is under WEB-INF - * false otherwise - */ - private void scanJar(JarURLConnection conn, List tldNames, - boolean isLocal) - throws JasperException { - - String resourcePath = conn.getJarFileURL().toString(); - TldInfo[] tldInfos = jarTldCacheLocal.get(resourcePath); - - // Optimize for most common cases: jars known to NOT have tlds - if (tldInfos != null && tldInfos.length == 0) { - try { - conn.getJarFile().close(); - } catch (IOException ex) { - //ignored - } - return; - } - - // scan the tld if the jar has not been cached. - if (tldInfos == null) { - JarFile jarFile = null; - ArrayList tldInfoA = new ArrayList(); - try { - jarFile = conn.getJarFile(); - if (tldNames != null) { - for (String tldName : tldNames) { - JarEntry entry = jarFile.getJarEntry(tldName); - InputStream stream = jarFile.getInputStream(entry); - tldInfoA.add(scanTld(resourcePath, tldName, stream)); - } - } else { - Enumeration entries = jarFile.entries(); - while (entries.hasMoreElements()) { - JarEntry entry = entries.nextElement(); - String name = entry.getName(); - if (!name.startsWith("META-INF/")) continue; - if (!name.endsWith(".tld")) continue; - InputStream stream = jarFile.getInputStream(entry); - tldInfoA.add(scanTld(resourcePath, name, stream)); - } - } - } catch (IOException ex) { - if (resourcePath.startsWith(FILE_PROTOCOL) && - !((new File(resourcePath)).exists())) { - if (log.isLoggable(Level.WARNING)) { - log.log(Level.WARNING, - Localizer.getMessage("jsp.warn.nojar", - resourcePath), - ex); - } - } else { - throw new JasperException( - Localizer.getMessage("jsp.error.jar.io", resourcePath), - ex); - } - } finally { - if (jarFile != null) { - try { - jarFile.close(); - } catch (Throwable t) { - // ignore - } - } - } - // Update the jar TLD cache - tldInfos = tldInfoA.toArray(new TldInfo[tldInfoA.size()]); - jarTldCacheLocal.put(resourcePath, tldInfos); - if (!isLocal) { - // Also update the global cache; - jarTldCache.put(resourcePath, tldInfos); - } - } - - // Iterate over tldinfos to add listeners or to map tldlocations - for (TldInfo tldInfo: tldInfos) { - if (scanListeners) { - addListener(tldInfo, isLocal); - } - mapTldLocation(resourcePath, tldInfo, isLocal); - } - } - - private void addListener(TldInfo tldInfo, boolean isLocal) { - String uri = tldInfo.getUri(); - if (!systemUrisJsf.contains(uri) - || (isLocal && useMyFaces) - || (!isLocal && !useMyFaces)) { - for (String listenerClassName: tldInfo.getListeners()) { - if (log.isLoggable(Level.FINE)) { - log.fine( "Add tld listener " + listenerClassName); - } - ctxt.addListener(listenerClassName); - } - } - } - - private void mapTldLocation(String resourcePath, TldInfo tldInfo, - boolean isLocal) { - - String uri = tldInfo.getUri(); - if (uri == null) { - return; - } - - if ((isLocal - // Local tld files override the tlds in the jar files, - // unless it is in a system jar (except when using myfaces) - && mappings.get(uri) == null - && !systemUris.contains(uri) - && (!systemUrisJsf.contains(uri) || useMyFaces) - ) || - (!isLocal - // Jars are scanned bottom up, so jars in WEB-INF override - // thos in the system (except when using myfaces) - && (mappings.get(uri) == null - || systemUris.contains(uri) - || (systemUrisJsf.contains(uri) && !useMyFaces) - ) - ) - ) { - String entryName = tldInfo.getEntryName(); - if (log.isLoggable(Level.FINE)) { - log.fine("Add tld map from tld in " + - (isLocal? "WEB-INF": "jar: ") + uri + "=>" + - resourcePath + "," + entryName); - } - mappings.put(uri, new String[] {resourcePath, entryName}); - } - } - - - /* - * Searches the filesystem under /WEB-INF for any TLD files, and scans - * them for and elements. - */ - private void processTldsInFileSystem(String startPath) - throws JasperException { - - Set dirList = ctxt.getResourcePaths(startPath); - if (dirList != null) { - Iterator it = dirList.iterator(); - while (it.hasNext()) { - String path = (String) it.next(); - if (path.endsWith("/")) { - processTldsInFileSystem(path); - } - if (!path.endsWith(".tld")) { - continue; - } - if (path.startsWith("/WEB-INF/tags/") - && !path.endsWith("implicit.tld")) { - throw new JasperException( - Localizer.getMessage( - "jsp.error.tldinit.tldInWebInfTags", - path)); - } - InputStream stream = ctxt.getResourceAsStream(path); - TldInfo tldInfo = scanTld(path, null, stream); - // Add listeners or to map tldlocations for this TLD - if (scanListeners) { - addListener(tldInfo, true); - } - mapTldLocation(path, tldInfo, true); - } - } - } - - /** - * Scan the given TLD for uri and listeners elements. - * - * @param resourcePath the resource path for the jar file or the tld file. - * @param entryName If the resource path is a jar file, then the name of - * the tld file in the jar, else should be null. - * @param stream The input stream for the tld - * @return The TldInfo for this tld - */ - private TldInfo scanTld(String resourcePath, String entryName, - InputStream stream) - throws JasperException { - try { - // Parse the tag library descriptor at the specified resource path - TreeNode tld = new ParserUtils(blockExternal).parseXMLDocument( - resourcePath, stream, isValidationEnabled); - - String uri = null; - TreeNode uriNode = tld.findChild("uri"); - if (uriNode != null) { - uri = uriNode.getBody(); - } - - ArrayList listeners = new ArrayList(); - - IteratorlistenerNodes = tld.findChildren("listener"); - while (listenerNodes.hasNext()) { - TreeNode listener = listenerNodes.next(); - TreeNode listenerClass = listener.findChild("listener-class"); - if (listenerClass != null) { - String listenerClassName = listenerClass.getBody(); - if (listenerClassName != null) { - listeners.add(listenerClassName); - } - } - } - - return new TldInfo(uri, entryName, - listeners.toArray(new String[listeners.size()])); - - } finally { - if (stream != null) { - try { - stream.close(); - } catch (Throwable t) { - // do nothing - } - } - } - } - - /* - * Scans all JARs accessible to the webapp's classloader and its - * parent classloaders for TLDs. - * - * The list of JARs always includes the JARs under WEB-INF/lib, as well as - * all shared JARs in the classloader delegation chain of the webapp's - * classloader. - * - * Considering JARs in the classloader delegation chain constitutes a - * Tomcat-specific extension to the TLD search - * order defined in the JSP spec. It allows tag libraries packaged as JAR - * files to be shared by web applications by simply dropping them in a - * location that all web applications have access to (e.g., - * /common/lib). - */ - private void scanJars() throws Exception { - - ClassLoader webappLoader = - Thread.currentThread().getContextClassLoader(); - ClassLoader loader = webappLoader; - - Map> tldMap; - if (scanListeners) { - tldMap = getTldListenerMap(); - } else { - tldMap= getTldMap(); - } - - Boolean isStandalone = (Boolean) - ctxt.getAttribute(IS_STANDALONE_ATTRIBUTE_NAME); - - while (loader != null) { - if (loader instanceof URLClassLoader) { - boolean isLocal = (loader == webappLoader); - URL[] urls = ((URLClassLoader) loader).getURLs(); - List extraJars = new ArrayList(); - - for (int i=0; i 0) { - List newJars; - do { - newJars = new ArrayList(); - for (String jar: extraJars) { - URL jarURL = new URL("jar:" + jar + "!/"); - JarURLConnection jconn = - (JarURLConnection) jarURL.openConnection(); - jconn.setUseCaches(false); - if (addManifestClassPath(extraJars,newJars,jconn)){ - scanJar(jconn, null, true); - } - } - extraJars.addAll(newJars); - } while (newJars.size() != 0); - } - } - - if (tldMap != null && isStandalone != null) { - if (isStandalone.booleanValue()) { - break; - } else { - if (EAR_LIB_CLASSLOADER.equals( - loader.getClass().getName())) { - // Do not walk up classloader delegation chain beyond - // EarLibClassLoader - break; - } - } - } - - loader = loader.getParent(); - } - - if (tldMap != null) { - for (URI uri : tldMap.keySet()) { - URL jarURL = new URL("jar:" + uri.toString() + "!/"); - scanJar((JarURLConnection)jarURL.openConnection(), - tldMap.get(uri), false); - } - } - } - - /* - * Add the jars in the manifest Class-Path to the list "jars" - * @param scannedJars List of jars that has been previously scanned - * @param newJars List of jars from Manifest Class-Path - * @return true is the jar file exists - */ - private boolean addManifestClassPath(List scannedJars, - List newJars, - JarURLConnection jconn){ - - Manifest manifest; - try { - manifest = jconn.getManifest(); - } catch (IOException ex) { - // Maybe non existing jar, ignored - return false; - } - - String file = jconn.getJarFileURL().toString(); - if (! file.contains("WEB-INF")) { - // Only jar in WEB-INF is considered here - return true; - } - - if (manifest == null) - return true; - - java.util.jar.Attributes attrs = manifest.getMainAttributes(); - String cp = (String) attrs.getValue("Class-Path"); - if (cp == null) - return true; - - String[] paths = cp.split(" "); - int lastIndex = file.lastIndexOf('/'); - if (lastIndex < 0) { - lastIndex = file.lastIndexOf('\\'); - } - String baseDir = ""; - if (lastIndex > 0) { - baseDir = file.substring(0, lastIndex+1); - } - for (String path: paths) { - String p; - if (path.startsWith("/") || path.startsWith("\\")){ - p = "file:" + path; - } else { - p = baseDir + path; - } - if ((scannedJars == null || !scannedJars.contains(p)) && - !newJars.contains(p) ){ - newJars.add(p); - } - } - return true; - } - - static class TldInfo { - private String entryName; // The name of the tld file - private String uri; // The uri name for the tld - private String[] listeners; // The listeners in the tld - - public TldInfo(String uri, String entryName, String[] listeners) { - this.uri = uri; - this.entryName = entryName; - this.listeners = listeners; - } - - public String getEntryName() { - return entryName; - } - - public String getUri() { - return uri; - } - - public String[] getListeners() { - return listeners; - } - } -} diff --git a/impl/src/main/java/org/apache/jasper/runtime/VariableMapperImpl.java b/impl/src/main/java/org/apache/jasper/runtime/VariableMapperImpl.java deleted file mode 100644 index f9fdbbe..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/VariableMapperImpl.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import java.util.HashMap; -import javax.el.ELContext; -import javax.el.ELResolver; -import javax.el.VariableMapper; -import javax.el.ValueExpression; - - -/** - *

    This is the implementation of VariableMapper. - * The compiler creates an empty variable mapper when an ELContext is created. - * The variable mapper will be updated by tag handlers, if necessary. - * - * @author Kin-man Chung - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class VariableMapperImpl extends VariableMapper -{ - //------------------------------------- - /** - * Constructor - **/ - public VariableMapperImpl () { - map = new HashMap(); - } - - //------------------------------------- - /** - * Resolves the specified variable within the given context. - * Returns null if the variable is not found. - **/ - public ValueExpression resolveVariable (String variable) { - return map.get(variable); - } - - public ValueExpression setVariable(String variable, - ValueExpression expression) { - ValueExpression prev = null; - if (expression == null) { - map.remove(variable); - } else { - prev = map.get(variable); - map.put(variable, expression); - } - return prev; - } - - private HashMap map; -} diff --git a/impl/src/main/java/org/apache/jasper/runtime/VariableResolverImpl.java b/impl/src/main/java/org/apache/jasper/runtime/VariableResolverImpl.java deleted file mode 100644 index 2630838..0000000 --- a/impl/src/main/java/org/apache/jasper/runtime/VariableResolverImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.runtime; - -import javax.el.ELContext; -import javax.el.ELResolver; -import javax.servlet.jsp.PageContext; -import javax.servlet.jsp.el.VariableResolver; - - -/** - *

    This is the implementation of VariableResolver in JSP 2.0, - * using ELResolver in JSP2.1. - * It looks up variable references in the PageContext, and also - * recognizes references to implicit objects. - * - * @author Kin-man Chung - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ - **/ - -public class VariableResolverImpl - implements VariableResolver -{ - private PageContext pageContext; - - //------------------------------------- - /** - * Constructor - **/ - public VariableResolverImpl (PageContext pageContext) { - this.pageContext = pageContext; - } - - //------------------------------------- - /** - * Resolves the specified variable within the given context. - * Returns null if the variable is not found. - **/ - public Object resolveVariable (String pName) - throws javax.servlet.jsp.el.ELException { - - ELContext elContext = pageContext.getELContext(); - ELResolver elResolver = elContext.getELResolver(); - try { - return elResolver.getValue(elContext, null, pName); - } catch (javax.el.ELException ex) { - throw new javax.servlet.jsp.el.ELException(); - } - } -} diff --git a/impl/src/main/java/org/apache/jasper/security/PrivilegedGetTccl.java b/impl/src/main/java/org/apache/jasper/security/PrivilegedGetTccl.java deleted file mode 100644 index 052a341..0000000 --- a/impl/src/main/java/org/apache/jasper/security/PrivilegedGetTccl.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.security; - -import java.security.PrivilegedAction; - -public class PrivilegedGetTccl implements PrivilegedAction { - @Override - public ClassLoader run() { - return Thread.currentThread().getContextClassLoader(); - } -} - - diff --git a/impl/src/main/java/org/apache/jasper/security/PrivilegedSetTccl.java b/impl/src/main/java/org/apache/jasper/security/PrivilegedSetTccl.java deleted file mode 100644 index a9691b4..0000000 --- a/impl/src/main/java/org/apache/jasper/security/PrivilegedSetTccl.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.security; - -import java.security.PrivilegedAction; - -public class PrivilegedSetTccl implements PrivilegedAction { - - private ClassLoader cl; - - public PrivilegedSetTccl(ClassLoader cl) { - this.cl = cl; - } - - @Override - public Void run() { - Thread.currentThread().setContextClassLoader(cl); - return null; - } -} diff --git a/impl/src/main/java/org/apache/jasper/security/SecurityClassLoad.java b/impl/src/main/java/org/apache/jasper/security/SecurityClassLoad.java deleted file mode 100644 index ac48436..0000000 --- a/impl/src/main/java/org/apache/jasper/security/SecurityClassLoad.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.security; - -import java.util.logging.Logger; -import java.util.logging.Level; - -/** - * Static class used to preload java classes when using the - * Java SecurityManager so that the defineClassInPackage - * RuntimePermission does not trigger an AccessControlException. - * - * @author Jean-Francois Arcand - */ - -public final class SecurityClassLoad { - - private static Logger log= - Logger.getLogger(SecurityClassLoad.class.getName()); - - public static void securityClassLoad(ClassLoader loader){ - - if( System.getSecurityManager() == null ){ - return; - } - - String basePackage = "org.apache.jasper."; - try { - loader.loadClass( basePackage + - "runtime.JspFactoryImpl$PrivilegedGetPageContext"); - loader.loadClass( basePackage + - "runtime.JspFactoryImpl$PrivilegedReleasePageContext"); - - loader.loadClass( basePackage + - "runtime.JspRuntimeLibrary"); - loader.loadClass( basePackage + - "runtime.JspRuntimeLibrary$PrivilegedIntrospectHelper"); - - loader.loadClass( basePackage + - "runtime.ServletResponseWrapperInclude"); - loader.loadClass( basePackage + - "runtime.TagHandlerPool"); - loader.loadClass( basePackage + - "runtime.JspFragmentHelper"); - - loader.loadClass( basePackage + - "runtime.ProtectedFunctionMapper"); - loader.loadClass( basePackage + - "runtime.ProtectedFunctionMapper$1"); - loader.loadClass( basePackage + - "runtime.ProtectedFunctionMapper$2"); - loader.loadClass( basePackage + - "runtime.ProtectedFunctionMapper$3"); - loader.loadClass( basePackage + - "runtime.ProtectedFunctionMapper$4"); - - loader.loadClass( basePackage + - "runtime.PageContextImpl"); - loader.loadClass( basePackage + - "runtime.PageContextImpl$1"); - loader.loadClass( basePackage + - "runtime.PageContextImpl$2"); - loader.loadClass( basePackage + - "runtime.PageContextImpl$3"); - loader.loadClass( basePackage + - "runtime.PageContextImpl$4"); - loader.loadClass( basePackage + - "runtime.PageContextImpl$5"); - loader.loadClass( basePackage + - "runtime.PageContextImpl$6"); - loader.loadClass( basePackage + - "runtime.PageContextImpl$7"); - loader.loadClass( basePackage + - "runtime.PageContextImpl$8"); - loader.loadClass( basePackage + - "runtime.PageContextImpl$9"); - loader.loadClass( basePackage + - "runtime.PageContextImpl$10"); - loader.loadClass( basePackage + - "runtime.PageContextImpl$11"); - - loader.loadClass( basePackage + - "runtime.JspContextWrapper"); - - loader.loadClass( basePackage + - "servlet.JspServletWrapper"); - - loader.loadClass( basePackage + - "runtime.JspWriterImpl$1"); - } catch (ClassNotFoundException ex) { - log.log(Level.SEVERE, "SecurityClassLoad", ex); - } - } -} diff --git a/impl/src/main/java/org/apache/jasper/security/SecurityUtil.java b/impl/src/main/java/org/apache/jasper/security/SecurityUtil.java deleted file mode 100644 index e5c1516..0000000 --- a/impl/src/main/java/org/apache/jasper/security/SecurityUtil.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.security; - -import org.apache.jasper.Constants; - -/** - * Util class for Security related operations. - * - * @author Jean-Francois Arcand - */ - -public final class SecurityUtil{ - - private static boolean packageDefinitionEnabled = - System.getProperty("package.definition") == null ? false : true; - - /** - * Return the SecurityManager only if Security is enabled AND - * package protection mechanism is enabled. - */ - public static boolean isPackageProtectionEnabled(){ - if (packageDefinitionEnabled && Constants.IS_SECURITY_ENABLED){ - return true; - } - return false; - } - - -} diff --git a/impl/src/main/java/org/apache/jasper/servlet/JasperLoader.java b/impl/src/main/java/org/apache/jasper/servlet/JasperLoader.java deleted file mode 100644 index 1bbc3d6..0000000 --- a/impl/src/main/java/org/apache/jasper/servlet/JasperLoader.java +++ /dev/null @@ -1,289 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.servlet; - -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.net.URL; -import java.net.URLClassLoader; -import java.security.AccessController; -import java.security.CodeSource; -import java.security.PermissionCollection; -import java.security.PrivilegedAction; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.security.ProtectionDomain; -import java.util.Map; - -import javax.servlet.http.*; - -import org.apache.jasper.JasperException; -import org.apache.jasper.Constants; -import org.apache.jasper.security.SecurityUtil; - -// START OF IASRI 4709374 -// XXX Remove dependency on glassfish common-util -// import com.sun.appserv.server.util.PreprocessorUtil; -// END OF IASRI 4709374 - -/** - * Class loader for loading servlet class files (corresponding to JSP files) - * and tag handler class files (corresponding to tag files). - * - * @author Anil K. Vijendran - * @author Harish Prabandham - * @author Jean-Francois Arcand - * @author Kin-man Chung - */ -public class JasperLoader extends URLClassLoader { - - private PermissionCollection permissionCollection; - private CodeSource codeSource; - private ClassLoader parent; - private SecurityManager securityManager; - private Map bytecodes; - - public JasperLoader(URL[] urls, ClassLoader parent, - PermissionCollection permissionCollection, - CodeSource codeSource, - Map bytecodes) { - super(urls, parent); - this.permissionCollection = permissionCollection; - this.codeSource = codeSource; - this.parent = parent; - this.securityManager = System.getSecurityManager(); - this.bytecodes = bytecodes; - } - - /** - * Load the class with the specified name. This method searches for - * classes in the same manner as loadClass(String, boolean) - * with false as the second argument. - * - * @param name Name of the class to be loaded - * - * @exception ClassNotFoundException if the class was not found - */ - public Class loadClass(String name) throws ClassNotFoundException { - - return (loadClass(name, false)); - } - - /** - * Load the class with the specified name, searching using the following - * algorithm until it finds and returns the class. If the class cannot - * be found, returns ClassNotFoundException. - *

      - *
    • Call findLoadedClass(String) to check if the - * class has already been loaded. If it has, the same - * Class object is returned.
    • - *
    • If the delegate property is set to true, - * call the loadClass() method of the parent class - * loader, if any.
    • - *
    • Call findClass() to find this class in our locally - * defined repositories.
    • - *
    • Call the loadClass() method of our parent - * class loader, if any.
    • - *
    - * If the class was found using the above steps, and the - * resolve flag is true, this method will then - * call resolveClass(Class) on the resulting Class object. - * - * @param name Name of the class to be loaded - * @param resolve If true then resolve the class - * - * @exception ClassNotFoundException if the class was not found - */ - public synchronized Class loadClass(final String name, boolean resolve) - throws ClassNotFoundException { - - Class clazz = null; - - // (0) Check our previously loaded class cache - clazz = findLoadedClass(name); - if (clazz != null) { - if (resolve) - resolveClass(clazz); - return (clazz); - } - - // (.5) Permission to access this class when using a SecurityManager - if (securityManager != null) { - int dot = name.lastIndexOf('.'); - if (dot >= 0) { - try { - // Do not call the security manager since by default, we grant that package. - if (!"org.apache.jasper.runtime".equalsIgnoreCase(name.substring(0,dot))){ - securityManager.checkPackageAccess(name.substring(0,dot)); - } - } catch (SecurityException se) { - String error = "Security Violation, attempt to use " + - "Restricted Class: " + name; - se.printStackTrace(); - throw new ClassNotFoundException(error); - } - } - } - - if( !name.startsWith(Constants.JSP_PACKAGE_NAME) ) { - // Class is not in org.apache.jsp, therefore, have our - // parent load it - clazz = parent.loadClass(name); - if( resolve ) - resolveClass(clazz); - return clazz; - } - - return findClass(name); - } - - // START OF IASRI 4709374 - public Class findClass(String className) throws ClassNotFoundException { - - // If the class file is in memory, use it - byte[] cdata = this.bytecodes.get(className); - - String path = className.replace('.', '/') + ".class"; - if (cdata == null) { - // If the bytecode preprocessor is not enabled, use super.findClass - // as usual. -/* XXX - if (!PreprocessorUtil.isPreprocessorEnabled()) { - return super.findClass(className); - } -*/ - - // read class data from file - cdata = loadClassDataFromFile(path); - if (cdata == null) { - throw new ClassNotFoundException(className); - } - } - - // Preprocess the loaded byte code -/* XXX - if (PreprocessorUtil.isPreprocessorEnabled()) { - cdata = PreprocessorUtil.processClass(path, cdata); - } -*/ - - Class clazz = null; - if (securityManager != null) { - ProtectionDomain pd - = new ProtectionDomain(codeSource, permissionCollection); - clazz = defineClass(className, cdata, 0, cdata.length, pd); - } else { - clazz = defineClass(className, cdata, 0, cdata.length); - } - return clazz; - } - // END OF IASRI 4709374 - - /* - * Load JSP class data from file. - */ - private byte[] loadClassDataFromFile(final String fileName) { - byte[] classBytes = null; - try { - InputStream in = null; - - if (SecurityUtil.isPackageProtectionEnabled()){ - in = AccessController.doPrivileged( - new PrivilegedAction(){ - public InputStream run(){ - return getResourceAsStream(fileName); - } - }); - } else { - in = getResourceAsStream(fileName); - } - - if (in == null) { - return null; - } - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte buf[] = new byte[1024]; - for (int i = 0; (i = in.read(buf)) != -1; ) { - baos.write(buf, 0, i); - } - in.close(); - baos.close(); - classBytes = baos.toByteArray(); - } catch(Exception ex) { - ex.printStackTrace(); - return null; - } - return classBytes; - } - - /** - * Get the Permissions for a CodeSource. - * - * Since this ClassLoader is only used for a JSP page in - * a web application context, we just return our preset - * PermissionCollection for the web app context. - * - * @param codeSource Code source where the code was loaded from - * @return PermissionCollection for CodeSource - */ - public final PermissionCollection getPermissions(CodeSource codeSource) { - return permissionCollection; - } -} diff --git a/impl/src/main/java/org/apache/jasper/servlet/JspCServletContext.java b/impl/src/main/java/org/apache/jasper/servlet/JspCServletContext.java deleted file mode 100644 index ff89225..0000000 --- a/impl/src/main/java/org/apache/jasper/servlet/JspCServletContext.java +++ /dev/null @@ -1,886 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.servlet; - - -import java.io.File; -import java.io.InputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Enumeration; -import java.util.EventListener; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Map; -import java.util.Set; -import java.util.Vector; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.net.URL; -import javax.servlet.RequestDispatcher; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRegistration; -import javax.servlet.FilterRegistration; -import javax.servlet.Filter; -import javax.servlet.SessionCookieConfig; -import javax.servlet.SessionTrackingMode; -import javax.servlet.descriptor.JspConfigDescriptor; -import javax.servlet.descriptor.TaglibDescriptor; -import javax.servlet.descriptor.JspPropertyGroupDescriptor; - -import org.apache.jasper.JasperException; -import org.apache.jasper.xmlparser.TreeNode; -import org.apache.jasper.xmlparser.ParserUtils; - -/** - * Simple ServletContext implementation without - * HTTP-specific methods. - * - * @author Peter Rossbach (pr@webapp.de) - */ - -public class JspCServletContext implements ServletContext { - - - // ----------------------------------------------------- Instance Variables - - - /** - * Servlet context attributes. - */ - protected Hashtable myAttributes; - - - /** - * The log writer we will write log messages to. - */ - protected PrintWriter myLogWriter; - - - /** - * The base URL (document root) for this context. - */ - protected URL myResourceBaseURL; - - private JspConfigDescriptor jspConfigDescriptor; - - // ----------------------------------------------------------- Constructors - - - /** - * Create a new instance of this ServletContext implementation. - * - * @param aLogWriter PrintWriter which is used for log() calls - * @param aResourceBaseURL Resource base URL - */ - public JspCServletContext(PrintWriter aLogWriter, URL aResourceBaseURL) { - - myAttributes = new Hashtable(); - myLogWriter = aLogWriter; - myResourceBaseURL = aResourceBaseURL; - - parseWebDotXml(); - } - - - // --------------------------------------------------------- Public Methods - - - /** - * Return the specified context attribute, if any. - * - * @param name Name of the requested attribute - */ - public Object getAttribute(String name) { - - return (myAttributes.get(name)); - - } - - - /** - * Return an enumeration of context attribute names. - */ - public Enumeration getAttributeNames() { - - return (myAttributes.keys()); - - } - - - /** - * Returns the context path of the web application. - */ - public String getContextPath() { - return null; - } - - - /** - * Return the servlet context for the specified path. - * - * @param uripath Server-relative path starting with '/' - */ - public ServletContext getContext(String uripath) { - - return (null); - - } - - - /** - * Return the specified context initialization parameter. - * - * @param name Name of the requested parameter - */ - public String getInitParameter(String name) { - - return (null); - - } - - - /** - * Return an enumeration of the names of context initialization - * parameters. - */ - public Enumeration getInitParameterNames() { - - return (new Vector().elements()); - - } - - - /** - * Return the Servlet API major version number. - */ - public int getMajorVersion() { - return 3; - } - - - /** - * Return the MIME type for the specified filename. - * - * @param file Filename whose MIME type is requested - */ - public String getMimeType(String file) { - return (null); - } - - - /** - * Return the Servlet API minor version number. - */ - public int getMinorVersion() { - return 0; - } - - public int getEffectiveMajorVersion() { - // TODO: get it from web.xml - return 3; - } - - public int getEffectiveMinorVersion() { - // TODO: get it from web.xml - return 0; - } - - - /** - * Return a request dispatcher for the specified servlet name. - * - * @param name Name of the requested servlet - */ - public RequestDispatcher getNamedDispatcher(String name) { - - return (null); - - } - - - /** - * Return the real path for the specified context-relative - * virtual path. - * - * @param path The context-relative virtual path to resolve - */ - public String getRealPath(String path) { - - if (!myResourceBaseURL.getProtocol().equals("file")) - return (null); - if (!path.startsWith("/")) - return (null); - try { - return - (getResource(path).getFile().replace('/', File.separatorChar)); - } catch (Throwable t) { - return (null); - } - - } - - - /** - * Return a request dispatcher for the specified context-relative path. - * - * @param path Context-relative path for which to acquire a dispatcher - */ - public RequestDispatcher getRequestDispatcher(String path) { - - return (null); - - } - - - /** - * Return a URL object of a resource that is mapped to the - * specified context-relative path. - * - * @param path Context-relative path of the desired resource - * - * @exception MalformedURLException if the resource path is - * not properly formed - */ - public URL getResource(String path) throws MalformedURLException { - - if (!path.startsWith("/")) - throw new MalformedURLException("Path '" + path + - "' does not start with '/'"); - URL url = new URL(myResourceBaseURL, path.substring(1)); - InputStream is = null; - try { - is = url.openStream(); - } catch (Throwable t) { - url = null; - } finally { - if (is != null) { - try { - is.close(); - } catch (Throwable t2) { - // Ignore - } - } - } - return url; - } - - - /** - * Return an InputStream allowing access to the resource at the - * specified context-relative path. - * - * @param path Context-relative path of the desired resource - */ - public InputStream getResourceAsStream(String path) { - - try { - return (getResource(path).openStream()); - } catch (Throwable t) { - return (null); - } - - } - - - /** - * Return the set of resource paths for the "directory" at the - * specified context path. - * - * @param path Context-relative base path - */ - public Set getResourcePaths(String path) { - - Set thePaths = new HashSet(); - if (!path.endsWith("/")) - path += "/"; - String basePath = getRealPath(path); - if (basePath == null) - return (thePaths); - File theBaseDir = new File(basePath); - if (!theBaseDir.exists() || !theBaseDir.isDirectory()) - return (thePaths); - String theFiles[] = theBaseDir.list(); - for (int i = 0; i < theFiles.length; i++) { - File testFile = new File(basePath + File.separator + theFiles[i]); - if (testFile.isFile()) - thePaths.add(path + theFiles[i]); - else if (testFile.isDirectory()) - thePaths.add(path + theFiles[i] + "/"); - } - return (thePaths); - - } - - - /** - * Return descriptive information about this server. - */ - public String getServerInfo() { - - return ("JspCServletContext/1.0"); - - } - - - /** - * Return a null reference for the specified servlet name. - * - * @param name Name of the requested servlet - * - * @deprecated This method has been deprecated with no replacement - */ - public Servlet getServlet(String name) throws ServletException { - - return (null); - - } - - - /** - * Return the name of this servlet context. - */ - public String getServletContextName() { - - return (getServerInfo()); - - } - - - /** - * Return an empty enumeration of servlet names. - * - * @deprecated This method has been deprecated with no replacement - */ - public Enumeration getServletNames() { - - return (new Vector().elements()); - - } - - - /** - * Return an empty enumeration of servlets. - * - * @deprecated This method has been deprecated with no replacement - */ - public Enumeration getServlets() { - - return (new Vector().elements()); - - } - - - /** - * Log the specified message. - * - * @param message The message to be logged - */ - public void log(String message) { - - myLogWriter.println(message); - - } - - - /** - * Log the specified message and exception. - * - * @param exception The exception to be logged - * @param message The message to be logged - * - * @deprecated Use log(String,Throwable) instead - */ - public void log(Exception exception, String message) { - - log(message, exception); - - } - - - /** - * Log the specified message and exception. - * - * @param message The message to be logged - * @param exception The exception to be logged - */ - public void log(String message, Throwable exception) { - - myLogWriter.println(message); - exception.printStackTrace(myLogWriter); - - } - - - /** - * Remove the specified context attribute. - * - * @param name Name of the attribute to remove - */ - public void removeAttribute(String name) { - - myAttributes.remove(name); - - } - - - /** - * Set or replace the specified context attribute. - * - * @param name Name of the context attribute to set - * @param value Corresponding attribute value - */ - public void setAttribute(String name, Object value) { - - myAttributes.put(name, value); - - } - - - /* - * Adds the servlet with the given name, description, class name, - * init parameters, and loadOnStartup, to this servlet context. - */ - public void addServlet(String servletName, - String description, - String className, - Map initParameters, - int loadOnStartup) { - // Do nothing - return; - } - - - /** - * Adds servlet mappings from the given url patterns to the servlet - * with the given servlet name to this servlet context. - */ - public void addServletMapping(String servletName, - String[] urlPatterns) { - // Do nothing - return; - } - - - /** - * Adds the filter with the given name, description, and class name to - * this servlet context. - */ - public void addFilter(String filterName, - String description, - String className, - Map initParameters) { - // Do nothing - return; - } - - public boolean setInitParameter(String name, String value) { - throw new UnsupportedOperationException(); - } - - public ServletRegistration.Dynamic addServlet( - String servletName, String className) { - throw new UnsupportedOperationException(); - } - - public ServletRegistration.Dynamic addServlet( - String servletName, Servlet servlet) { - throw new UnsupportedOperationException(); - } - - public ServletRegistration.Dynamic addServlet(String servletName, - Class servletClass) { - throw new UnsupportedOperationException(); - } - - public T createServlet(Class c) - throws ServletException { - throw new UnsupportedOperationException(); - } - - public ServletRegistration getServletRegistration(String servletName) { - throw new UnsupportedOperationException(); - } - - public Map getServletRegistrations() { - throw new UnsupportedOperationException(); - } - - public FilterRegistration.Dynamic addFilter( - String filterName, String className) { - throw new UnsupportedOperationException(); - } - - public FilterRegistration.Dynamic addFilter( - String filterName, Filter filter) { - throw new UnsupportedOperationException(); - } - - public FilterRegistration.Dynamic addFilter(String filterName, - Class filterClass) { - throw new UnsupportedOperationException(); - } - - public T createFilter(Class c) { - throw new UnsupportedOperationException(); - } - - public FilterRegistration getFilterRegistration(String filterName) { - throw new UnsupportedOperationException(); - } - - public Map getFilterRegistrations() { - throw new UnsupportedOperationException(); - } - - public SessionCookieConfig getSessionCookieConfig() { - throw new UnsupportedOperationException(); - } - - public void setSessionTrackingModes(Set sessionTrackingModes) { - throw new UnsupportedOperationException(); - } - - public Set getDefaultSessionTrackingModes() { - throw new UnsupportedOperationException(); - } - - public Set getEffectiveSessionTrackingModes() { - throw new UnsupportedOperationException(); - } - - public void addListener(String className) { - throw new UnsupportedOperationException(); - } - - public void addListener(T t) { - throw new UnsupportedOperationException(); - } - - public void addListener(Class listenerClass) { - throw new UnsupportedOperationException(); - } - - public T createListener(Class clazz) - throws ServletException { - throw new UnsupportedOperationException(); - } - - public JspConfigDescriptor getJspConfigDescriptor() { - return jspConfigDescriptor; - } - - public ClassLoader getClassLoader() { - throw new UnsupportedOperationException(); - } - - public void declareRoles(String... roleNames) { - throw new UnsupportedOperationException(); - } - - private static final String WEB_XML = "/WEB-INF/web.xml"; - private void parseWebDotXml() { - - InputStream is = getResourceAsStream(WEB_XML); - if (is == null) { - return; - } - - TreeNode web = null; - try { - web = new ParserUtils().parseXMLDocument(WEB_XML, is); - } catch (JasperException ex) { - log("Error in parsing web.xml", ex); - return; - } - - TreeNode jspConfig = web.findChild("jsp-config"); - if (jspConfig == null) { - return; - } - - ArrayList taglibs = new ArrayList(); - ArrayList jspPropertyGroups = - new ArrayList(); - - Iterator children = jspConfig.findChildren("taglib"); - while (children.hasNext()) { - TreeNode taglib = children.next(); - String tagUri = null; - String tagLoc = null; - TreeNode child = taglib.findChild("taglib-uri"); - if (child != null) - tagUri = child.getBody(); - child = taglib.findChild("taglib-location"); - if (child != null) - tagLoc = child.getBody(); - if (tagUri == null || tagLoc == null) { - return; - } - taglibs.add(new TaglibDescriptorImpl(tagUri, tagLoc)); - } - - children = jspConfig.findChildren("jsp-property-group"); - while (children.hasNext()) { - - ArrayList urlPatterns = new ArrayList(); - String pageEncoding = null; - String scriptingInvalid = null; - String elIgnored = null; - String isXml = null; - ArrayList includePrelude = new ArrayList(); - ArrayList includeCoda = new ArrayList(); - String trimSpaces = null; - String poundAllowed = null; - String buffer = null; - String defaultContentType = null; - String errorOnUndeclaredNamespace = null; - - TreeNode pgroup = children.next(); - Iterator properties = pgroup.findChildren(); - while (properties.hasNext()) { - TreeNode element = properties.next(); - String tname = element.getName(); - - // url-patterns, preludes, and codas and accumulative, other - // properties keep last. - - if ("url-pattern".equals(tname)) - urlPatterns.add(element.getBody()); - else if ("page-encoding".equals(tname)) - pageEncoding = element.getBody(); - else if ("is-xml".equals(tname)) - isXml = element.getBody(); - else if ("el-ignored".equals(tname)) - elIgnored = element.getBody(); - else if ("scripting-invalid".equals(tname)) - scriptingInvalid = element.getBody(); - else if ("include-prelude".equals(tname)) - includePrelude.add(element.getBody()); - else if ("include-coda".equals(tname)) - includeCoda.add(element.getBody()); - else if ("trim-directive-whitespaces".equals(tname)) - trimSpaces = element.getBody(); - else if ("deferred-syntax-allowed-as-literal".equals(tname)) - poundAllowed = element.getBody(); - else if ("default-content-type".equals(tname)) - defaultContentType = element.getBody(); - else if ("buffer".equals(tname)) - buffer = element.getBody(); - else if ("error-on-undeclared-namespace".equals(tname)) - errorOnUndeclaredNamespace = element.getBody(); - } - jspPropertyGroups.add(new JspPropertyGroupDescriptorImpl( - urlPatterns, - isXml, - elIgnored, - scriptingInvalid, - trimSpaces, - poundAllowed, - pageEncoding, - includePrelude, - includeCoda, - defaultContentType, - buffer, - errorOnUndeclaredNamespace)); - } - - jspConfigDescriptor = - new JspConfigDescriptorImpl(taglibs, jspPropertyGroups); - } - - static class JspPropertyGroupDescriptorImpl - implements JspPropertyGroupDescriptor { - Collection urlPatterns; - String isXml; - String elIgnored; - String scriptingInvalid; - String trimSpaces; - String poundAllowed; - String pageEncoding; - Collection includePrelude; - Collection includeCoda; - String defaultContentType; - String buffer; - String errorOnUndeclaredNamespace; - - JspPropertyGroupDescriptorImpl(Collection urlPatterns, - String isXml, String elIgnored, String scriptingInvalid, - String trimSpaces, String poundAllowed, - String pageEncoding, Collection includePrelude, - Collection includeCoda, String defaultContentType, - String buffer, String errorOnUndeclaredNamespace) { - this.urlPatterns = urlPatterns; - this.isXml = isXml; - this.elIgnored = elIgnored; - this.scriptingInvalid = scriptingInvalid; - this.trimSpaces = trimSpaces; - this.poundAllowed = poundAllowed; - this.pageEncoding = pageEncoding; - this.includePrelude = includePrelude; - this.includeCoda =includeCoda; - this.defaultContentType = defaultContentType; - this.buffer = buffer; - this.errorOnUndeclaredNamespace = errorOnUndeclaredNamespace; - } - - @Override - public Collection getUrlPatterns() { - return urlPatterns; - } - - @Override - public String getElIgnored() { - return elIgnored; - } - - @Override - public String getPageEncoding() { - return pageEncoding; - } - - @Override - public String getScriptingInvalid() { - return scriptingInvalid; - } - - @Override - public String getIsXml() { - return isXml; - } - - @Override - public Collection getIncludePreludes() { - return includePrelude; - } - - @Override - public Collection getIncludeCodas() { - return includeCoda; - } - - @Override - public String getDeferredSyntaxAllowedAsLiteral() { - return poundAllowed; - } - - @Override - public String getTrimDirectiveWhitespaces() { - return trimSpaces; - } - - @Override - public String getDefaultContentType() { - return defaultContentType; - } - - @Override - public String getBuffer() { - return buffer; - } - - @Override - public String getErrorOnUndeclaredNamespace() { - return errorOnUndeclaredNamespace; - } - } - - static class TaglibDescriptorImpl implements TaglibDescriptor { - - String uri, loc; - - public TaglibDescriptorImpl(String uri, String loc) { - this.uri = uri; - this.loc = loc;; - } - - public String getTaglibURI() { - return uri; - } - - public String getTaglibLocation() { - return loc; - } - } - - static class JspConfigDescriptorImpl implements JspConfigDescriptor { - - Collection taglibs; - Collection jspPropertyGroups; - - public JspConfigDescriptorImpl(Collection taglibs, - Collection jspPropertyGroups) { - this.taglibs = taglibs; - this.jspPropertyGroups = jspPropertyGroups; - } - - public Collection getTaglibs() { - return this.taglibs; - } - - public Collection getJspPropertyGroups() { - return this.jspPropertyGroups; - } - } -} diff --git a/impl/src/main/java/org/apache/jasper/servlet/JspServlet.java b/impl/src/main/java/org/apache/jasper/servlet/JspServlet.java deleted file mode 100644 index 5d4a658..0000000 --- a/impl/src/main/java/org/apache/jasper/servlet/JspServlet.java +++ /dev/null @@ -1,487 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2011 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.servlet; - -// START PWC 6300204 -import java.io.FileNotFoundException; -// END PWC 6300204 -import java.io.IOException; -import java.io.InputStream; -import java.util.Enumeration; -// START GlassFish 750 -import java.net.URL; -import java.net.URLEncoder; -import java.util.concurrent.ConcurrentHashMap; -// END GlassFish 750 -import java.util.concurrent.atomic.*; -// START SJSWS 6232180 -import java.util.HashSet; -import java.util.StringTokenizer; -// END SJSWS 6232180 -// START GlassFish 747 -import java.util.HashMap; -// END GlassFish 747 -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -// START GlassFish 750 -import javax.servlet.jsp.tagext.TagLibraryInfo; -// END GlassFish 750 - -import java.util.logging.Logger; -import java.util.logging.Level; - -import org.apache.jasper.Constants; -import org.apache.jasper.EmbeddedServletOptions; -import org.apache.jasper.Options; -import org.apache.jasper.compiler.JspRuntimeContext; -import org.apache.jasper.compiler.JspUtil; -import org.apache.jasper.compiler.Localizer; -import org.apache.jasper.runtime.JspApplicationContextImpl; -import org.glassfish.jsp.api.JspProbeEmitter; -import org.glassfish.jsp.api.ResourceInjector; - -/** - * The JSP engine (a.k.a Jasper). - * - * The servlet container is responsible for providing a - * URLClassLoader for the web application context Jasper - * is being used in. Jasper will try get the Tomcat - * ServletContext attribute for its ServletContext class - * loader, if that fails, it uses the parent class loader. - * In either case, it must be a URLClassLoader. - * - * @author Anil K. Vijendran - * @author Harish Prabandham - * @author Remy Maucherat - * @author Kin-man Chung - * @author Glenn Nielsen - */ -public class JspServlet extends HttpServlet { - - // Logger - private static Logger log = Logger.getLogger(JspServlet.class.getName()); - - private static final int CHAR_LIMIT = 256; - - private ServletContext context; - private ServletConfig config; - private Options options; - private JspRuntimeContext rctxt; - - // START S1AS - // jsp error count - private AtomicInteger countErrors = new AtomicInteger(0); - // END S1AS - - // START SJSWS 6232180 - private String httpMethodsString = null; - private HashSet httpMethodsSet = null; - // END SJSWS 6232180 - - // START GlassFish 750 - private ConcurrentHashMap taglibs; - private ConcurrentHashMap tagFileJarUrls; - // END GlassFish 750 - - private JspProbeEmitter jspProbeEmitter; - - /* - * Initializes this JspServlet. - */ - public void init(ServletConfig config) throws ServletException { - - super.init(config); - this.config = config; - this.context = config.getServletContext(); - - // Initialize the JSP Runtime Context - options = new EmbeddedServletOptions(config, context); - rctxt = new JspRuntimeContext(context,options); - - // START SJSWS 6232180 - // Determine which HTTP methods to service ("*" means all) - httpMethodsString = config.getInitParameter("httpMethods"); - if (httpMethodsString != null - && !httpMethodsString.equals("*")) { - httpMethodsSet = new HashSet(); - StringTokenizer tokenizer = new StringTokenizer( - httpMethodsString, ", \t\n\r\f"); - while (tokenizer.hasMoreTokens()) { - httpMethodsSet.add(tokenizer.nextToken()); - } - } - // END SJSWS 6232180 - - // START GlassFish 750 - taglibs = new ConcurrentHashMap(); - context.setAttribute(Constants.JSP_TAGLIBRARY_CACHE, taglibs); - - tagFileJarUrls = new ConcurrentHashMap(); - context.setAttribute(Constants.JSP_TAGFILE_JAR_URLS_CACHE, - tagFileJarUrls); - // END GlassFish 750 - - if (log.isLoggable(Level.FINEST)) { - log.finest(Localizer.getMessage("jsp.message.scratch.dir.is", - options.getScratchDir().toString())); - log.finest(Localizer.getMessage("jsp.message.dont.modify.servlets")); - } - - this.jspProbeEmitter = (JspProbeEmitter) - config.getServletContext().getAttribute( - "org.glassfish.jsp.monitor.probeEmitter"); - } - - - /** - * Returns the number of JSPs for which JspServletWrappers exist, i.e., - * the number of JSPs that have been loaded into the webapp with which - * this JspServlet is associated. - * - *

    This info may be used for monitoring purposes. - * - * @return The number of JSPs that have been loaded into the webapp with - * which this JspServlet is associated - */ - public int getJspCount() { - return this.rctxt.getJspCount(); - } - - - /** - * Resets the JSP reload counter. - * - * @param count Value to which to reset the JSP reload counter - */ - public void setJspReloadCount(int count) { - this.rctxt.setJspReloadCount(count); - } - - - /** - * Gets the number of JSPs that have been reloaded. - * - *

    This info may be used for monitoring purposes. - * - * @return The number of JSPs (in the webapp with which this JspServlet is - * associated) that have been reloaded - */ - public int getJspReloadCount() { - return this.rctxt.getJspReloadCount(); - } - - - // START S1AS - /** - * Gets the number of errors triggered by JSP invocations. - * - * @return The number of errors triggered by JSP invocations - */ - public int getJspErrorCount() { - return countErrors.get(); - } - // END S1AS - - - /** - *

    Look for a precompilation request as described in - * Section 8.4.2 of the JSP 1.2 Specification. WARNING - - * we cannot use request.getParameter() for this, because - * that will trigger parsing all of the request parameters, and not give - * a servlet the opportunity to call - * request.setCharacterEncoding() first.

    - * - * @param request The servlet requset we are processing - * - * @exception ServletException if an invalid parameter value for the - * jsp_precompile parameter name is specified - */ - boolean preCompile(HttpServletRequest request) throws ServletException { - - String queryString = request.getQueryString(); - if (queryString == null) { - return (false); - } - int start = queryString.indexOf(Constants.PRECOMPILE); - if (start < 0) { - return (false); - } - queryString = - queryString.substring(start + Constants.PRECOMPILE.length()); - if (queryString.length() == 0) { - return (true); // ?jsp_precompile - } - if (queryString.startsWith("&")) { - return (true); // ?jsp_precompile&foo=bar... - } - if (!queryString.startsWith("=")) { - return (false); // part of some other name or value - } - int limit = queryString.length(); - int ampersand = queryString.indexOf("&"); - if (ampersand > 0) { - limit = ampersand; - } - String value = queryString.substring(1, limit); - if (value.equals("true")) { - return (true); // ?jsp_precompile=true - } else if (value.equals("false")) { - // Spec says if jsp_precompile=false, the request should not - // be delivered to the JSP page; the easiest way to implement - // this is to set the flag to true, and precompile the page anyway. - // This still conforms to the spec, since it says the - // precompilation request can be ignored. - return (true); // ?jsp_precompile=false - } else { - throw new ServletException("Cannot have request parameter " + - Constants.PRECOMPILE + " set to " + - value); - } - - } - - - public void service(HttpServletRequest request, - HttpServletResponse response) - throws ServletException, IOException { - - // START SJSWS 6232180 - if (httpMethodsSet != null) { - String method = request.getMethod(); - if (method == null) { - return; - } - if (!httpMethodsSet.contains(method)) { - super.service(request, response); - return; - } - if (method.equals("OPTIONS")) { - response.addHeader("Allow", httpMethodsString); - return; - } - } - // END SJSWS 6232180 - - String jspUri = null; - - String jspFile = (String) request.getAttribute(Constants.JSP_FILE); - if (jspFile != null) { - // JSP is specified via in declaration - jspUri = jspFile; - request.removeAttribute(Constants.JSP_FILE); - } else { - /* - * Check to see if the requested JSP has been the target of a - * RequestDispatcher.include() - */ - jspUri = (String) request.getAttribute(Constants.INC_SERVLET_PATH); - if (jspUri != null) { - /* - * Requested JSP has been target of - * RequestDispatcher.include(). Its path is assembled from the - * relevant javax.servlet.include.* request attributes - */ - String pathInfo = (String) request.getAttribute( - "javax.servlet.include.path_info"); - if (pathInfo != null) { - jspUri += pathInfo; - } - } else { - /* - * Requested JSP has not been the target of a - * RequestDispatcher.include(). Reconstruct its path from the - * request's getServletPath() and getPathInfo() - */ - jspUri = request.getServletPath(); - String pathInfo = request.getPathInfo(); - if (pathInfo != null) { - jspUri += pathInfo; - } - } - } - - if (log.isLoggable(Level.FINE)) { - StringBuilder msg = new StringBuilder(); - msg.append("JspEngine --> [" + jspUri); - msg.append("] ServletPath: [" + request.getServletPath()); - msg.append("] PathInfo: [" + request.getPathInfo()); - msg.append("] RealPath: [" + context.getRealPath(jspUri)); - msg.append("] RequestURI: [" + request.getRequestURI()); - msg.append("] QueryString: [" + request.getQueryString()); - msg.append("]"); - log.fine(msg.toString()); - } - - try { - boolean precompile = preCompile(request); - serviceJspFile(request, response, jspUri, null, precompile); - } catch (RuntimeException e) { - // STARTS S1AS - incrementErrorCount(jspUri); - // END S1AS - throw e; - } catch (Error e) { - incrementErrorCount(jspUri); - throw e; - } catch (ServletException e) { - // STARTS S1AS - incrementErrorCount(jspUri); - // END S1AS - throw e; - } catch (IOException e) { - // STARTS S1AS - incrementErrorCount(jspUri); - // END S1AS - throw e; - } catch (Throwable e) { - // STARTS S1AS - incrementErrorCount(jspUri); - // END S1AS - throw new ServletException(e); - } - - } - - public void destroy() { - if (log.isLoggable(Level.FINE)) { - log.fine("JspServlet.destroy()"); - } - - rctxt.destroy(); - JspApplicationContextImpl.removeJspApplicationContext(context); - - // START GlassFish 750 - taglibs.clear(); - tagFileJarUrls.clear(); - // END GlassFish 750 - - // START GlassFish 747 - HashMap tldUriToLocationMap = (HashMap) context.getAttribute( - Constants.JSP_TLD_URI_TO_LOCATION_MAP); - if (tldUriToLocationMap != null) { - tldUriToLocationMap.clear(); - } - // END GlassFish 747 - } - - - // -------------------------------------------------------- Private Methods - - private void serviceJspFile(HttpServletRequest request, - HttpServletResponse response, String jspUri, - Throwable exception, boolean precompile) - throws ServletException, IOException { - - JspServletWrapper wrapper = - (JspServletWrapper) rctxt.getWrapper(jspUri); - if (wrapper == null) { - synchronized(this) { - wrapper = (JspServletWrapper) rctxt.getWrapper(jspUri); - if (wrapper == null) { - // Check if the requested JSP page exists, to avoid - // creating unnecessary directories and files. - if (null == context.getResource(jspUri) - && !options.getUsePrecompiled()) { - String includeRequestUri = (String) - request.getAttribute("javax.servlet.include.request_uri"); - if (includeRequestUri != null) { - // Missing JSP resource has been the target of a - // RequestDispatcher.include(). - // Throw an exception (rather than returning a - // 404 response error code), because any call to - // response.sendError() must be ignored by the - // servlet engine when issued from within an - // included resource (as per the Servlet spec). - throw new FileNotFoundException( - JspUtil.escapeXml(jspUri)); - } - - response.sendError(HttpServletResponse.SC_NOT_FOUND); - log.severe(Localizer.getMessage( - "jsp.error.file.not.found", - context.getRealPath(jspUri))); - return; - } - boolean isErrorPage = exception != null; - wrapper = new JspServletWrapper(config, options, jspUri, - isErrorPage, rctxt); - rctxt.addWrapper(jspUri,wrapper); - } - } - } - - wrapper.service(request, response, precompile); - - } - - - // STARTS S1AS - private void incrementErrorCount(String jspUri) { - countErrors.incrementAndGet(); - // Fire the jspErrorEvent probe event - if (jspProbeEmitter != null) { - jspProbeEmitter.jspErrorEvent(jspUri); - } - } - // END S1AS -} diff --git a/impl/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java b/impl/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java deleted file mode 100644 index d557748..0000000 --- a/impl/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java +++ /dev/null @@ -1,504 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.servlet; - -// START PWC 6468930 -import java.io.File; -// END PWC 6468930 -import java.io.FileNotFoundException; -import java.io.IOException; -import java.net.URL; -import java.util.logging.Logger; -import java.util.logging.Level; - -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.SingleThreadModel; -import javax.servlet.UnavailableException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.tagext.TagInfo; - -import org.glassfish.jsp.api.JspProbeEmitter; - -import org.apache.jasper.JasperException; -import org.apache.jasper.JspCompilationContext; -import org.apache.jasper.Options; -import org.apache.jasper.compiler.JspRuntimeContext; -import org.apache.jasper.compiler.Localizer; -import org.apache.jasper.runtime.JspSourceDependent; - -/** - * The JSP engine (a.k.a Jasper). - * - * The servlet container is responsible for providing a - * URLClassLoader for the web application context Jasper - * is being used in. Jasper will try get the Tomcat - * ServletContext attribute for its ServletContext class - * loader, if that fails, it uses the parent class loader. - * In either case, it must be a URLClassLoader. - * - * @author Anil K. Vijendran - * @author Harish Prabandham - * @author Remy Maucherat - * @author Kin-man Chung - * @author Glenn Nielsen - */ - -public class JspServletWrapper { - - // Logger - private static Logger log = - Logger.getLogger(JspServletWrapper.class.getName()); - - private Servlet theServlet; - private String jspUri; - private Class servletClass; - private Class tagHandlerClass; - private JspCompilationContext ctxt; - private long available = 0L; - private ServletConfig config; - private Options options; - private boolean firstTime = true; - private boolean reload = true; - private boolean isTagFile; - private int tripCount; - private JasperException compileException; - private JspProbeEmitter jspProbeEmitter; - /* PWC 6468930 - private long servletClassLastModifiedTime; - */ - // START PWC 6468930 - private long servletClassLastModifiedTime = 0L; - private File jspFile = null; - // END PWC 6468930 - private long lastModificationTest = 0L; - - /* - * JspServletWrapper for JSP pages. - */ - JspServletWrapper(ServletConfig config, Options options, String jspUri, - boolean isErrorPage, JspRuntimeContext rctxt) - throws JasperException { - - this.isTagFile = false; - this.config = config; - this.options = options; - this.jspUri = jspUri; - this.jspProbeEmitter = (JspProbeEmitter) - config.getServletContext().getAttribute( - "org.glassfish.jsp.monitor.probeEmitter"); - - ctxt = new JspCompilationContext(jspUri, isErrorPage, options, - config.getServletContext(), - this, rctxt); - // START PWC 6468930 - String jspFilePath = ctxt.getRealPath(jspUri); - if (jspFilePath != null) { - jspFile = new File(jspFilePath); - } - // END PWC 6468930 - } - - /* - * JspServletWrapper for tag files. - */ - public JspServletWrapper(ServletContext servletContext, - Options options, - String tagFilePath, - TagInfo tagInfo, - JspRuntimeContext rctxt, - URL tagFileJarUrl) - throws JasperException { - - this.isTagFile = true; - this.config = null; // not used - this.options = options; - this.jspUri = tagFilePath; - this.tripCount = 0; - ctxt = new JspCompilationContext(jspUri, tagInfo, options, - servletContext, this, rctxt, - tagFileJarUrl); - } - - public JspCompilationContext getJspEngineContext() { - return ctxt; - } - - public void setReload(boolean reload) { - this.reload = reload; - } - - public Servlet getServlet() - throws ServletException, IOException, ClassNotFoundException - { - if (reload) { - synchronized (this) { - // Synchronizing on jsw enables simultaneous loading - // of different pages, but not the same page. - if (reload) { - // This is to maintain the original protocol. - destroy(); - - try { - servletClass = ctxt.load(); - theServlet = (Servlet) servletClass.newInstance(); - } catch( IllegalAccessException ex1 ) { - throw new JasperException( ex1 ); - } catch( InstantiationException ex ) { - throw new JasperException( ex ); - } - - theServlet.init(config); - - if (!firstTime) { - ctxt.getRuntimeContext().incrementJspReloadCount(); - // Fire the jspReloadedEvent probe event - if (jspProbeEmitter != null) { - jspProbeEmitter.jspReloadedEvent(jspUri); - } - } - - reload = false; - - // Fire the jspLoadedEvent probe event - if (jspProbeEmitter != null) { - jspProbeEmitter.jspLoadedEvent(jspUri); - } - } - } - } - return theServlet; - } - - public ServletContext getServletContext() { - return config.getServletContext(); - } - - /** - * Sets the compilation exception for this JspServletWrapper. - * - * @param je The compilation exception - */ - public void setCompilationException(JasperException je) { - this.compileException = je; - } - - /** - * Sets the last-modified time of the servlet class file associated with - * this JspServletWrapper. - * - * @param lastModified Last-modified time of servlet class - */ - public void setServletClassLastModifiedTime(long lastModified) { - if (this.servletClassLastModifiedTime < lastModified) { - synchronized (this) { - if (this.servletClassLastModifiedTime < lastModified) { - this.servletClassLastModifiedTime = lastModified; - reload = true; - } - } - } - } - - // START CR 6373479 - /** - * Gets the last-modified time of the servlet class file associated with - * this JspServletWrapper. - * - * @return Last-modified time of servlet class - */ - public long getServletClassLastModifiedTime() { - return servletClassLastModifiedTime; - } - // END CR 6373479 - - /** - * Compile (if needed) and load a tag file - */ - public Class loadTagFile() throws JasperException { - - try { - ctxt.compile(); - if (reload) { - tagHandlerClass = ctxt.load(); - } - } catch (ClassNotFoundException ex) { - } catch (FileNotFoundException ex) { - log.log(Level.SEVERE, Localizer.getMessage("jsp.error.compiling")); - throw new JasperException(ex); - } - return tagHandlerClass; - } - - /** - * Compile and load a prototype for the Tag file. This is needed - * when compiling tag files with circular dependencies. A prototpe - * (skeleton) with no dependencies on other other tag files is - * generated and compiled. - */ - public Class loadTagFilePrototype() throws JasperException { - - ctxt.setPrototypeMode(true); - try { - return loadTagFile(); - } finally { - ctxt.setPrototypeMode(false); - } - } - - /** - * Get a list of files that the current page has source dependency on. - */ - public java.util.List getDependants() { - try { - Object target; - if (isTagFile) { - if (reload) { - tagHandlerClass = ctxt.load(); - } - target = tagHandlerClass.newInstance(); - } else { - target = getServlet(); - } - if (target != null && target instanceof JspSourceDependent) { - return ((JspSourceDependent) target).getDependants(); - } - } catch (Throwable ex) { - } - return null; - } - - public boolean isTagFile() { - return this.isTagFile; - } - - public int incTripCount() { - return tripCount++; - } - - public int decTripCount() { - return tripCount--; - } - - public void service(HttpServletRequest request, - HttpServletResponse response, - boolean precompile) - throws ServletException, IOException { - - try { - - if (ctxt.isRemoved()) { - jspFileNotFound(request, response); - return; - } - - if ((available > 0L) && (available < Long.MAX_VALUE)) { - response.setDateHeader("Retry-After", available); - response.sendError - (HttpServletResponse.SC_SERVICE_UNAVAILABLE, - Localizer.getMessage("jsp.error.unavailable")); - } - - /* - * (1) Compile - */ - // BEGIN S1AS 6181923 - // if (options.getDevelopment() || firstTime) { - // END S1AS 6181923 - // BEGIN S1AS 6181923 - if (!options.getUsePrecompiled() - && (options.getDevelopment() || firstTime)) { - // END S1AS 6181923 - synchronized (this) { - firstTime = false; - - // The following sets reload to true, if necessary - ctxt.compile(); - } - } else { - if (compileException != null) { - // Throw cached compilation exception - throw compileException; - } - } - - /* - * (2) (Re)load servlet class file - */ - try { - getServlet(); - } catch (ClassNotFoundException ex) { - // This can only happen when use-precomiled is set and a - // supposedly pre-compiled class does not exist. - jspFileNotFound(request, response); - return; - } - - // If a page is to be precompiled only, return. - if (precompile) { - return; - } - - /* - * (3) Service request - */ - if (theServlet instanceof SingleThreadModel) { - // sync on the wrapper so that the freshness - // of the page is determined right before servicing - synchronized (this) { - theServlet.service(request, response); - } - } else { - theServlet.service(request, response); - } - - } catch (UnavailableException ex) { - String includeRequestUri = (String) - request.getAttribute("javax.servlet.include.request_uri"); - if (includeRequestUri != null) { - // This file was included. Throw an exception as - // a response.sendError() will be ignored by the - // servlet engine. - throw ex; - } else { - int unavailableSeconds = ex.getUnavailableSeconds(); - if (unavailableSeconds <= 0) { - unavailableSeconds = 60; // Arbitrary default - } - available = System.currentTimeMillis() + - (unavailableSeconds * 1000L); - response.sendError - (HttpServletResponse.SC_SERVICE_UNAVAILABLE, - ex.getMessage()); - } - } catch (ServletException ex) { - throw ex; - } catch (IOException ex) { - throw ex; - } catch (IllegalStateException ex) { - throw ex; - } catch (Exception ex) { - throw new JasperException(ex); - } - } - - public void destroy() { - if (theServlet != null) { - theServlet.destroy(); - // Fire the jspDestroyedEvent probe event - if (jspProbeEmitter != null) { - jspProbeEmitter.jspDestroyedEvent(jspUri); - } - } - } - - /** - * @return Returns the lastModificationTest. - */ - public long getLastModificationTest() { - return lastModificationTest; - } - - /** - * @param lastModificationTest The lastModificationTest to set. - */ - public void setLastModificationTest(long lastModificationTest) { - this.lastModificationTest = lastModificationTest; - } - - // START PWC 6468930 - public File getJspFile() { - return jspFile; - } - // END PWC 6468930 - - /* - * Handles the case where a requested JSP file no longer exists. - */ - private void jspFileNotFound(HttpServletRequest request, - HttpServletResponse response) - throws ServletException, IOException { - - FileNotFoundException fnfe = new FileNotFoundException(jspUri); - - ctxt.incrementRemoved(); - String includeRequestUri = (String) - request.getAttribute("javax.servlet.include.request_uri"); - if (includeRequestUri != null) { - // This file was included. Throw an exception as - // a response.sendError() will be ignored by the - // servlet engine. - throw new ServletException(fnfe); - } else { - try { - response.sendError(HttpServletResponse.SC_NOT_FOUND, - fnfe.getMessage()); - } catch (IllegalStateException ise) { - log.log(Level.SEVERE, - Localizer.getMessage("jsp.error.file.not.found", - fnfe.getMessage()), - fnfe); - } - } - } - -} diff --git a/impl/src/main/java/org/apache/jasper/servlet/mbeans-descriptors.xml b/impl/src/main/java/org/apache/jasper/servlet/mbeans-descriptors.xml deleted file mode 100644 index 32553d3..0000000 --- a/impl/src/main/java/org/apache/jasper/servlet/mbeans-descriptors.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/impl/src/main/java/org/apache/jasper/tagplugins/jstl/Choose.java b/impl/src/main/java/org/apache/jasper/tagplugins/jstl/Choose.java deleted file mode 100644 index 6511b94..0000000 --- a/impl/src/main/java/org/apache/jasper/tagplugins/jstl/Choose.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.tagplugins.jstl; - -import org.apache.jasper.compiler.tagplugin.*; - -public final class Choose implements TagPlugin { - - public void doTag(TagPluginContext ctxt) { - - // Not much to do here, much of the work will be done in the - // containing tags, and . - - ctxt.generateBody(); - // See comments in When.java for the reason "}" is generated here. - ctxt.generateJavaSource("}"); - } -} diff --git a/impl/src/main/java/org/apache/jasper/tagplugins/jstl/ForEach.java b/impl/src/main/java/org/apache/jasper/tagplugins/jstl/ForEach.java deleted file mode 100644 index 337671c..0000000 --- a/impl/src/main/java/org/apache/jasper/tagplugins/jstl/ForEach.java +++ /dev/null @@ -1,384 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.tagplugins.jstl; - -import org.apache.jasper.compiler.tagplugin.*; - -public final class ForEach implements TagPlugin { - - private boolean hasVar, hasBegin, hasEnd, hasStep; - - public void doTag(TagPluginContext ctxt) { - - String index = null; - - boolean hasVarStatus = ctxt.isAttributeSpecified("varStatus"); - if (hasVarStatus) { - ctxt.dontUseTagPlugin(); - return; - } - - hasVar = ctxt.isAttributeSpecified("var"); - hasBegin = ctxt.isAttributeSpecified("begin"); - hasEnd = ctxt.isAttributeSpecified("end"); - hasStep = ctxt.isAttributeSpecified("step"); - - boolean hasItems = ctxt.isAttributeSpecified("items"); - if (hasItems) { - doCollection(ctxt); - return; - } - - // We must have a begin and end attributes - index = ctxt.getTemporaryVariableName(); - ctxt.generateJavaSource("for (int " + index + " = "); - ctxt.generateAttribute("begin"); - ctxt.generateJavaSource("; " + index + " <= "); - ctxt.generateAttribute("end"); - if (hasStep) { - ctxt.generateJavaSource("; " + index + "+="); - ctxt.generateAttribute("step"); - ctxt.generateJavaSource(") {"); - } - else { - ctxt.generateJavaSource("; " + index + "++) {"); - } - - // If var is specified and the body contains an EL, then sycn - // the var attribute - if (hasVar /* && ctxt.hasEL() */) { - ctxt.generateJavaSource("_jspx_page_context.setAttribute("); - ctxt.generateAttribute("var"); - ctxt.generateJavaSource(", String.valueOf(" + index + "));"); - } - ctxt.generateBody(); - ctxt.generateJavaSource("}"); - } - - /** - * Generate codes for Collections - * The pseudo code is: - */ - private void doCollection(TagPluginContext ctxt) { - - ctxt.generateImport("java.util.*"); - generateIterators(ctxt); - - String itemsV = ctxt.getTemporaryVariableName(); - ctxt.generateJavaSource("Object " + itemsV + "= "); - ctxt.generateAttribute("items"); - ctxt.generateJavaSource(";"); - - String indexV=null, beginV=null, endV=null, stepV=null; - if (hasBegin) { - beginV = ctxt.getTemporaryVariableName(); - ctxt.generateJavaSource("int " + beginV + " = "); - ctxt.generateAttribute("begin"); - ctxt.generateJavaSource(";"); - } - if (hasEnd) { - indexV = ctxt.getTemporaryVariableName(); - ctxt.generateJavaSource("int " + indexV + " = 0;"); - endV = ctxt.getTemporaryVariableName(); - ctxt.generateJavaSource("int " + endV + " = "); - ctxt.generateAttribute("end"); - ctxt.generateJavaSource(";"); - } - if (hasStep) { - stepV = ctxt.getTemporaryVariableName(); - ctxt.generateJavaSource("int " + stepV + " = "); - ctxt.generateAttribute("step"); - ctxt.generateJavaSource(";"); - } - - String iterV = ctxt.getTemporaryVariableName(); - ctxt.generateJavaSource("Iterator " + iterV + " = null;"); - // Object[] - ctxt.generateJavaSource("if (" + itemsV + " instanceof Object[])"); - ctxt.generateJavaSource(iterV + "=toIterator((Object[])" + itemsV + ");"); - // boolean[] - ctxt.generateJavaSource("else if (" + itemsV + " instanceof boolean[])"); - ctxt.generateJavaSource(iterV + "=toIterator((boolean[])" + itemsV + ");"); - // byte[] - ctxt.generateJavaSource("else if (" + itemsV + " instanceof byte[])"); - ctxt.generateJavaSource(iterV + "=toIterator((byte[])" + itemsV + ");"); - // char[] - ctxt.generateJavaSource("else if (" + itemsV + " instanceof char[])"); - ctxt.generateJavaSource(iterV + "=toIterator((char[])" + itemsV + ");"); - // short[] - ctxt.generateJavaSource("else if (" + itemsV + " instanceof short[])"); - ctxt.generateJavaSource(iterV + "=toIterator((short[])" + itemsV + ");"); - // int[] - ctxt.generateJavaSource("else if (" + itemsV + " instanceof int[])"); - ctxt.generateJavaSource(iterV + "=toIterator((int[])" + itemsV + ");"); - // long[] - ctxt.generateJavaSource("else if (" + itemsV + " instanceof long[])"); - ctxt.generateJavaSource(iterV + "=toIterator((long[])" + itemsV + ");"); - // float[] - ctxt.generateJavaSource("else if (" + itemsV + " instanceof float[])"); - ctxt.generateJavaSource(iterV + "=toIterator((float[])" + itemsV + ");"); - // double[] - ctxt.generateJavaSource("else if (" + itemsV + " instanceof double[])"); - ctxt.generateJavaSource(iterV + "=toIterator((double[])" + itemsV + ");"); - - // Collection - ctxt.generateJavaSource("else if (" + itemsV + " instanceof Collection)"); - ctxt.generateJavaSource(iterV + "=((Collection)" + itemsV + ").iterator();"); - - // Iterator - ctxt.generateJavaSource("else if (" + itemsV + " instanceof Iterator)"); - ctxt.generateJavaSource(iterV + "=(Iterator)" + itemsV + ";"); - - // Enumeration - ctxt.generateJavaSource("else if (" + itemsV + " instanceof Enumeration)"); - ctxt.generateJavaSource(iterV + "=toIterator((Enumeration)" + itemsV + ");"); - - // Map - ctxt.generateJavaSource("else if (" + itemsV + " instanceof Map)"); - ctxt.generateJavaSource(iterV + "=((Map)" + itemsV + ").entrySet().iterator();"); - - if (hasBegin) { - String tV = ctxt.getTemporaryVariableName(); - ctxt.generateJavaSource("for (int " + tV + "=" + beginV + ";" + - tV + ">0 && " + iterV + ".hasNext(); " + - tV + "--)"); - ctxt.generateJavaSource(iterV + ".next();"); - } - - ctxt.generateJavaSource("while (" + iterV + ".hasNext()){"); - if (hasVar) { - ctxt.generateJavaSource("_jspx_page_context.setAttribute("); - ctxt.generateAttribute("var"); - ctxt.generateJavaSource(", " + iterV + ".next());"); - } - - ctxt.generateBody(); - - if (hasStep) { - String tV = ctxt.getTemporaryVariableName(); - ctxt.generateJavaSource("for (int " + tV + "=" + stepV + "-1;" + - tV + ">0 && " + iterV + ".hasNext(); " + - tV + "--)"); - ctxt.generateJavaSource(iterV + ".next();"); - } - if (hasEnd) { - if (hasStep) { - ctxt.generateJavaSource(indexV + "+=" + stepV + ";"); - } - else { - ctxt.generateJavaSource(indexV + "++;"); - } - if (hasBegin) { - ctxt.generateJavaSource("if(" + beginV + "+" + indexV + - ">"+ endV + ")"); - } - else { - ctxt.generateJavaSource("if(" + indexV + ">" + endV + ")"); - } - ctxt.generateJavaSource("break;"); - } - ctxt.generateJavaSource("}"); // while - } - - /** - * Generate iterators for data types supported in items - */ - private void generateIterators(TagPluginContext ctxt) { - - // Object[] - ctxt.generateDeclaration("ObjectArrayIterator", - "private Iterator toIterator(final Object[] a){\n" + - " return (new Iterator() {\n" + - " int index=0;\n" + - " public boolean hasNext() {\n" + - " return index < a.length;}\n" + - " public Object next() {\n" + - " return a[index++];}\n" + - " public void remove() {}\n" + - " });\n" + - "}" - ); - - // boolean[] - ctxt.generateDeclaration("booleanArrayIterator", - "private Iterator toIterator(final boolean[] a){\n" + - " return (new Iterator() {\n" + - " int index=0;\n" + - " public boolean hasNext() {\n" + - " return index < a.length;}\n" + - " public Object next() {\n" + - " return new Boolean(a[index++]);}\n" + - " public void remove() {}\n" + - " });\n" + - "}" - ); - - // byte[] - ctxt.generateDeclaration("byteArrayIterator", - "private Iterator toIterator(final byte[] a){\n" + - " return (new Iterator() {\n" + - " int index=0;\n" + - " public boolean hasNext() {\n" + - " return index < a.length;}\n" + - " public Object next() {\n" + - " return new Byte(a[index++]);}\n" + - " public void remove() {}\n" + - " });\n" + - "}" - ); - - // char[] - ctxt.generateDeclaration("charArrayIterator", - "private Iterator toIterator(final char[] a){\n" + - " return (new Iterator() {\n" + - " int index=0;\n" + - " public boolean hasNext() {\n" + - " return index < a.length;}\n" + - " public Object next() {\n" + - " return new Character(a[index++]);}\n" + - " public void remove() {}\n" + - " });\n" + - "}" - ); - - // short[] - ctxt.generateDeclaration("shortArrayIterator", - "private Iterator toIterator(final short[] a){\n" + - " return (new Iterator() {\n" + - " int index=0;\n" + - " public boolean hasNext() {\n" + - " return index < a.length;}\n" + - " public Object next() {\n" + - " return new Short(a[index++]);}\n" + - " public void remove() {}\n" + - " });\n" + - "}" - ); - - // int[] - ctxt.generateDeclaration("intArrayIterator", - "private Iterator toIterator(final int[] a){\n" + - " return (new Iterator() {\n" + - " int index=0;\n" + - " public boolean hasNext() {\n" + - " return index < a.length;}\n" + - " public Object next() {\n" + - " return new Integer(a[index++]);}\n" + - " public void remove() {}\n" + - " });\n" + - "}" - ); - - // long[] - ctxt.generateDeclaration("longArrayIterator", - "private Iterator toIterator(final long[] a){\n" + - " return (new Iterator() {\n" + - " int index=0;\n" + - " public boolean hasNext() {\n" + - " return index < a.length;}\n" + - " public Object next() {\n" + - " return new Long(a[index++]);}\n" + - " public void remove() {}\n" + - " });\n" + - "}" - ); - - // float[] - ctxt.generateDeclaration("floatArrayIterator", - "private Iterator toIterator(final float[] a){\n" + - " return (new Iterator() {\n" + - " int index=0;\n" + - " public boolean hasNext() {\n" + - " return index < a.length;}\n" + - " public Object next() {\n" + - " return new Float(a[index++]);}\n" + - " public void remove() {}\n" + - " });\n" + - "}" - ); - - // double[] - ctxt.generateDeclaration("doubleArrayIterator", - "private Iterator toIterator(final double[] a){\n" + - " return (new Iterator() {\n" + - " int index=0;\n" + - " public boolean hasNext() {\n" + - " return index < a.length;}\n" + - " public Object next() {\n" + - " return new Double(a[index++]);}\n" + - " public void remove() {}\n" + - " });\n" + - "}" - ); - - // Enumeration - ctxt.generateDeclaration("enumIterator", - "private Iterator toIterator(final Enumeration e){\n" + - " return (new Iterator() {\n" + - " public boolean hasNext() {\n" + - " return e.hasMoreElements();}\n" + - " public Object next() {\n" + - " return e.nextElement();}\n" + - " public void remove() {}\n" + - " });\n" + - "}" - ); - - } -} diff --git a/impl/src/main/java/org/apache/jasper/tagplugins/jstl/If.java b/impl/src/main/java/org/apache/jasper/tagplugins/jstl/If.java deleted file mode 100644 index 131462f..0000000 --- a/impl/src/main/java/org/apache/jasper/tagplugins/jstl/If.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.tagplugins.jstl; - -import org.apache.jasper.compiler.tagplugin.*; - -public final class If implements TagPlugin { - - public void doTag(TagPluginContext ctxt) { - String condV = ctxt.getTemporaryVariableName(); - ctxt.generateJavaSource("boolean " + condV + "="); - ctxt.generateAttribute("test"); - ctxt.generateJavaSource(";"); - if (ctxt.isAttributeSpecified("var")) { - String scope = "PageContext.PAGE_SCOPE"; - if (ctxt.isAttributeSpecified("scope")) { - String scopeStr = ctxt.getConstantAttribute("scope"); - if ("request".equals(scopeStr)) { - scope = "PageContext.REQUEST_SCOPE"; - } else if ("session".equals(scopeStr)) { - scope = "PageContext.SESSION_SCOPE"; - } else if ("application".equals(scopeStr)) { - scope = "PageContext.APPLICATION_SCOPE"; - } - } - ctxt.generateJavaSource("_jspx_page_context.setAttribute("); - ctxt.generateAttribute("var"); - ctxt.generateJavaSource(", new Boolean(" + condV + ")," + scope + ");"); - } - ctxt.generateJavaSource("if (" + condV + "){"); - ctxt.generateBody(); - ctxt.generateJavaSource("}"); - } -} diff --git a/impl/src/main/java/org/apache/jasper/tagplugins/jstl/Otherwise.java b/impl/src/main/java/org/apache/jasper/tagplugins/jstl/Otherwise.java deleted file mode 100644 index 380c5d8..0000000 --- a/impl/src/main/java/org/apache/jasper/tagplugins/jstl/Otherwise.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.tagplugins.jstl; - -import org.apache.jasper.compiler.tagplugin.*; - -public final class Otherwise implements TagPlugin { - - public void doTag(TagPluginContext ctxt) { - - // See When.java for the reason whey "}" is need at the beginng and - // not at the end. - ctxt.generateJavaSource("} else {"); - ctxt.generateBody(); - } -} diff --git a/impl/src/main/java/org/apache/jasper/tagplugins/jstl/When.java b/impl/src/main/java/org/apache/jasper/tagplugins/jstl/When.java deleted file mode 100644 index b33b788..0000000 --- a/impl/src/main/java/org/apache/jasper/tagplugins/jstl/When.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.tagplugins.jstl; - -import org.apache.jasper.compiler.tagplugin.*; - -public final class When implements TagPlugin { - - public void doTag(TagPluginContext ctxt) { - // Get the parent context to determine if this is the first - TagPluginContext parentContext = ctxt.getParentContext(); - if (parentContext == null) { - ctxt.dontUseTagPlugin(); - return; - } - - if ("true".equals(parentContext.getPluginAttribute("hasBeenHere"))) { - ctxt.generateJavaSource("} else if("); - // See comment below for the reason we generate the extra "}" here. - } - else { - ctxt.generateJavaSource("if("); - parentContext.setPluginAttribute("hasBeenHere", "true"); - } - ctxt.generateAttribute("test"); - ctxt.generateJavaSource("){"); - ctxt.generateBody(); - - // We don't generate the closing "}" for the "if" here because there - // may be whitespaces in between 's. Instead we delay - // generating it until the next or or - // - } -} diff --git a/impl/src/main/java/org/apache/jasper/tagplugins/jstl/tagPlugins.xml b/impl/src/main/java/org/apache/jasper/tagplugins/jstl/tagPlugins.xml deleted file mode 100644 index d420e17..0000000 --- a/impl/src/main/java/org/apache/jasper/tagplugins/jstl/tagPlugins.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - org.apache.taglibs.standard.tag.rt.core.IfTag - org.apache.jasper.tagplugins.jstl.If - - - org.apache.taglibs.standard.tag.common.core.ChooseTag - org.apache.jasper.tagplugins.jstl.Choose - - - org.apache.taglibs.standard.tag.rt.core.WhenTag - org.apache.jasper.tagplugins.jstl.When - - - org.apache.taglibs.standard.tag.common.core.OtherwiseTag - org.apache.jasper.tagplugins.jstl.Otherwise - - - org.apache.taglibs.standard.tag.rt.core.ForEachTag - org.apache.jasper.tagplugins.jstl.ForEach - - diff --git a/impl/src/main/java/org/apache/jasper/util/SystemLogHandler.java b/impl/src/main/java/org/apache/jasper/util/SystemLogHandler.java deleted file mode 100644 index 759d905..0000000 --- a/impl/src/main/java/org/apache/jasper/util/SystemLogHandler.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.util; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; - - -/** - * This helper class may be used to do sophisticated redirection of - * System.out and System.err. - * - * @author Remy Maucherat - */ -public class SystemLogHandler extends PrintStream { - - - // ----------------------------------------------------------- Constructors - - - /** - * Construct the handler to capture the output of the given steam. - */ - public SystemLogHandler(PrintStream wrapped) { - super(wrapped); - this.wrapped = wrapped; - } - - - // ----------------------------------------------------- Instance Variables - - - /** - * Wrapped PrintStream. - */ - protected PrintStream wrapped = null; - - - /** - * Thread <-> PrintStream associations. - */ - protected static final ThreadLocal streams = new ThreadLocal(); - - - /** - * Thread <-> ByteArrayOutputStream associations. - */ - protected static final ThreadLocal data = new ThreadLocal(); - - - // --------------------------------------------------------- Public Methods - - - public PrintStream getWrapped() { - return wrapped; - } - - /** - * Start capturing thread's output. - */ - public static void setThread() { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - data.set(baos); - streams.set(new PrintStream(baos)); - } - - - /** - * Stop capturing thread's output and return captured data as a String. - */ - public static String unsetThread() { - ByteArrayOutputStream baos = - (ByteArrayOutputStream) data.get(); - if (baos == null) { - return null; - } - streams.set(null); - data.set(null); - return baos.toString(); - } - - - // ------------------------------------------------------ Protected Methods - - - /** - * Find PrintStream to which the output must be written to. - */ - protected PrintStream findStream() { - PrintStream ps = (PrintStream) streams.get(); - if (ps == null) { - ps = wrapped; - } - return ps; - } - - - // ---------------------------------------------------- PrintStream Methods - - - public void flush() { - findStream().flush(); - } - - public void close() { - findStream().close(); - } - - public boolean checkError() { - return findStream().checkError(); - } - - protected void setError() { - //findStream().setError(); - } - - public void write(int b) { - findStream().write(b); - } - - public void write(byte[] b) - throws IOException { - findStream().write(b); - } - - public void write(byte[] buf, int off, int len) { - findStream().write(buf, off, len); - } - - public void print(boolean b) { - findStream().print(b); - } - - public void print(char c) { - findStream().print(c); - } - - public void print(int i) { - findStream().print(i); - } - - public void print(long l) { - findStream().print(l); - } - - public void print(float f) { - findStream().print(f); - } - - public void print(double d) { - findStream().print(d); - } - - public void print(char[] s) { - findStream().print(s); - } - - public void print(String s) { - findStream().print(s); - } - - public void print(Object obj) { - findStream().print(obj); - } - - public void println() { - findStream().println(); - } - - public void println(boolean x) { - findStream().println(x); - } - - public void println(char x) { - findStream().println(x); - } - - public void println(int x) { - findStream().println(x); - } - - public void println(long x) { - findStream().println(x); - } - - public void println(float x) { - findStream().println(x); - } - - public void println(double x) { - findStream().println(x); - } - - public void println(char[] x) { - findStream().println(x); - } - - public void println(String x) { - findStream().println(x); - } - - public void println(Object x) { - findStream().println(x); - } - -} diff --git a/impl/src/main/java/org/apache/jasper/xmlparser/ASCIIReader.java b/impl/src/main/java/org/apache/jasper/xmlparser/ASCIIReader.java deleted file mode 100644 index 9f4de5c..0000000 --- a/impl/src/main/java/org/apache/jasper/xmlparser/ASCIIReader.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.xmlparser; - -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import org.apache.jasper.compiler.Localizer; - -/** - * A simple ASCII byte reader. This is an optimized reader for reading - * byte streams that only contain 7-bit ASCII characters. - * - * @author Andy Clark, IBM - * - * @version $Id: ASCIIReader.java,v 1.3 2006/12/12 02:12:48 jluehe Exp $ - */ -public class ASCIIReader - extends Reader { - - // - // Constants - // - - /** Default byte buffer size (2048). */ - public static final int DEFAULT_BUFFER_SIZE = 2048; - - // - // Data - // - - /** Input stream. */ - protected InputStream fInputStream; - - /** Byte buffer. */ - protected byte[] fBuffer; - - // - // Constructors - // - - /** - * Constructs an ASCII reader from the specified input stream - * and buffer size. - * - * @param inputStream The input stream. - * @param size The initial buffer size. - */ - public ASCIIReader(InputStream inputStream, int size) { - fInputStream = inputStream; - fBuffer = new byte[size]; - } - - // - // Reader methods - // - - /** - * Read a single character. This method will block until a character is - * available, an I/O error occurs, or the end of the stream is reached. - * - *

    Subclasses that intend to support efficient single-character input - * should override this method. - * - * @return The character read, as an integer in the range 0 to 127 - * (0x00-0x7f), or -1 if the end of the stream has - * been reached - * - * @exception IOException If an I/O error occurs - */ - public int read() throws IOException { - int b0 = fInputStream.read(); - if (b0 > 0x80) { - throw new IOException(Localizer.getMessage("jsp.error.xml.invalidASCII", - Integer.toString(b0))); - } - return b0; - } // read():int - - /** - * Read characters into a portion of an array. This method will block - * until some input is available, an I/O error occurs, or the end of the - * stream is reached. - * - * @param ch Destination buffer - * @param offset Offset at which to start storing characters - * @param length Maximum number of characters to read - * - * @return The number of characters read, or -1 if the end of the - * stream has been reached - * - * @exception IOException If an I/O error occurs - */ - public int read(char ch[], int offset, int length) throws IOException { - if (length > fBuffer.length) { - length = fBuffer.length; - } - int count = fInputStream.read(fBuffer, 0, length); - for (int i = 0; i < count; i++) { - int b0 = fBuffer[i]; - if (b0 < 0) { - throw new IOException(Localizer.getMessage("jsp.error.xml.invalidASCII", - Integer.toString(b0))); - } - ch[offset + i] = (char)b0; - } - return count; - } // read(char[],int,int) - - /** - * Skip characters. This method will block until some characters are - * available, an I/O error occurs, or the end of the stream is reached. - * - * @param n The number of characters to skip - * - * @return The number of characters actually skipped - * - * @exception IOException If an I/O error occurs - */ - public long skip(long n) throws IOException { - return fInputStream.skip(n); - } // skip(long):long - - /** - * Tell whether this stream is ready to be read. - * - * @return True if the next read() is guaranteed not to block for input, - * false otherwise. Note that returning false does not guarantee that the - * next read will block. - * - * @exception IOException If an I/O error occurs - */ - public boolean ready() throws IOException { - return false; - } // ready() - - /** - * Tell whether this stream supports the mark() operation. - */ - public boolean markSupported() { - return fInputStream.markSupported(); - } // markSupported() - - /** - * Mark the present position in the stream. Subsequent calls to reset() - * will attempt to reposition the stream to this point. Not all - * character-input streams support the mark() operation. - * - * @param readAheadLimit Limit on the number of characters that may be - * read while still preserving the mark. After - * reading this many characters, attempting to - * reset the stream may fail. - * - * @exception IOException If the stream does not support mark(), - * or if some other I/O error occurs - */ - public void mark(int readAheadLimit) throws IOException { - fInputStream.mark(readAheadLimit); - } // mark(int) - - /** - * Reset the stream. If the stream has been marked, then attempt to - * reposition it at the mark. If the stream has not been marked, then - * attempt to reset it in some way appropriate to the particular stream, - * for example by repositioning it to its starting point. Not all - * character-input streams support the reset() operation, and some support - * reset() without supporting mark(). - * - * @exception IOException If the stream has not been marked, - * or if the mark has been invalidated, - * or if the stream does not support reset(), - * or if some other I/O error occurs - */ - public void reset() throws IOException { - fInputStream.reset(); - } // reset() - - /** - * Close the stream. Once a stream has been closed, further read(), - * ready(), mark(), or reset() invocations will throw an IOException. - * Closing a previously-closed stream, however, has no effect. - * - * @exception IOException If an I/O error occurs - */ - public void close() throws IOException { - fInputStream.close(); - } // close() - -} // class ASCIIReader diff --git a/impl/src/main/java/org/apache/jasper/xmlparser/EncodingMap.java b/impl/src/main/java/org/apache/jasper/xmlparser/EncodingMap.java deleted file mode 100644 index 76a61e5..0000000 --- a/impl/src/main/java/org/apache/jasper/xmlparser/EncodingMap.java +++ /dev/null @@ -1,1055 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.xmlparser; - -import java.util.Hashtable; - -/** - * EncodingMap is a convenience class which handles conversions between - * IANA encoding names and Java encoding names, and vice versa. The - * encoding names used in XML instance documents must - * be the IANA encoding names specified or one of the aliases for those names - * which IANA defines. - *

    - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    - *

    Common Name - *

    - *

    Use this name in XML files - *

    - *

    Name Type - *

    - *

    Xerces converts to this Java Encoder Name - *

    8 bit Unicode - *

    UTF-8 - *

    - *

    IANA - *

    - *

    UTF8 - *

    ISO Latin 1 - *

    ISO-8859-1 - *

    - *

    MIME - *

    - *

    ISO-8859-1 - *

    ISO Latin 2 - *

    ISO-8859-2 - *

    - *

    MIME - *

    - *

    ISO-8859-2 - *

    ISO Latin 3 - *

    ISO-8859-3 - *

    - *

    MIME - *

    - *

    ISO-8859-3 - *

    ISO Latin 4 - *

    ISO-8859-4 - *

    - *

    MIME - *

    - *

    ISO-8859-4 - *

    ISO Latin Cyrillic - *

    ISO-8859-5 - *

    - *

    MIME - *

    - *

    ISO-8859-5 - *

    ISO Latin Arabic - *

    ISO-8859-6 - *

    - *

    MIME - *

    - *

    ISO-8859-6 - *

    ISO Latin Greek - *

    ISO-8859-7 - *

    - *

    MIME - *

    - *

    ISO-8859-7 - *

    ISO Latin Hebrew - *

    ISO-8859-8 - *

    - *

    MIME - *

    - *

    ISO-8859-8 - *

    ISO Latin 5 - *

    ISO-8859-9 - *

    - *

    MIME - *

    - *

    ISO-8859-9 - *

    EBCDIC: US - *

    ebcdic-cp-us - *

    - *

    IANA - *

    - *

    cp037 - *

    EBCDIC: Canada - *

    ebcdic-cp-ca - *

    - *

    IANA - *

    - *

    cp037 - *

    EBCDIC: Netherlands - *

    ebcdic-cp-nl - *

    - *

    IANA - *

    - *

    cp037 - *

    EBCDIC: Denmark - *

    ebcdic-cp-dk - *

    - *

    IANA - *

    - *

    cp277 - *

    EBCDIC: Norway - *

    ebcdic-cp-no - *

    - *

    IANA - *

    - *

    cp277 - *

    EBCDIC: Finland - *

    ebcdic-cp-fi - *

    - *

    IANA - *

    - *

    cp278 - *

    EBCDIC: Sweden - *

    ebcdic-cp-se - *

    - *

    IANA - *

    - *

    cp278 - *

    EBCDIC: Italy - *

    ebcdic-cp-it - *

    - *

    IANA - *

    - *

    cp280 - *

    EBCDIC: Spain, Latin America - *

    ebcdic-cp-es - *

    - *

    IANA - *

    - *

    cp284 - *

    EBCDIC: Great Britain - *

    ebcdic-cp-gb - *

    - *

    IANA - *

    - *

    cp285 - *

    EBCDIC: France - *

    ebcdic-cp-fr - *

    - *

    IANA - *

    - *

    cp297 - *

    EBCDIC: Arabic - *

    ebcdic-cp-ar1 - *

    - *

    IANA - *

    - *

    cp420 - *

    EBCDIC: Hebrew - *

    ebcdic-cp-he - *

    - *

    IANA - *

    - *

    cp424 - *

    EBCDIC: Switzerland - *

    ebcdic-cp-ch - *

    - *

    IANA - *

    - *

    cp500 - *

    EBCDIC: Roece - *

    ebcdic-cp-roece - *

    - *

    IANA - *

    - *

    cp870 - *

    EBCDIC: Yugoslavia - *

    ebcdic-cp-yu - *

    - *

    IANA - *

    - *

    cp870 - *

    EBCDIC: Iceland - *

    ebcdic-cp-is - *

    - *

    IANA - *

    - *

    cp871 - *

    EBCDIC: Urdu - *

    ebcdic-cp-ar2 - *

    - *

    IANA - *

    - *

    cp918 - *

    Chinese for PRC, mixed 1/2 byte - *

    gb2312 - *

    - *

    MIME - *

    - *

    GB2312 - *

    Extended Unix Code, packed for Japanese - *

    euc-jp - *

    - *

    MIME - *

    - *

    eucjis - *

    Japanese: iso-2022-jp - *

    iso-2020-jp - *

    - *

    MIME - *

    - *

    JIS - *

    Japanese: Shift JIS - *

    Shift_JIS - *

    - *

    MIME - *

    - *

    SJIS - *

    Chinese: Big5 - *

    Big5 - *

    - *

    MIME - *

    - *

    Big5 - *

    Extended Unix Code, packed for Korean - *

    euc-kr - *

    - *

    MIME - *

    - *

    iso2022kr - *

    Cyrillic - *

    koi8-r - *

    - *

    MIME - *

    - *

    koi8-r - *

    - * - * @author TAMURA Kent, IBM - * @author Andy Clark, IBM - * - * @version $Id: EncodingMap.java,v 1.2 2005/12/08 01:29:00 kchung Exp $ - */ -public class EncodingMap { - - // - // Data - // - - /** fIANA2JavaMap */ - protected final static Hashtable fIANA2JavaMap - = new Hashtable(); - - /** fJava2IANAMap */ - protected final static Hashtable fJava2IANAMap - = new Hashtable(); - - // - // Static initialization - // - - static { - - // add IANA to Java encoding mappings. - fIANA2JavaMap.put("BIG5", "Big5"); - fIANA2JavaMap.put("CSBIG5", "Big5"); - fIANA2JavaMap.put("CP037", "CP037"); - fIANA2JavaMap.put("IBM037", "CP037"); - fIANA2JavaMap.put("CSIBM037", "CP037"); - fIANA2JavaMap.put("EBCDIC-CP-US", "CP037"); - fIANA2JavaMap.put("EBCDIC-CP-CA", "CP037"); - fIANA2JavaMap.put("EBCDIC-CP-NL", "CP037"); - fIANA2JavaMap.put("EBCDIC-CP-WT", "CP037"); - fIANA2JavaMap.put("IBM273", "CP273"); - fIANA2JavaMap.put("CP273", "CP273"); - fIANA2JavaMap.put("CSIBM273", "CP273"); - fIANA2JavaMap.put("IBM277", "CP277"); - fIANA2JavaMap.put("CP277", "CP277"); - fIANA2JavaMap.put("CSIBM277", "CP277"); - fIANA2JavaMap.put("EBCDIC-CP-DK", "CP277"); - fIANA2JavaMap.put("EBCDIC-CP-NO", "CP277"); - fIANA2JavaMap.put("IBM278", "CP278"); - fIANA2JavaMap.put("CP278", "CP278"); - fIANA2JavaMap.put("CSIBM278", "CP278"); - fIANA2JavaMap.put("EBCDIC-CP-FI", "CP278"); - fIANA2JavaMap.put("EBCDIC-CP-SE", "CP278"); - fIANA2JavaMap.put("IBM280", "CP280"); - fIANA2JavaMap.put("CP280", "CP280"); - fIANA2JavaMap.put("CSIBM280", "CP280"); - fIANA2JavaMap.put("EBCDIC-CP-IT", "CP280"); - fIANA2JavaMap.put("IBM284", "CP284"); - fIANA2JavaMap.put("CP284", "CP284"); - fIANA2JavaMap.put("CSIBM284", "CP284"); - fIANA2JavaMap.put("EBCDIC-CP-ES", "CP284"); - fIANA2JavaMap.put("EBCDIC-CP-GB", "CP285"); - fIANA2JavaMap.put("IBM285", "CP285"); - fIANA2JavaMap.put("CP285", "CP285"); - fIANA2JavaMap.put("CSIBM285", "CP285"); - fIANA2JavaMap.put("EBCDIC-JP-KANA", "CP290"); - fIANA2JavaMap.put("IBM290", "CP290"); - fIANA2JavaMap.put("CP290", "CP290"); - fIANA2JavaMap.put("CSIBM290", "CP290"); - fIANA2JavaMap.put("EBCDIC-CP-FR", "CP297"); - fIANA2JavaMap.put("IBM297", "CP297"); - fIANA2JavaMap.put("CP297", "CP297"); - fIANA2JavaMap.put("CSIBM297", "CP297"); - fIANA2JavaMap.put("EBCDIC-CP-AR1", "CP420"); - fIANA2JavaMap.put("IBM420", "CP420"); - fIANA2JavaMap.put("CP420", "CP420"); - fIANA2JavaMap.put("CSIBM420", "CP420"); - fIANA2JavaMap.put("EBCDIC-CP-HE", "CP424"); - fIANA2JavaMap.put("IBM424", "CP424"); - fIANA2JavaMap.put("CP424", "CP424"); - fIANA2JavaMap.put("CSIBM424", "CP424"); - fIANA2JavaMap.put("IBM437", "CP437"); - fIANA2JavaMap.put("437", "CP437"); - fIANA2JavaMap.put("CP437", "CP437"); - fIANA2JavaMap.put("CSPC8CODEPAGE437", "CP437"); - fIANA2JavaMap.put("EBCDIC-CP-CH", "CP500"); - fIANA2JavaMap.put("IBM500", "CP500"); - fIANA2JavaMap.put("CP500", "CP500"); - fIANA2JavaMap.put("CSIBM500", "CP500"); - fIANA2JavaMap.put("EBCDIC-CP-CH", "CP500"); - fIANA2JavaMap.put("EBCDIC-CP-BE", "CP500"); - fIANA2JavaMap.put("IBM775", "CP775"); - fIANA2JavaMap.put("CP775", "CP775"); - fIANA2JavaMap.put("CSPC775BALTIC", "CP775"); - fIANA2JavaMap.put("IBM850", "CP850"); - fIANA2JavaMap.put("850", "CP850"); - fIANA2JavaMap.put("CP850", "CP850"); - fIANA2JavaMap.put("CSPC850MULTILINGUAL", "CP850"); - fIANA2JavaMap.put("IBM852", "CP852"); - fIANA2JavaMap.put("852", "CP852"); - fIANA2JavaMap.put("CP852", "CP852"); - fIANA2JavaMap.put("CSPCP852", "CP852"); - fIANA2JavaMap.put("IBM855", "CP855"); - fIANA2JavaMap.put("855", "CP855"); - fIANA2JavaMap.put("CP855", "CP855"); - fIANA2JavaMap.put("CSIBM855", "CP855"); - fIANA2JavaMap.put("IBM857", "CP857"); - fIANA2JavaMap.put("857", "CP857"); - fIANA2JavaMap.put("CP857", "CP857"); - fIANA2JavaMap.put("CSIBM857", "CP857"); - fIANA2JavaMap.put("IBM00858", "CP858"); - fIANA2JavaMap.put("CP00858", "CP858"); - fIANA2JavaMap.put("CCSID00858", "CP858"); - fIANA2JavaMap.put("IBM860", "CP860"); - fIANA2JavaMap.put("860", "CP860"); - fIANA2JavaMap.put("CP860", "CP860"); - fIANA2JavaMap.put("CSIBM860", "CP860"); - fIANA2JavaMap.put("IBM861", "CP861"); - fIANA2JavaMap.put("861", "CP861"); - fIANA2JavaMap.put("CP861", "CP861"); - fIANA2JavaMap.put("CP-IS", "CP861"); - fIANA2JavaMap.put("CSIBM861", "CP861"); - fIANA2JavaMap.put("IBM862", "CP862"); - fIANA2JavaMap.put("862", "CP862"); - fIANA2JavaMap.put("CP862", "CP862"); - fIANA2JavaMap.put("CSPC862LATINHEBREW", "CP862"); - fIANA2JavaMap.put("IBM863", "CP863"); - fIANA2JavaMap.put("863", "CP863"); - fIANA2JavaMap.put("CP863", "CP863"); - fIANA2JavaMap.put("CSIBM863", "CP863"); - fIANA2JavaMap.put("IBM864", "CP864"); - fIANA2JavaMap.put("CP864", "CP864"); - fIANA2JavaMap.put("CSIBM864", "CP864"); - fIANA2JavaMap.put("IBM865", "CP865"); - fIANA2JavaMap.put("865", "CP865"); - fIANA2JavaMap.put("CP865", "CP865"); - fIANA2JavaMap.put("CSIBM865", "CP865"); - fIANA2JavaMap.put("IBM866", "CP866"); - fIANA2JavaMap.put("866", "CP866"); - fIANA2JavaMap.put("CP866", "CP866"); - fIANA2JavaMap.put("CSIBM866", "CP866"); - fIANA2JavaMap.put("IBM868", "CP868"); - fIANA2JavaMap.put("CP868", "CP868"); - fIANA2JavaMap.put("CSIBM868", "CP868"); - fIANA2JavaMap.put("CP-AR", "CP868"); - fIANA2JavaMap.put("IBM869", "CP869"); - fIANA2JavaMap.put("CP869", "CP869"); - fIANA2JavaMap.put("CSIBM869", "CP869"); - fIANA2JavaMap.put("CP-GR", "CP869"); - fIANA2JavaMap.put("IBM870", "CP870"); - fIANA2JavaMap.put("CP870", "CP870"); - fIANA2JavaMap.put("CSIBM870", "CP870"); - fIANA2JavaMap.put("EBCDIC-CP-ROECE", "CP870"); - fIANA2JavaMap.put("EBCDIC-CP-YU", "CP870"); - fIANA2JavaMap.put("IBM871", "CP871"); - fIANA2JavaMap.put("CP871", "CP871"); - fIANA2JavaMap.put("CSIBM871", "CP871"); - fIANA2JavaMap.put("EBCDIC-CP-IS", "CP871"); - fIANA2JavaMap.put("IBM918", "CP918"); - fIANA2JavaMap.put("CP918", "CP918"); - fIANA2JavaMap.put("CSIBM918", "CP918"); - fIANA2JavaMap.put("EBCDIC-CP-AR2", "CP918"); - fIANA2JavaMap.put("IBM00924", "CP924"); - fIANA2JavaMap.put("CP00924", "CP924"); - fIANA2JavaMap.put("CCSID00924", "CP924"); - // is this an error??? - fIANA2JavaMap.put("EBCDIC-LATIN9--EURO", "CP924"); - fIANA2JavaMap.put("IBM1026", "CP1026"); - fIANA2JavaMap.put("CP1026", "CP1026"); - fIANA2JavaMap.put("CSIBM1026", "CP1026"); - fIANA2JavaMap.put("IBM01140", "Cp1140"); - fIANA2JavaMap.put("CP01140", "Cp1140"); - fIANA2JavaMap.put("CCSID01140", "Cp1140"); - fIANA2JavaMap.put("IBM01141", "Cp1141"); - fIANA2JavaMap.put("CP01141", "Cp1141"); - fIANA2JavaMap.put("CCSID01141", "Cp1141"); - fIANA2JavaMap.put("IBM01142", "Cp1142"); - fIANA2JavaMap.put("CP01142", "Cp1142"); - fIANA2JavaMap.put("CCSID01142", "Cp1142"); - fIANA2JavaMap.put("IBM01143", "Cp1143"); - fIANA2JavaMap.put("CP01143", "Cp1143"); - fIANA2JavaMap.put("CCSID01143", "Cp1143"); - fIANA2JavaMap.put("IBM01144", "Cp1144"); - fIANA2JavaMap.put("CP01144", "Cp1144"); - fIANA2JavaMap.put("CCSID01144", "Cp1144"); - fIANA2JavaMap.put("IBM01145", "Cp1145"); - fIANA2JavaMap.put("CP01145", "Cp1145"); - fIANA2JavaMap.put("CCSID01145", "Cp1145"); - fIANA2JavaMap.put("IBM01146", "Cp1146"); - fIANA2JavaMap.put("CP01146", "Cp1146"); - fIANA2JavaMap.put("CCSID01146", "Cp1146"); - fIANA2JavaMap.put("IBM01147", "Cp1147"); - fIANA2JavaMap.put("CP01147", "Cp1147"); - fIANA2JavaMap.put("CCSID01147", "Cp1147"); - fIANA2JavaMap.put("IBM01148", "Cp1148"); - fIANA2JavaMap.put("CP01148", "Cp1148"); - fIANA2JavaMap.put("CCSID01148", "Cp1148"); - fIANA2JavaMap.put("IBM01149", "Cp1149"); - fIANA2JavaMap.put("CP01149", "Cp1149"); - fIANA2JavaMap.put("CCSID01149", "Cp1149"); - fIANA2JavaMap.put("EUC-JP", "EUCJIS"); - fIANA2JavaMap.put("CSEUCPKDFMTJAPANESE", "EUCJIS"); - fIANA2JavaMap.put("EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE", "EUCJIS"); - fIANA2JavaMap.put("EUC-KR", "KSC5601"); - fIANA2JavaMap.put("CSEUCKR", "KSC5601"); - fIANA2JavaMap.put("KS_C_5601-1987", "KS_C_5601-1987"); - fIANA2JavaMap.put("ISO-IR-149", "KS_C_5601-1987"); - fIANA2JavaMap.put("KS_C_5601-1989", "KS_C_5601-1987"); - fIANA2JavaMap.put("KSC_5601", "KS_C_5601-1987"); - fIANA2JavaMap.put("KOREAN", "KS_C_5601-1987"); - fIANA2JavaMap.put("CSKSC56011987", "KS_C_5601-1987"); - fIANA2JavaMap.put("GB2312", "GB2312"); - fIANA2JavaMap.put("CSGB2312", "GB2312"); - fIANA2JavaMap.put("ISO-2022-JP", "JIS"); - fIANA2JavaMap.put("CSISO2022JP", "JIS"); - fIANA2JavaMap.put("ISO-2022-KR", "ISO2022KR"); - fIANA2JavaMap.put("CSISO2022KR", "ISO2022KR"); - fIANA2JavaMap.put("ISO-2022-CN", "ISO2022CN"); - - fIANA2JavaMap.put("X0201", "JIS0201"); - fIANA2JavaMap.put("CSISO13JISC6220JP", "JIS0201"); - fIANA2JavaMap.put("X0208", "JIS0208"); - fIANA2JavaMap.put("ISO-IR-87", "JIS0208"); - fIANA2JavaMap.put("X0208dbiJIS_X0208-1983", "JIS0208"); - fIANA2JavaMap.put("CSISO87JISX0208", "JIS0208"); - fIANA2JavaMap.put("X0212", "JIS0212"); - fIANA2JavaMap.put("ISO-IR-159", "JIS0212"); - fIANA2JavaMap.put("CSISO159JISX02121990", "JIS0212"); - fIANA2JavaMap.put("GB18030", "GB18030"); - fIANA2JavaMap.put("GBK", "GBK"); - fIANA2JavaMap.put("CP936", "GBK"); - fIANA2JavaMap.put("MS936", "GBK"); - fIANA2JavaMap.put("WINDOWS-936", "GBK"); - fIANA2JavaMap.put("SHIFT_JIS", "SJIS"); - fIANA2JavaMap.put("CSSHIFTJIS", "SJIS"); - fIANA2JavaMap.put("MS_KANJI", "SJIS"); - fIANA2JavaMap.put("WINDOWS-31J", "MS932"); - fIANA2JavaMap.put("CSWINDOWS31J", "MS932"); - - // Add support for Cp1252 and its friends - fIANA2JavaMap.put("WINDOWS-1250", "Cp1250"); - fIANA2JavaMap.put("WINDOWS-1251", "Cp1251"); - fIANA2JavaMap.put("WINDOWS-1252", "Cp1252"); - fIANA2JavaMap.put("WINDOWS-1253", "Cp1253"); - fIANA2JavaMap.put("WINDOWS-1254", "Cp1254"); - fIANA2JavaMap.put("WINDOWS-1255", "Cp1255"); - fIANA2JavaMap.put("WINDOWS-1256", "Cp1256"); - fIANA2JavaMap.put("WINDOWS-1257", "Cp1257"); - fIANA2JavaMap.put("WINDOWS-1258", "Cp1258"); - fIANA2JavaMap.put("TIS-620", "TIS620"); - - fIANA2JavaMap.put("ISO-8859-1", "ISO8859_1"); - fIANA2JavaMap.put("ISO-IR-100", "ISO8859_1"); - fIANA2JavaMap.put("ISO_8859-1", "ISO8859_1"); - fIANA2JavaMap.put("LATIN1", "ISO8859_1"); - fIANA2JavaMap.put("CSISOLATIN1", "ISO8859_1"); - fIANA2JavaMap.put("L1", "ISO8859_1"); - fIANA2JavaMap.put("IBM819", "ISO8859_1"); - fIANA2JavaMap.put("CP819", "ISO8859_1"); - - fIANA2JavaMap.put("ISO-8859-2", "ISO8859_2"); - fIANA2JavaMap.put("ISO-IR-101", "ISO8859_2"); - fIANA2JavaMap.put("ISO_8859-2", "ISO8859_2"); - fIANA2JavaMap.put("LATIN2", "ISO8859_2"); - fIANA2JavaMap.put("CSISOLATIN2", "ISO8859_2"); - fIANA2JavaMap.put("L2", "ISO8859_2"); - - fIANA2JavaMap.put("ISO-8859-3", "ISO8859_3"); - fIANA2JavaMap.put("ISO-IR-109", "ISO8859_3"); - fIANA2JavaMap.put("ISO_8859-3", "ISO8859_3"); - fIANA2JavaMap.put("LATIN3", "ISO8859_3"); - fIANA2JavaMap.put("CSISOLATIN3", "ISO8859_3"); - fIANA2JavaMap.put("L3", "ISO8859_3"); - - fIANA2JavaMap.put("ISO-8859-4", "ISO8859_4"); - fIANA2JavaMap.put("ISO-IR-110", "ISO8859_4"); - fIANA2JavaMap.put("ISO_8859-4", "ISO8859_4"); - fIANA2JavaMap.put("LATIN4", "ISO8859_4"); - fIANA2JavaMap.put("CSISOLATIN4", "ISO8859_4"); - fIANA2JavaMap.put("L4", "ISO8859_4"); - - fIANA2JavaMap.put("ISO-8859-5", "ISO8859_5"); - fIANA2JavaMap.put("ISO-IR-144", "ISO8859_5"); - fIANA2JavaMap.put("ISO_8859-5", "ISO8859_5"); - fIANA2JavaMap.put("CYRILLIC", "ISO8859_5"); - fIANA2JavaMap.put("CSISOLATINCYRILLIC", "ISO8859_5"); - - fIANA2JavaMap.put("ISO-8859-6", "ISO8859_6"); - fIANA2JavaMap.put("ISO-IR-127", "ISO8859_6"); - fIANA2JavaMap.put("ISO_8859-6", "ISO8859_6"); - fIANA2JavaMap.put("ECMA-114", "ISO8859_6"); - fIANA2JavaMap.put("ASMO-708", "ISO8859_6"); - fIANA2JavaMap.put("ARABIC", "ISO8859_6"); - fIANA2JavaMap.put("CSISOLATINARABIC", "ISO8859_6"); - - fIANA2JavaMap.put("ISO-8859-7", "ISO8859_7"); - fIANA2JavaMap.put("ISO-IR-126", "ISO8859_7"); - fIANA2JavaMap.put("ISO_8859-7", "ISO8859_7"); - fIANA2JavaMap.put("ELOT_928", "ISO8859_7"); - fIANA2JavaMap.put("ECMA-118", "ISO8859_7"); - fIANA2JavaMap.put("GREEK", "ISO8859_7"); - fIANA2JavaMap.put("CSISOLATINGREEK", "ISO8859_7"); - fIANA2JavaMap.put("GREEK8", "ISO8859_7"); - - fIANA2JavaMap.put("ISO-8859-8", "ISO8859_8"); - fIANA2JavaMap.put("ISO-8859-8-I", "ISO8859_8"); // added since this encoding only differs w.r.t. presentation - fIANA2JavaMap.put("ISO-IR-138", "ISO8859_8"); - fIANA2JavaMap.put("ISO_8859-8", "ISO8859_8"); - fIANA2JavaMap.put("HEBREW", "ISO8859_8"); - fIANA2JavaMap.put("CSISOLATINHEBREW", "ISO8859_8"); - - fIANA2JavaMap.put("ISO-8859-9", "ISO8859_9"); - fIANA2JavaMap.put("ISO-IR-148", "ISO8859_9"); - fIANA2JavaMap.put("ISO_8859-9", "ISO8859_9"); - fIANA2JavaMap.put("LATIN5", "ISO8859_9"); - fIANA2JavaMap.put("CSISOLATIN5", "ISO8859_9"); - fIANA2JavaMap.put("L5", "ISO8859_9"); - - fIANA2JavaMap.put("ISO-8859-13", "ISO8859_13"); - - fIANA2JavaMap.put("ISO-8859-15", "ISO8859_15_FDIS"); - fIANA2JavaMap.put("ISO_8859-15", "ISO8859_15_FDIS"); - fIANA2JavaMap.put("LATIN-9", "ISO8859_15_FDIS"); - - fIANA2JavaMap.put("KOI8-R", "KOI8_R"); - fIANA2JavaMap.put("CSKOI8R", "KOI8_R"); - fIANA2JavaMap.put("US-ASCII", "ASCII"); - fIANA2JavaMap.put("ISO-IR-6", "ASCII"); - fIANA2JavaMap.put("ANSI_X3.4-1968", "ASCII"); - fIANA2JavaMap.put("ANSI_X3.4-1986", "ASCII"); - fIANA2JavaMap.put("ISO_646.IRV:1991", "ASCII"); - fIANA2JavaMap.put("ASCII", "ASCII"); - fIANA2JavaMap.put("CSASCII", "ASCII"); - fIANA2JavaMap.put("ISO646-US", "ASCII"); - fIANA2JavaMap.put("US", "ASCII"); - fIANA2JavaMap.put("IBM367", "ASCII"); - fIANA2JavaMap.put("CP367", "ASCII"); - fIANA2JavaMap.put("UTF-8", "UTF8"); - fIANA2JavaMap.put("UTF-16", "UTF-16"); - fIANA2JavaMap.put("UTF-16BE", "UnicodeBig"); - fIANA2JavaMap.put("UTF-16LE", "UnicodeLittle"); - - // support for 1047, as proposed to be added to the - // IANA registry in - // http://lists.w3.org/Archives/Public/ietf-charset/2002JulSep/0049.html - fIANA2JavaMap.put("IBM-1047", "Cp1047"); - fIANA2JavaMap.put("IBM1047", "Cp1047"); - fIANA2JavaMap.put("CP1047", "Cp1047"); - - // Adding new aliases as proposed in - // http://lists.w3.org/Archives/Public/ietf-charset/2002JulSep/0058.html - fIANA2JavaMap.put("IBM-37", "CP037"); - fIANA2JavaMap.put("IBM-273", "CP273"); - fIANA2JavaMap.put("IBM-277", "CP277"); - fIANA2JavaMap.put("IBM-278", "CP278"); - fIANA2JavaMap.put("IBM-280", "CP280"); - fIANA2JavaMap.put("IBM-284", "CP284"); - fIANA2JavaMap.put("IBM-285", "CP285"); - fIANA2JavaMap.put("IBM-290", "CP290"); - fIANA2JavaMap.put("IBM-297", "CP297"); - fIANA2JavaMap.put("IBM-420", "CP420"); - fIANA2JavaMap.put("IBM-424", "CP424"); - fIANA2JavaMap.put("IBM-437", "CP437"); - fIANA2JavaMap.put("IBM-500", "CP500"); - fIANA2JavaMap.put("IBM-775", "CP775"); - fIANA2JavaMap.put("IBM-850", "CP850"); - fIANA2JavaMap.put("IBM-852", "CP852"); - fIANA2JavaMap.put("IBM-855", "CP855"); - fIANA2JavaMap.put("IBM-857", "CP857"); - fIANA2JavaMap.put("IBM-858", "CP858"); - fIANA2JavaMap.put("IBM-860", "CP860"); - fIANA2JavaMap.put("IBM-861", "CP861"); - fIANA2JavaMap.put("IBM-862", "CP862"); - fIANA2JavaMap.put("IBM-863", "CP863"); - fIANA2JavaMap.put("IBM-864", "CP864"); - fIANA2JavaMap.put("IBM-865", "CP865"); - fIANA2JavaMap.put("IBM-866", "CP866"); - fIANA2JavaMap.put("IBM-868", "CP868"); - fIANA2JavaMap.put("IBM-869", "CP869"); - fIANA2JavaMap.put("IBM-870", "CP870"); - fIANA2JavaMap.put("IBM-871", "CP871"); - fIANA2JavaMap.put("IBM-918", "CP918"); - fIANA2JavaMap.put("IBM-924", "CP924"); - fIANA2JavaMap.put("IBM-1026", "CP1026"); - fIANA2JavaMap.put("IBM-1140", "Cp1140"); - fIANA2JavaMap.put("IBM-1141", "Cp1141"); - fIANA2JavaMap.put("IBM-1142", "Cp1142"); - fIANA2JavaMap.put("IBM-1143", "Cp1143"); - fIANA2JavaMap.put("IBM-1144", "Cp1144"); - fIANA2JavaMap.put("IBM-1145", "Cp1145"); - fIANA2JavaMap.put("IBM-1146", "Cp1146"); - fIANA2JavaMap.put("IBM-1147", "Cp1147"); - fIANA2JavaMap.put("IBM-1148", "Cp1148"); - fIANA2JavaMap.put("IBM-1149", "Cp1149"); - fIANA2JavaMap.put("IBM-819", "ISO8859_1"); - fIANA2JavaMap.put("IBM-367", "ASCII"); - - // REVISIT: - // j:CNS11643 -> EUC-TW? - // ISO-2022-CN? ISO-2022-CN-EXT? - - // add Java to IANA encoding mappings - //fJava2IANAMap.put("8859_1", "US-ASCII"); // ? - fJava2IANAMap.put("ISO8859_1", "ISO-8859-1"); - fJava2IANAMap.put("ISO8859_2", "ISO-8859-2"); - fJava2IANAMap.put("ISO8859_3", "ISO-8859-3"); - fJava2IANAMap.put("ISO8859_4", "ISO-8859-4"); - fJava2IANAMap.put("ISO8859_5", "ISO-8859-5"); - fJava2IANAMap.put("ISO8859_6", "ISO-8859-6"); - fJava2IANAMap.put("ISO8859_7", "ISO-8859-7"); - fJava2IANAMap.put("ISO8859_8", "ISO-8859-8"); - fJava2IANAMap.put("ISO8859_9", "ISO-8859-9"); - fJava2IANAMap.put("ISO8859_13", "ISO-8859-13"); - fJava2IANAMap.put("ISO8859_15", "ISO-8859-15"); - fJava2IANAMap.put("ISO8859_15_FDIS", "ISO-8859-15"); - fJava2IANAMap.put("Big5", "BIG5"); - fJava2IANAMap.put("CP037", "EBCDIC-CP-US"); - fJava2IANAMap.put("CP273", "IBM273"); - fJava2IANAMap.put("CP277", "EBCDIC-CP-DK"); - fJava2IANAMap.put("CP278", "EBCDIC-CP-FI"); - fJava2IANAMap.put("CP280", "EBCDIC-CP-IT"); - fJava2IANAMap.put("CP284", "EBCDIC-CP-ES"); - fJava2IANAMap.put("CP285", "EBCDIC-CP-GB"); - fJava2IANAMap.put("CP290", "EBCDIC-JP-KANA"); - fJava2IANAMap.put("CP297", "EBCDIC-CP-FR"); - fJava2IANAMap.put("CP420", "EBCDIC-CP-AR1"); - fJava2IANAMap.put("CP424", "EBCDIC-CP-HE"); - fJava2IANAMap.put("CP437", "IBM437"); - fJava2IANAMap.put("CP500", "EBCDIC-CP-CH"); - fJava2IANAMap.put("CP775", "IBM775"); - fJava2IANAMap.put("CP850", "IBM850"); - fJava2IANAMap.put("CP852", "IBM852"); - fJava2IANAMap.put("CP855", "IBM855"); - fJava2IANAMap.put("CP857", "IBM857"); - fJava2IANAMap.put("CP858", "IBM00858"); - fJava2IANAMap.put("CP860", "IBM860"); - fJava2IANAMap.put("CP861", "IBM861"); - fJava2IANAMap.put("CP862", "IBM862"); - fJava2IANAMap.put("CP863", "IBM863"); - fJava2IANAMap.put("CP864", "IBM864"); - fJava2IANAMap.put("CP865", "IBM865"); - fJava2IANAMap.put("CP866", "IBM866"); - fJava2IANAMap.put("CP868", "IBM868"); - fJava2IANAMap.put("CP869", "IBM869"); - fJava2IANAMap.put("CP870", "EBCDIC-CP-ROECE"); - fJava2IANAMap.put("CP871", "EBCDIC-CP-IS"); - fJava2IANAMap.put("CP918", "EBCDIC-CP-AR2"); - fJava2IANAMap.put("CP924", "IBM00924"); - fJava2IANAMap.put("CP1026", "IBM1026"); - fJava2IANAMap.put("Cp01140", "IBM01140"); - fJava2IANAMap.put("Cp01141", "IBM01141"); - fJava2IANAMap.put("Cp01142", "IBM01142"); - fJava2IANAMap.put("Cp01143", "IBM01143"); - fJava2IANAMap.put("Cp01144", "IBM01144"); - fJava2IANAMap.put("Cp01145", "IBM01145"); - fJava2IANAMap.put("Cp01146", "IBM01146"); - fJava2IANAMap.put("Cp01147", "IBM01147"); - fJava2IANAMap.put("Cp01148", "IBM01148"); - fJava2IANAMap.put("Cp01149", "IBM01149"); - fJava2IANAMap.put("EUCJIS", "EUC-JP"); - fJava2IANAMap.put("KS_C_5601-1987", "KS_C_5601-1987"); - fJava2IANAMap.put("GB2312", "GB2312"); - fJava2IANAMap.put("ISO2022KR", "ISO-2022-KR"); - fJava2IANAMap.put("ISO2022CN", "ISO-2022-CN"); - fJava2IANAMap.put("JIS", "ISO-2022-JP"); - fJava2IANAMap.put("KOI8_R", "KOI8-R"); - fJava2IANAMap.put("KSC5601", "EUC-KR"); - fJava2IANAMap.put("GB18030", "GB18030"); - fJava2IANAMap.put("GBK", "GBK"); - fJava2IANAMap.put("SJIS", "SHIFT_JIS"); - fJava2IANAMap.put("MS932", "WINDOWS-31J"); - fJava2IANAMap.put("UTF8", "UTF-8"); - fJava2IANAMap.put("Unicode", "UTF-16"); - fJava2IANAMap.put("UnicodeBig", "UTF-16BE"); - fJava2IANAMap.put("UnicodeLittle", "UTF-16LE"); - fJava2IANAMap.put("JIS0201", "X0201"); - fJava2IANAMap.put("JIS0208", "X0208"); - fJava2IANAMap.put("JIS0212", "ISO-IR-159"); - - // proposed addition (see above for details): - fJava2IANAMap.put("CP1047", "IBM1047"); - - } // () - - // - // Constructors - // - - /** Default constructor. */ - public EncodingMap() {} - - // - // Public static methods - // - - /** - * Adds an IANA to Java encoding name mapping. - * - * @param ianaEncoding The IANA encoding name. - * @param javaEncoding The Java encoding name. - */ - public static void putIANA2JavaMapping(String ianaEncoding, - String javaEncoding) { - fIANA2JavaMap.put(ianaEncoding, javaEncoding); - } // putIANA2JavaMapping(String,String) - - /** - * Returns the Java encoding name for the specified IANA encoding name. - * - * @param ianaEncoding The IANA encoding name. - */ - public static String getIANA2JavaMapping(String ianaEncoding) { - return fIANA2JavaMap.get(ianaEncoding); - } // getIANA2JavaMapping(String):String - - /** - * Removes an IANA to Java encoding name mapping. - * - * @param ianaEncoding The IANA encoding name. - */ - public static String removeIANA2JavaMapping(String ianaEncoding) { - return fIANA2JavaMap.remove(ianaEncoding); - } // removeIANA2JavaMapping(String):String - - /** - * Adds a Java to IANA encoding name mapping. - * - * @param javaEncoding The Java encoding name. - * @param ianaEncoding The IANA encoding name. - */ - public static void putJava2IANAMapping(String javaEncoding, - String ianaEncoding) { - fJava2IANAMap.put(javaEncoding, ianaEncoding); - } // putJava2IANAMapping(String,String) - - /** - * Returns the IANA encoding name for the specified Java encoding name. - * - * @param javaEncoding The Java encoding name. - */ - public static String getJava2IANAMapping(String javaEncoding) { - return fJava2IANAMap.get(javaEncoding); - } // getJava2IANAMapping(String):String - - /** - * Removes a Java to IANA encoding name mapping. - * - * @param javaEncoding The Java encoding name. - */ - public static String removeJava2IANAMapping(String javaEncoding) { - return fJava2IANAMap.remove(javaEncoding); - } // removeJava2IANAMapping - -} // class EncodingMap diff --git a/impl/src/main/java/org/apache/jasper/xmlparser/ParserUtils.java b/impl/src/main/java/org/apache/jasper/xmlparser/ParserUtils.java deleted file mode 100755 index 4d1f601..0000000 --- a/impl/src/main/java/org/apache/jasper/xmlparser/ParserUtils.java +++ /dev/null @@ -1,767 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.xmlparser; - -import java.io.*; -import java.net.URI; -import java.net.URLEncoder; -import java.util.HashMap; -import java.util.StringTokenizer; -import java.util.logging.Logger; -import java.util.logging.Level; -import java.security.AccessController; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamSource; -import javax.xml.validation.Schema; -import javax.xml.validation.SchemaFactory; -import javax.xml.XMLConstants; - -import org.apache.jasper.Constants; -import org.apache.jasper.JasperException; -import org.apache.jasper.security.PrivilegedGetTccl; -import org.apache.jasper.security.PrivilegedSetTccl; -import org.apache.jasper.compiler.Localizer; -import org.w3c.dom.Comment; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.Text; -import org.w3c.dom.ls.LSResourceResolver; -import org.w3c.dom.ls.LSInput; -import org.xml.sax.EntityResolver; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -/** - * XML parsing utilities for processing web application deployment - * descriptor and tag library descriptor files. FIXME - make these - * use a separate class loader for the parser to be used. - * - * @author Craig R. McClanahan - * @version $Revision: 1.11 $ $Date: 2007/05/05 05:32:59 $ - */ - -public class ParserUtils { - - // Logger - static Logger log = Logger.getLogger(ParserUtils.class.getName()); - - /** - * An error handler for use when parsing XML documents. - */ - private static ErrorHandler errorHandler = new MyErrorHandler(); - - /** - * An entity resolver for use when parsing XML documents. - */ - static EntityResolver entityResolver; - - static String schemaResourcePrefix; - - static String dtdResourcePrefix; - - static boolean isDtdResourcePrefixFileUrl = false; - static boolean isSchemaResourcePrefixFileUrl = false; - - private static final String SCHEMA_LOCATION_ATTR = "schemaLocation"; - - private static HashMap schemaCache = - new HashMap(); - - /** - * List of the Public IDs that we cache, and their - * associated location. This is used by - * an EntityResolver to return the location of the - * cached copy of a DTD. - */ - static final String[] CACHED_DTD_PUBLIC_IDS = { - Constants.TAGLIB_DTD_PUBLIC_ID_11, - Constants.TAGLIB_DTD_PUBLIC_ID_12, - Constants.WEBAPP_DTD_PUBLIC_ID_22, - Constants.WEBAPP_DTD_PUBLIC_ID_23, - }; - - // START PWC 6386258 - private static final String[] DEFAULT_DTD_RESOURCE_PATHS = { - Constants.TAGLIB_DTD_RESOURCE_PATH_11, - Constants.TAGLIB_DTD_RESOURCE_PATH_12, - Constants.WEBAPP_DTD_RESOURCE_PATH_22, - Constants.WEBAPP_DTD_RESOURCE_PATH_23, - }; - - static final String[] CACHED_DTD_RESOURCE_PATHS = - (String[])DEFAULT_DTD_RESOURCE_PATHS; - - private static final String[] DEFAULT_SCHEMA_RESOURCE_PATHS = { - Constants.TAGLIB_SCHEMA_RESOURCE_PATH_20, - Constants.TAGLIB_SCHEMA_RESOURCE_PATH_21, - Constants.WEBAPP_SCHEMA_RESOURCE_PATH_24, - Constants.WEBAPP_SCHEMA_RESOURCE_PATH_25, - }; - - static final String[] CACHED_SCHEMA_RESOURCE_PATHS = - (String[])DEFAULT_SCHEMA_RESOURCE_PATHS; - // END PWC 6386258 - - - // --------------------------------------------------------- Constructors - public ParserUtils() { - this(false); - } - - public ParserUtils(boolean blockExternal) { - if (entityResolver == null) { - entityResolver = new MyEntityResolver(blockExternal); - } - } - - // --------------------------------------------------------- Static Methods - - public static void setEntityResolver(EntityResolver er) { - entityResolver = er; - } - - // START PWC 6386258 - /** - * Sets the path prefix URL for .xsd resources - */ - public static void setSchemaResourcePrefix(String prefix) { - - if (prefix != null && prefix.startsWith("file:")) { - schemaResourcePrefix = uencode(prefix); - isSchemaResourcePrefixFileUrl = true; - } else { - schemaResourcePrefix = prefix; - isSchemaResourcePrefixFileUrl = false; - } - - for (int i=0; iTreeNode - * that corresponds to the root node of the document tree. - * - * @param uri URI of the XML document being parsed - * @param is Input source containing the deployment descriptor - * - * @exception JasperException if an I/O or parsing error has occurred - */ - public TreeNode parseXMLDocument(String uri, InputSource is) - throws JasperException { - return parseXMLDocument(uri, is, false); - } - - /** - * Parse the specified XML document, and return a TreeNode - * that corresponds to the root node of the document tree. - * - * @param uri URI of the XML document being parsed - * @param is Input source containing the deployment descriptor - * @param validate true if the XML document needs to be validated against - * its DTD or schema, false otherwise - * - * @exception JasperException if an I/O or parsing error has occurred - */ - public TreeNode parseXMLDocument(String uri, InputSource is, - boolean validate) - throws JasperException { - - Document document = null; - - // Perform an XML parse of this document, via JAXP - - // START 6412405 - ClassLoader currentLoader; - if (Constants.IS_SECURITY_ENABLED) { - PrivilegedGetTccl pa = new PrivilegedGetTccl(); - currentLoader = AccessController.doPrivileged(pa); - } else { - currentLoader = Thread.currentThread().getContextClassLoader(); - } - try { - if (Constants.IS_SECURITY_ENABLED) { - PrivilegedSetTccl pa = - new PrivilegedSetTccl(getClass().getClassLoader()); - AccessController.doPrivileged(pa); - } else { - Thread.currentThread().setContextClassLoader( - getClass().getClassLoader()); - } - // END 6412405 - DocumentBuilderFactory factory = - DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); - /* See CR 6399139 - factory.setFeature( - "http://apache.org/xml/features/validation/dynamic", - true); - */ - DocumentBuilder builder = factory.newDocumentBuilder(); - builder.setEntityResolver(entityResolver); - builder.setErrorHandler(errorHandler); - document = builder.parse(is); - document.setDocumentURI(uri); - if (validate) { - Schema schema = getSchema(document); - if (schema != null) { - // Validate TLD against specified schema - schema.newValidator().validate(new DOMSource(document)); - } - /* See CR 6399139 - else { - log.warning(Localizer.getMessage( - "jsp.warning.dtdValidationNotSupported")); - } - */ - } - } catch (ParserConfigurationException ex) { - throw new JasperException - (Localizer.getMessage("jsp.error.parse.xml", uri), ex); - } catch (SAXParseException ex) { - throw new JasperException - (Localizer.getMessage("jsp.error.parse.xml.line", - uri, - Integer.toString(ex.getLineNumber()), - Integer.toString(ex.getColumnNumber())), - ex); - } catch (SAXException sx) { - throw new JasperException - (Localizer.getMessage("jsp.error.parse.xml", uri), sx); - } catch (IOException io) { - throw new JasperException - (Localizer.getMessage("jsp.error.parse.xml", uri), io); - // START 6412405 - } finally { - if (Constants.IS_SECURITY_ENABLED) { - PrivilegedSetTccl pa = new PrivilegedSetTccl(currentLoader); - AccessController.doPrivileged(pa); - } else { - Thread.currentThread().setContextClassLoader(currentLoader); - } - } - // END 6412405 - - // Convert the resulting document to a graph of TreeNodes - return (convert(null, document.getDocumentElement())); - } - - - /** - * Parse the specified XML document, and return a TreeNode - * that corresponds to the root node of the document tree. - * - * @param uri URI of the XML document being parsed - * @param is Input stream containing the deployment descriptor - * - * @exception JasperException if an I/O or parsing error has occurred - */ - public TreeNode parseXMLDocument(String uri, InputStream is) - throws JasperException { - return parseXMLDocument(uri, new InputSource(is), false); - } - - /** - * Parse the specified XML document, and return a TreeNode - * that corresponds to the root node of the document tree. - * - * @param uri URI of the XML document being parsed - * @param is Input stream containing the deployment descriptor - * @param validate true if the XML document needs to be validated against - * its DTD or schema, false otherwise - * - * @exception JasperException if an I/O or parsing error has occurred - */ - public TreeNode parseXMLDocument(String uri, InputStream is, - boolean validate) - throws JasperException { - return parseXMLDocument(uri, new InputSource(is), validate); - } - - - // ------------------------------------------------------ Protected Methods - - - /** - * Create and return a TreeNode that corresponds to the specified Node, - * including processing all of the attributes and children nodes. - * - * @param parent The parent TreeNode (if any) for the new TreeNode - * @param node The XML document Node to be converted - */ - protected TreeNode convert(TreeNode parent, Node node) { - - // Construct a new TreeNode for this node - TreeNode treeNode = new TreeNode(node.getNodeName(), parent); - - // Convert all attributes of this node - NamedNodeMap attributes = node.getAttributes(); - if (attributes != null) { - int n = attributes.getLength(); - for (int i = 0; i < n; i++) { - Node attribute = attributes.item(i); - treeNode.addAttribute(attribute.getNodeName(), - attribute.getNodeValue()); - } - } - - // Create and attach all children of this node - NodeList children = node.getChildNodes(); - if (children != null) { - int n = children.getLength(); - for (int i = 0; i < n; i++) { - Node child = children.item(i); - if (child instanceof Comment) - continue; - if (child instanceof Text) { - String body = ((Text) child).getData(); - if (body != null) { - body = body.trim(); - if (body.length() > 0) - treeNode.setBody(body); - } - } else { - TreeNode treeChild = convert(treeNode, child); - } - } - } - - // Return the completed TreeNode graph - return (treeNode); - } - - - // -------------------------------------------------------- Private Methods - - /* - * Gets the compiled schema referenced by the given XML document. - * - * @param document The XML document to validate - * - * @return The schema against which to validate - */ - private static Schema getSchema(Document document) - throws SAXException, JasperException { - - Schema schema = null; - Element root = document.getDocumentElement(); - NamedNodeMap map = root.getAttributes(); - for (int i=0; map!=null && iaddSymbol will always return the same string - * reference. - *

    - * The symbol table performs the same task as String.intern() - * with the following differences: - *

      - *
    • - * A new string object does not need to be created in order to - * retrieve a unique reference. Symbols can be added by using - * a series of characters in a character array. - *
    • - *
    • - * Users of the symbol table can provide their own symbol hashing - * implementation. For example, a simple string hashing algorithm - * may fail to produce a balanced set of hashcodes for symbols - * that are mostly unique. Strings with similar leading - * characters are especially prone to this poor hashing behavior. - *
    • - *
    - * - * @see SymbolHash - * - * @author Andy Clark - * - * @version $Id: SymbolTable.java,v 1.2 2005/12/08 01:29:00 kchung Exp $ - */ -public class SymbolTable { - - // - // Constants - // - - /** Default table size. */ - protected static final int TABLE_SIZE = 101; - - // - // Data - // - - /** Buckets. */ - protected Entry[] fBuckets = null; - - // actual table size - protected int fTableSize; - - // - // Constructors - // - - /** Constructs a symbol table with a default number of buckets. */ - public SymbolTable() { - this(TABLE_SIZE); - } - - /** Constructs a symbol table with a specified number of buckets. */ - public SymbolTable(int tableSize) { - fTableSize = tableSize; - fBuckets = new Entry[fTableSize]; - } - - // - // Public methods - // - - /** - * Adds the specified symbol to the symbol table and returns a - * reference to the unique symbol. If the symbol already exists, - * the previous symbol reference is returned instead, in order - * guarantee that symbol references remain unique. - * - * @param symbol The new symbol. - */ - public String addSymbol(String symbol) { - - // search for identical symbol - int bucket = hash(symbol) % fTableSize; - int length = symbol.length(); - OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) { - if (length == entry.characters.length) { - for (int i = 0; i < length; i++) { - if (symbol.charAt(i) != entry.characters[i]) { - continue OUTER; - } - } - return entry.symbol; - } - } - - // create new entry - Entry entry = new Entry(symbol, fBuckets[bucket]); - fBuckets[bucket] = entry; - return entry.symbol; - - } // addSymbol(String):String - - /** - * Adds the specified symbol to the symbol table and returns a - * reference to the unique symbol. If the symbol already exists, - * the previous symbol reference is returned instead, in order - * guarantee that symbol references remain unique. - * - * @param buffer The buffer containing the new symbol. - * @param offset The offset into the buffer of the new symbol. - * @param length The length of the new symbol in the buffer. - */ - public String addSymbol(char[] buffer, int offset, int length) { - - // search for identical symbol - int bucket = hash(buffer, offset, length) % fTableSize; - OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) { - if (length == entry.characters.length) { - for (int i = 0; i < length; i++) { - if (buffer[offset + i] != entry.characters[i]) { - continue OUTER; - } - } - return entry.symbol; - } - } - - // add new entry - Entry entry = new Entry(buffer, offset, length, fBuckets[bucket]); - fBuckets[bucket] = entry; - return entry.symbol; - - } // addSymbol(char[],int,int):String - - /** - * Returns a hashcode value for the specified symbol. The value - * returned by this method must be identical to the value returned - * by the hash(char[],int,int) method when called - * with the character array that comprises the symbol string. - * - * @param symbol The symbol to hash. - */ - public int hash(String symbol) { - - int code = 0; - int length = symbol.length(); - for (int i = 0; i < length; i++) { - code = code * 37 + symbol.charAt(i); - } - return code & 0x7FFFFFF; - - } // hash(String):int - - /** - * Returns a hashcode value for the specified symbol information. - * The value returned by this method must be identical to the value - * returned by the hash(String) method when called - * with the string object created from the symbol information. - * - * @param buffer The character buffer containing the symbol. - * @param offset The offset into the character buffer of the start - * of the symbol. - * @param length The length of the symbol. - */ - public int hash(char[] buffer, int offset, int length) { - - int code = 0; - for (int i = 0; i < length; i++) { - code = code * 37 + buffer[offset + i]; - } - return code & 0x7FFFFFF; - - } // hash(char[],int,int):int - - /** - * Returns true if the symbol table already contains the specified - * symbol. - * - * @param symbol The symbol to look for. - */ - public boolean containsSymbol(String symbol) { - - // search for identical symbol - int bucket = hash(symbol) % fTableSize; - int length = symbol.length(); - OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) { - if (length == entry.characters.length) { - for (int i = 0; i < length; i++) { - if (symbol.charAt(i) != entry.characters[i]) { - continue OUTER; - } - } - return true; - } - } - - return false; - - } // containsSymbol(String):boolean - - /** - * Returns true if the symbol table already contains the specified - * symbol. - * - * @param buffer The buffer containing the symbol to look for. - * @param offset The offset into the buffer. - * @param length The length of the symbol in the buffer. - */ - public boolean containsSymbol(char[] buffer, int offset, int length) { - - // search for identical symbol - int bucket = hash(buffer, offset, length) % fTableSize; - OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) { - if (length == entry.characters.length) { - for (int i = 0; i < length; i++) { - if (buffer[offset + i] != entry.characters[i]) { - continue OUTER; - } - } - return true; - } - } - - return false; - - } // containsSymbol(char[],int,int):boolean - - // - // Classes - // - - /** - * This class is a symbol table entry. Each entry acts as a node - * in a linked list. - */ - protected static final class Entry { - - // - // Data - // - - /** Symbol. */ - public String symbol; - - /** - * Symbol characters. This information is duplicated here for - * comparison performance. - */ - public char[] characters; - - /** The next entry. */ - public Entry next; - - // - // Constructors - // - - /** - * Constructs a new entry from the specified symbol and next entry - * reference. - */ - public Entry(String symbol, Entry next) { - this.symbol = symbol.intern(); - characters = new char[symbol.length()]; - symbol.getChars(0, characters.length, characters, 0); - this.next = next; - } - - /** - * Constructs a new entry from the specified symbol information and - * next entry reference. - */ - public Entry(char[] ch, int offset, int length, Entry next) { - characters = new char[length]; - System.arraycopy(ch, offset, characters, 0, length); - symbol = new String(characters).intern(); - this.next = next; - } - - } // class Entry - -} // class SymbolTable diff --git a/impl/src/main/java/org/apache/jasper/xmlparser/TreeNode.java b/impl/src/main/java/org/apache/jasper/xmlparser/TreeNode.java deleted file mode 100644 index d08cdeb..0000000 --- a/impl/src/main/java/org/apache/jasper/xmlparser/TreeNode.java +++ /dev/null @@ -1,404 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.xmlparser; - - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; - - -/** - * Simplified implementation of a Node from a Document Object Model (DOM) - * parse of an XML document. This class is used to represent a DOM tree - * so that the XML parser's implementation of org.w3c.dom need - * not be visible to the remainder of Jasper. - *

    - * WARNING - Construction of a new tree, or modifications - * to an existing one, are not thread-safe and such accesses must be - * synchronized. - * - * @author Craig R. McClanahan - * @version $Revision: 1.2 $ $Date: 2005/12/08 01:29:00 $ - */ - -public class TreeNode { - - - // ----------------------------------------------------------- Constructors - - - /** - * Construct a new node with no parent. - * - * @param name The name of this node - */ - public TreeNode(String name) { - - this(name, null); - - } - - - /** - * Construct a new node with the specified parent. - * - * @param name The name of this node - * @param parent The node that is the parent of this node - */ - public TreeNode(String name, TreeNode parent) { - - super(); - this.name = name; - this.parent = parent; - if (this.parent != null) - this.parent.addChild(this); - - } - - - // ----------------------------------------------------- Instance Variables - - - /** - * The attributes of this node, keyed by attribute name, - * Instantiated only if required. - */ - protected HashMap attributes = null; - - - /** - * The body text associated with this node (if any). - */ - protected String body = null; - - - /** - * The children of this node, instantiated only if required. - */ - protected ArrayList children = null; - - - /** - * The name of this node. - */ - protected String name = null; - - - /** - * The parent node of this node. - */ - protected TreeNode parent = null; - - - // --------------------------------------------------------- Public Methods - - - /** - * Add an attribute to this node, replacing any existing attribute - * with the same name. - * - * @param name The attribute name to add - * @param value The new attribute value - */ - public void addAttribute(String name, String value) { - - if (attributes == null) - attributes = new HashMap(); - attributes.put(name, value); - - } - - - /** - * Add a new child node to this node. - * - * @param node The new child node - */ - public void addChild(TreeNode node) { - - if (children == null) - children = new ArrayList(); - children.add(node); - - } - - - /** - * Return the value of the specified node attribute if it exists, or - * null otherwise. - * - * @param name Name of the requested attribute - */ - public String findAttribute(String name) { - - if (attributes == null) - return (null); - else - return (attributes.get(name)); - - } - - - /** - * Return an Iterator of the attribute names of this node. If there are - * no attributes, an empty Iterator is returned. - */ - public Iterator findAttributes() { - - Set attrs; - if (attributes == null) - attrs = Collections.emptySet(); - else - attrs = attributes.keySet(); - return attrs.iterator(); - - } - - - /** - * Return the first child node of this node with the specified name, - * if there is one; otherwise, return null. - * - * @param name Name of the desired child element - */ - public TreeNode findChild(String name) { - - if (children == null) - return (null); - for (TreeNode item: children) { - if (name.equals(item.getName())) - return (item); - } - return (null); - - } - - - /** - * Return an Iterator of all children of this node. If there are no - * children, an empty Iterator is returned. - */ - public Iterator findChildren() { - - List nodes; - if (children == null) - nodes = Collections.emptyList(); - else - nodes = children; - return nodes.iterator(); - } - - - /** - * Return an Iterator over all children of this node that have the - * specified name. If there are no such children, an empty Iterator - * is returned. - * - * @param name Name used to select children - */ - public Iterator findChildren(String name) { - - List results; - if (children == null) - results = Collections.emptyList(); - else { - results = new ArrayList(); - for (TreeNode item: children) { - if (name.equals(item.getName())) - results.add(item); - } - } - return results.iterator(); - } - - - /** - * Return the body text associated with this node (if any). - */ - public String getBody() { - - return (this.body); - - } - - - /** - * Return the name of this node. - */ - public String getName() { - - return (this.name); - - } - - - /** - * Remove any existing value for the specified attribute name. - * - * @param name The attribute name to remove - */ - public void removeAttribute(String name) { - - if (attributes != null) - attributes.remove(name); - - } - - - /** - * Remove a child node from this node, if it is one. - * - * @param node The child node to remove - */ - public void removeNode(TreeNode node) { - - if (children != null) - children.remove(node); - - } - - - /** - * Set the body text associated with this node (if any). - * - * @param body The body text (if any) - */ - public void setBody(String body) { - - this.body = body; - - } - - - /** - * Return a String representation of this TreeNode. - */ - public String toString() { - - StringBuilder sb = new StringBuilder(); - toString(sb, 0, this); - return (sb.toString()); - - } - - - // ------------------------------------------------------ Protected Methods - - - /** - * Append to the specified StringBuilder a character representation of - * this node, with the specified amount of indentation. - * - * @param sb The StringBuilder to append to - * @param indent Number of characters of indentation - * @param node The TreeNode to be printed - */ - protected void toString(StringBuilder sb, int indent, - TreeNode node) { - - int indent2 = indent + 2; - - // Reconstruct an opening node - for (int i = 0; i < indent; i++) - sb.append(' '); - sb.append('<'); - sb.append(node.getName()); - Iterator names = node.findAttributes(); - while (names.hasNext()) { - sb.append(' '); - String name = (String) names.next(); - sb.append(name); - sb.append("=\""); - String value = node.findAttribute(name); - sb.append(value); - sb.append("\""); - } - sb.append(">\n"); - - // Reconstruct the body text of this node (if any) - String body = node.getBody(); - if ((body != null) && (body.length() > 0)) { - for (int i = 0; i < indent2; i++) - sb.append(' '); - sb.append(body); - sb.append("\n"); - } - - // Reconstruct child nodes with extra indentation - Iterator children = node.findChildren(); - while (children.hasNext()) { - TreeNode child = children.next(); - toString(sb, indent2, child); - } - - // Reconstruct a closing node marker - for (int i = 0; i < indent; i++) - sb.append(' '); - sb.append("\n"); - - } - - -} diff --git a/impl/src/main/java/org/apache/jasper/xmlparser/UCSReader.java b/impl/src/main/java/org/apache/jasper/xmlparser/UCSReader.java deleted file mode 100644 index fa663b6..0000000 --- a/impl/src/main/java/org/apache/jasper/xmlparser/UCSReader.java +++ /dev/null @@ -1,345 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.xmlparser; - -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.util.logging.Logger; -import java.util.logging.Level; - - -/** - * Reader for UCS-2 and UCS-4 encodings. - * (i.e., encodings from ISO-10646-UCS-(2|4)). - * - * @author Neil Graham, IBM - * - * @version $Id: UCSReader.java,v 1.3 2006/03/12 01:27:12 jluehe Exp $ - */ -public class UCSReader extends Reader { - - - private static Logger log= Logger.getLogger(UCSReader.class.getName()); - - // - // Constants - // - - /** Default byte buffer size (8192, larger than that of ASCIIReader - * since it's reasonable to surmise that the average UCS-4-encoded - * file should be 4 times as large as the average ASCII-encoded file). - */ - public static final int DEFAULT_BUFFER_SIZE = 8192; - - public static final short UCS2LE = 1; - public static final short UCS2BE = 2; - public static final short UCS4LE = 4; - public static final short UCS4BE = 8; - - // - // Data - // - - /** Input stream. */ - protected InputStream fInputStream; - - /** Byte buffer. */ - protected byte[] fBuffer; - - // what kind of data we're dealing with - protected short fEncoding; - - // - // Constructors - // - - /** - * Constructs an ASCII reader from the specified input stream - * using the default buffer size. The Endian-ness and whether this is - * UCS-2 or UCS-4 needs also to be known in advance. - * - * @param inputStream The input stream. - * @param encoding One of UCS2LE, UCS2BE, UCS4LE or UCS4BE. - */ - public UCSReader(InputStream inputStream, short encoding) { - this(inputStream, DEFAULT_BUFFER_SIZE, encoding); - } // (InputStream, short) - - /** - * Constructs an ASCII reader from the specified input stream - * and buffer size. The Endian-ness and whether this is - * UCS-2 or UCS-4 needs also to be known in advance. - * - * @param inputStream The input stream. - * @param size The initial buffer size. - * @param encoding One of UCS2LE, UCS2BE, UCS4LE or UCS4BE. - */ - public UCSReader(InputStream inputStream, int size, short encoding) { - fInputStream = inputStream; - fBuffer = new byte[size]; - fEncoding = encoding; - } // (InputStream,int,short) - - // - // Reader methods - // - - /** - * Read a single character. This method will block until a character is - * available, an I/O error occurs, or the end of the stream is reached. - * - *

    Subclasses that intend to support efficient single-character input - * should override this method. - * - * @return The character read, as an integer in the range 0 to 127 - * (0x00-0x7f), or -1 if the end of the stream has - * been reached - * - * @exception IOException If an I/O error occurs - */ - public int read() throws IOException { - int b0 = fInputStream.read() & 0xff; - if (b0 == 0xff) - return -1; - int b1 = fInputStream.read() & 0xff; - if (b1 == 0xff) - return -1; - if(fEncoding >=4) { - int b2 = fInputStream.read() & 0xff; - if (b2 == 0xff) - return -1; - int b3 = fInputStream.read() & 0xff; - if (b3 == 0xff) - return -1; - if (log.isLoggable(Level.FINE)) - log.fine("b0 is " + (b0 & 0xff) + " b1 " + (b1 & 0xff) + " b2 " + (b2 & 0xff) + " b3 " + (b3 & 0xff)); - if (fEncoding == UCS4BE) - return (b0<<24)+(b1<<16)+(b2<<8)+b3; - else - return (b3<<24)+(b2<<16)+(b1<<8)+b0; - } else { // UCS-2 - if (fEncoding == UCS2BE) - return (b0<<8)+b1; - else - return (b1<<8)+b0; - } - } // read():int - - /** - * Read characters into a portion of an array. This method will block - * until some input is available, an I/O error occurs, or the end of the - * stream is reached. - * - * @param ch Destination buffer - * @param offset Offset at which to start storing characters - * @param length Maximum number of characters to read - * - * @return The number of characters read, or -1 if the end of the - * stream has been reached - * - * @exception IOException If an I/O error occurs - */ - public int read(char ch[], int offset, int length) throws IOException { - int byteLength = length << ((fEncoding >= 4)?2:1); - if (byteLength > fBuffer.length) { - byteLength = fBuffer.length; - } - int count = fInputStream.read(fBuffer, 0, byteLength); - if(count == -1) return -1; - // try and make count be a multiple of the number of bytes we're looking for - if(fEncoding >= 4) { // BigEndian - // this looks ugly, but it avoids an if at any rate... - int numToRead = (4 - (count & 3) & 3); - for(int i=0; i> ((fEncoding >= 4)?2:1); - int curPos = 0; - for (int i = 0; i < numChars; i++) { - int b0 = fBuffer[curPos++] & 0xff; - int b1 = fBuffer[curPos++] & 0xff; - if(fEncoding >=4) { - int b2 = fBuffer[curPos++] & 0xff; - int b3 = fBuffer[curPos++] & 0xff; - if (fEncoding == UCS4BE) - ch[offset+i] = (char)((b0<<24)+(b1<<16)+(b2<<8)+b3); - else - ch[offset+i] = (char)((b3<<24)+(b2<<16)+(b1<<8)+b0); - } else { // UCS-2 - if (fEncoding == UCS2BE) - ch[offset+i] = (char)((b0<<8)+b1); - else - ch[offset+i] = (char)((b1<<8)+b0); - } - } - return numChars; - } // read(char[],int,int) - - /** - * Skip characters. This method will block until some characters are - * available, an I/O error occurs, or the end of the stream is reached. - * - * @param n The number of characters to skip - * - * @return The number of characters actually skipped - * - * @exception IOException If an I/O error occurs - */ - public long skip(long n) throws IOException { - // charWidth will represent the number of bits to move - // n leftward to get num of bytes to skip, and then move the result rightward - // to get num of chars effectively skipped. - // The trick with &'ing, as with elsewhere in this dcode, is - // intended to avoid an expensive use of / that might not be optimized - // away. - int charWidth = (fEncoding >=4)?2:1; - long bytesSkipped = fInputStream.skip(n<> charWidth; - return (bytesSkipped >> charWidth) + 1; - } // skip(long):long - - /** - * Tell whether this stream is ready to be read. - * - * @return True if the next read() is guaranteed not to block for input, - * false otherwise. Note that returning false does not guarantee that the - * next read will block. - * - * @exception IOException If an I/O error occurs - */ - public boolean ready() throws IOException { - return false; - } // ready() - - /** - * Tell whether this stream supports the mark() operation. - */ - public boolean markSupported() { - return fInputStream.markSupported(); - } // markSupported() - - /** - * Mark the present position in the stream. Subsequent calls to reset() - * will attempt to reposition the stream to this point. Not all - * character-input streams support the mark() operation. - * - * @param readAheadLimit Limit on the number of characters that may be - * read while still preserving the mark. After - * reading this many characters, attempting to - * reset the stream may fail. - * - * @exception IOException If the stream does not support mark(), - * or if some other I/O error occurs - */ - public void mark(int readAheadLimit) throws IOException { - fInputStream.mark(readAheadLimit); - } // mark(int) - - /** - * Reset the stream. If the stream has been marked, then attempt to - * reposition it at the mark. If the stream has not been marked, then - * attempt to reset it in some way appropriate to the particular stream, - * for example by repositioning it to its starting point. Not all - * character-input streams support the reset() operation, and some support - * reset() without supporting mark(). - * - * @exception IOException If the stream has not been marked, - * or if the mark has been invalidated, - * or if the stream does not support reset(), - * or if some other I/O error occurs - */ - public void reset() throws IOException { - fInputStream.reset(); - } // reset() - - /** - * Close the stream. Once a stream has been closed, further read(), - * ready(), mark(), or reset() invocations will throw an IOException. - * Closing a previously-closed stream, however, has no effect. - * - * @exception IOException If an I/O error occurs - */ - public void close() throws IOException { - fInputStream.close(); - } // close() - -} // class UCSReader diff --git a/impl/src/main/java/org/apache/jasper/xmlparser/UTF8Reader.java b/impl/src/main/java/org/apache/jasper/xmlparser/UTF8Reader.java deleted file mode 100644 index 3dc3238..0000000 --- a/impl/src/main/java/org/apache/jasper/xmlparser/UTF8Reader.java +++ /dev/null @@ -1,660 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.xmlparser; - -import java.io.InputStream; -import java.io.IOException; -import java.io.Reader; -import java.io.UTFDataFormatException; -import org.apache.jasper.compiler.Localizer; - -/** - * @author Andy Clark, IBM - * - * @version $Id: UTF8Reader.java,v 1.4 2006/10/03 02:25:27 jluehe Exp $ - */ -public class UTF8Reader - extends Reader { - - // - // Constants - // - - /** Default byte buffer size (2048). */ - public static final int DEFAULT_BUFFER_SIZE = 2048; - - // - // Data - // - - /** Input stream. */ - protected InputStream fInputStream; - - /** Byte buffer. */ - protected byte[] fBuffer; - - /** Offset into buffer. */ - protected int fOffset; - - /** Surrogate character. */ - private int fSurrogate = -1; - - // - // Constructors - // - - /** - * Constructs a UTF-8 reader from the specified input stream, - * buffer size and MessageFormatter. - * - * @param inputStream The input stream. - * @param size The initial buffer size. - */ - public UTF8Reader(InputStream inputStream, int size) { - fInputStream = inputStream; - fBuffer = new byte[size]; - } - - // - // Reader methods - // - - /** - * Read a single character. This method will block until a character is - * available, an I/O error occurs, or the end of the stream is reached. - * - *

    Subclasses that intend to support efficient single-character input - * should override this method. - * - * @return The character read, as an integer in the range 0 to 16383 - * (0x00-0xffff), or -1 if the end of the stream has - * been reached - * - * @exception IOException If an I/O error occurs - */ - public int read() throws IOException { - - // decode character - int c = fSurrogate; - if (fSurrogate == -1) { - // NOTE: We use the index into the buffer if there are remaining - // bytes from the last block read. -Ac - int index = 0; - - // get first byte - int b0 = index == fOffset - ? fInputStream.read() : fBuffer[index++] & 0x00FF; - if (b0 == -1) { - return -1; - } - - // UTF-8: [0xxx xxxx] - // Unicode: [0000 0000] [0xxx xxxx] - if (b0 < 0x80) { - c = (char)b0; - } - - // UTF-8: [110y yyyy] [10xx xxxx] - // Unicode: [0000 0yyy] [yyxx xxxx] - else if ((b0 & 0xE0) == 0xC0) { - int b1 = index == fOffset - ? fInputStream.read() : fBuffer[index++] & 0x00FF; - if (b1 == -1) { - expectedByte(2, 2); - } - if ((b1 & 0xC0) != 0x80) { - invalidByte(2, 2, b1); - } - c = ((b0 << 6) & 0x07C0) | (b1 & 0x003F); - } - - // UTF-8: [1110 zzzz] [10yy yyyy] [10xx xxxx] - // Unicode: [zzzz yyyy] [yyxx xxxx] - else if ((b0 & 0xF0) == 0xE0) { - int b1 = index == fOffset - ? fInputStream.read() : fBuffer[index++] & 0x00FF; - if (b1 == -1) { - expectedByte(2, 3); - } - if ((b1 & 0xC0) != 0x80) { - invalidByte(2, 3, b1); - } - int b2 = index == fOffset - ? fInputStream.read() : fBuffer[index++] & 0x00FF; - if (b2 == -1) { - expectedByte(3, 3); - } - if ((b2 & 0xC0) != 0x80) { - invalidByte(3, 3, b2); - } - c = ((b0 << 12) & 0xF000) | ((b1 << 6) & 0x0FC0) | - (b2 & 0x003F); - } - - // UTF-8: [1111 0uuu] [10uu zzzz] [10yy yyyy] [10xx xxxx]* - // Unicode: [1101 10ww] [wwzz zzyy] (high surrogate) - // [1101 11yy] [yyxx xxxx] (low surrogate) - // * uuuuu = wwww + 1 - else if ((b0 & 0xF8) == 0xF0) { - int b1 = index == fOffset - ? fInputStream.read() : fBuffer[index++] & 0x00FF; - if (b1 == -1) { - expectedByte(2, 4); - } - if ((b1 & 0xC0) != 0x80) { - invalidByte(2, 3, b1); - } - int b2 = index == fOffset - ? fInputStream.read() : fBuffer[index++] & 0x00FF; - if (b2 == -1) { - expectedByte(3, 4); - } - if ((b2 & 0xC0) != 0x80) { - invalidByte(3, 3, b2); - } - int b3 = index == fOffset - ? fInputStream.read() : fBuffer[index++] & 0x00FF; - if (b3 == -1) { - expectedByte(4, 4); - } - if ((b3 & 0xC0) != 0x80) { - invalidByte(4, 4, b3); - } - int uuuuu = ((b0 << 2) & 0x001C) | ((b1 >> 4) & 0x0003); - if (uuuuu > 0x10) { - invalidSurrogate(uuuuu); - } - int wwww = uuuuu - 1; - int hs = 0xD800 | - ((wwww << 6) & 0x03C0) | ((b1 << 2) & 0x003C) | - ((b2 >> 4) & 0x0003); - int ls = 0xDC00 | ((b2 << 6) & 0x03C0) | (b3 & 0x003F); - c = hs; - fSurrogate = ls; - } - - // error - else { - invalidByte(1, 1, b0); - } - } - - // use surrogate - else { - fSurrogate = -1; - } - - // return character - return c; - - } // read():int - - /** - * Read characters into a portion of an array. This method will block - * until some input is available, an I/O error occurs, or the end of the - * stream is reached. - * - * @param ch Destination buffer - * @param offset Offset at which to start storing characters - * @param length Maximum number of characters to read - * - * @return The number of characters read, or -1 if the end of the - * stream has been reached - * - * @exception IOException If an I/O error occurs - */ - public int read(char ch[], int offset, int length) throws IOException { - - // handle surrogate - int out = offset; - if (fSurrogate != -1) { - ch[offset + 1] = (char)fSurrogate; - fSurrogate = -1; - length--; - out++; - } - - // read bytes - int count = 0; - if (fOffset == 0) { - // adjust length to read - if (length > fBuffer.length) { - length = fBuffer.length; - } - - // perform read operation - count = fInputStream.read(fBuffer, 0, length); - if (count == -1) { - return -1; - } - count += out - offset; - } - - // skip read; last character was in error - // NOTE: Having an offset value other than zero means that there was - // an error in the last character read. In this case, we have - // skipped the read so we don't consume any bytes past the - // error. By signalling the error on the next block read we - // allow the method to return the most valid characters that - // it can on the previous block read. -Ac - else { - count = fOffset; - fOffset = 0; - } - - // convert bytes to characters - final int total = count; - for (int in = 0; in < total; in++) { - int b0 = fBuffer[in] & 0x00FF; - - // UTF-8: [0xxx xxxx] - // Unicode: [0000 0000] [0xxx xxxx] - if (b0 < 0x80) { - ch[out++] = (char)b0; - continue; - } - - // UTF-8: [110y yyyy] [10xx xxxx] - // Unicode: [0000 0yyy] [yyxx xxxx] - if ((b0 & 0xE0) == 0xC0) { - int b1 = -1; - if (++in < total) { - b1 = fBuffer[in] & 0x00FF; - } - else { - b1 = fInputStream.read(); - if (b1 == -1) { - if (out > offset) { - fBuffer[0] = (byte)b0; - fOffset = 1; - return out - offset; - } - expectedByte(2, 2); - } - count++; - } - if ((b1 & 0xC0) != 0x80) { - if (out > offset) { - fBuffer[0] = (byte)b0; - fBuffer[1] = (byte)b1; - fOffset = 2; - return out - offset; - } - invalidByte(2, 2, b1); - } - int c = ((b0 << 6) & 0x07C0) | (b1 & 0x003F); - ch[out++] = (char)c; - count -= 1; - continue; - } - - // UTF-8: [1110 zzzz] [10yy yyyy] [10xx xxxx] - // Unicode: [zzzz yyyy] [yyxx xxxx] - if ((b0 & 0xF0) == 0xE0) { - int b1 = -1; - if (++in < total) { - b1 = fBuffer[in] & 0x00FF; - } - else { - b1 = fInputStream.read(); - if (b1 == -1) { - if (out > offset) { - fBuffer[0] = (byte)b0; - fOffset = 1; - return out - offset; - } - expectedByte(2, 3); - } - count++; - } - if ((b1 & 0xC0) != 0x80) { - if (out > offset) { - fBuffer[0] = (byte)b0; - fBuffer[1] = (byte)b1; - fOffset = 2; - return out - offset; - } - invalidByte(2, 3, b1); - } - int b2 = -1; - if (++in < total) { - b2 = fBuffer[in] & 0x00FF; - } - else { - b2 = fInputStream.read(); - if (b2 == -1) { - if (out > offset) { - fBuffer[0] = (byte)b0; - fBuffer[1] = (byte)b1; - fOffset = 2; - return out - offset; - } - expectedByte(3, 3); - } - count++; - } - if ((b2 & 0xC0) != 0x80) { - if (out > offset) { - fBuffer[0] = (byte)b0; - fBuffer[1] = (byte)b1; - fBuffer[2] = (byte)b2; - fOffset = 3; - return out - offset; - } - invalidByte(3, 3, b2); - } - int c = ((b0 << 12) & 0xF000) | ((b1 << 6) & 0x0FC0) | - (b2 & 0x003F); - ch[out++] = (char)c; - count -= 2; - continue; - } - - // UTF-8: [1111 0uuu] [10uu zzzz] [10yy yyyy] [10xx xxxx]* - // Unicode: [1101 10ww] [wwzz zzyy] (high surrogate) - // [1101 11yy] [yyxx xxxx] (low surrogate) - // * uuuuu = wwww + 1 - if ((b0 & 0xF8) == 0xF0) { - int b1 = -1; - if (++in < total) { - b1 = fBuffer[in] & 0x00FF; - } - else { - b1 = fInputStream.read(); - if (b1 == -1) { - if (out > offset) { - fBuffer[0] = (byte)b0; - fOffset = 1; - return out - offset; - } - expectedByte(2, 4); - } - count++; - } - if ((b1 & 0xC0) != 0x80) { - if (out > offset) { - fBuffer[0] = (byte)b0; - fBuffer[1] = (byte)b1; - fOffset = 2; - return out - offset; - } - invalidByte(2, 4, b1); - } - int b2 = -1; - if (++in < total) { - b2 = fBuffer[in] & 0x00FF; - } - else { - b2 = fInputStream.read(); - if (b2 == -1) { - if (out > offset) { - fBuffer[0] = (byte)b0; - fBuffer[1] = (byte)b1; - fOffset = 2; - return out - offset; - } - expectedByte(3, 4); - } - count++; - } - if ((b2 & 0xC0) != 0x80) { - if (out > offset) { - fBuffer[0] = (byte)b0; - fBuffer[1] = (byte)b1; - fBuffer[2] = (byte)b2; - fOffset = 3; - return out - offset; - } - invalidByte(3, 4, b2); - } - int b3 = -1; - if (++in < total) { - b3 = fBuffer[in] & 0x00FF; - } - else { - b3 = fInputStream.read(); - if (b3 == -1) { - if (out > offset) { - fBuffer[0] = (byte)b0; - fBuffer[1] = (byte)b1; - fBuffer[2] = (byte)b2; - fOffset = 3; - return out - offset; - } - expectedByte(4, 4); - } - count++; - } - if ((b3 & 0xC0) != 0x80) { - if (out > offset) { - fBuffer[0] = (byte)b0; - fBuffer[1] = (byte)b1; - fBuffer[2] = (byte)b2; - fBuffer[3] = (byte)b3; - fOffset = 4; - return out - offset; - } - invalidByte(4, 4, b2); - } - - // decode bytes into surrogate characters - int uuuuu = ((b0 << 2) & 0x001C) | ((b1 >> 4) & 0x0003); - if (uuuuu > 0x10) { - invalidSurrogate(uuuuu); - } - int wwww = uuuuu - 1; - int zzzz = b1 & 0x000F; - int yyyyyy = b2 & 0x003F; - int xxxxxx = b3 & 0x003F; - int hs = 0xD800 | ((wwww << 6) & 0x03C0) | (zzzz << 2) | (yyyyyy >> 4); - int ls = 0xDC00 | ((yyyyyy << 6) & 0x03C0) | xxxxxx; - - // set characters - ch[out++] = (char)hs; - ch[out++] = (char)ls; - count -= 2; - continue; - } - - // error - if (out > offset) { - fBuffer[0] = (byte)b0; - fOffset = 1; - return out - offset; - } - invalidByte(1, 1, b0); - } - - // return number of characters converted - return count; - - } // read(char[],int,int) - - /** - * Skip characters. This method will block until some characters are - * available, an I/O error occurs, or the end of the stream is reached. - * - * @param n The number of characters to skip - * - * @return The number of characters actually skipped - * - * @exception IOException If an I/O error occurs - */ - public long skip(long n) throws IOException { - - long remaining = n; - final char[] ch = new char[fBuffer.length]; - do { - int length = ch.length < remaining ? ch.length : (int)remaining; - int count = read(ch, 0, length); - if (count > 0) { - remaining -= count; - } - else { - break; - } - } while (remaining > 0); - - long skipped = n - remaining; - return skipped; - - } // skip(long):long - - /** - * Tell whether this stream is ready to be read. - * - * @return True if the next read() is guaranteed not to block for input, - * false otherwise. Note that returning false does not guarantee that the - * next read will block. - * - * @exception IOException If an I/O error occurs - */ - public boolean ready() throws IOException { - return false; - } // ready() - - /** - * Tell whether this stream supports the mark() operation. - */ - public boolean markSupported() { - return false; - } // markSupported() - - /** - * Mark the present position in the stream. Subsequent calls to reset() - * will attempt to reposition the stream to this point. Not all - * character-input streams support the mark() operation. - * - * @param readAheadLimit Limit on the number of characters that may be - * read while still preserving the mark. After - * reading this many characters, attempting to - * reset the stream may fail. - * - * @exception IOException If the stream does not support mark(), - * or if some other I/O error occurs - */ - public void mark(int readAheadLimit) throws IOException { - throw new IOException( - Localizer.getMessage("jsp.error.xml.operationNotSupported", - "mark()", "UTF-8")); - } - - /** - * Reset the stream. If the stream has been marked, then attempt to - * reposition it at the mark. If the stream has not been marked, then - * attempt to reset it in some way appropriate to the particular stream, - * for example by repositioning it to its starting point. Not all - * character-input streams support the reset() operation, and some support - * reset() without supporting mark(). - * - * @exception IOException If the stream has not been marked, - * or if the mark has been invalidated, - * or if the stream does not support reset(), - * or if some other I/O error occurs - */ - public void reset() throws IOException { - fOffset = 0; - fSurrogate = -1; - } // reset() - - /** - * Close the stream. Once a stream has been closed, further read(), - * ready(), mark(), or reset() invocations will throw an IOException. - * Closing a previously-closed stream, however, has no effect. - * - * @exception IOException If an I/O error occurs - */ - public void close() throws IOException { - fInputStream.close(); - } // close() - - // - // Private methods - // - - /** Throws an exception for expected byte. */ - private void expectedByte(int position, int count) - throws UTFDataFormatException { - - throw new UTFDataFormatException( - Localizer.getMessage("jsp.error.xml.expectedByte", - Integer.toString(position), - Integer.toString(count))); - - } // expectedByte(int,int,int) - - /** Throws an exception for invalid byte. */ - private void invalidByte(int position, int count, int c) - throws UTFDataFormatException { - - throw new UTFDataFormatException( - Localizer.getMessage("jsp.error.xml.invalidByte", - Integer.toString(position), - Integer.toString(count))); - } // invalidByte(int,int,int,int) - - /** Throws an exception for invalid surrogate bits. */ - private void invalidSurrogate(int uuuuu) throws UTFDataFormatException { - - throw new UTFDataFormatException( - Localizer.getMessage("jsp.error.xml.invalidHighSurrogate", - Integer.toHexString(uuuuu))); - } // invalidSurrogate(int) - -} // class UTF8Reader diff --git a/impl/src/main/java/org/apache/jasper/xmlparser/XMLChar.java b/impl/src/main/java/org/apache/jasper/xmlparser/XMLChar.java deleted file mode 100644 index ad48824..0000000 --- a/impl/src/main/java/org/apache/jasper/xmlparser/XMLChar.java +++ /dev/null @@ -1,1064 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.xmlparser; - -import java.util.Arrays; - -/** - * This class defines the basic XML character properties. The data - * in this class can be used to verify that a character is a valid - * XML character or if the character is a space, name start, or name - * character. - *

    - * A series of convenience methods are supplied to ease the burden - * of the developer. Because inlining the checks can improve per - * character performance, the tables of character properties are - * public. Using the character as an index into the CHARS - * array and applying the appropriate mask flag (e.g. - * MASK_VALID), yields the same results as calling the - * convenience methods. There is one exception: check the comments - * for the isValid method for details. - * - * @author Glenn Marcy, IBM - * @author Andy Clark, IBM - * @author Eric Ye, IBM - * @author Arnaud Le Hors, IBM - * @author Michael Glavassevich, IBM - * @author Rahul Srivastava, Sun Microsystems Inc. - * - * @version $Id: XMLChar.java,v 1.2 2005/12/08 01:29:01 kchung Exp $ - */ -public class XMLChar { - - // - // Constants - // - - /** Character flags. */ - private static final byte[] CHARS = new byte[1 << 16]; - - /** Valid character mask. */ - public static final int MASK_VALID = 0x01; - - /** Space character mask. */ - public static final int MASK_SPACE = 0x02; - - /** Name start character mask. */ - public static final int MASK_NAME_START = 0x04; - - /** Name character mask. */ - public static final int MASK_NAME = 0x08; - - /** Pubid character mask. */ - public static final int MASK_PUBID = 0x10; - - /** - * Content character mask. Special characters are those that can - * be considered the start of markup, such as '<' and '&'. - * The various newline characters are considered special as well. - * All other valid XML characters can be considered content. - *

    - * This is an optimization for the inner loop of character scanning. - */ - public static final int MASK_CONTENT = 0x20; - - /** NCName start character mask. */ - public static final int MASK_NCNAME_START = 0x40; - - /** NCName character mask. */ - public static final int MASK_NCNAME = 0x80; - - // - // Static initialization - // - - static { - - // Initializing the Character Flag Array - // Code generated by: XMLCharGenerator. - - CHARS[9] = 35; - CHARS[10] = 19; - CHARS[13] = 19; - CHARS[32] = 51; - CHARS[33] = 49; - CHARS[34] = 33; - Arrays.fill(CHARS, 35, 38, (byte) 49 ); // Fill 3 of value (byte) 49 - CHARS[38] = 1; - Arrays.fill(CHARS, 39, 45, (byte) 49 ); // Fill 6 of value (byte) 49 - Arrays.fill(CHARS, 45, 47, (byte) -71 ); // Fill 2 of value (byte) -71 - CHARS[47] = 49; - Arrays.fill(CHARS, 48, 58, (byte) -71 ); // Fill 10 of value (byte) -71 - CHARS[58] = 61; - CHARS[59] = 49; - CHARS[60] = 1; - CHARS[61] = 49; - CHARS[62] = 33; - Arrays.fill(CHARS, 63, 65, (byte) 49 ); // Fill 2 of value (byte) 49 - Arrays.fill(CHARS, 65, 91, (byte) -3 ); // Fill 26 of value (byte) -3 - Arrays.fill(CHARS, 91, 93, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[93] = 1; - CHARS[94] = 33; - CHARS[95] = -3; - CHARS[96] = 33; - Arrays.fill(CHARS, 97, 123, (byte) -3 ); // Fill 26 of value (byte) -3 - Arrays.fill(CHARS, 123, 183, (byte) 33 ); // Fill 60 of value (byte) 33 - CHARS[183] = -87; - Arrays.fill(CHARS, 184, 192, (byte) 33 ); // Fill 8 of value (byte) 33 - Arrays.fill(CHARS, 192, 215, (byte) -19 ); // Fill 23 of value (byte) -19 - CHARS[215] = 33; - Arrays.fill(CHARS, 216, 247, (byte) -19 ); // Fill 31 of value (byte) -19 - CHARS[247] = 33; - Arrays.fill(CHARS, 248, 306, (byte) -19 ); // Fill 58 of value (byte) -19 - Arrays.fill(CHARS, 306, 308, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 308, 319, (byte) -19 ); // Fill 11 of value (byte) -19 - Arrays.fill(CHARS, 319, 321, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 321, 329, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[329] = 33; - Arrays.fill(CHARS, 330, 383, (byte) -19 ); // Fill 53 of value (byte) -19 - CHARS[383] = 33; - Arrays.fill(CHARS, 384, 452, (byte) -19 ); // Fill 68 of value (byte) -19 - Arrays.fill(CHARS, 452, 461, (byte) 33 ); // Fill 9 of value (byte) 33 - Arrays.fill(CHARS, 461, 497, (byte) -19 ); // Fill 36 of value (byte) -19 - Arrays.fill(CHARS, 497, 500, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 500, 502, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 502, 506, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 506, 536, (byte) -19 ); // Fill 30 of value (byte) -19 - Arrays.fill(CHARS, 536, 592, (byte) 33 ); // Fill 56 of value (byte) 33 - Arrays.fill(CHARS, 592, 681, (byte) -19 ); // Fill 89 of value (byte) -19 - Arrays.fill(CHARS, 681, 699, (byte) 33 ); // Fill 18 of value (byte) 33 - Arrays.fill(CHARS, 699, 706, (byte) -19 ); // Fill 7 of value (byte) -19 - Arrays.fill(CHARS, 706, 720, (byte) 33 ); // Fill 14 of value (byte) 33 - Arrays.fill(CHARS, 720, 722, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 722, 768, (byte) 33 ); // Fill 46 of value (byte) 33 - Arrays.fill(CHARS, 768, 838, (byte) -87 ); // Fill 70 of value (byte) -87 - Arrays.fill(CHARS, 838, 864, (byte) 33 ); // Fill 26 of value (byte) 33 - Arrays.fill(CHARS, 864, 866, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 866, 902, (byte) 33 ); // Fill 36 of value (byte) 33 - CHARS[902] = -19; - CHARS[903] = -87; - Arrays.fill(CHARS, 904, 907, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[907] = 33; - CHARS[908] = -19; - CHARS[909] = 33; - Arrays.fill(CHARS, 910, 930, (byte) -19 ); // Fill 20 of value (byte) -19 - CHARS[930] = 33; - Arrays.fill(CHARS, 931, 975, (byte) -19 ); // Fill 44 of value (byte) -19 - CHARS[975] = 33; - Arrays.fill(CHARS, 976, 983, (byte) -19 ); // Fill 7 of value (byte) -19 - Arrays.fill(CHARS, 983, 986, (byte) 33 ); // Fill 3 of value (byte) 33 - CHARS[986] = -19; - CHARS[987] = 33; - CHARS[988] = -19; - CHARS[989] = 33; - CHARS[990] = -19; - CHARS[991] = 33; - CHARS[992] = -19; - CHARS[993] = 33; - Arrays.fill(CHARS, 994, 1012, (byte) -19 ); // Fill 18 of value (byte) -19 - Arrays.fill(CHARS, 1012, 1025, (byte) 33 ); // Fill 13 of value (byte) 33 - Arrays.fill(CHARS, 1025, 1037, (byte) -19 ); // Fill 12 of value (byte) -19 - CHARS[1037] = 33; - Arrays.fill(CHARS, 1038, 1104, (byte) -19 ); // Fill 66 of value (byte) -19 - CHARS[1104] = 33; - Arrays.fill(CHARS, 1105, 1117, (byte) -19 ); // Fill 12 of value (byte) -19 - CHARS[1117] = 33; - Arrays.fill(CHARS, 1118, 1154, (byte) -19 ); // Fill 36 of value (byte) -19 - CHARS[1154] = 33; - Arrays.fill(CHARS, 1155, 1159, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 1159, 1168, (byte) 33 ); // Fill 9 of value (byte) 33 - Arrays.fill(CHARS, 1168, 1221, (byte) -19 ); // Fill 53 of value (byte) -19 - Arrays.fill(CHARS, 1221, 1223, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1223, 1225, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 1225, 1227, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1227, 1229, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 1229, 1232, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 1232, 1260, (byte) -19 ); // Fill 28 of value (byte) -19 - Arrays.fill(CHARS, 1260, 1262, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1262, 1270, (byte) -19 ); // Fill 8 of value (byte) -19 - Arrays.fill(CHARS, 1270, 1272, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1272, 1274, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 1274, 1329, (byte) 33 ); // Fill 55 of value (byte) 33 - Arrays.fill(CHARS, 1329, 1367, (byte) -19 ); // Fill 38 of value (byte) -19 - Arrays.fill(CHARS, 1367, 1369, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[1369] = -19; - Arrays.fill(CHARS, 1370, 1377, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 1377, 1415, (byte) -19 ); // Fill 38 of value (byte) -19 - Arrays.fill(CHARS, 1415, 1425, (byte) 33 ); // Fill 10 of value (byte) 33 - Arrays.fill(CHARS, 1425, 1442, (byte) -87 ); // Fill 17 of value (byte) -87 - CHARS[1442] = 33; - Arrays.fill(CHARS, 1443, 1466, (byte) -87 ); // Fill 23 of value (byte) -87 - CHARS[1466] = 33; - Arrays.fill(CHARS, 1467, 1470, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[1470] = 33; - CHARS[1471] = -87; - CHARS[1472] = 33; - Arrays.fill(CHARS, 1473, 1475, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[1475] = 33; - CHARS[1476] = -87; - Arrays.fill(CHARS, 1477, 1488, (byte) 33 ); // Fill 11 of value (byte) 33 - Arrays.fill(CHARS, 1488, 1515, (byte) -19 ); // Fill 27 of value (byte) -19 - Arrays.fill(CHARS, 1515, 1520, (byte) 33 ); // Fill 5 of value (byte) 33 - Arrays.fill(CHARS, 1520, 1523, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 1523, 1569, (byte) 33 ); // Fill 46 of value (byte) 33 - Arrays.fill(CHARS, 1569, 1595, (byte) -19 ); // Fill 26 of value (byte) -19 - Arrays.fill(CHARS, 1595, 1600, (byte) 33 ); // Fill 5 of value (byte) 33 - CHARS[1600] = -87; - Arrays.fill(CHARS, 1601, 1611, (byte) -19 ); // Fill 10 of value (byte) -19 - Arrays.fill(CHARS, 1611, 1619, (byte) -87 ); // Fill 8 of value (byte) -87 - Arrays.fill(CHARS, 1619, 1632, (byte) 33 ); // Fill 13 of value (byte) 33 - Arrays.fill(CHARS, 1632, 1642, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 1642, 1648, (byte) 33 ); // Fill 6 of value (byte) 33 - CHARS[1648] = -87; - Arrays.fill(CHARS, 1649, 1720, (byte) -19 ); // Fill 71 of value (byte) -19 - Arrays.fill(CHARS, 1720, 1722, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1722, 1727, (byte) -19 ); // Fill 5 of value (byte) -19 - CHARS[1727] = 33; - Arrays.fill(CHARS, 1728, 1743, (byte) -19 ); // Fill 15 of value (byte) -19 - CHARS[1743] = 33; - Arrays.fill(CHARS, 1744, 1748, (byte) -19 ); // Fill 4 of value (byte) -19 - CHARS[1748] = 33; - CHARS[1749] = -19; - Arrays.fill(CHARS, 1750, 1765, (byte) -87 ); // Fill 15 of value (byte) -87 - Arrays.fill(CHARS, 1765, 1767, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 1767, 1769, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[1769] = 33; - Arrays.fill(CHARS, 1770, 1774, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 1774, 1776, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1776, 1786, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 1786, 2305, (byte) 33 ); // Fill 519 of value (byte) 33 - Arrays.fill(CHARS, 2305, 2308, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[2308] = 33; - Arrays.fill(CHARS, 2309, 2362, (byte) -19 ); // Fill 53 of value (byte) -19 - Arrays.fill(CHARS, 2362, 2364, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[2364] = -87; - CHARS[2365] = -19; - Arrays.fill(CHARS, 2366, 2382, (byte) -87 ); // Fill 16 of value (byte) -87 - Arrays.fill(CHARS, 2382, 2385, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2385, 2389, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 2389, 2392, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2392, 2402, (byte) -19 ); // Fill 10 of value (byte) -19 - Arrays.fill(CHARS, 2402, 2404, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2404, 2406, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2406, 2416, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 2416, 2433, (byte) 33 ); // Fill 17 of value (byte) 33 - Arrays.fill(CHARS, 2433, 2436, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[2436] = 33; - Arrays.fill(CHARS, 2437, 2445, (byte) -19 ); // Fill 8 of value (byte) -19 - Arrays.fill(CHARS, 2445, 2447, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2447, 2449, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2449, 2451, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2451, 2473, (byte) -19 ); // Fill 22 of value (byte) -19 - CHARS[2473] = 33; - Arrays.fill(CHARS, 2474, 2481, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[2481] = 33; - CHARS[2482] = -19; - Arrays.fill(CHARS, 2483, 2486, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2486, 2490, (byte) -19 ); // Fill 4 of value (byte) -19 - Arrays.fill(CHARS, 2490, 2492, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[2492] = -87; - CHARS[2493] = 33; - Arrays.fill(CHARS, 2494, 2501, (byte) -87 ); // Fill 7 of value (byte) -87 - Arrays.fill(CHARS, 2501, 2503, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2503, 2505, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2505, 2507, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2507, 2510, (byte) -87 ); // Fill 3 of value (byte) -87 - Arrays.fill(CHARS, 2510, 2519, (byte) 33 ); // Fill 9 of value (byte) 33 - CHARS[2519] = -87; - Arrays.fill(CHARS, 2520, 2524, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 2524, 2526, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2526] = 33; - Arrays.fill(CHARS, 2527, 2530, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 2530, 2532, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2532, 2534, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2534, 2544, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 2544, 2546, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2546, 2562, (byte) 33 ); // Fill 16 of value (byte) 33 - CHARS[2562] = -87; - Arrays.fill(CHARS, 2563, 2565, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2565, 2571, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 2571, 2575, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 2575, 2577, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2577, 2579, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2579, 2601, (byte) -19 ); // Fill 22 of value (byte) -19 - CHARS[2601] = 33; - Arrays.fill(CHARS, 2602, 2609, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[2609] = 33; - Arrays.fill(CHARS, 2610, 2612, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2612] = 33; - Arrays.fill(CHARS, 2613, 2615, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2615] = 33; - Arrays.fill(CHARS, 2616, 2618, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2618, 2620, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[2620] = -87; - CHARS[2621] = 33; - Arrays.fill(CHARS, 2622, 2627, (byte) -87 ); // Fill 5 of value (byte) -87 - Arrays.fill(CHARS, 2627, 2631, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 2631, 2633, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2633, 2635, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2635, 2638, (byte) -87 ); // Fill 3 of value (byte) -87 - Arrays.fill(CHARS, 2638, 2649, (byte) 33 ); // Fill 11 of value (byte) 33 - Arrays.fill(CHARS, 2649, 2653, (byte) -19 ); // Fill 4 of value (byte) -19 - CHARS[2653] = 33; - CHARS[2654] = -19; - Arrays.fill(CHARS, 2655, 2662, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 2662, 2674, (byte) -87 ); // Fill 12 of value (byte) -87 - Arrays.fill(CHARS, 2674, 2677, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 2677, 2689, (byte) 33 ); // Fill 12 of value (byte) 33 - Arrays.fill(CHARS, 2689, 2692, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[2692] = 33; - Arrays.fill(CHARS, 2693, 2700, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[2700] = 33; - CHARS[2701] = -19; - CHARS[2702] = 33; - Arrays.fill(CHARS, 2703, 2706, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[2706] = 33; - Arrays.fill(CHARS, 2707, 2729, (byte) -19 ); // Fill 22 of value (byte) -19 - CHARS[2729] = 33; - Arrays.fill(CHARS, 2730, 2737, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[2737] = 33; - Arrays.fill(CHARS, 2738, 2740, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2740] = 33; - Arrays.fill(CHARS, 2741, 2746, (byte) -19 ); // Fill 5 of value (byte) -19 - Arrays.fill(CHARS, 2746, 2748, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[2748] = -87; - CHARS[2749] = -19; - Arrays.fill(CHARS, 2750, 2758, (byte) -87 ); // Fill 8 of value (byte) -87 - CHARS[2758] = 33; - Arrays.fill(CHARS, 2759, 2762, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[2762] = 33; - Arrays.fill(CHARS, 2763, 2766, (byte) -87 ); // Fill 3 of value (byte) -87 - Arrays.fill(CHARS, 2766, 2784, (byte) 33 ); // Fill 18 of value (byte) 33 - CHARS[2784] = -19; - Arrays.fill(CHARS, 2785, 2790, (byte) 33 ); // Fill 5 of value (byte) 33 - Arrays.fill(CHARS, 2790, 2800, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 2800, 2817, (byte) 33 ); // Fill 17 of value (byte) 33 - Arrays.fill(CHARS, 2817, 2820, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[2820] = 33; - Arrays.fill(CHARS, 2821, 2829, (byte) -19 ); // Fill 8 of value (byte) -19 - Arrays.fill(CHARS, 2829, 2831, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2831, 2833, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2833, 2835, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2835, 2857, (byte) -19 ); // Fill 22 of value (byte) -19 - CHARS[2857] = 33; - Arrays.fill(CHARS, 2858, 2865, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[2865] = 33; - Arrays.fill(CHARS, 2866, 2868, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2868, 2870, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2870, 2874, (byte) -19 ); // Fill 4 of value (byte) -19 - Arrays.fill(CHARS, 2874, 2876, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[2876] = -87; - CHARS[2877] = -19; - Arrays.fill(CHARS, 2878, 2884, (byte) -87 ); // Fill 6 of value (byte) -87 - Arrays.fill(CHARS, 2884, 2887, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2887, 2889, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2889, 2891, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2891, 2894, (byte) -87 ); // Fill 3 of value (byte) -87 - Arrays.fill(CHARS, 2894, 2902, (byte) 33 ); // Fill 8 of value (byte) 33 - Arrays.fill(CHARS, 2902, 2904, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2904, 2908, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 2908, 2910, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2910] = 33; - Arrays.fill(CHARS, 2911, 2914, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 2914, 2918, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 2918, 2928, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 2928, 2946, (byte) 33 ); // Fill 18 of value (byte) 33 - Arrays.fill(CHARS, 2946, 2948, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[2948] = 33; - Arrays.fill(CHARS, 2949, 2955, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 2955, 2958, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2958, 2961, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[2961] = 33; - Arrays.fill(CHARS, 2962, 2966, (byte) -19 ); // Fill 4 of value (byte) -19 - Arrays.fill(CHARS, 2966, 2969, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2969, 2971, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2971] = 33; - CHARS[2972] = -19; - CHARS[2973] = 33; - Arrays.fill(CHARS, 2974, 2976, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2976, 2979, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2979, 2981, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2981, 2984, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2984, 2987, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 2987, 2990, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2990, 2998, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[2998] = 33; - Arrays.fill(CHARS, 2999, 3002, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 3002, 3006, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3006, 3011, (byte) -87 ); // Fill 5 of value (byte) -87 - Arrays.fill(CHARS, 3011, 3014, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 3014, 3017, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[3017] = 33; - Arrays.fill(CHARS, 3018, 3022, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 3022, 3031, (byte) 33 ); // Fill 9 of value (byte) 33 - CHARS[3031] = -87; - Arrays.fill(CHARS, 3032, 3047, (byte) 33 ); // Fill 15 of value (byte) 33 - Arrays.fill(CHARS, 3047, 3056, (byte) -87 ); // Fill 9 of value (byte) -87 - Arrays.fill(CHARS, 3056, 3073, (byte) 33 ); // Fill 17 of value (byte) 33 - Arrays.fill(CHARS, 3073, 3076, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[3076] = 33; - Arrays.fill(CHARS, 3077, 3085, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[3085] = 33; - Arrays.fill(CHARS, 3086, 3089, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[3089] = 33; - Arrays.fill(CHARS, 3090, 3113, (byte) -19 ); // Fill 23 of value (byte) -19 - CHARS[3113] = 33; - Arrays.fill(CHARS, 3114, 3124, (byte) -19 ); // Fill 10 of value (byte) -19 - CHARS[3124] = 33; - Arrays.fill(CHARS, 3125, 3130, (byte) -19 ); // Fill 5 of value (byte) -19 - Arrays.fill(CHARS, 3130, 3134, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3134, 3141, (byte) -87 ); // Fill 7 of value (byte) -87 - CHARS[3141] = 33; - Arrays.fill(CHARS, 3142, 3145, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[3145] = 33; - Arrays.fill(CHARS, 3146, 3150, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 3150, 3157, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 3157, 3159, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 3159, 3168, (byte) 33 ); // Fill 9 of value (byte) 33 - Arrays.fill(CHARS, 3168, 3170, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 3170, 3174, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3174, 3184, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3184, 3202, (byte) 33 ); // Fill 18 of value (byte) 33 - Arrays.fill(CHARS, 3202, 3204, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[3204] = 33; - Arrays.fill(CHARS, 3205, 3213, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[3213] = 33; - Arrays.fill(CHARS, 3214, 3217, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[3217] = 33; - Arrays.fill(CHARS, 3218, 3241, (byte) -19 ); // Fill 23 of value (byte) -19 - CHARS[3241] = 33; - Arrays.fill(CHARS, 3242, 3252, (byte) -19 ); // Fill 10 of value (byte) -19 - CHARS[3252] = 33; - Arrays.fill(CHARS, 3253, 3258, (byte) -19 ); // Fill 5 of value (byte) -19 - Arrays.fill(CHARS, 3258, 3262, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3262, 3269, (byte) -87 ); // Fill 7 of value (byte) -87 - CHARS[3269] = 33; - Arrays.fill(CHARS, 3270, 3273, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[3273] = 33; - Arrays.fill(CHARS, 3274, 3278, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 3278, 3285, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 3285, 3287, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 3287, 3294, (byte) 33 ); // Fill 7 of value (byte) 33 - CHARS[3294] = -19; - CHARS[3295] = 33; - Arrays.fill(CHARS, 3296, 3298, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 3298, 3302, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3302, 3312, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3312, 3330, (byte) 33 ); // Fill 18 of value (byte) 33 - Arrays.fill(CHARS, 3330, 3332, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[3332] = 33; - Arrays.fill(CHARS, 3333, 3341, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[3341] = 33; - Arrays.fill(CHARS, 3342, 3345, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[3345] = 33; - Arrays.fill(CHARS, 3346, 3369, (byte) -19 ); // Fill 23 of value (byte) -19 - CHARS[3369] = 33; - Arrays.fill(CHARS, 3370, 3386, (byte) -19 ); // Fill 16 of value (byte) -19 - Arrays.fill(CHARS, 3386, 3390, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3390, 3396, (byte) -87 ); // Fill 6 of value (byte) -87 - Arrays.fill(CHARS, 3396, 3398, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 3398, 3401, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[3401] = 33; - Arrays.fill(CHARS, 3402, 3406, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 3406, 3415, (byte) 33 ); // Fill 9 of value (byte) 33 - CHARS[3415] = -87; - Arrays.fill(CHARS, 3416, 3424, (byte) 33 ); // Fill 8 of value (byte) 33 - Arrays.fill(CHARS, 3424, 3426, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 3426, 3430, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3430, 3440, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3440, 3585, (byte) 33 ); // Fill 145 of value (byte) 33 - Arrays.fill(CHARS, 3585, 3631, (byte) -19 ); // Fill 46 of value (byte) -19 - CHARS[3631] = 33; - CHARS[3632] = -19; - CHARS[3633] = -87; - Arrays.fill(CHARS, 3634, 3636, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 3636, 3643, (byte) -87 ); // Fill 7 of value (byte) -87 - Arrays.fill(CHARS, 3643, 3648, (byte) 33 ); // Fill 5 of value (byte) 33 - Arrays.fill(CHARS, 3648, 3654, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 3654, 3663, (byte) -87 ); // Fill 9 of value (byte) -87 - CHARS[3663] = 33; - Arrays.fill(CHARS, 3664, 3674, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3674, 3713, (byte) 33 ); // Fill 39 of value (byte) 33 - Arrays.fill(CHARS, 3713, 3715, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[3715] = 33; - CHARS[3716] = -19; - Arrays.fill(CHARS, 3717, 3719, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 3719, 3721, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[3721] = 33; - CHARS[3722] = -19; - Arrays.fill(CHARS, 3723, 3725, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[3725] = -19; - Arrays.fill(CHARS, 3726, 3732, (byte) 33 ); // Fill 6 of value (byte) 33 - Arrays.fill(CHARS, 3732, 3736, (byte) -19 ); // Fill 4 of value (byte) -19 - CHARS[3736] = 33; - Arrays.fill(CHARS, 3737, 3744, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[3744] = 33; - Arrays.fill(CHARS, 3745, 3748, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[3748] = 33; - CHARS[3749] = -19; - CHARS[3750] = 33; - CHARS[3751] = -19; - Arrays.fill(CHARS, 3752, 3754, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 3754, 3756, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[3756] = 33; - Arrays.fill(CHARS, 3757, 3759, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[3759] = 33; - CHARS[3760] = -19; - CHARS[3761] = -87; - Arrays.fill(CHARS, 3762, 3764, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 3764, 3770, (byte) -87 ); // Fill 6 of value (byte) -87 - CHARS[3770] = 33; - Arrays.fill(CHARS, 3771, 3773, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[3773] = -19; - Arrays.fill(CHARS, 3774, 3776, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 3776, 3781, (byte) -19 ); // Fill 5 of value (byte) -19 - CHARS[3781] = 33; - CHARS[3782] = -87; - CHARS[3783] = 33; - Arrays.fill(CHARS, 3784, 3790, (byte) -87 ); // Fill 6 of value (byte) -87 - Arrays.fill(CHARS, 3790, 3792, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 3792, 3802, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3802, 3864, (byte) 33 ); // Fill 62 of value (byte) 33 - Arrays.fill(CHARS, 3864, 3866, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 3866, 3872, (byte) 33 ); // Fill 6 of value (byte) 33 - Arrays.fill(CHARS, 3872, 3882, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3882, 3893, (byte) 33 ); // Fill 11 of value (byte) 33 - CHARS[3893] = -87; - CHARS[3894] = 33; - CHARS[3895] = -87; - CHARS[3896] = 33; - CHARS[3897] = -87; - Arrays.fill(CHARS, 3898, 3902, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3902, 3904, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 3904, 3912, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[3912] = 33; - Arrays.fill(CHARS, 3913, 3946, (byte) -19 ); // Fill 33 of value (byte) -19 - Arrays.fill(CHARS, 3946, 3953, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 3953, 3973, (byte) -87 ); // Fill 20 of value (byte) -87 - CHARS[3973] = 33; - Arrays.fill(CHARS, 3974, 3980, (byte) -87 ); // Fill 6 of value (byte) -87 - Arrays.fill(CHARS, 3980, 3984, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3984, 3990, (byte) -87 ); // Fill 6 of value (byte) -87 - CHARS[3990] = 33; - CHARS[3991] = -87; - CHARS[3992] = 33; - Arrays.fill(CHARS, 3993, 4014, (byte) -87 ); // Fill 21 of value (byte) -87 - Arrays.fill(CHARS, 4014, 4017, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 4017, 4024, (byte) -87 ); // Fill 7 of value (byte) -87 - CHARS[4024] = 33; - CHARS[4025] = -87; - Arrays.fill(CHARS, 4026, 4256, (byte) 33 ); // Fill 230 of value (byte) 33 - Arrays.fill(CHARS, 4256, 4294, (byte) -19 ); // Fill 38 of value (byte) -19 - Arrays.fill(CHARS, 4294, 4304, (byte) 33 ); // Fill 10 of value (byte) 33 - Arrays.fill(CHARS, 4304, 4343, (byte) -19 ); // Fill 39 of value (byte) -19 - Arrays.fill(CHARS, 4343, 4352, (byte) 33 ); // Fill 9 of value (byte) 33 - CHARS[4352] = -19; - CHARS[4353] = 33; - Arrays.fill(CHARS, 4354, 4356, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[4356] = 33; - Arrays.fill(CHARS, 4357, 4360, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[4360] = 33; - CHARS[4361] = -19; - CHARS[4362] = 33; - Arrays.fill(CHARS, 4363, 4365, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[4365] = 33; - Arrays.fill(CHARS, 4366, 4371, (byte) -19 ); // Fill 5 of value (byte) -19 - Arrays.fill(CHARS, 4371, 4412, (byte) 33 ); // Fill 41 of value (byte) 33 - CHARS[4412] = -19; - CHARS[4413] = 33; - CHARS[4414] = -19; - CHARS[4415] = 33; - CHARS[4416] = -19; - Arrays.fill(CHARS, 4417, 4428, (byte) 33 ); // Fill 11 of value (byte) 33 - CHARS[4428] = -19; - CHARS[4429] = 33; - CHARS[4430] = -19; - CHARS[4431] = 33; - CHARS[4432] = -19; - Arrays.fill(CHARS, 4433, 4436, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 4436, 4438, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 4438, 4441, (byte) 33 ); // Fill 3 of value (byte) 33 - CHARS[4441] = -19; - Arrays.fill(CHARS, 4442, 4447, (byte) 33 ); // Fill 5 of value (byte) 33 - Arrays.fill(CHARS, 4447, 4450, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[4450] = 33; - CHARS[4451] = -19; - CHARS[4452] = 33; - CHARS[4453] = -19; - CHARS[4454] = 33; - CHARS[4455] = -19; - CHARS[4456] = 33; - CHARS[4457] = -19; - Arrays.fill(CHARS, 4458, 4461, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 4461, 4463, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 4463, 4466, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 4466, 4468, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[4468] = 33; - CHARS[4469] = -19; - Arrays.fill(CHARS, 4470, 4510, (byte) 33 ); // Fill 40 of value (byte) 33 - CHARS[4510] = -19; - Arrays.fill(CHARS, 4511, 4520, (byte) 33 ); // Fill 9 of value (byte) 33 - CHARS[4520] = -19; - Arrays.fill(CHARS, 4521, 4523, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[4523] = -19; - Arrays.fill(CHARS, 4524, 4526, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 4526, 4528, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 4528, 4535, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 4535, 4537, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[4537] = 33; - CHARS[4538] = -19; - CHARS[4539] = 33; - Arrays.fill(CHARS, 4540, 4547, (byte) -19 ); // Fill 7 of value (byte) -19 - Arrays.fill(CHARS, 4547, 4587, (byte) 33 ); // Fill 40 of value (byte) 33 - CHARS[4587] = -19; - Arrays.fill(CHARS, 4588, 4592, (byte) 33 ); // Fill 4 of value (byte) 33 - CHARS[4592] = -19; - Arrays.fill(CHARS, 4593, 4601, (byte) 33 ); // Fill 8 of value (byte) 33 - CHARS[4601] = -19; - Arrays.fill(CHARS, 4602, 7680, (byte) 33 ); // Fill 3078 of value (byte) 33 - Arrays.fill(CHARS, 7680, 7836, (byte) -19 ); // Fill 156 of value (byte) -19 - Arrays.fill(CHARS, 7836, 7840, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 7840, 7930, (byte) -19 ); // Fill 90 of value (byte) -19 - Arrays.fill(CHARS, 7930, 7936, (byte) 33 ); // Fill 6 of value (byte) 33 - Arrays.fill(CHARS, 7936, 7958, (byte) -19 ); // Fill 22 of value (byte) -19 - Arrays.fill(CHARS, 7958, 7960, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 7960, 7966, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 7966, 7968, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 7968, 8006, (byte) -19 ); // Fill 38 of value (byte) -19 - Arrays.fill(CHARS, 8006, 8008, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 8008, 8014, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 8014, 8016, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 8016, 8024, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[8024] = 33; - CHARS[8025] = -19; - CHARS[8026] = 33; - CHARS[8027] = -19; - CHARS[8028] = 33; - CHARS[8029] = -19; - CHARS[8030] = 33; - Arrays.fill(CHARS, 8031, 8062, (byte) -19 ); // Fill 31 of value (byte) -19 - Arrays.fill(CHARS, 8062, 8064, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 8064, 8117, (byte) -19 ); // Fill 53 of value (byte) -19 - CHARS[8117] = 33; - Arrays.fill(CHARS, 8118, 8125, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[8125] = 33; - CHARS[8126] = -19; - Arrays.fill(CHARS, 8127, 8130, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 8130, 8133, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[8133] = 33; - Arrays.fill(CHARS, 8134, 8141, (byte) -19 ); // Fill 7 of value (byte) -19 - Arrays.fill(CHARS, 8141, 8144, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 8144, 8148, (byte) -19 ); // Fill 4 of value (byte) -19 - Arrays.fill(CHARS, 8148, 8150, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 8150, 8156, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 8156, 8160, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 8160, 8173, (byte) -19 ); // Fill 13 of value (byte) -19 - Arrays.fill(CHARS, 8173, 8178, (byte) 33 ); // Fill 5 of value (byte) 33 - Arrays.fill(CHARS, 8178, 8181, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[8181] = 33; - Arrays.fill(CHARS, 8182, 8189, (byte) -19 ); // Fill 7 of value (byte) -19 - Arrays.fill(CHARS, 8189, 8400, (byte) 33 ); // Fill 211 of value (byte) 33 - Arrays.fill(CHARS, 8400, 8413, (byte) -87 ); // Fill 13 of value (byte) -87 - Arrays.fill(CHARS, 8413, 8417, (byte) 33 ); // Fill 4 of value (byte) 33 - CHARS[8417] = -87; - Arrays.fill(CHARS, 8418, 8486, (byte) 33 ); // Fill 68 of value (byte) 33 - CHARS[8486] = -19; - Arrays.fill(CHARS, 8487, 8490, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 8490, 8492, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 8492, 8494, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[8494] = -19; - Arrays.fill(CHARS, 8495, 8576, (byte) 33 ); // Fill 81 of value (byte) 33 - Arrays.fill(CHARS, 8576, 8579, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 8579, 12293, (byte) 33 ); // Fill 3714 of value (byte) 33 - CHARS[12293] = -87; - CHARS[12294] = 33; - CHARS[12295] = -19; - Arrays.fill(CHARS, 12296, 12321, (byte) 33 ); // Fill 25 of value (byte) 33 - Arrays.fill(CHARS, 12321, 12330, (byte) -19 ); // Fill 9 of value (byte) -19 - Arrays.fill(CHARS, 12330, 12336, (byte) -87 ); // Fill 6 of value (byte) -87 - CHARS[12336] = 33; - Arrays.fill(CHARS, 12337, 12342, (byte) -87 ); // Fill 5 of value (byte) -87 - Arrays.fill(CHARS, 12342, 12353, (byte) 33 ); // Fill 11 of value (byte) 33 - Arrays.fill(CHARS, 12353, 12437, (byte) -19 ); // Fill 84 of value (byte) -19 - Arrays.fill(CHARS, 12437, 12441, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 12441, 12443, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 12443, 12445, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 12445, 12447, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 12447, 12449, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 12449, 12539, (byte) -19 ); // Fill 90 of value (byte) -19 - CHARS[12539] = 33; - Arrays.fill(CHARS, 12540, 12543, (byte) -87 ); // Fill 3 of value (byte) -87 - Arrays.fill(CHARS, 12543, 12549, (byte) 33 ); // Fill 6 of value (byte) 33 - Arrays.fill(CHARS, 12549, 12589, (byte) -19 ); // Fill 40 of value (byte) -19 - Arrays.fill(CHARS, 12589, 19968, (byte) 33 ); // Fill 7379 of value (byte) 33 - Arrays.fill(CHARS, 19968, 40870, (byte) -19 ); // Fill 20902 of value (byte) -19 - Arrays.fill(CHARS, 40870, 44032, (byte) 33 ); // Fill 3162 of value (byte) 33 - Arrays.fill(CHARS, 44032, 55204, (byte) -19 ); // Fill 11172 of value (byte) -19 - Arrays.fill(CHARS, 55204, 55296, (byte) 33 ); // Fill 92 of value (byte) 33 - Arrays.fill(CHARS, 57344, 65534, (byte) 33 ); // Fill 8190 of value (byte) 33 - - } // () - - // - // Public static methods - // - - /** - * Returns true if the specified character is a supplemental character. - * - * @param c The character to check. - */ - public static boolean isSupplemental(int c) { - return (c >= 0x10000 && c <= 0x10FFFF); - } - - /** - * Returns true the supplemental character corresponding to the given - * surrogates. - * - * @param h The high surrogate. - * @param l The low surrogate. - */ - public static int supplemental(char h, char l) { - return (h - 0xD800) * 0x400 + (l - 0xDC00) + 0x10000; - } - - /** - * Returns the high surrogate of a supplemental character - * - * @param c The supplemental character to "split". - */ - public static char highSurrogate(int c) { - return (char) (((c - 0x00010000) >> 10) + 0xD800); - } - - /** - * Returns the low surrogate of a supplemental character - * - * @param c The supplemental character to "split". - */ - public static char lowSurrogate(int c) { - return (char) (((c - 0x00010000) & 0x3FF) + 0xDC00); - } - - /** - * Returns whether the given character is a high surrogate - * - * @param c The character to check. - */ - public static boolean isHighSurrogate(int c) { - return (0xD800 <= c && c <= 0xDBFF); - } - - /** - * Returns whether the given character is a low surrogate - * - * @param c The character to check. - */ - public static boolean isLowSurrogate(int c) { - return (0xDC00 <= c && c <= 0xDFFF); - } - - - /** - * Returns true if the specified character is valid. This method - * also checks the surrogate character range from 0x10000 to 0x10FFFF. - *

    - * If the program chooses to apply the mask directly to the - * CHARS array, then they are responsible for checking - * the surrogate character range. - * - * @param c The character to check. - */ - public static boolean isValid(int c) { - return (c < 0x10000 && (CHARS[c] & MASK_VALID) != 0) || - (0x10000 <= c && c <= 0x10FFFF); - } // isValid(int):boolean - - /** - * Returns true if the specified character is invalid. - * - * @param c The character to check. - */ - public static boolean isInvalid(int c) { - return !isValid(c); - } // isInvalid(int):boolean - - /** - * Returns true if the specified character can be considered content. - * - * @param c The character to check. - */ - public static boolean isContent(int c) { - return (c < 0x10000 && (CHARS[c] & MASK_CONTENT) != 0) || - (0x10000 <= c && c <= 0x10FFFF); - } // isContent(int):boolean - - /** - * Returns true if the specified character can be considered markup. - * Markup characters include '<', '&', and '%'. - * - * @param c The character to check. - */ - public static boolean isMarkup(int c) { - return c == '<' || c == '&' || c == '%'; - } // isMarkup(int):boolean - - /** - * Returns true if the specified character is a space character - * as defined by production [3] in the XML 1.0 specification. - * - * @param c The character to check. - */ - public static boolean isSpace(int c) { - return c <= 0x20 && (CHARS[c] & MASK_SPACE) != 0; - } // isSpace(int):boolean - - /** - * Returns true if the specified character is a valid name start - * character as defined by production [5] in the XML 1.0 - * specification. - * - * @param c The character to check. - */ - public static boolean isNameStart(int c) { - return c < 0x10000 && (CHARS[c] & MASK_NAME_START) != 0; - } // isNameStart(int):boolean - - /** - * Returns true if the specified character is a valid name - * character as defined by production [4] in the XML 1.0 - * specification. - * - * @param c The character to check. - */ - public static boolean isName(int c) { - return c < 0x10000 && (CHARS[c] & MASK_NAME) != 0; - } // isName(int):boolean - - /** - * Returns true if the specified character is a valid NCName start - * character as defined by production [4] in Namespaces in XML - * recommendation. - * - * @param c The character to check. - */ - public static boolean isNCNameStart(int c) { - return c < 0x10000 && (CHARS[c] & MASK_NCNAME_START) != 0; - } // isNCNameStart(int):boolean - - /** - * Returns true if the specified character is a valid NCName - * character as defined by production [5] in Namespaces in XML - * recommendation. - * - * @param c The character to check. - */ - public static boolean isNCName(int c) { - return c < 0x10000 && (CHARS[c] & MASK_NCNAME) != 0; - } // isNCName(int):boolean - - /** - * Returns true if the specified character is a valid Pubid - * character as defined by production [13] in the XML 1.0 - * specification. - * - * @param c The character to check. - */ - public static boolean isPubid(int c) { - return c < 0x10000 && (CHARS[c] & MASK_PUBID) != 0; - } // isPubid(int):boolean - - /* - * [5] Name ::= (Letter | '_' | ':') (NameChar)* - */ - /** - * Check to see if a string is a valid Name according to [5] - * in the XML 1.0 Recommendation - * - * @param name string to check - * @return true if name is a valid Name - */ - public static boolean isValidName(String name) { - if (name.length() == 0) - return false; - char ch = name.charAt(0); - if( isNameStart(ch) == false) - return false; - for (int i = 1; i < name.length(); i++ ) { - ch = name.charAt(i); - if( isName( ch ) == false ){ - return false; - } - } - return true; - } // isValidName(String):boolean - - - /* - * from the namespace rec - * [4] NCName ::= (Letter | '_') (NCNameChar)* - */ - /** - * Check to see if a string is a valid NCName according to [4] - * from the XML Namespaces 1.0 Recommendation - * - * @param name string to check - * @return true if name is a valid NCName - */ - public static boolean isValidNCName(String ncName) { - if (ncName.length() == 0) - return false; - char ch = ncName.charAt(0); - if( isNCNameStart(ch) == false) - return false; - for (int i = 1; i < ncName.length(); i++ ) { - ch = ncName.charAt(i); - if( isNCName( ch ) == false ){ - return false; - } - } - return true; - } // isValidNCName(String):boolean - - /* - * [7] Nmtoken ::= (NameChar)+ - */ - /** - * Check to see if a string is a valid Nmtoken according to [7] - * in the XML 1.0 Recommendation - * - * @param nmtoken string to check - * @return true if nmtoken is a valid Nmtoken - */ - public static boolean isValidNmtoken(String nmtoken) { - if (nmtoken.length() == 0) - return false; - for (int i = 0; i < nmtoken.length(); i++ ) { - char ch = nmtoken.charAt(i); - if( ! isName( ch ) ){ - return false; - } - } - return true; - } // isValidName(String):boolean - - - - - - // encodings - - /** - * Returns true if the encoding name is a valid IANA encoding. - * This method does not verify that there is a decoder available - * for this encoding, only that the characters are valid for an - * IANA encoding name. - * - * @param ianaEncoding The IANA encoding name. - */ - public static boolean isValidIANAEncoding(String ianaEncoding) { - if (ianaEncoding != null) { - int length = ianaEncoding.length(); - if (length > 0) { - char c = ianaEncoding.charAt(0); - if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { - for (int i = 1; i < length; i++) { - c = ianaEncoding.charAt(i); - if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && - (c < '0' || c > '9') && c != '.' && c != '_' && - c != '-') { - return false; - } - } - return true; - } - } - } - return false; - } // isValidIANAEncoding(String):boolean - - /** - * Returns true if the encoding name is a valid Java encoding. - * This method does not verify that there is a decoder available - * for this encoding, only that the characters are valid for an - * Java encoding name. - * - * @param javaEncoding The Java encoding name. - */ - public static boolean isValidJavaEncoding(String javaEncoding) { - if (javaEncoding != null) { - int length = javaEncoding.length(); - if (length > 0) { - for (int i = 1; i < length; i++) { - char c = javaEncoding.charAt(i); - if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && - (c < '0' || c > '9') && c != '.' && c != '_' && - c != '-') { - return false; - } - } - return true; - } - } - return false; - } // isValidIANAEncoding(String):boolean - - -} // class XMLChar diff --git a/impl/src/main/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java b/impl/src/main/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java deleted file mode 100644 index cffc803..0000000 --- a/impl/src/main/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java +++ /dev/null @@ -1,1690 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.xmlparser; - -import java.io.EOFException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.IOException; -import java.io.Reader; -import java.util.Locale; -import java.util.jar.JarFile; - -import org.apache.jasper.JasperException; -import org.apache.jasper.JspCompilationContext; -import org.apache.jasper.compiler.ErrorDispatcher; -import org.apache.jasper.compiler.JspUtil; - -public class XMLEncodingDetector { - - private InputStream stream; - private String encoding; - private boolean isEncodingSetInProlog; - private Boolean isBigEndian; - private Boolean hasBom; - private Reader reader; - - // org.apache.xerces.impl.XMLEntityManager fields - public static final int DEFAULT_BUFFER_SIZE = 2048; - public static final int DEFAULT_XMLDECL_BUFFER_SIZE = 64; - /* PWC1.2 6298448 - private boolean fAllowJavaEncodings; - */ - // START PWC1.2 6298448 - private boolean fAllowJavaEncodings = true; - // END PWC1.2 6298448 - private SymbolTable fSymbolTable; - private XMLEncodingDetector fCurrentEntity; - private int fBufferSize = DEFAULT_BUFFER_SIZE; - - // org.apache.xerces.impl.XMLEntityManager.ScannedEntity fields - private int lineNumber = 1; - private int columnNumber = 1; - private boolean literal; - private char[] ch = new char[DEFAULT_BUFFER_SIZE]; - private int position; - private int count; - private boolean mayReadChunks = false; - - // org.apache.xerces.impl.XMLScanner fields - private XMLString fString = new XMLString(); - private XMLStringBuffer fStringBuffer = new XMLStringBuffer(); - private XMLStringBuffer fStringBuffer2 = new XMLStringBuffer(); - private final static String fVersionSymbol = "version"; - private final static String fEncodingSymbol = "encoding"; - private final static String fStandaloneSymbol = "standalone"; - - // org.apache.xerces.impl.XMLDocumentFragmentScannerImpl fields - private int fMarkupDepth = 0; - private String[] fStrings = new String[3]; - - private ErrorDispatcher err; - - /** - * Constructor - */ - public XMLEncodingDetector() { - fSymbolTable = new SymbolTable(); - fCurrentEntity = this; - } - - /** - * Autodetects the encoding of the XML document supplied by the given - * input stream. - * - * Encoding autodetection is done according to the XML 1.0 specification, - * Appendix F.1: Detection Without External Encoding Information. - * - * @return Two-element array, where the first element (of type - * java.lang.String) contains the name of the (auto)detected encoding, and - * the second element (of type java.lang.Boolean) specifies whether the - * encoding was specified using the 'encoding' attribute of an XML prolog - * (TRUE) or autodetected (FALSE). - */ - public static Object[] getEncoding(String fname, JarFile jarFile, - JspCompilationContext ctxt, - ErrorDispatcher err) - throws IOException, JasperException - { - InputStream inStream = JspUtil.getInputStream(fname, jarFile, ctxt, - err); - XMLEncodingDetector detector = new XMLEncodingDetector(); - Object[] ret = detector.getEncoding(inStream, err); - inStream.close(); - - return ret; - } - - private Object[] getEncoding(InputStream in, ErrorDispatcher err) - throws IOException, JasperException - { - this.stream = in; - this.err=err; - createInitialReader(); - scanXMLDecl(); - - return new Object[] { this.encoding, - Boolean.valueOf(this.isEncodingSetInProlog), - this.hasBom }; - } - - // stub method - void endEntity() { - } - - // Adapted from: - // org.apache.xerces.impl.XMLEntityManager.startEntity() - private void createInitialReader() throws IOException, JasperException { - - // wrap this stream in RewindableInputStream - stream = new RewindableInputStream(stream); - - // perform auto-detect of encoding if necessary - if (encoding == null) { - // read first four bytes and determine encoding - final byte[] b4 = new byte[4]; - int count = 0; - for (; count<4; count++ ) { - b4[count] = (byte)stream.read(); - } - if (count == 4) { - Object [] encodingDesc = getEncodingName(b4, count); - encoding = (String)(encodingDesc[0]); - isBigEndian = (Boolean)(encodingDesc[1]); - hasBom = (Boolean)(encodingDesc[2]); - - stream.reset(); - // Special case UTF-8 files with BOM created by Microsoft - // tools. It's more efficient to consume the BOM than make - // the reader perform extra checks. -Ac - if (count > 2 && encoding.equals("UTF-8")) { - int b0 = b4[0] & 0xFF; - int b1 = b4[1] & 0xFF; - int b2 = b4[2] & 0xFF; - if (b0 == 0xEF && b1 == 0xBB && b2 == 0xBF) { - // ignore first three bytes... - stream.skip(3); - } - } - reader = createReader(stream, encoding, isBigEndian); - } else { - reader = createReader(stream, encoding, isBigEndian); - } - } - } - - // Adapted from: - // org.apache.xerces.impl.XMLEntityManager.createReader - /** - * Creates a reader capable of reading the given input stream in - * the specified encoding. - * - * @param inputStream The input stream. - * @param encoding The encoding name that the input stream is - * encoded using. If the user has specified that - * Java encoding names are allowed, then the - * encoding name may be a Java encoding name; - * otherwise, it is an ianaEncoding name. - * @param isBigEndian For encodings (like uCS-4), whose names cannot - * specify a byte order, this tells whether the order - * is bigEndian. null means unknown or not relevant. - * - * @return Returns a reader. - */ - private Reader createReader(InputStream inputStream, String encoding, - Boolean isBigEndian) - throws IOException, JasperException { - - // normalize encoding name - if (encoding == null) { - encoding = "UTF-8"; - } - - // try to use an optimized reader - String ENCODING = encoding.toUpperCase(Locale.ENGLISH); - if (ENCODING.equals("UTF-8")) { - return new UTF8Reader(inputStream, fBufferSize); - } - if (ENCODING.equals("US-ASCII")) { - return new ASCIIReader(inputStream, fBufferSize); - } - if (ENCODING.equals("ISO-10646-UCS-4")) { - if (isBigEndian != null) { - boolean isBE = isBigEndian.booleanValue(); - if (isBE) { - return new UCSReader(inputStream, UCSReader.UCS4BE); - } else { - return new UCSReader(inputStream, UCSReader.UCS4LE); - } - } else { - err.jspError("jsp.error.xml.encodingByteOrderUnsupported", - encoding); - } - } - if (ENCODING.equals("ISO-10646-UCS-2")) { - if (isBigEndian != null) { // sould never happen with this encoding... - boolean isBE = isBigEndian.booleanValue(); - if (isBE) { - return new UCSReader(inputStream, UCSReader.UCS2BE); - } else { - return new UCSReader(inputStream, UCSReader.UCS2LE); - } - } else { - err.jspError("jsp.error.xml.encodingByteOrderUnsupported", - encoding); - } - } - - // check for valid name - boolean validIANA = XMLChar.isValidIANAEncoding(encoding); - boolean validJava = XMLChar.isValidJavaEncoding(encoding); - if (!validIANA || (fAllowJavaEncodings && !validJava)) { - err.jspError("jsp.error.xml.encodingDeclInvalid", encoding); - // NOTE: AndyH suggested that, on failure, we use ISO Latin 1 - // because every byte is a valid ISO Latin 1 character. - // It may not translate correctly but if we failed on - // the encoding anyway, then we're expecting the content - // of the document to be bad. This will just prevent an - // invalid UTF-8 sequence to be detected. This is only - // important when continue-after-fatal-error is turned - // on. -Ac - encoding = "ISO-8859-1"; - } - - // try to use a Java reader - String javaEncoding = EncodingMap.getIANA2JavaMapping(ENCODING); - if (javaEncoding == null) { - if (fAllowJavaEncodings) { - javaEncoding = encoding; - } else { - err.jspError("jsp.error.xml.encodingDeclInvalid", encoding); - // see comment above. - javaEncoding = "ISO8859_1"; - } - } - return new InputStreamReader(inputStream, javaEncoding); - - } // createReader(InputStream,String, Boolean): Reader - - // Adapted from: - // org.apache.xerces.impl.XMLEntityManager.getEncodingName - /** - * Returns the IANA encoding name that is auto-detected from - * the bytes specified, with the endian-ness of that encoding where - * appropriate. - * - * @param b4 The first four bytes of the input. - * @param count The number of bytes actually read. - * @return a 2-element array: the first element, an IANA-encoding string, - * the second element a Boolean which is true iff the document is big - * endian, false if it's little-endian, and null if the distinction isn't - * relevant. - */ - private Object[] getEncodingName(byte[] b4, int count) { - - if (count < 2) { - return new Object[]{"UTF-8", null, null}; - } - - // UTF-16, with BOM - int b0 = b4[0] & 0xFF; - int b1 = b4[1] & 0xFF; - if (b0 == 0xFE && b1 == 0xFF) { - // UTF-16, big-endian, with a BOM - return new Object [] {"UTF-16BE", Boolean.TRUE, - Boolean.TRUE}; - } - /* SJSAS 6307968 - if (b0 == 0xFF && b1 == 0xFE) { - */ - // BEGIN SJSAS 6307968 - if (count == 2 && b0 == 0xFF && b1 == 0xFE) { - // END SJSAS 6307968 - // UTF-16, little-endian, with a BOM - return new Object [] {"UTF-16LE", Boolean.FALSE, - Boolean.TRUE}; - } - - // default to UTF-8 if we don't have enough bytes to make a - // good determination of the encoding - if (count < 3) { - return new Object [] {"UTF-8", null, null}; - } - - // UTF-8 with a BOM - int b2 = b4[2] & 0xFF; - if (b0 == 0xEF && b1 == 0xBB && b2 == 0xBF) { - return new Object [] {"UTF-8", null, Boolean.TRUE}; - } - - // default to UTF-8 if we don't have enough bytes to make a - // good determination of the encoding - if (count < 4) { - return new Object [] {"UTF-8", null, null}; - } - - // other encodings - int b3 = b4[3] & 0xFF; - if (b0 == 0x00 && b1 == 0x00 && b2 == 0x00 && b3 == 0x3C) { - // UCS-4, big endian (1234) - return new Object [] {"ISO-10646-UCS-4", Boolean.TRUE, null}; - } - if (b0 == 0x3C && b1 == 0x00 && b2 == 0x00 && b3 == 0x00) { - // UCS-4, little endian (4321) - return new Object [] {"ISO-10646-UCS-4", Boolean.FALSE, null}; - } - if (b0 == 0x00 && b1 == 0x00 && b2 == 0x3C && b3 == 0x00) { - // UCS-4, unusual octet order (2143) - // REVISIT: What should this be? - return new Object [] {"ISO-10646-UCS-4", null, null}; - } - if (b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x00) { - // UCS-4, unusual octect order (3412) - // REVISIT: What should this be? - return new Object [] {"ISO-10646-UCS-4", null, null}; - } - if (b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x3F) { - // UTF-16, big-endian, no BOM - // (or could turn out to be UCS-2... - // REVISIT: What should this be? - return new Object [] {"UTF-16BE", Boolean.TRUE, null}; - } - if (b0 == 0x3C && b1 == 0x00 && b2 == 0x3F && b3 == 0x00) { - // UTF-16, little-endian, no BOM - // (or could turn out to be UCS-2... - return new Object [] {"UTF-16LE", Boolean.FALSE, null}; - } - if (b0 == 0x4C && b1 == 0x6F && b2 == 0xA7 && b3 == 0x94) { - // EBCDIC - // a la xerces1, return CP037 instead of EBCDIC here - return new Object [] {"CP037", null, null}; - } - if (b0 == 0x00 && b1 == 0x00 && b2 == 0xFE && b3 == 0xFF) { - // UTF-32, big-endian, with a BOM - return new Object [] {"UTF-32BE", Boolean.TRUE, - Boolean.TRUE}; - } - if (b0 == 0xFF && b1 == 0xFE && b2 == 0x00 && b3 == 0x00) { - // UTF-32, little-endian, with a BOM - return new Object [] {"UTF-32LE", Boolean.FALSE, - Boolean.TRUE}; - } - // BEGIN SJSAS 6307968 - if (b0 == 0xFF && b1 == 0xFE) { - // UTF-16, little-endian, with a BOM - return new Object [] {"UTF-16LE", Boolean.FALSE, - Boolean.TRUE}; - } - // END SJSAS 6307968 - - // default encoding - return new Object [] {"UTF-8", null, null}; - - } - - // Adapted from: - // org.apache.xerces.impl.XMLEntityManager.EntityScanner.isExternal - /** Returns true if the current entity being scanned is external. */ - public boolean isExternal() { - return true; - } - - // Adapted from: - // org.apache.xerces.impl.XMLEntityManager.EntityScanner.peekChar - /** - * Returns the next character on the input. - *

    - * Note: The character is not consumed. - * - * @throws IOException Thrown if i/o error occurs. - * @throws EOFException Thrown on end of file. - */ - public int peekChar() throws IOException { - - // load more characters, if needed - if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); - } - - // peek at character - int c = fCurrentEntity.ch[fCurrentEntity.position]; - - // return peeked character - if (fCurrentEntity.isExternal()) { - return c != '\r' ? c : '\n'; - } - else { - return c; - } - - } // peekChar():int - - // Adapted from: - // org.apache.xerces.impl.XMLEntityManager.EntityScanner.scanChar - /** - * Returns the next character on the input. - *

    - * Note: The character is consumed. - * - * @throws IOException Thrown if i/o error occurs. - * @throws EOFException Thrown on end of file. - */ - public int scanChar() throws IOException { - - // load more characters, if needed - if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); - } - - // scan character - int c = fCurrentEntity.ch[fCurrentEntity.position++]; - boolean external = false; - if (c == '\n' || - (c == '\r' && (external = fCurrentEntity.isExternal()))) { - fCurrentEntity.lineNumber++; - fCurrentEntity.columnNumber = 1; - if (fCurrentEntity.position == fCurrentEntity.count) { - fCurrentEntity.ch[0] = (char)c; - load(1, false); - } - if (c == '\r' && external) { - if (fCurrentEntity.ch[fCurrentEntity.position++] != '\n') { - fCurrentEntity.position--; - } - c = '\n'; - } - } - - // return character that was scanned - fCurrentEntity.columnNumber++; - return c; - - } - - // Adapted from: - // org.apache.xerces.impl.XMLEntityManager.EntityScanner.scanName - /** - * Returns a string matching the Name production appearing immediately - * on the input as a symbol, or null if no Name string is present. - *

    - * Note: The Name characters are consumed. - *

    - * Note: The string returned must be a symbol. The - * SymbolTable can be used for this purpose. - * - * @throws IOException Thrown if i/o error occurs. - * @throws EOFException Thrown on end of file. - * - * @see SymbolTable - * @see XMLChar#isName - * @see XMLChar#isNameStart - */ - public String scanName() throws IOException { - - // load more characters, if needed - if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); - } - - // scan name - int offset = fCurrentEntity.position; - if (XMLChar.isNameStart(fCurrentEntity.ch[offset])) { - if (++fCurrentEntity.position == fCurrentEntity.count) { - fCurrentEntity.ch[0] = fCurrentEntity.ch[offset]; - offset = 0; - if (load(1, false)) { - fCurrentEntity.columnNumber++; - String symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, - 0, 1); - return symbol; - } - } - while (XMLChar.isName(fCurrentEntity.ch[fCurrentEntity.position])) { - if (++fCurrentEntity.position == fCurrentEntity.count) { - int length = fCurrentEntity.position - offset; - if (length == fBufferSize) { - // bad luck we have to resize our buffer - char[] tmp = new char[fBufferSize * 2]; - System.arraycopy(fCurrentEntity.ch, offset, - tmp, 0, length); - fCurrentEntity.ch = tmp; - fBufferSize *= 2; - } else { - System.arraycopy(fCurrentEntity.ch, offset, - fCurrentEntity.ch, 0, length); - } - offset = 0; - if (load(length, false)) { - break; - } - } - } - } - int length = fCurrentEntity.position - offset; - fCurrentEntity.columnNumber += length; - - // return name - String symbol = null; - if (length > 0) { - symbol = fSymbolTable.addSymbol(fCurrentEntity.ch, offset, length); - } - return symbol; - - } - - // Adapted from: - // org.apache.xerces.impl.XMLEntityManager.EntityScanner.scanLiteral - /** - * Scans a range of attribute value data, setting the fields of the - * XMLString structure, appropriately. - *

    - * Note: The characters are consumed. - *

    - * Note: This method does not guarantee to return - * the longest run of attribute value data. This method may return - * before the quote character due to reaching the end of the input - * buffer or any other reason. - *

    - * Note: The fields contained in the XMLString - * structure are not guaranteed to remain valid upon subsequent calls - * to the entity scanner. Therefore, the caller is responsible for - * immediately using the returned character data or making a copy of - * the character data. - * - * @param quote The quote character that signifies the end of the - * attribute value data. - * @param content The content structure to fill. - * - * @return Returns the next character on the input, if known. This - * value may be -1 but this does note designate - * end of file. - * - * @throws IOException Thrown if i/o error occurs. - * @throws EOFException Thrown on end of file. - */ - public int scanLiteral(int quote, XMLString content) - throws IOException { - - // load more characters, if needed - if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); - } else if (fCurrentEntity.position == fCurrentEntity.count - 1) { - fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1]; - load(1, false); - fCurrentEntity.position = 0; - } - - // normalize newlines - int offset = fCurrentEntity.position; - int c = fCurrentEntity.ch[offset]; - int newlines = 0; - boolean external = fCurrentEntity.isExternal(); - if (c == '\n' || (c == '\r' && external)) { - do { - c = fCurrentEntity.ch[fCurrentEntity.position++]; - if (c == '\r' && external) { - newlines++; - fCurrentEntity.lineNumber++; - fCurrentEntity.columnNumber = 1; - if (fCurrentEntity.position == fCurrentEntity.count) { - offset = 0; - fCurrentEntity.position = newlines; - if (load(newlines, false)) { - break; - } - } - if (fCurrentEntity.ch[fCurrentEntity.position] == '\n') { - fCurrentEntity.position++; - offset++; - } - /*** NEWLINE NORMALIZATION ***/ - else { - newlines++; - } - /***/ - } - else if (c == '\n') { - newlines++; - fCurrentEntity.lineNumber++; - fCurrentEntity.columnNumber = 1; - if (fCurrentEntity.position == fCurrentEntity.count) { - offset = 0; - fCurrentEntity.position = newlines; - if (load(newlines, false)) { - break; - } - } - /*** NEWLINE NORMALIZATION *** - if (fCurrentEntity.ch[fCurrentEntity.position] == '\r' - && external) { - fCurrentEntity.position++; - offset++; - } - /***/ - } - else { - fCurrentEntity.position--; - break; - } - } while (fCurrentEntity.position < fCurrentEntity.count - 1); - for (int i = offset; i < fCurrentEntity.position; i++) { - fCurrentEntity.ch[i] = '\n'; - } - int length = fCurrentEntity.position - offset; - if (fCurrentEntity.position == fCurrentEntity.count - 1) { - content.setValues(fCurrentEntity.ch, offset, length); - return -1; - } - } - - // scan literal value - while (fCurrentEntity.position < fCurrentEntity.count) { - c = fCurrentEntity.ch[fCurrentEntity.position++]; - if ((c == quote && - (!fCurrentEntity.literal || external)) - || c == '%' || !XMLChar.isContent(c)) { - fCurrentEntity.position--; - break; - } - } - int length = fCurrentEntity.position - offset; - fCurrentEntity.columnNumber += length - newlines; - content.setValues(fCurrentEntity.ch, offset, length); - - // return next character - if (fCurrentEntity.position != fCurrentEntity.count) { - c = fCurrentEntity.ch[fCurrentEntity.position]; - // NOTE: We don't want to accidentally signal the - // end of the literal if we're expanding an - // entity appearing in the literal. -Ac - if (c == quote && fCurrentEntity.literal) { - c = -1; - } - } - else { - c = -1; - } - return c; - - } - - /** - * Scans a range of character data up to the specified delimiter, - * setting the fields of the XMLString structure, appropriately. - *

    - * Note: The characters are consumed. - *

    - * Note: This assumes that the internal buffer is - * at least the same size, or bigger, than the length of the delimiter - * and that the delimiter contains at least one character. - *

    - * Note: This method does not guarantee to return - * the longest run of character data. This method may return before - * the delimiter due to reaching the end of the input buffer or any - * other reason. - *

    - * Note: The fields contained in the XMLString - * structure are not guaranteed to remain valid upon subsequent calls - * to the entity scanner. Therefore, the caller is responsible for - * immediately using the returned character data or making a copy of - * the character data. - * - * @param delimiter The string that signifies the end of the character - * data to be scanned. - * @param buffer The data structure to fill. - * - * @return Returns true if there is more data to scan, false otherwise. - * - * @throws IOException Thrown if i/o error occurs. - * @throws EOFException Thrown on end of file. - */ - public boolean scanData(String delimiter, XMLStringBuffer buffer) - throws IOException { - - boolean done = false; - int delimLen = delimiter.length(); - char charAt0 = delimiter.charAt(0); - boolean external = fCurrentEntity.isExternal(); - do { - - // load more characters, if needed - - if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); - } - else if (fCurrentEntity.position >= fCurrentEntity.count - delimLen) { - System.arraycopy(fCurrentEntity.ch, fCurrentEntity.position, - fCurrentEntity.ch, 0, fCurrentEntity.count - fCurrentEntity.position); - load(fCurrentEntity.count - fCurrentEntity.position, false); - fCurrentEntity.position = 0; - } - if (fCurrentEntity.position >= fCurrentEntity.count - delimLen) { - // something must be wrong with the input: e.g., file ends an - // unterminated comment - int length = fCurrentEntity.count - fCurrentEntity.position; - buffer.append (fCurrentEntity.ch, fCurrentEntity.position, - length); - fCurrentEntity.columnNumber += fCurrentEntity.count; - fCurrentEntity.position = fCurrentEntity.count; - load(0,true); - return false; - } - - // normalize newlines - int offset = fCurrentEntity.position; - int c = fCurrentEntity.ch[offset]; - int newlines = 0; - if (c == '\n' || (c == '\r' && external)) { - do { - c = fCurrentEntity.ch[fCurrentEntity.position++]; - if (c == '\r' && external) { - newlines++; - fCurrentEntity.lineNumber++; - fCurrentEntity.columnNumber = 1; - if (fCurrentEntity.position == fCurrentEntity.count) { - offset = 0; - fCurrentEntity.position = newlines; - if (load(newlines, false)) { - break; - } - } - if (fCurrentEntity.ch[fCurrentEntity.position] == '\n') { - fCurrentEntity.position++; - offset++; - } - /*** NEWLINE NORMALIZATION ***/ - else { - newlines++; - } - } - else if (c == '\n') { - newlines++; - fCurrentEntity.lineNumber++; - fCurrentEntity.columnNumber = 1; - if (fCurrentEntity.position == fCurrentEntity.count) { - offset = 0; - fCurrentEntity.position = newlines; - fCurrentEntity.count = newlines; - if (load(newlines, false)) { - break; - } - } - } - else { - fCurrentEntity.position--; - break; - } - } while (fCurrentEntity.position < fCurrentEntity.count - 1); - for (int i = offset; i < fCurrentEntity.position; i++) { - fCurrentEntity.ch[i] = '\n'; - } - int length = fCurrentEntity.position - offset; - if (fCurrentEntity.position == fCurrentEntity.count - 1) { - buffer.append(fCurrentEntity.ch, offset, length); - return true; - } - } - - // iterate over buffer looking for delimiter - OUTER: while (fCurrentEntity.position < fCurrentEntity.count) { - c = fCurrentEntity.ch[fCurrentEntity.position++]; - if (c == charAt0) { - // looks like we just hit the delimiter - int delimOffset = fCurrentEntity.position - 1; - for (int i = 1; i < delimLen; i++) { - if (fCurrentEntity.position == fCurrentEntity.count) { - fCurrentEntity.position -= i; - break OUTER; - } - c = fCurrentEntity.ch[fCurrentEntity.position++]; - if (delimiter.charAt(i) != c) { - fCurrentEntity.position--; - break; - } - } - if (fCurrentEntity.position == delimOffset + delimLen) { - done = true; - break; - } - } - else if (c == '\n' || (external && c == '\r')) { - fCurrentEntity.position--; - break; - } - else if (XMLChar.isInvalid(c)) { - fCurrentEntity.position--; - int length = fCurrentEntity.position - offset; - fCurrentEntity.columnNumber += length - newlines; - buffer.append(fCurrentEntity.ch, offset, length); - return true; - } - } - int length = fCurrentEntity.position - offset; - fCurrentEntity.columnNumber += length - newlines; - if (done) { - length -= delimLen; - } - buffer.append (fCurrentEntity.ch, offset, length); - - // return true if string was skipped - } while (!done); - return !done; - - } - - // Adapted from: - // org.apache.xerces.impl.XMLEntityManager.EntityScanner.skipChar - /** - * Skips a character appearing immediately on the input. - *

    - * Note: The character is consumed only if it matches - * the specified character. - * - * @param c The character to skip. - * - * @return Returns true if the character was skipped. - * - * @throws IOException Thrown if i/o error occurs. - * @throws EOFException Thrown on end of file. - */ - public boolean skipChar(int c) throws IOException { - - // load more characters, if needed - if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); - } - - // skip character - int cc = fCurrentEntity.ch[fCurrentEntity.position]; - if (cc == c) { - fCurrentEntity.position++; - if (c == '\n') { - fCurrentEntity.lineNumber++; - fCurrentEntity.columnNumber = 1; - } - else { - fCurrentEntity.columnNumber++; - } - return true; - } else if (c == '\n' && cc == '\r' && fCurrentEntity.isExternal()) { - // handle newlines - if (fCurrentEntity.position == fCurrentEntity.count) { - fCurrentEntity.ch[0] = (char)cc; - load(1, false); - } - fCurrentEntity.position++; - if (fCurrentEntity.ch[fCurrentEntity.position] == '\n') { - fCurrentEntity.position++; - } - fCurrentEntity.lineNumber++; - fCurrentEntity.columnNumber = 1; - return true; - } - - // character was not skipped - return false; - - } - - // Adapted from: - // org.apache.xerces.impl.XMLEntityManager.EntityScanner.skipSpaces - /** - * Skips space characters appearing immediately on the input. - *

    - * Note: The characters are consumed only if they are - * space characters. - * - * @return Returns true if at least one space character was skipped. - * - * @throws IOException Thrown if i/o error occurs. - * @throws EOFException Thrown on end of file. - * - * @see XMLChar#isSpace - */ - public boolean skipSpaces() throws IOException { - - // load more characters, if needed - if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); - } - - // skip spaces - int c = fCurrentEntity.ch[fCurrentEntity.position]; - if (XMLChar.isSpace(c)) { - boolean external = fCurrentEntity.isExternal(); - do { - boolean entityChanged = false; - // handle newlines - if (c == '\n' || (external && c == '\r')) { - fCurrentEntity.lineNumber++; - fCurrentEntity.columnNumber = 1; - if (fCurrentEntity.position == fCurrentEntity.count - 1) { - fCurrentEntity.ch[0] = (char)c; - entityChanged = load(1, true); - if (!entityChanged) - // the load change the position to be 1, - // need to restore it when entity not changed - fCurrentEntity.position = 0; - } - if (c == '\r' && external) { - // REVISIT: Does this need to be updated to fix the - // #x0D ^#x0A newline normalization problem? -Ac - if (fCurrentEntity.ch[++fCurrentEntity.position] != '\n') { - fCurrentEntity.position--; - } - } - /*** NEWLINE NORMALIZATION *** - else { - if (fCurrentEntity.ch[fCurrentEntity.position + 1] == '\r' - && external) { - fCurrentEntity.position++; - } - } - /***/ - } - else { - fCurrentEntity.columnNumber++; - } - // load more characters, if needed - if (!entityChanged) - fCurrentEntity.position++; - if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); - } - } while (XMLChar.isSpace(c = fCurrentEntity.ch[fCurrentEntity.position])); - return true; - } - - // no spaces were found - return false; - - } - - /** - * Skips the specified string appearing immediately on the input. - *

    - * Note: The characters are consumed only if they are - * space characters. - * - * @param s The string to skip. - * - * @return Returns true if the string was skipped. - * - * @throws IOException Thrown if i/o error occurs. - * @throws EOFException Thrown on end of file. - */ - public boolean skipString(String s) throws IOException { - - // load more characters, if needed - if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, true); - } - - // skip string - final int length = s.length(); - for (int i = 0; i < length; i++) { - char c = fCurrentEntity.ch[fCurrentEntity.position++]; - if (c != s.charAt(i)) { - fCurrentEntity.position -= i + 1; - return false; - } - if (i < length - 1 && fCurrentEntity.position == fCurrentEntity.count) { - System.arraycopy(fCurrentEntity.ch, fCurrentEntity.count - i - 1, fCurrentEntity.ch, 0, i + 1); - // REVISIT: Can a string to be skipped cross an - // entity boundary? -Ac - if (load(i + 1, false)) { - fCurrentEntity.position -= i + 1; - return false; - } - } - } - fCurrentEntity.columnNumber += length; - return true; - - } - - // Adapted from: - // org.apache.xerces.impl.XMLEntityManager.EntityScanner.load - /** - * Loads a chunk of text. - * - * @param offset The offset into the character buffer to - * read the next batch of characters. - * @param changeEntity True if the load should change entities - * at the end of the entity, otherwise leave - * the current entity in place and the entity - * boundary will be signaled by the return - * value. - * - * @returns Returns true if the entity changed as a result of this - * load operation. - */ - final boolean load(int offset, boolean changeEntity) - throws IOException { - - // read characters - int length = fCurrentEntity.mayReadChunks? - (fCurrentEntity.ch.length - offset): - (DEFAULT_XMLDECL_BUFFER_SIZE); - int count = fCurrentEntity.reader.read(fCurrentEntity.ch, offset, - length); - - // reset count and position - boolean entityChanged = false; - if (count != -1) { - if (count != 0) { - fCurrentEntity.count = count + offset; - fCurrentEntity.position = offset; - } - } - - // end of this entity - else { - fCurrentEntity.count = offset; - fCurrentEntity.position = offset; - entityChanged = true; - if (changeEntity) { - endEntity(); - if (fCurrentEntity == null) { - throw new EOFException(); - } - // handle the trailing edges - if (fCurrentEntity.position == fCurrentEntity.count) { - load(0, false); - } - } - } - - return entityChanged; - - } - - // Adapted from: - // org.apache.xerces.impl.XMLEntityManager.RewindableInputStream - /** - * This class wraps the byte inputstreams we're presented with. - * We need it because java.io.InputStreams don't provide - * functionality to reread processed bytes, and they have a habit - * of reading more than one character when you call their read() - * methods. This means that, once we discover the true (declared) - * encoding of a document, we can neither backtrack to read the - * whole doc again nor start reading where we are with a new - * reader. - * - * This class allows rewinding an inputStream by allowing a mark - * to be set, and the stream reset to that position. The - * class assumes that it needs to read one character per - * invocation when it's read() method is inovked, but uses the - * underlying InputStream's read(char[], offset length) method--it - * won't buffer data read this way! - * - * @author Neil Graham, IBM - * @author Glenn Marcy, IBM - */ - private final class RewindableInputStream extends InputStream { - - private InputStream fInputStream; - private byte[] fData; - private int fStartOffset; - private int fEndOffset; - private int fOffset; - private int fLength; - private int fMark; - - public RewindableInputStream(InputStream is) { - fData = new byte[DEFAULT_XMLDECL_BUFFER_SIZE]; - fInputStream = is; - fStartOffset = 0; - fEndOffset = -1; - fOffset = 0; - fLength = 0; - fMark = 0; - } - - public void setStartOffset(int offset) { - fStartOffset = offset; - } - - public void rewind() { - fOffset = fStartOffset; - } - - public int read() throws IOException { - int b = 0; - if (fOffset < fLength) { - return fData[fOffset++] & 0xff; - } - if (fOffset == fEndOffset) { - return -1; - } - if (fOffset == fData.length) { - byte[] newData = new byte[fOffset << 1]; - System.arraycopy(fData, 0, newData, 0, fOffset); - fData = newData; - } - b = fInputStream.read(); - if (b == -1) { - fEndOffset = fOffset; - return -1; - } - fData[fLength++] = (byte)b; - fOffset++; - return b & 0xff; - } - - public int read(byte[] b, int off, int len) throws IOException { - int bytesLeft = fLength - fOffset; - if (bytesLeft == 0) { - if (fOffset == fEndOffset) { - return -1; - } - // better get some more for the voracious reader... - if (fCurrentEntity.mayReadChunks) { - return fInputStream.read(b, off, len); - } - int returnedVal = read(); - if (returnedVal == -1) { - fEndOffset = fOffset; - return -1; - } - b[off] = (byte)returnedVal; - return 1; - } - if (len < bytesLeft) { - if (len <= 0) { - return 0; - } - } - else { - len = bytesLeft; - } - if (b != null) { - System.arraycopy(fData, fOffset, b, off, len); - } - fOffset += len; - return len; - } - - public long skip(long n) - throws IOException - { - int bytesLeft; - if (n <= 0) { - return 0; - } - bytesLeft = fLength - fOffset; - if (bytesLeft == 0) { - if (fOffset == fEndOffset) { - return 0; - } - return fInputStream.skip(n); - } - if (n <= bytesLeft) { - fOffset += n; - return n; - } - fOffset += bytesLeft; - if (fOffset == fEndOffset) { - return bytesLeft; - } - n -= bytesLeft; - /* - * In a manner of speaking, when this class isn't permitting more - * than one byte at a time to be read, it is "blocking". The - * available() method should indicate how much can be read without - * blocking, so while we're in this mode, it should only indicate - * that bytes in its buffer are available; otherwise, the result of - * available() on the underlying InputStream is appropriate. - */ - return fInputStream.skip(n) + bytesLeft; - } - - public int available() throws IOException { - int bytesLeft = fLength - fOffset; - if (bytesLeft == 0) { - if (fOffset == fEndOffset) { - return -1; - } - return fCurrentEntity.mayReadChunks ? fInputStream.available() - : 0; - } - return bytesLeft; - } - - public void mark(int howMuch) { - fMark = fOffset; - } - - public void reset() { - fOffset = fMark; - } - - public boolean markSupported() { - return true; - } - - public void close() throws IOException { - if (fInputStream != null) { - fInputStream.close(); - fInputStream = null; - } - } - } // end of RewindableInputStream class - - // Adapted from: - // org.apache.xerces.impl.XMLDocumentScannerImpl.dispatch - private void scanXMLDecl() throws IOException, JasperException { - - if (skipString(" - *

    -     * [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
    -     * [24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ")
    -     * [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' |  "'" EncName "'" )
    -     * [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
    -     * [32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'")
    -     *                 | ('"' ('yes' | 'no') '"'))
    -     *
    -     * [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
    -     * 
    - * - * @param scanningTextDecl True if a text declaration is to - * be scanned instead of an XML - * declaration. - */ - private void scanXMLDeclOrTextDecl(boolean scanningTextDecl) - throws IOException, JasperException { - - // scan decl - scanXMLDeclOrTextDecl(scanningTextDecl, fStrings); - fMarkupDepth--; - - // pseudo-attribute values - String encodingPseudoAttr = fStrings[1]; - - // set encoding on reader - if (encodingPseudoAttr != null) { - isEncodingSetInProlog = true; - encoding = encodingPseudoAttr; - } - } - - // Adapted from: - // org.apache.xerces.impl.XMLScanner.scanXMLDeclOrTextDecl - /** - * Scans an XML or text declaration. - *

    - *

    -     * [23] XMLDecl ::= ''
    -     * [24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ")
    -     * [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' |  "'" EncName "'" )
    -     * [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
    -     * [32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'")
    -     *                 | ('"' ('yes' | 'no') '"'))
    -     *
    -     * [77] TextDecl ::= ''
    -     * 
    - * - * @param scanningTextDecl True if a text declaration is to - * be scanned instead of an XML - * declaration. - * @param pseudoAttributeValues An array of size 3 to return the version, - * encoding and standalone pseudo attribute values - * (in that order). - * - * Note: This method uses fString, anything in it - * at the time of calling is lost. - */ - private void scanXMLDeclOrTextDecl(boolean scanningTextDecl, - String[] pseudoAttributeValues) - throws IOException, JasperException { - - // pseudo-attribute values - String version = null; - String encoding = null; - String standalone = null; - - // scan pseudo-attributes - final int STATE_VERSION = 0; - final int STATE_ENCODING = 1; - final int STATE_STANDALONE = 2; - final int STATE_DONE = 3; - int state = STATE_VERSION; - - boolean dataFoundForTarget = false; - boolean sawSpace = skipSpaces(); - while (peekChar() != '?') { - dataFoundForTarget = true; - String name = scanPseudoAttribute(scanningTextDecl, fString); - switch (state) { - case STATE_VERSION: { - if (name == fVersionSymbol) { - if (!sawSpace) { - reportFatalError(scanningTextDecl - ? "jsp.error.xml.spaceRequiredBeforeVersionInTextDecl" - : "jsp.error.xml.spaceRequiredBeforeVersionInXMLDecl", - null); - } - version = fString.toString(); - state = STATE_ENCODING; - if (!version.equals("1.0")) { - // REVISIT: XML REC says we should throw an error - // in such cases. - // some may object the throwing of fatalError. - err.jspError("jsp.error.xml.versionNotSupported", - version); - } - } else if (name == fEncodingSymbol) { - if (!scanningTextDecl) { - err.jspError("jsp.error.xml.versionInfoRequired"); - } - if (!sawSpace) { - reportFatalError(scanningTextDecl - ? "jsp.error.xml.spaceRequiredBeforeEncodingInTextDecl" - : "jsp.error.xml.spaceRequiredBeforeEncodingInXMLDecl", - null); - } - encoding = fString.toString(); - state = scanningTextDecl ? STATE_DONE : STATE_STANDALONE; - } else { - if (scanningTextDecl) { - err.jspError("jsp.error.xml.encodingDeclRequired"); - } - else { - err.jspError("jsp.error.xml.versionInfoRequired"); - } - } - break; - } - case STATE_ENCODING: { - if (name == fEncodingSymbol) { - if (!sawSpace) { - reportFatalError(scanningTextDecl - ? "jsp.error.xml.spaceRequiredBeforeEncodingInTextDecl" - : "jsp.error.xml.spaceRequiredBeforeEncodingInXMLDecl", - null); - } - encoding = fString.toString(); - state = scanningTextDecl ? STATE_DONE : STATE_STANDALONE; - // TODO: check encoding name; set encoding on - // entity scanner - } else if (!scanningTextDecl && name == fStandaloneSymbol) { - if (!sawSpace) { - err.jspError("jsp.error.xml.spaceRequiredBeforeStandalone"); - } - standalone = fString.toString(); - state = STATE_DONE; - if (!standalone.equals("yes") && !standalone.equals("no")) { - err.jspError("jsp.error.xml.sdDeclInvalid"); - } - } else { - err.jspError("jsp.error.xml.encodingDeclRequired"); - } - break; - } - case STATE_STANDALONE: { - if (name == fStandaloneSymbol) { - if (!sawSpace) { - err.jspError("jsp.error.xml.spaceRequiredBeforeStandalone"); - } - standalone = fString.toString(); - state = STATE_DONE; - if (!standalone.equals("yes") && !standalone.equals("no")) { - err.jspError("jsp.error.xml.sdDeclInvalid"); - } - } else { - err.jspError("jsp.error.xml.encodingDeclRequired"); - } - break; - } - default: { - err.jspError("jsp.error.xml.noMorePseudoAttributes"); - } - } - sawSpace = skipSpaces(); - } - // REVISIT: should we remove this error reporting? - if (scanningTextDecl && state != STATE_DONE) { - err.jspError("jsp.error.xml.morePseudoAttributes"); - } - - // If there is no data in the xml or text decl then we fail to report - // error for version or encoding info above. - if (scanningTextDecl) { - if (!dataFoundForTarget && encoding == null) { - err.jspError("jsp.error.xml.encodingDeclRequired"); - } - } else { - if (!dataFoundForTarget && version == null) { - err.jspError("jsp.error.xml.versionInfoRequired"); - } - } - - // end - if (!skipChar('?')) { - err.jspError("jsp.error.xml.xmlDeclUnterminated"); - } - if (!skipChar('>')) { - err.jspError("jsp.error.xml.xmlDeclUnterminated"); - - } - - // fill in return array - pseudoAttributeValues[0] = version; - pseudoAttributeValues[1] = encoding; - pseudoAttributeValues[2] = standalone; - } - - // Adapted from: - // org.apache.xerces.impl.XMLScanner.scanPseudoAttribute - /** - * Scans a pseudo attribute. - * - * @param scanningTextDecl True if scanning this pseudo-attribute for a - * TextDecl; false if scanning XMLDecl. This - * flag is needed to report the correct type of - * error. - * @param value The string to fill in with the attribute - * value. - * - * @return The name of the attribute - * - * Note: This method uses fStringBuffer2, anything in it - * at the time of calling is lost. - */ - public String scanPseudoAttribute(boolean scanningTextDecl, - XMLString value) - throws IOException, JasperException { - - String name = scanName(); - if (name == null) { - err.jspError("jsp.error.xml.pseudoAttrNameExpected"); - } - skipSpaces(); - if (!skipChar('=')) { - reportFatalError(scanningTextDecl ? - "jsp.error.xml.eqRequiredInTextDecl" - : "jsp.error.xml.eqRequiredInXMLDecl", - name); - } - skipSpaces(); - int quote = peekChar(); - if (quote != '\'' && quote != '"') { - reportFatalError(scanningTextDecl ? - "jsp.error.xml.quoteRequiredInTextDecl" - : "jsp.error.xml.quoteRequiredInXMLDecl" , - name); - } - scanChar(); - int c = scanLiteral(quote, value); - if (c != quote) { - fStringBuffer2.clear(); - do { - fStringBuffer2.append(value); - if (c != -1) { - if (c == '&' || c == '%' || c == '<' || c == ']') { - fStringBuffer2.append((char)scanChar()); - } - else if (XMLChar.isHighSurrogate(c)) { - scanSurrogates(fStringBuffer2); - } - else if (XMLChar.isInvalid(c)) { - String key = scanningTextDecl - ? "jsp.error.xml.invalidCharInTextDecl" - : "jsp.error.xml.invalidCharInXMLDecl"; - reportFatalError(key, Integer.toString(c, 16)); - scanChar(); - } - } - c = scanLiteral(quote, value); - } while (c != quote); - fStringBuffer2.append(value); - value.setValues(fStringBuffer2); - } - if (!skipChar(quote)) { - reportFatalError(scanningTextDecl ? - "jsp.error.xml.closeQuoteMissingInTextDecl" - : "jsp.error.xml.closeQuoteMissingInXMLDecl", - name); - } - - // return - return name; - - } - - // Adapted from: - // org.apache.xerces.impl.XMLScanner.scanPIData - /** - * Scans a processing data. This is needed to handle the situation - * where a document starts with a processing instruction whose - * target name starts with "xml". (e.g. xmlfoo) - * - * Note: This method uses fStringBuffer, anything in it - * at the time of calling is lost. - * - * @param target The PI target - * @param data The string to fill in with the data - */ - private void scanPIData(String target, XMLString data) - throws IOException, JasperException { - - // check target - if (target.length() == 3) { - char c0 = Character.toLowerCase(target.charAt(0)); - char c1 = Character.toLowerCase(target.charAt(1)); - char c2 = Character.toLowerCase(target.charAt(2)); - if (c0 == 'x' && c1 == 'm' && c2 == 'l') { - err.jspError("jsp.error.xml.reservedPITarget"); - } - } - - // spaces - if (!skipSpaces()) { - if (skipString("?>")) { - // we found the end, there is no data - data.clear(); - return; - } - else { - // if there is data there should be some space - err.jspError("jsp.error.xml.spaceRequiredInPI"); - } - } - - fStringBuffer.clear(); - // data - if (scanData("?>", fStringBuffer)) { - do { - int c = peekChar(); - if (c != -1) { - if (XMLChar.isHighSurrogate(c)) { - scanSurrogates(fStringBuffer); - } else if (XMLChar.isInvalid(c)) { - err.jspError("jsp.error.xml.invalidCharInPI", - Integer.toHexString(c)); - scanChar(); - } - } - } while (scanData("?>", fStringBuffer)); - } - data.setValues(fStringBuffer); - - } - - // Adapted from: - // org.apache.xerces.impl.XMLScanner.scanSurrogates - /** - * Scans surrogates and append them to the specified buffer. - *

    - * Note: This assumes the current char has already been - * identified as a high surrogate. - * - * @param buf The StringBuffer to append the read surrogates to. - * @returns True if it succeeded. - */ - private boolean scanSurrogates(XMLStringBuffer buf) - throws IOException, JasperException { - - int high = scanChar(); - int low = peekChar(); - if (!XMLChar.isLowSurrogate(low)) { - err.jspError("jsp.error.xml.invalidCharInContent", - Integer.toString(high, 16)); - return false; - } - scanChar(); - - // convert surrogates to supplemental character - int c = XMLChar.supplemental((char)high, (char)low); - - // supplemental character must be a valid XML character - if (!XMLChar.isValid(c)) { - err.jspError("jsp.error.xml.invalidCharInContent", - Integer.toString(c, 16)); - return false; - } - - // fill in the buffer - buf.append((char)high); - buf.append((char)low); - - return true; - - } - - // Adapted from: - // org.apache.xerces.impl.XMLScanner.reportFatalError - /** - * Convenience function used in all XML scanners. - */ - private void reportFatalError(String msgId, String arg) - throws JasperException { - err.jspError(msgId, arg); - } - -} - - diff --git a/impl/src/main/java/org/apache/jasper/xmlparser/XMLString.java b/impl/src/main/java/org/apache/jasper/xmlparser/XMLString.java deleted file mode 100644 index 5035218..0000000 --- a/impl/src/main/java/org/apache/jasper/xmlparser/XMLString.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.xmlparser; - -/** - * This class is used as a structure to pass text contained in the underlying - * character buffer of the scanner. The offset and length fields allow the - * buffer to be re-used without creating new character arrays. - *

    - * Note: Methods that are passed an XMLString structure - * should consider the contents read-only and not make any modifications - * to the contents of the buffer. The method receiving this structure - * should also not modify the offset and length if this structure (or - * the values of this structure) are passed to another method. - *

    - * Note: Methods that are passed an XMLString structure - * are required to copy the information out of the buffer if it is to be - * saved for use beyond the scope of the method. The contents of the - * structure are volatile and the contents of the character buffer cannot - * be assured once the method that is passed this structure returns. - * Therefore, methods passed this structure should not save any reference - * to the structure or the character array contained in the structure. - * - * @author Eric Ye, IBM - * @author Andy Clark, IBM - * - * @version $Id: XMLString.java,v 1.2 2005/12/08 01:29:02 kchung Exp $ - */ -public class XMLString { - - // - // Data - // - - /** The character array. */ - public char[] ch; - - /** The offset into the character array. */ - public int offset; - - /** The length of characters from the offset. */ - public int length; - - // - // Constructors - // - - /** Default constructor. */ - public XMLString() { - } // () - - /** - * Constructs an XMLString structure preset with the specified - * values. - * - * @param ch The character array. - * @param offset The offset into the character array. - * @param length The length of characters from the offset. - */ - public XMLString(char[] ch, int offset, int length) { - setValues(ch, offset, length); - } // (char[],int,int) - - /** - * Constructs an XMLString structure with copies of the values in - * the given structure. - *

    - * Note: This does not copy the character array; - * only the reference to the array is copied. - * - * @param string The XMLString to copy. - */ - public XMLString(XMLString string) { - setValues(string); - } // (XMLString) - - // - // Public methods - // - - /** - * Initializes the contents of the XMLString structure with the - * specified values. - * - * @param ch The character array. - * @param offset The offset into the character array. - * @param length The length of characters from the offset. - */ - public void setValues(char[] ch, int offset, int length) { - this.ch = ch; - this.offset = offset; - this.length = length; - } // setValues(char[],int,int) - - /** - * Initializes the contents of the XMLString structure with copies - * of the given string structure. - *

    - * Note: This does not copy the character array; - * only the reference to the array is copied. - * - * @param s - */ - public void setValues(XMLString s) { - setValues(s.ch, s.offset, s.length); - } // setValues(XMLString) - - /** Resets all of the values to their defaults. */ - public void clear() { - this.ch = null; - this.offset = 0; - this.length = -1; - } // clear() - - /** - * Returns true if the contents of this XMLString structure and - * the specified array are equal. - * - * @param ch The character array. - * @param offset The offset into the character array. - * @param length The length of characters from the offset. - */ - public boolean equals(char[] ch, int offset, int length) { - if (ch == null) { - return false; - } - if (this.length != length) { - return false; - } - - for (int i=0; i 0 ? new String(ch, offset, length) : ""; - } // toString():String - -} // class XMLString diff --git a/impl/src/main/java/org/apache/jasper/xmlparser/XMLStringBuffer.java b/impl/src/main/java/org/apache/jasper/xmlparser/XMLStringBuffer.java deleted file mode 100644 index fa418c8..0000000 --- a/impl/src/main/java/org/apache/jasper/xmlparser/XMLStringBuffer.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright 2004 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jasper.xmlparser; - -/** - * XMLString is a structure used to pass character arrays. However, - * XMLStringBuffer is a buffer in which characters can be appended - * and extends XMLString so that it can be passed to methods - * expecting an XMLString object. This is a safe operation because - * it is assumed that any callee will not modify - * the contents of the XMLString structure. - *

    - * The contents of the string are managed by the string buffer. As - * characters are appended, the string buffer will grow as needed. - *

    - * Note: Never set the ch, - * offset, and length fields directly. - * These fields are managed by the string buffer. In order to reset - * the buffer, call clear(). - * - * @author Andy Clark, IBM - * @author Eric Ye, IBM - * - * @version $Id: XMLStringBuffer.java,v 1.2 2005/12/08 01:29:02 kchung Exp $ - */ -public class XMLStringBuffer - extends XMLString { - - // - // Constants - // - - /** Default buffer size (32). */ - public static final int DEFAULT_SIZE = 32; - - // - // Constructors - // - - /** - * - */ - public XMLStringBuffer() { - this(DEFAULT_SIZE); - } // () - - /** - * - * - * @param size - */ - public XMLStringBuffer(int size) { - ch = new char[size]; - } // (int) - - /** Constructs a string buffer from a char. */ - public XMLStringBuffer(char c) { - this(1); - append(c); - } // (char) - - /** Constructs a string buffer from a String. */ - public XMLStringBuffer(String s) { - this(s.length()); - append(s); - } // (String) - - /** Constructs a string buffer from the specified character array. */ - public XMLStringBuffer(char[] ch, int offset, int length) { - this(length); - append(ch, offset, length); - } // (char[],int,int) - - /** Constructs a string buffer from the specified XMLString. */ - public XMLStringBuffer(XMLString s) { - this(s.length); - append(s); - } // (XMLString) - - // - // Public methods - // - - /** Clears the string buffer. */ - public void clear() { - offset = 0; - length = 0; - } - - /** - * append - * - * @param c - */ - public void append(char c) { - if (this.length + 1 > this.ch.length) { - int newLength = this.ch.length*2; - if (newLength < this.ch.length + DEFAULT_SIZE) - newLength = this.ch.length + DEFAULT_SIZE; - char[] newch = new char[newLength]; - System.arraycopy(this.ch, 0, newch, 0, this.length); - this.ch = newch; - } - this.ch[this.length] = c; - this.length++; - } // append(char) - - /** - * append - * - * @param s - */ - public void append(String s) { - int length = s.length(); - if (this.length + length > this.ch.length) { - int newLength = this.ch.length*2; - if (newLength < this.length + length + DEFAULT_SIZE) - newLength = this.ch.length + length + DEFAULT_SIZE; - char[] newch = new char[newLength]; - System.arraycopy(this.ch, 0, newch, 0, this.length); - this.ch = newch; - } - s.getChars(0, length, this.ch, this.length); - this.length += length; - } // append(String) - - /** - * append - * - * @param ch - * @param offset - * @param length - */ - public void append(char[] ch, int offset, int length) { - if (this.length + length > this.ch.length) { - char[] newch = new char[this.ch.length + length + DEFAULT_SIZE]; - System.arraycopy(this.ch, 0, newch, 0, this.length); - this.ch = newch; - } - System.arraycopy(ch, offset, this.ch, this.length, length); - this.length += length; - } // append(char[],int,int) - - /** - * append - * - * @param s - */ - public void append(XMLString s) { - append(s.ch, s.offset, s.length); - } // append(XMLString) - -} // class XMLStringBuffer diff --git a/impl/src/main/java/org/glassfish/jsp/api/ByteWriter.java b/impl/src/main/java/org/glassfish/jsp/api/ByteWriter.java deleted file mode 100644 index 6532882..0000000 --- a/impl/src/main/java/org/glassfish/jsp/api/ByteWriter.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -package org.glassfish.jsp.api; - -/** - * This interface defines additional functionalities a web container can - * provide for the response writer. If implementated, perfermance will - * likely to be improved. - * - * @author Kin-man Chung - */ - -public interface ByteWriter { - - /** - * Write a portion of a byte array to the output. - * - * @param buff A byte array - * @param off Offset from which to start reading byte - * @param len Number of bytes to write - */ - void write(byte buff[], int off, int len) - throws java.io.IOException; -} diff --git a/impl/src/main/java/org/glassfish/jsp/api/JspProbeEmitter.java b/impl/src/main/java/org/glassfish/jsp/api/JspProbeEmitter.java deleted file mode 100644 index 61d8280..0000000 --- a/impl/src/main/java/org/glassfish/jsp/api/JspProbeEmitter.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -package org.glassfish.jsp.api; - -import javax.servlet.Servlet; - -/** - * Interface for triggering events useful for monitoring. - * - * A web container can pass an implementation of this interface in the - * context attribute "org.glassfish.jsp.monitor.probeEmitter". - */ - -public interface JspProbeEmitter { - - public void jspLoadedEvent(String jspUri); - - public void jspReloadedEvent(String jspUri); - - public void jspDestroyedEvent(String jspUri); - - public void jspErrorEvent(String jspUri); -} diff --git a/impl/src/main/java/org/glassfish/jsp/api/ResourceInjector.java b/impl/src/main/java/org/glassfish/jsp/api/ResourceInjector.java deleted file mode 100644 index d27a5eb..0000000 --- a/impl/src/main/java/org/glassfish/jsp/api/ResourceInjector.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ - -package org.glassfish.jsp.api; - -import javax.servlet.jsp.tagext.JspTag; - -/** - * Interface for injecting injectable resources into tag handler instances. - * - * @author Jan Luehe - */ -public interface ResourceInjector { - - /** - * Instantiates and injects the given tag handler class. - * - * @param clazz the tag handler class to be instantiated and injected - * - * @throws Exception if an error has occurred during instantiation or - * injection - */ - public T createTagHandlerInstance(Class clazz) - throws Exception; - - /** - * Invokes any @PreDestroy methods defined on the instance's class - * (and super-classes). - * - * @param handler The tag handler instance whose @PreDestroy methods - * to call - */ - public void preDestroy(JspTag handler); -} diff --git a/impl/src/main/resources/javax.servlet.ServletContainerInitializer b/impl/src/main/resources/javax.servlet.ServletContainerInitializer deleted file mode 100644 index 573229d..0000000 --- a/impl/src/main/resources/javax.servlet.ServletContainerInitializer +++ /dev/null @@ -1 +0,0 @@ -org.apache.jasper.runtime.TldScanner diff --git a/parent-pom/pom.xml b/parent-pom/pom.xml deleted file mode 100644 index 618a306..0000000 --- a/parent-pom/pom.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - 4.0.0 - - net.java - jvnet-parent - 5 - - - org.glassfish.web - jsp - pom - 2.2.1-SNAPSHOT - JavaServer Pages modules - - - - kchung - Kin-man Chung - http://blogs.sun.com/kchung/ - Oracle Corporation - - lead - - - - - https://javaee.github.io/javaee-jsp-api - - Oracle - http://www.oracle.com - - - - - CDDL + GPLv2 with classpath exception - ://oss.oracle.com/licenses/CDDL+GPL-1.1 - repo - A business-friendly OSS license - - - - github - https://github.com/javaee/javaee-jsp-api/issues/ - - - - JSP Developer - dev@jsp.java.net - - - - scm:git:https://github.com/javaee/javaee-jsp-api.git - scm:git:ssh://git@github.com/javaee/javaee-jsp-api.git - https://github.com/javaee/javaee-jsp-api - - - - 2.3.1 - - High - - - - - - maven-compiler-plugin - - 1.5 - 1.5 - - - - org.apache.maven.plugins - maven-source-plugin - 2.1 - - true - - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - - org.codehaus.mojo - findbugs-maven-plugin - ${findbugs.version} - - ${findbugs.threshold} - ${findbugs.exclude} - true - true - - - - - - - - org.codehaus.mojo - findbugs-maven-plugin - 2.0.1 - - High - ${findbugs.exclude} - - - - - - - glassfish-repository - http://download.java.net/maven/glassfish - - never - - - - java.net - http://download.java.net/maven/1 - legacy - - never - - - - maven2-repository.dev.java.net - Java.net Repository for Maven - http://download.java.net/maven/2 - - never - - - - - - - glassfish-repository - Java.net Repository for Maven 2 - http://download.java.net/maven/glassfish - - never - - - - - diff --git a/spec/HOW-TO.txt b/spec/HOW-TO.txt deleted file mode 100644 index 4a0e4b7..0000000 --- a/spec/HOW-TO.txt +++ /dev/null @@ -1,94 +0,0 @@ -/usr/dist/share/framemaker,v7.0: -open fm/jsp-partioned.book -admin/specgeneration.txt - -- Open JSP 1.1 - - manual editing of footer - -- Open chapter1 - - view->masterpage - - dbl click on footer -> all pages footer -> edit definition -> PFD *2* - - special->variable->book title -> edit definition -> PFD *2* - -- Import variable defs from chapter 1 into all other chapters: - - select all components: - - click on JSP.1.1 - - go to bottom - - shift - click - - file->import->formats->deselect everything except for variables - make sure I import from chapter1 - -- Update the var defs in the same way for file apigen/mymifdocletemplate.mif - e.g., "book title" and "release date" vars - - when saving, yes on everything - -- Import APIs: - - apigen/apigen.sh - - REPOS_HOME point to GF home, e.g., REPOS_HOME=/space/luehe/ws/sjsas90 - - make sure apigen/apigen/fm exists before running script - -- Add generated *.fm files to book: - - - Location from where to add: /space/luehe/ws/specs/jspspec/apigen/apigen/fm - - Add API fm files to book by clicking 3rd from left icon at bottom of - jsp-partitioned.book - - API fm files to add: - - javax.servlet.jsp.fm - - javax.servlet.jsp.tagext.fm - - javax.servlet.jsp.el.fm - - If we ever decide to copy generated files into book directory, notice: - The gif files that are saved in doc-files in the API src directory - must be copied to be accessible to the generated .fm file - --> if they are changed, must be copied. Looks like the first gif - in the tagext API must have its ref updated. Others follow through - once this one is fixed... - - Make sure to cvs commit - -- Correct problems in javax.servlet.jsp.tagext.fm: - - - Edit -> Find -> Paragraph Tag: "ClassNumbered-1" - Make sure all the ones that are not supposed to be "1." are changed to - ClassNumbered-2 instead. I had to change 4 of them. - This is a bug in the MIF converter. - Change para tag by clicking paragraph icon (top righthand corner) - - - Find VariableInfo class and fix the table. - Select the whole table and resize column widths. - Select "By Scaling to Widths Totalling" and set to "6.5". - Just in case: - - Change font of inner (white background) cells to be non-bold - (manually per cell by highlighting cell) - - TO resize column: select cell (Ctrl- click); shift select the handle - of the cell - -- Change cover page: - - - The background for "Early Draft Release", "Public Review", - "Proposed Final Draft". - - In jsp-partioned.book, dbl-click on JSP_Title.fm - - View -> Reference Pages - - Make necessary edits - - View -> Bodypages (will get me back to cover page) - - Insert graph by selecting paragraph just above the graph (i.e., - "discuss this specification") - -> paragraph -> designer -> advanced tab - Frame below pgf -> public / expert / ... - -- generate TOC - -> Click on 2nd from left icon at bottom of jsp-partioned.book - -> Click on "update" (no other modifs) - (there are going to be errors about unresolved refs - ignore) - -> File -> Save book - -> File -> Save book as -> PDF - See specgeneration.txt for details, but the following may not be - required: - - o On the Tags tab: Turn off (de-select) Generate Tagged PDF. I - don't see where the structure of the tags makes any sense, so I - suggest turning this off. Will produce a small file size, too. - -> to make sure PDF bookmarks are generated, make sure - "Genarate PDF bookmarks" has been selected, and choose "All" as the - level - - -> use "top" utility to see when done - diff --git a/spec/README.txt b/spec/README.txt deleted file mode 100644 index 4c4aad4..0000000 --- a/spec/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -This is the main JSP specification workspace. - -apigen/ Ant build file to auto-generate portions of the spec (e.g. API) - -fm/ FrameMaker source files for specification - -xsd/ XML Schema source - -admin/ Administrative information about the spec - diff --git a/spec/SATCK JSR 245 JavaServer Pages 2.3 2.20.13.pdf b/spec/SATCK JSR 245 JavaServer Pages 2.3 2.20.13.pdf deleted file mode 100644 index 1f395ea..0000000 Binary files a/spec/SATCK JSR 245 JavaServer Pages 2.3 2.20.13.pdf and /dev/null differ diff --git a/spec/TODO.txt b/spec/TODO.txt deleted file mode 100644 index fc0affe..0000000 --- a/spec/TODO.txt +++ /dev/null @@ -1,28 +0,0 @@ -Commetns from SAP - -E.1.6 -> missing method name -E.2.13 and E.2.14 -> fix the formatting -E.2.16 -> fix formatting - ------ -From Bill: - --------- Original Message -------- -Subject: schemas in specs -Date: Tue, 06 Sep 2005 14:52:05 -0700 -From: Bill Shannon -To: javaee-specleads@sun.com - -My spec has been getting bigger and bigger, largely because I've -been carrying around all the schemas and DTDs for all versions of -Java EE as part of the document. I polled my expert group and -they generally supported moving the schemas out of the spec document. - -What I'm going to do is reference the current and previous schemas -on the web within the main spec document. I'm also going to prepare -a download bundle that contains the spec document and the current -(but not previous) schema files. - -If any of you are including your schemas in your spec documents, -you might want to consider doing the same. - diff --git a/spec/admin/TODO.txt b/spec/admin/TODO.txt deleted file mode 100644 index 6b33ccb..0000000 --- a/spec/admin/TODO.txt +++ /dev/null @@ -1,310 +0,0 @@ -TODO for PFD: -- verify -> http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_1.xsd - -- License (get from Karen; have a FIXME on it currently) -- Preface -> requirement for Java SE (more discussions on this) -- Ack for JSP 2.1 (to be written) -- Fix this: - The JCP and This Specification - The JCP is designed to be a very flexible process so each expert group can address the requirements of the specific communities it serves. The reference implementation - for JSP 2.1 ... (PENDING). (do a global search on PENDING as a word to catch - any other occurrences). -- unresolved cross-references - --------------------------------------------------------------------------- -problem with TOC: - -open the TOC file -view -> reference pages - goto table of contents specification - set the tab with the ellipsis... - did that, but still does not work - think I have to do it in the source page as well? - -- also, page numbers for APIs in TOC do not have the volume number. - -=========================================================================== -TODO for Public Review -=========================================================================== -- Fix the schema -- Fix the TOC (ellipsises) -- Print + Full review of the content - ---------------------------------------------------------------------------- -- review all variables: - -- do not generate inherited summaries - option -noinheritedsummary does not work - (talk to Doug Kramer) - -- when saving the PDF: - - use condition indicators setting is inconsitent - -- mifdoclet complains about JspContext, FacesContext - ---------------------------------------------------------------------------- -PENDING: - -Preface - - JSP 2.1 requirements - - element for Servlet 2.5 - - Acknowledgements for JSP 2.1 - -Status - - JCP and this specification - ---------------------------------------------------------------------------- -- write an article on the unified EL for java.net? - - An EDR of two key web-tier specs has just been released: - JSP 2.1 and JSF 1.2. Want to know what's cooking, read on... - Have the 4 spec-leads be co-authors? - -=========================================================================== -MODIFICATIONS TO JSP SPEC for JSP 2.1 EDR -=========================================================================== -GLOBAL CHANGES - -- everywhere we use JSP 2.0 -- everywhere we use J2EE 1.4 -- everywhere we use Servlet 2.4 - ------ -Title page - - updated to 2.1 - - updated editors - - updated release - - now mentions the java.net project instead of - comment alias - ------ -Copyright and license - -- updated with EDR license - ------ -Contents - -[generated] - ------ -Preface -[L] - -- intro paragraph on JSP 2.1 -- section Relation To JSP 2.0 -- section Backwards Compatibility -- section Migration from JSP 2.0 to JSP 2.1 -- updated related documents. -- updated historical note - ------ -Status - -- Minor Modifs for JSP 2.1. -- pending: RI info - ------ -Overview - -- minor modifs - - JSP 2.0 "added" (instead of "adds")) - ------ -1. Core syntax and semantics -[K] - -1.3.2 Element Syntax -- EL expressions use the syntax ${expr} as well as #{expr}; - -1.3.10.1 EBNF grammar for JSP syntax -- updated for #{} -- leave this to Mark - see also the validity constraints where token ${ is discussed - -1.6 -> quoting -isELIgnored and have been updated to consider #{} as well as ${} -in Table JSP.1-8 - ------ -2. Expression Language -[F][J] - -Has lots of modifications. -We now only focus on the EL within the JSP environment. -Tried to keep as much as possible what already existed there, -and only adjust when required. - -Need thorough review from Mark. - ------ -3. JSP Configuration - -3.3.2 Deactivating EL Evaluation - ignore #{} with servlet 2.4 - ------ -4. Internationalization issues - -No modification. - ------ -5. standard actions - -No modification. - ------ -6. JSP Documents - -No modification. - ------ -7. tag extensions - -No modification. - ------ -8. Tag files - -No modification. - ------ -9. Scripting - -No modification. - ------ -10. XML View - -10.1.11 Request time attribute expressions -10.1.12 Template Text and XML Elements - ------ -11. JSP Container - -No modification. - ------ -12. Core API - -[A] [B] [E] -- modified intro.html to add JspApplicationContext -- JspApplicationContext added to sequence - ------ -13. Tag Extension API - -No modification... but maybe there are some modifications. -Mark? - ------ -14. EL API -[C][D][I] - -- in make/html/javax/servlet/jsp/el - modified intro.html to say that the - javax.servlet.jsp.el API is now deprecated + - 2 new ELResolver classes. - -- Added the 2 new ELREsolver classes. - ------ -A. Packaging JSP Pages - -No modification. - ------ -B. JSP Elements of web.xml - -No modification. - ------ -C. TLD Formats -[G] - -New elements for value-expression and method-expression. -New graphic + schema for JSP 2.1. - ------ -D. Page Encoding detection - -No modification. - ------ -E. Changes - -Updated for 2.1 - ---------------------------------------------------------------------------- -Title Page -* Please, put your name first! Please! I want you to get credit for` - all the hard work you've done and that you are about to do :) - -Preface -* Migrating section, 1st paragraph: Explicitly mention that your - applications will run unmodified in a JSP 2.1 container and that - these changes only apply if you want to upgrade web.xml to 2.5. - -JSP.1.1.9.1. -* Update Servlet 2.4 --> Servlet 2.5 (do this globally) - -JSP.1.10.1 -* isELIgnored in table - instead of saying 'evaluated' say 'recognized', - since #{} is not technically evaluated in the page. Its evaluation is - deferred. - ---------------------------------------------------------------------------- -Pierre - if you'd like I can help make changes to this and/or other chapters once you're done sweeping for cross reference fixes. We'll sync up after I'm done with my review. - -* Missing File: - Looking for ../../jspspec_old2/src-new/JSP/doc-files/jsp-ELResolver.gif - -JSP.2.1.1 -* [Mark, which section is this] - (re: backwards compatibility) - I think Eduardo was referring to what is now sections JSP.2.5 - and JSP.2.6 in your draft - -JSP.2.1.2 -* Make it clear that only ${} is allowed in template text. - #{} must cause a translation error - -JSP.2.2. -* This section should be mvoed to JSP.2.1.1 since it - deals only with attribute values -* Mention that #{} syntax must be used for value and - method expressions whereas ${} must be used for - all other types. -* "The unified expression language also adds..." - Actually, in the unified EL everything is deferred. - JSP adds support for not immediately evaluating the - expression if an attribute is declared as accepting - a deferred expression. - -JSP.2.3. -* Very clear! -* We should add something stating that when the attribute - is deferred and "xyz" is provided, we need to pass in a - ValueExpression where isLiteralText() == true - -JSP.2.5 -* Duplicate ${expr} - should the second be #{expr}? -* Incorrect - ${expr} was reserved before JSP 2.1 (it was reserved - in JSP 2.0). Just change JSP 2.1 to JSP 2.0 and it should be - fine. - -JSP.2.9 -* CompositeResolver --> CompositeELResolver -* 3-5 - mention that these are constructed in read/write mode - -JSP.2.10 -* Mention somewhere in this section that function information is bound - into the ValueExpression or MethodExpression object at parse-time - and is serialized along with the state of the expression. - ---------------------------------------------------------------------------- -JSP.3.3.2 -* Last paragraph needs to be updated to address \# as well -* We need to address the case I just discussed on the webtier-alignment alias here: - -If web.xml is Servlet 2.4 or earlier, and a tag attribute is marked as deferred in its TLD (which is not a backwards-compatibility case), then passing a value with "#{}" is interpreted as a ValueExpression or MethodExpression. In all other cases, #{} has no special meaning in the page, for backwards compatibility reasons. diff --git a/spec/admin/announce.txt b/spec/admin/announce.txt deleted file mode 100644 index 0846eb1..0000000 --- a/spec/admin/announce.txt +++ /dev/null @@ -1,222 +0,0 @@ -Announce a new release of the spec - ------ -EXPERT GROUPS -jsp-spec-eg project at java.net -webtier-alignment project at java.net - -- email the following mailing lists: - - eg@jsp-spec-eg.dev.java.net - - users@webtier-alignment.dev.java.net -- update status on the home page - ------ -OFFICIAL CHANNEL for the JSP SPEC -jsp-spec-public project at java.net - -- use Announce tool to announce the new release -- email the following mailing lists: - - announce@jsp-spec-public.dev.java.net - - users@jsp-spec-public.dev.java.net -- update status on the home page - ------ -OFFICIAL FORUMS - -JSP http://forum.java.sun.com/forum.jspa?forumID=45 -JSF http://forum.java.sun.com/forum.jspa?forumID=427 - ------ -Internal - -All of J2EE: kt-org@sun.com - ------ -Others - -jakarta-taglibs taglibs-user@jakarta.apache.org -tomcat-users asked Jan (because I'm not subscribed and cannot post) - ---------------------------------------------------------------------------- -EDR - 2004.12.08 - ------ -This announcement was just sent to the J2EE web-tier community. -This is an important milestone. We're making good progress in -aligning JSP and Faces... - ------ -Experts, - -Our official announcement about JSP 2.1 and Faces 1.1 EDR. -An important milestone! - ------ -[ANNOUNCE] JSP 2.1 and Faces 1.2 Early Draft Review - -We're pleased to announce the availability of the Early Draft Review -of the next versions of the specification for JavaServer Pages and -Faces. JavaServer Pages (JSP) 2.1 is developed under JSR-245 and -JavaServer Faces (Faces) 1.2 is developed under JSR-252. The two -expert groups are working together to improve the alignment between -these two powerful web presentation technologies. The foremost such -alignment issue is the Expression Language, as stated in both JSRs. - -JSP 2.1 exports the Expression Language (EL) into its own separate -document; technically a sub-document of the JSP specification. The -Unified EL spec defines a new top level java package, javax.el. This -package is completely independent of the technology using it and -allows the using technology to plug itself into the EL resolution -process. The bulk of the changes in the JSP spec itself follow from -how it uses the Unified EL. - -As mentioned in the original JSR-252, this spec is not a new feature -release. Faces 1.2 contains the work for it to leverage the new -Unified EL, as well as a few spec related bug fixes. - -The alignment of Faces and JSP in these JSRs enables some new -capabilities and provides a solid foundation for future growth. For -example, in a web application that uses both Faces and JSP, it is -possible for pages that only use JSP (without any faces content) to -access managed beans. Please see Appendix E of the JSP spec and the -preface of the Faces spec to see details of what's changed! - -To access the specifications: - - JSP 2.1 EDR (JSR-245) - http://jcp.org/aboutJava/communityprocess/edr/jsr245/ - Faces 1.2 EDR (JSR-252) - http://jcp.org/aboutJava/communityprocess/edr/jsr252/ - -Sincerely, - -Ed Burns, Pierre Delisle, Roger Kitain, Mark Roth and the JSR-245 and -JSR-252 Expert Groups. - ---------------------------------------------------------------------------- -Announcement: - -Experts, - -The new unified EL and JSP 2.1 Specifications are now ready -for review by the Expert Group. - -The two spec documents as well as the javadocs have been checked in -the CVS repository of our EG private project at java.net -(https://jsp-spec-eg.dev.java.net/). - -Simply click on the download link of revision 1.1 of these files: - - 1. EL 2.1 - - Specification (rev 1.1: draft 1 for EDR) - https://jsp-spec-eg.dev.java.net/source/browse/jsp-spec-eg/spec/ELSpec2.1.pdf - - APIs (javadoc) (rev 1.1: draft 1 for EDR) - https://jsp-spec-eg.dev.java.net/source/browse/jsp-spec-eg/spec/ELAPI2.1.zip - - 2. JSP 2.1 - - Specification (rev 1.1: draft 1 for EDR) - https://jsp-spec-eg.dev.java.net/source/browse/jsp-spec-eg/spec/JSPSpec2.1.pdf - - APIs (javadoc) (rev 1.1: draft 1 for EDR) - https://jsp-spec-eg.dev.java.net/source/browse/jsp-spec-eg/spec/JSPAPI2.1.zip - -These will be handed off to the JCP for our public Early Draft Review (EDR) -on Friday December 3. We'd really appreciate any review comments by close of business -on Wednesday December 1st, if possible. - -To aid in your review, please look at the change log in Appendix E of -the JSP spec. - -The entire Unified EL spec is new, although most of chapter 1 has been -lifted from the JSP 2.0 spec. Section 1.2 is a must read. - -Many Thanks, - - -- Pierre & Mark - -P.S. To all of you in the U.S., Happy Thanksgiving! - ---------------------------------------------------------------------------- -I've included below a draft of an email that we could send to announce -the availability of PR. We could use that same email for both JSF and -JSP. - ---- -On the JSP side, I would plan to send the announcement -to the following lists: - -JSP EG: - eg@jsp-spec-eg.dev.java.net - -JSP spec Public website: - users@jsp-spec-public.dev.java.net - announce@jsp-spec-public.dev.java.net - announce page -> add one entry for the announcement - update status on home page - -Official Forum: - http://forum.java.sun.com/forum.jspa?forumID=45 - -Related Lists: - taglibs-user@jakarta.apache.org - tomcat-users@jakarta.apache.org - -Internal - kt-org@sun.com (has this changed?) - -Please let me know if I am missing any. And I assume -that Jayashri will complement with JSF specific -lists. - ---- -For the blog(s), I think it would make more sense to have a single -blog that covers the current state of affairs with PR of -JSP and JSF. I don't think it makes sense to have 2 blogs -to talk essentially about the same thing (although the 2 views -can be different, I think that a common view serves us better -at this point since this is the focus of these 2 JSRs). - -Ed, I assume you'd be handling it. If you need help, let me -know. - - -Thanks, - - -- Pierre - ---------------------------------------------------------------- -Subject: [ANNOUNCE] JSP 2.1 and Faces 1.2 Public Review - -We are pleased to announce the availability of the Public Review -of the next versions of the specification for JavaServer Pages (JSP) -and JavaServer Faces (Faces). JSP 2.1 is developed under JSR-245 and -Faces 1.2 is developed under JSR-252. The two expert groups are working -ogether to improve the alignment between these two powerful web presentation -technologies. - -Building on the work that was accomplished with the Early Draft -Review, this Public Review covers two additional areas that required -better integration between JSP and Faces: - - - Tree Creation and Content Interweaving - - Deferred expressions nested within iteration tags - -Please see Appendix E of the JSP spec and the -Preface of the Faces spec to see details of what's changed. - -To access the specifications: - - JSP 2.1 PR (JSR-245) - http://jcp.org/aboutJava/communityprocess/pr/jsr245/ - - Faces 1.2 PR (JSR-252) - http://jcp.org/aboutJava/communityprocess/pr/jsr252/ - -Sincerely, - -The JSR-245 and JSR-252 Expert Groups - -------------------------------------------------------------- diff --git a/spec/admin/specgeneration.txt b/spec/admin/specgeneration.txt deleted file mode 100644 index 6e89956..0000000 --- a/spec/admin/specgeneration.txt +++ /dev/null @@ -1,191 +0,0 @@ -problem with headers/footers of the API chapters - -import in the API chapter the variables from a regular spec chapter. -Looks like that allows the footer to show, but not the header. - ---------------------------------------------------------------------------- -For a new release: - -Maker Variables - - All pages footer - - Book Title - - JSP_VERSION - - ... scan the list... - -Footer: - - Update release date - -Preface - - Update intro with the specifics of this version - -The background for "Early Draft Release", "Public Review", -"Proposed Final Draft". - - They are defined in Reference Pages - - paragraph just above th graph -> paragraph designer - advanced tab - Frame below pgf -> public / expert / ... - -Get the appropriate license from Program Manager - -Acknowledgements - -Cross-references - ---------------------------------------------------------------------------- -APIs - -Update the template - View Master Pages - update BookTitle and ReleaseDate - -Generate the javadocs via mifdoclet. - -Simply run apigen/apigen.bat - Make sure the script points to the proper sources for the - JSP APIs. - -> If dzbatcher hangs, make sure the fm/ directory exists - in apigen/apigen2. (looks like it cannot create it?). - -Things to fix after running apigen: - - -Set the variables in those files (see above) - -for javax.servlet.jsp.tagext - -The gif files that are saved in doc-files in the API src directory -must be copied to be accessible to the generated .fm file - --> if they are changed, must be copied. Looks like the first gif in the tagext API - must have its ref updated. Others follow through once this one is fixed... - -Edit -> Find -> Paragraph Tag: "ClassNumbered-1" - Make sure all the ones that are not supposed to be "1." are changed to - ClassNumbered-2 instead. I had to change 4 of them. - This is a bug in the MIF converter. - -Find VariableInfo class and fix the table. - Select the whole table and resize column widths. - Scale to total 6.5". Change font of inner (white background) - cells to be non-bold. - TO resize column: select cell (Ctrl- click); shift seleect the handle of the cell - ---------------------------------------------------------------------------- -Schemas - -see admin/xsd.txt - -save graphs as jpg -then impot in the maker document (96 dpi). - -[old stuff that does not seem to work -save the vthought file as .eps -open it with photoshop elements -> copy -> paste into the frame document.] - -Can save as MIF as well, but was not able to import it though... - ---------------------------------------------------------------------------- -gen the TOC -save as PDF - -> make sure to disable conditional text (only keep the Fix conditional text) - -Hi Pierre, - -Pat was able to fix your problem with the headers and footers disappearing. I was able to fix your TOC numbering problem. - -To fix the header/footer issue, do the following when you Save As PDF and the dialog called PDF Setup for Selected Files comes up: - -o On the Settings Tab: - -- PDF Job Options: Choose Print or enPrintOptimized (if available) - -- Page size: Width-8.5" Height: 11.0" - -o On the Bookmarks Tab: Keep as is. Settings are just fine. - -o On the Tags tab: Turn off (de-select) Generate Tagged PDF. I don't see where the structure of the tags makes any sense, so I suggest turning this off. Will produce a small file size, too. - -o On the Links Tag: Leave as is. - -Another bonus is the the PDF is smaller and it takes less time to generate! - -To fix the numbering problem, it's a little more complicated if you're not familiar with reference pages, but here are the steps: - -* Open the book and all documents in the book, including the TOC. -* While viewing the TOC document, perform the rest of these steps. -* Position your cursor on javax.servlet.jsp. -* Go to Format-->Paragraphs-->Designer... - You should see a popup called Paragraph Designer and in the Paragraph Tag menu, you should see PackageHeadTOC. -* On the Basic Tab check the following: - - First is set to 0.292" - - Left is set to 1.0" - - Right is set to 0.0" - - You have one tab stop set to 4.958" -* When you've confirmed this, click Update All -* Without closing the dialog, position your cursor at ErrorData (right below javax.servlet.jsp) -* No, the Paragraph Tag menu should say ClassHeadTOC. -* Again, on the Basic tab, confirm the following: - - First is set to 0.625" - - Left is 1.5" - - Right is 0.0" - - You have one tab stop set to 4.958" -* When you've confirmed this, click Update All -* Exit the dialog. -* Save the document. -Now, here's the hard part: -* Make sure the Formatting Bar is viewable (Go to View-->Formatting Bar) -* Go to View-->Reference Pages -* Scroll down to where it says Table of Contents Specification. -* Now, scroll to the definition for ClassHeadTOC. The menu on the formatting bar should tell you which definition your cursor is on. -* In front of the <$pagenum>, enter <$volnum>- (This will give you the correct numbering. i.e 2-17 or whatever). -* Make sure that there are a string of dots in between <$paratext> and <$volnum>. If there aren't, position your cursor after <$paratext> and hit the tab key. -* Now, go to the PackageHeadTOC definition. It should be the third one down. -* Do as you did for the ClassHeadTOC definition. -* Save the document. -* Now, go to the book document. -* Select the top level of the book. -* Go to Edit-->Update Book. -* In the Update Book dialog, select all checkboxes except Apply Master Pages. -* Under the Generate box, make sure your TOC is there. -* Click Update. - -If you want, you can call me and I can walk you through it. - -Jennifer - - ---------------------------------------------------------------------------- -Zip of the javadocs - - - - - - - - - - - - - - - - ---------------------------------------------------------------------------- -FrameMaker (solaris) - /net/irishmusic.eng/opt/local/framemaker,v6.0/fminit - ---------------------------------------------------------------------------- -cvs repository: - sunsw.sfbay.sun.com:/sw/jsp - module is: jspspec - -old repository: - bringover -w ~/jspspec -p /java/j2ee/Specs/JSP/2.0/workspace . - - diff --git a/spec/admin/xsd.txt b/spec/admin/xsd.txt deleted file mode 100644 index 81f4a83..0000000 --- a/spec/admin/xsd.txt +++ /dev/null @@ -1,322 +0,0 @@ ---------------------------------------------------------------------------- -Building the schemas: - -1. Create a child teamware workspace of /java/j2ee/XMLSchemas/deployment - - bringover -w ~/xmlschemas-deployment -p /java/j2ee/XMLSchemas/deployment . - - or - - cd ~/xmlschemas-deployment - bringover - - This is the workspace that Umit created before she left. - It contains all the J2EE schemas in it - The *.xsds files are the source files for the .xsd output files. - They contain things like #include that are not valid .xsd but this - allows us to more easily maintain our schemas. - -2. Type make - This will produce *.xsd and *.mif for inclusion in the spec. - -3. Read the README file (included below), in particular the "THINGS YOU SHOULD KNOW IN - USING MIF" section. This section will tell you the correct way to - import the mif into the spec chapter. Yes, more manual steps :( - -Modifying the schemas: - -1. Edit the .xsds file for web-jsptaglibrary_2_1.xsd or jsp_2_0.xsd - (eventually we need to create a jsp_2_1.xsd as well). -2. Run make to generate the .xsd -3. cd testarea/ -4. Edit the taglib-2_1.xml or web-app.xml to write a test case for the new - changes to the schema. -5. Run 'make jsp-tld' or 'make web-app' to test the TLD or JSP portion - of the web.xml, respectively. -6. If the tests pass, check in the new test and schema -7. Build the schema as above and update the spec chapter -8. Update the .vthought diagrams for the TLD, if necessary -9. Check the latest version of the .xsd schemas into the - jakarta-servletapi-5/src/share/dtd directory and commit the changes. - -Hope this helps! -- Mark - ---------------------------------------------------------------------------- -Publishing the schemas ---------------------------------------------------------------------------- -Bill, - -I just put back the first revision of the JSP 2.1 TLD schema to our -/java/j2ee/XMLSchemas/deployment workspace. - -I just wanted to verify with you that we're still going to use this -same workspace for our J2EE 5.0 schemas. - -I had to modify Makefile to build both JSP 2.0 and JSP 2.1 schemas. -The previous Makefile assumed that only one version could be built at -a time. - ------ -Yes, I was planning to continue to use that workspace. - -When you're ready to publish your new schema to the web, let me know. - ------ -The current plan of record is for JSP and JSF to hand our respective -EDRs to the JCP on December 3. - -When do you recommend we publish the schema to the web? Can it be done after EDR? - ------ -Yes. When you publish is up to you. Publish it when you think a lot of -people will go to the web site looking for it. - ---------------------------------------------------------------------------- -TLD Diagram ---------------------------------------------------------------------------- -Pierre, - -Attached is the MIF (and .vthought source) to replace the diagram in the -TLD chapter for the JSP 2.1 TLD. - -Do you have any .vthought files in your repository? For some reason -it said that it wasn't part of the repository. Maybe I never checked -them in? - -I just noticed I could have done a better job with the schema and -prevented the user from specifying both and -, but this should do for now. I'll see if I can fix -that before EDR. - -Let me know if you have any trouble integrating the new diagram or -schema into the spec. - -- Mark - -TOOL is: Visual Thought (confluent www.confluent.com) - -============================================================================= -README from xmlschemas-deployment - -HOW TO USE SCHEMA GENERATOR: - -Necessary Files: - -(1) This directory contains a copy of - -xml.xsd -XMLSchema.dtd -datatypes.dtd - - -The originals can be found in http://www.w3.org/2001 directory. They -are also in the source code repository. - -PLEASE USE THEM AS IS. w3c grants us use as is. The license issue was resolved -within the W3CLicense file. Please refer to it. - -We use the local files for testing, because importing remote files to schema can -be problematic. This can be handled however by reusing a local copy of the -files. - -(2) You have several common files which you should include into your spec with -#include. They MUST BE included as annotations (XML Schema comments) to your -spec. - -annotations: contain copyright information that is generated by Bonnie which -MUST BE included in the preemble of each schema file - -glossary: Definition of common terms that are defined in common schemas such as -j2ee_.xsds that adopts its meaning given the scope it is included in. - -common: conventions that will apply to all files - -The best thing is to look at one of the .xsds files to see an example to use -#include. - - -HOW TO USE THIS DIRECTORY: - - --- Create an .xsds file. This is the source document for a schema file. Some -guidelines: - - -- Each line in the .xsds file should be at most 70 characters. - - -- Provide a - - - ... - block as comments for each type or element you create. - DO NOT use XML comments. This is markup and the documentation of each - element follows the declaration as you use other tools, such as XML Spy. - - Escape any sample XML markup used as documentation. The recommended - way to do this is to use a CDATA section. For example, - - - foo - - ]]> - - - See *.xsds file for other examples. This prevents some conformant - XSD processors from trying to validate the content of the - node itself, which would typically fail. - - -- Element declarations should have type, {min|max}Occurs in separate lines. - - I am not sure this rule totally makes sense b/c in a sense - {min,max}Occurs attributes are related and it improves readability - to have them on the same line. Also, I see many places where they - are on the same line so this guideline should probably be - removed. [eeg 4oct02] - - -- Follow the indentation conventions. (For emacs, you should turn - tabify off and use blanks instead). When in doubt, select the - buffer and run M-x untabify. - - -- Use for consistency with - the following convention: Don't forget to use description, - display-name and icon elements in the order with minOccurs=0 and - maxOccurs="unbounded". In the Schema version, we have xml:lang - attributes which allow for separate languages to be used for each of - these definitions. - - --- Use the make file to generate your specs .xsd and .mif files. The -make file uses xsdc to make the xsd and mif files. - --- The targets in the Makefile are for each specification area: - all: for all specs - web-app: servlet - ejb-jar: ejb - connector: as implied - jsp: as implied - jsp-tld: tag library - platform: app-client, application and j2ee schemas - j2ee: common j2ee schema only - clean: removes mif, xsd, and class files. - -There are also targets to build the validator.jar file. Please see below -for the details. - - --- Use make file target to make your xsd file. - --- You may get some errors. The xsdc compiler does several things: - - -- Formatting (Including copyright file, common definitions, basically - #includes); - - -- Sorting the definitions (The output includes the preemble and - the top level element first, followed by sorted global types). - - -- Checking referenced but not existing definitions in your - file. It does not load the definitions in the files that are - referenced (Some of the references are not local). Therefore, if you - have used common defs which are in j2ee_<*>.xsd files, you will get - errors such as: - - ejb-jar_2_1.xsd: type deployment-extensionType referenced but never defined - - Please examine the error messages. If you think that there is a type - which should have appeared in your xsd file but did not, revisit your - .xsds file and fix the references to it. The types that are from - referenced files will appear in the warnings, as shown in the example. - --- After you make your xsd file, cd to testarea and run tests for your spec. - You should read the README in that directory. - --- When you need to publish the schema, you should copy it to a different - directory so that subsequent builds do not corrupt the schema, such as - leighs_area directory. - --- The website is maintained by Bill Shannon. If you need help, see Bonnie. - -MODIFYING THE VALIDATOR JAR: - -Please see the README file in the testarea for details. - - -THE GORY DETAILS: - -xsdc is the xsd "compiler". It's written in perl. - -use commands: - -sh ./xsdc to generate an .xsd file. - -sh ./xsdc -m to generate the mif file. - -THINGS YOU SHOULD KNOW IN USING MIF: - -(A) You must first import the paragraph formats from new_formats_5.5.doc to your -specification. If this is already done, skip to (B). - -Open the new_formats_5.5.doc document with framemaker. You will see the -instructions. However, here they are here for completeness: - - 1. With the new formats file and your spec open, select -File->Import->Formats IN THE SPEC document. - - 2. In the Import from Documentation box choose new_formats_5.5. - - 3. Make sure that only the Paragraph Formats checkbox is selected. - - 4. Click on the Import button. - - 5. You should see 5 different paragraph formats in the available paragraphs -all named starting with "Schema-" - -(B). Select a location to include the schema. - -(C) File-Import-File and choose the mif file that corresponds to your schema, -i.e. ejb-jar_2_1.mif. Import the file. - -(D) You should see the document nicely formatted, namely annotations are in -italics, the types are bold, etc. - -OTHER STUFF: - -There are several directories which are of interest: - -- testarea/ contains an instance file to test your schema with. You must run -the test in the area for sanity check of your schema. - -- libraries/ contains the jar files to run the test script. - -- string_usage.html contains the usage of string based content with respect to -each spec. - -SRC FILE for VALIDATOR.JAR: - -Validation is enabled by building the validator.jar jar file which contains a -simple validator. - -The src directory contains the source for the validator program. The makefile -targets that are relevant for building are: - -classes: makes the classes directory for class files. -build: builds everything -validator.jar builds the validator.jar in the current directory. - -Please DO SET your JAVA_HOME env variable appropriately. - -The testarea requires a validator.jar to be present to be able to run the tests. - -Please note the following: - - The validator program cheats by using a Properties file to get the schema - that would be used for validating an instance document. In a real DD - processing, a double pass for validation would be necessary to determine the - version number and the schema document first and then use the information to - drive the parser to validate with a specific schema file. In this version, I - used a property file to drive the validator. - -Please also see the README for adding additional tests by using the Property -files. diff --git a/spec/apigen/apigen/fm/javax.servlet.jsp.el.fm b/spec/apigen/apigen/fm/javax.servlet.jsp.el.fm deleted file mode 100644 index 8f39e9a..0000000 Binary files a/spec/apigen/apigen/fm/javax.servlet.jsp.el.fm and /dev/null differ diff --git a/spec/apigen/apigen/fm/javax.servlet.jsp.fm b/spec/apigen/apigen/fm/javax.servlet.jsp.fm deleted file mode 100644 index b294253..0000000 Binary files a/spec/apigen/apigen/fm/javax.servlet.jsp.fm and /dev/null differ diff --git a/spec/apigen/apigen/fm/javax.servlet.jsp.tagext.fm b/spec/apigen/apigen/fm/javax.servlet.jsp.tagext.fm deleted file mode 100644 index 73731a9..0000000 Binary files a/spec/apigen/apigen/fm/javax.servlet.jsp.tagext.fm and /dev/null differ diff --git a/spec/build.xml b/spec/build.xml deleted file mode 100644 index 6f3cba6..0000000 --- a/spec/build.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - Greetings! This is build.xml for the JSP spec - - - - - - - - - - - - - - - diff --git a/spec/changelog.txt b/spec/changelog.txt deleted file mode 100644 index 3d1f657..0000000 --- a/spec/changelog.txt +++ /dev/null @@ -1,20 +0,0 @@ -1. The specification version is 2.3 - -2. Remove expression language from JSP specification. JSP 2.3 supports and depends on EL 3.0 - -3. Support EL 3.0 (JSR 341). - - In JSP.2.9, add the following two ELResovers, after item 2, and renumber - the other ELResolvers on the list. That is, place these ELResolvers between - the custom ELResolvers and the MapELResolver. - - 3. The ELResolver returned by ExpressionFactory.getStreamELResolver(). - 4. javax.el.StaticFieldELResolver. - -4. Clarification - - Add the following paragrah after the first praragraph in section JSP.11.1.1. - - "A JSP container must render a JSP page for the HTTP methods GET, POST, and - HEAD, with identical responses. The behavior of the JSP container - for other methods is undefined." diff --git a/spec/fm/JSP_API_Core.fm b/spec/fm/JSP_API_Core.fm deleted file mode 100644 index d2cc4d1..0000000 Binary files a/spec/fm/JSP_API_Core.fm and /dev/null differ diff --git a/spec/fm/JSP_API_EL.fm b/spec/fm/JSP_API_EL.fm deleted file mode 100644 index c08406c..0000000 Binary files a/spec/fm/JSP_API_EL.fm and /dev/null differ diff --git a/spec/fm/JSP_API_Tagext.fm b/spec/fm/JSP_API_Tagext.fm deleted file mode 100644 index 9ded6d2..0000000 Binary files a/spec/fm/JSP_API_Tagext.fm and /dev/null differ diff --git a/spec/fm/JSP_Changes.fm b/spec/fm/JSP_Changes.fm deleted file mode 100644 index 675b491..0000000 Binary files a/spec/fm/JSP_Changes.fm and /dev/null differ diff --git a/spec/fm/JSP_Compiling_JSPs.fm b/spec/fm/JSP_Compiling_JSPs.fm deleted file mode 100644 index 1c91911..0000000 Binary files a/spec/fm/JSP_Compiling_JSPs.fm and /dev/null differ diff --git a/spec/fm/JSP_Configuration.fm b/spec/fm/JSP_Configuration.fm deleted file mode 100644 index d568450..0000000 Binary files a/spec/fm/JSP_Configuration.fm and /dev/null differ diff --git a/spec/fm/JSP_DD.fm b/spec/fm/JSP_DD.fm deleted file mode 100644 index 44829b3..0000000 Binary files a/spec/fm/JSP_DD.fm and /dev/null differ diff --git a/spec/fm/JSP_Documents.fm b/spec/fm/JSP_Documents.fm deleted file mode 100644 index 261145b..0000000 Binary files a/spec/fm/JSP_Documents.fm and /dev/null differ diff --git a/spec/fm/JSP_Engine.fm b/spec/fm/JSP_Engine.fm deleted file mode 100644 index be16b78..0000000 Binary files a/spec/fm/JSP_Engine.fm and /dev/null differ diff --git a/spec/fm/JSP_Expression_Language.fm b/spec/fm/JSP_Expression_Language.fm deleted file mode 100644 index e3653f9..0000000 Binary files a/spec/fm/JSP_Expression_Language.fm and /dev/null differ diff --git a/spec/fm/JSP_Glossary.fm b/spec/fm/JSP_Glossary.fm deleted file mode 100644 index f0b7c72..0000000 Binary files a/spec/fm/JSP_Glossary.fm and /dev/null differ diff --git a/spec/fm/JSP_I18N.fm b/spec/fm/JSP_I18N.fm deleted file mode 100644 index 238b622..0000000 Binary files a/spec/fm/JSP_I18N.fm and /dev/null differ diff --git a/spec/fm/JSP_I18N_Algorithm.fm b/spec/fm/JSP_I18N_Algorithm.fm deleted file mode 100644 index ed96295..0000000 Binary files a/spec/fm/JSP_I18N_Algorithm.fm and /dev/null differ diff --git a/spec/fm/JSP_License_CD1.fm b/spec/fm/JSP_License_CD1.fm deleted file mode 100644 index 643217c..0000000 Binary files a/spec/fm/JSP_License_CD1.fm and /dev/null differ diff --git a/spec/fm/JSP_Overview.fm b/spec/fm/JSP_Overview.fm deleted file mode 100644 index 218c444..0000000 Binary files a/spec/fm/JSP_Overview.fm and /dev/null differ diff --git a/spec/fm/JSP_Part_I.fm b/spec/fm/JSP_Part_I.fm deleted file mode 100644 index ec55bd0..0000000 Binary files a/spec/fm/JSP_Part_I.fm and /dev/null differ diff --git a/spec/fm/JSP_Part_II.fm b/spec/fm/JSP_Part_II.fm deleted file mode 100644 index a4b0a61..0000000 Binary files a/spec/fm/JSP_Part_II.fm and /dev/null differ diff --git a/spec/fm/JSP_Part_III.fm b/spec/fm/JSP_Part_III.fm deleted file mode 100644 index 1392a20..0000000 Binary files a/spec/fm/JSP_Part_III.fm and /dev/null differ diff --git a/spec/fm/JSP_Preface.fm b/spec/fm/JSP_Preface.fm deleted file mode 100644 index 90fa564..0000000 Binary files a/spec/fm/JSP_Preface.fm and /dev/null differ diff --git a/spec/fm/JSP_Schema_XML.fm b/spec/fm/JSP_Schema_XML.fm deleted file mode 100644 index c6825fd..0000000 Binary files a/spec/fm/JSP_Schema_XML.fm and /dev/null differ diff --git a/spec/fm/JSP_Scripting.fm b/spec/fm/JSP_Scripting.fm deleted file mode 100644 index baf0ff8..0000000 Binary files a/spec/fm/JSP_Scripting.fm and /dev/null differ diff --git a/spec/fm/JSP_StandardActions.fm b/spec/fm/JSP_StandardActions.fm deleted file mode 100644 index 9e5242d..0000000 Binary files a/spec/fm/JSP_StandardActions.fm and /dev/null differ diff --git a/spec/fm/JSP_Status.fm b/spec/fm/JSP_Status.fm deleted file mode 100644 index 189bcb1..0000000 Binary files a/spec/fm/JSP_Status.fm and /dev/null differ diff --git a/spec/fm/JSP_Syntax.fm b/spec/fm/JSP_Syntax.fm deleted file mode 100644 index 106d700..0000000 Binary files a/spec/fm/JSP_Syntax.fm and /dev/null differ diff --git a/spec/fm/JSP_Syntax_1_16.fm b/spec/fm/JSP_Syntax_1_16.fm deleted file mode 100644 index 0cab308..0000000 Binary files a/spec/fm/JSP_Syntax_1_16.fm and /dev/null differ diff --git a/spec/fm/JSP_TLD.fm b/spec/fm/JSP_TLD.fm deleted file mode 100644 index 2c9646f..0000000 Binary files a/spec/fm/JSP_TLD.fm and /dev/null differ diff --git a/spec/fm/JSP_Tag_Extensions.fm b/spec/fm/JSP_Tag_Extensions.fm deleted file mode 100644 index 7f43883..0000000 Binary files a/spec/fm/JSP_Tag_Extensions.fm and /dev/null differ diff --git a/spec/fm/JSP_Tag_Files.fm b/spec/fm/JSP_Tag_Files.fm deleted file mode 100644 index c951396..0000000 Binary files a/spec/fm/JSP_Tag_Files.fm and /dev/null differ diff --git a/spec/fm/JSP_Title.fm b/spec/fm/JSP_Title.fm deleted file mode 100644 index a184441..0000000 Binary files a/spec/fm/JSP_Title.fm and /dev/null differ diff --git a/spec/fm/JSP_XML_Views.fm b/spec/fm/JSP_XML_Views.fm deleted file mode 100644 index 734347a..0000000 Binary files a/spec/fm/JSP_XML_Views.fm and /dev/null differ diff --git a/spec/fm/doc-files/ELResolvers.gif b/spec/fm/doc-files/ELResolvers.gif deleted file mode 100644 index 5bc6b74..0000000 Binary files a/spec/fm/doc-files/ELResolvers.gif and /dev/null differ diff --git a/spec/fm/doc-files/ELResolvers.vthought b/spec/fm/doc-files/ELResolvers.vthought deleted file mode 100644 index a4217c5..0000000 --- a/spec/fm/doc-files/ELResolvers.vthought +++ /dev/null @@ -1,1124 +0,0 @@ -; Visual Thought 1.0 - -(header - (program "vthought") - (version "1.4") - (buildDate "$Date: 1998/07/17 01:33:32 $") - (writeDate "Fri Jul 22, 2005 4:24:22 PM ") - (documentPath "D:\work\jspspec\fm\doc-files\ELResolvers.vthought") -) - -(document - (palette F) - (layout - (page "Letter") - (units "Inches") - (orientation "portrait") - (numberOfPages 1 1) - (scale 100) - (margins 18 18 18 18) - ) -) - -(views - (view - (location 189 12) - (size 795 871) - (zoom 1) - (documentLocation 0 0) - (gridSnap T) - (gridVisibility F) - (gridSpacing 14) - (pageBreaks T) - (toolVisibility T) - (rulerVisibility T) - ) -) - -(shapes - (shape - (id 15) - (layer -1) - (type "Rounded Rectangle") - (location 189.6276 56.0805) - (size 237.4529 28.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 jsp.ScopedAttributeELResolver}}) - ) - (shape - (id 21) - (layer -1) - (type "Rounded Rectangle") - (location 149.2207 728.4224) - (size 242.4414 27.1552) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 el.CompositeELResolver}}) - ) - (shape - (id 23) - (layer -1) - (type "Rounded Rectangle") - (location 189.6276 98.3218) - (size 237.4529 28.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 el.BeanELResolver}}) - ) - (shape - (id 24) - (layer -1) - (type "Rounded Rectangle") - (location 189.6276 140.5632) - (size 237.4529 28.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 el.ArrayELResolver}}) - ) - (shape - (id 25) - (layer -1) - (type "Rounded Rectangle") - (location 189.6276 182.8046) - (size 237.4529 28.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 el.ListELResolver}}) - ) - (shape - (id 26) - (layer -1) - (type "Rounded Rectangle") - (location 189.6276 225.046) - (size 237.4529 28.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 el.ResourceBundleELResolver}}) - ) - (shape - (id 27) - (layer -1) - (type "Rounded Rectangle") - (location 189.6276 267.2874) - (size 237.4529 28.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 el.MapELResolver}}) - ) - (shape - (id 28) - (layer -1) - (type "Rounded Rectangle") - (location 273.4345 309.0288) - (size 349.1954 37.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 Other ELResolvers added via -\par JspApplicationContext.addELResolver()}}) - ) - (shape - (id 29) - (layer -1) - (type "Rounded Rectangle") - (location 294.3862 351.7701) - (size 335.2276 28.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 ELResolvers from Application.addELResolver()}}) - ) - (shape - (id 30) - (layer -1) - (type "Rounded Rectangle") - (location 277.9828 392.0115) - (size 302.4207 38.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 jsf.PropertyResolverChainWrapper -\par (Supports legacy jsf.PropertyResolvers)}}) - ) - (shape - (id 31) - (layer -1) - (type "Rounded Rectangle") - (location 299.4828 436.2529) - (size 345.4207 38.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 jsf.VariableResolverChainWrapper -\par }{\i\f1\fs28\cf1 (Supports legacy jsf.VariableResolvers)}}) - ) - (shape - (id 32) - (layer -1) - (type "Rounded Rectangle") - (location 252.4828 478.4943) - (size 251.4207 28.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica-Light medium italic;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 ELResolvers in faces-config.xml}}) - ) - (shape - (id 33) - (layer -1) - (type "Rounded Rectangle") - (location 245.4988 520.7356) - (size 237.4529 28.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 jsf.ManagedBeanELResolver}}) - ) - (shape - (id 34) - (layer -1) - (type "Rounded Rectangle") - (location 245.4988 562.977) - (size 237.4529 28.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 jsf.ImplicitObjectELResolver}}) - ) - (shape - (id 35) - (layer -1) - (type "Rounded Rectangle") - (location 217.5632 605.2184) - (size 237.4529 28.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 JSF's el.CompositeELResolver}}) - ) - (shape - (id 36) - (layer -1) - (type "Rounded Rectangle") - (location 189.6276 647.4598) - (size 237.4529 28.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 el.CompositeELResolver}}) - ) - (shape - (id 37) - (layer -1) - (type "Rounded Rectangle") - (location 189.6276 689.7012) - (size 237.4529 28.1609) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Courier medium modern;}} -{\colortbl\red0\green0\blue0;\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1\fs28\cf1 jsp.ImplicitObjectELResolver}}) - ) -) - -(connections - (connection - (id 2) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (42.9655 56.0805) - (70.9011 56.0805) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 3) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (42.9655 98.3218) - (70.9011 98.3218) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 4) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (42.9655 140.5632) - (70.9011 140.5632) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 5) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (42.9655 182.8046) - (70.9011 182.8046) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 6) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (42.9655 225.046) - (70.9011 225.046) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 7) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (42.9655 267.2874) - (70.9011 267.2874) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 8) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (112.8046 351.7701) - (126.7724 351.7701) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 9) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (112.8046 394.0115) - (126.7724 394.0115) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 10) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (112.8046 436.2529) - (126.7724 436.2529) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 11) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (112.8046 478.4943) - (126.7724 478.4943) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 12) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (112.8046 520.7356) - (126.7724 520.7356) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 13) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (112.8046 562.977) - (126.7724 562.977) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 14) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (112.8046 591.1379) - (112.8046 351.7701) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 16) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (84.869 309.5287) - (98.8368 309.5287) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 17) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (84.869 605.2184) - (98.8368 605.2184) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 18) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (84.869 633.3793) - (84.869 309.5287) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 19) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (42.9655 647.4598) - (70.9011 647.4598) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 20) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (42.9655 689.7011) - (70.9011 689.7011) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 22) - (layer -1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (42.9655 717.8621) - (42.9655 56.0805) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) -) - -(groups - (group - (id 1) - (layer 0) - (rotation 0) - (locked F) - (contents 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37) - ) -) diff --git a/spec/fm/doc-files/javax/servlet/jsp/tagext/BodyTagProtocol.gif b/spec/fm/doc-files/javax/servlet/jsp/tagext/BodyTagProtocol.gif deleted file mode 100644 index a61e82b..0000000 Binary files a/spec/fm/doc-files/javax/servlet/jsp/tagext/BodyTagProtocol.gif and /dev/null differ diff --git a/spec/fm/doc-files/javax/servlet/jsp/tagext/IterationTagProtocol.gif b/spec/fm/doc-files/javax/servlet/jsp/tagext/IterationTagProtocol.gif deleted file mode 100644 index c262341..0000000 Binary files a/spec/fm/doc-files/javax/servlet/jsp/tagext/IterationTagProtocol.gif and /dev/null differ diff --git a/spec/fm/doc-files/javax/servlet/jsp/tagext/TagProtocol.gif b/spec/fm/doc-files/javax/servlet/jsp/tagext/TagProtocol.gif deleted file mode 100644 index 9a1880e..0000000 Binary files a/spec/fm/doc-files/javax/servlet/jsp/tagext/TagProtocol.gif and /dev/null differ diff --git a/spec/fm/doc-files/javax/servlet/jsp/tagext/VariableInfo-1.gif b/spec/fm/doc-files/javax/servlet/jsp/tagext/VariableInfo-1.gif deleted file mode 100644 index 32eabeb..0000000 Binary files a/spec/fm/doc-files/javax/servlet/jsp/tagext/VariableInfo-1.gif and /dev/null differ diff --git a/spec/fm/doc-files/javax/servlet/jsp/tagext/duke.gif b/spec/fm/doc-files/javax/servlet/jsp/tagext/duke.gif deleted file mode 100644 index 7c44111..0000000 Binary files a/spec/fm/doc-files/javax/servlet/jsp/tagext/duke.gif and /dev/null differ diff --git a/spec/fm/doc-files/jsp-ELResolver.gif b/spec/fm/doc-files/jsp-ELResolver.gif deleted file mode 100644 index 16f6966..0000000 Binary files a/spec/fm/doc-files/jsp-ELResolver.gif and /dev/null differ diff --git a/spec/fm/javax.servlet.jsp.el.fm b/spec/fm/javax.servlet.jsp.el.fm deleted file mode 100644 index 07aa333..0000000 Binary files a/spec/fm/javax.servlet.jsp.el.fm and /dev/null differ diff --git a/spec/fm/javax.servlet.jsp.fm b/spec/fm/javax.servlet.jsp.fm deleted file mode 100644 index bcb85bc..0000000 Binary files a/spec/fm/javax.servlet.jsp.fm and /dev/null differ diff --git a/spec/fm/javax.servlet.jsp.tagext.fm b/spec/fm/javax.servlet.jsp.tagext.fm deleted file mode 100644 index f9ddb3e..0000000 Binary files a/spec/fm/javax.servlet.jsp.tagext.fm and /dev/null differ diff --git a/spec/fm/jsp-partitioned.book b/spec/fm/jsp-partitioned.book deleted file mode 100644 index b8ebc09..0000000 Binary files a/spec/fm/jsp-partitioned.book and /dev/null differ diff --git a/spec/fm/jsp-partitioned_TOC.fm b/spec/fm/jsp-partitioned_TOC.fm deleted file mode 100644 index c9e2166..0000000 Binary files a/spec/fm/jsp-partitioned_TOC.fm and /dev/null differ diff --git a/spec/fm/tld-structure-function.vthought b/spec/fm/tld-structure-function.vthought deleted file mode 100644 index d80a9b7..0000000 --- a/spec/fm/tld-structure-function.vthought +++ /dev/null @@ -1,785 +0,0 @@ -; Visual Thought 1.0 - -(header - (program "vthought") - (version "1.4") - (buildDate "$Date: 1998/07/17 01:33:32 $") - (writeDate "Wed Apr 30, 2003 12:17:35 PM EDT") - (documentPath "/net/jse/files2/workspace/mroth/jsr152/spec/ws-mroth/src-new/JSP/tld-structure-function.vthought") -) - -(document - (palette F) - (layout - (page "Custom") - (pageDescription - (orientation "portrait") - (size 360 468) - (dscPageSize "Letter") - (paperTray "lettertray") - (paperSize "letter") - ) - (units "Inches") - (orientation "portrait") - (numberOfPages 1 1) - (scale 100) - (margins 18 18 18 18) - ) -) - -(views - (view - (location 282 139) - (size 632 723) - (zoom 1) - (documentLocation 0 0) - (gridSnap T) - (gridVisibility F) - (gridSpacing 9) - (pageBreaks T) - (toolVisibility T) - (rulerVisibility T) - ) -) - -(shapes - (shape - (id 13) - (layer 12) - (type "Rectangle") - (location 252 189) - (size 126 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc extension-element+}) - ) - (shape - (id 14) - (layer 13) - (type "Rectangle") - (location 90 189) - (size 126 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc function-extension*}) - ) - (shape - (id 15) - (layer 14) - (type "Rectangle") - (location 90 216) - (size 126 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc example?}) - ) - (shape - (id 16) - (layer 15) - (type "Rectangle") - (location 90 243) - (size 126 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc function-signature}) - ) - (shape - (id 17) - (layer 16) - (type "Rectangle") - (location 90 270) - (size 126 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc function-class}) - ) - (shape - (id 18) - (layer 17) - (type "Rectangle") - (location 90 297) - (size 126 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc name}) - ) - (shape - (id 19) - (layer 18) - (type "Rectangle") - (location 229.5 306) - (size 81 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc large-icon?}) - ) - (shape - (id 20) - (layer 19) - (type "Rectangle") - (location 229.5 342) - (size 81 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc small-icon?}) - ) - (shape - (id 21) - (layer 20) - (type "Rectangle") - (location 90 324) - (size 126 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc icon*}) - ) - (shape - (id 22) - (layer 21) - (type "Rectangle") - (location 90 351) - (size 126 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc display-name*}) - ) - (shape - (id 23) - (layer 22) - (type "Rectangle") - (location 90 378) - (size 126 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc description*}) - ) - (shape - (id 24) - (layer 23) - (type "Rectangle") - (location 40.5 414) - (size 63 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc function*}) - ) - (shape - (id 25) - (layer 24) - (type "Rectangle") - (location 162 301.5) - (size 324 261) - (rotation 0) - (locked F) - (style - (filled F) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText F) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - ) -) - -(connections - (connection - (id 1) - (layer 0) - (rotation 0) - (textRotation 0) - (locked F) - (end 23) - (points - (18 378) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 2) - (layer 1) - (rotation 0) - (textRotation 0) - (locked F) - (end 22) - (points - (18 351) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 3) - (layer 2) - (rotation 0) - (textRotation 0) - (locked F) - (end 21) - (points - (18 324) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 4) - (layer 3) - (rotation 0) - (textRotation 0) - (locked F) - (end 18) - (points - (18 297) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 5) - (layer 4) - (rotation 0) - (textRotation 0) - (locked F) - (end 17) - (points - (18 270) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 6) - (layer 5) - (rotation 0) - (textRotation 0) - (locked F) - (end 16) - (points - (18 243) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 7) - (layer 6) - (rotation 0) - (textRotation 0) - (locked F) - (end 15) - (points - (18 216) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 8) - (layer 7) - (rotation 0) - (textRotation 0) - (locked F) - (start 9 1) - (end 14) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 9) - (layer 8) - (rotation 0) - (textRotation 0) - (locked F) - (points - (18 405) - (18 189) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 10) - (layer 9) - (rotation 0) - (textRotation 0) - (locked F) - (start 14) - (end 13) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 11) - (layer 10) - (rotation 0) - (textRotation 0) - (locked F) - (start 12 1) - (end 19) - (points - (171 306) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 12) - (layer 11) - (rotation 0) - (textRotation 0) - (locked F) - (start 21) - (end 20) - (points - (171 324) - (171 342) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) -) - -(groups -) diff --git a/spec/fm/tld-structure-listener.vthought b/spec/fm/tld-structure-listener.vthought deleted file mode 100644 index 8c48c1d..0000000 --- a/spec/fm/tld-structure-listener.vthought +++ /dev/null @@ -1,494 +0,0 @@ -; Visual Thought 1.0 - -(header - (program "vthought") - (version "1.4") - (buildDate "$Date: 1998/07/17 01:33:32 $") - (writeDate "Wed May 14, 2003 11:08:07 PM EDT") - (documentPath "/home/mroth/jsp/spec/ws-mroth/src-new/JSP/tld-structure-listener.vthought") -) - -(document - (palette F) - (layout - (page "Custom") - (pageDescription - (orientation "portrait") - (size 360 468) - (dscPageSize "Letter") - (paperTray "lettertray") - (paperSize "letter") - ) - (units "Inches") - (orientation "portrait") - (numberOfPages 1 1) - (scale 100) - (margins 18 18 18 18) - ) -) - -(views - (view - (location 471 196) - (size 632 723) - (zoom 1) - (documentLocation 0 0) - (gridSnap T) - (gridVisibility F) - (gridSpacing 9) - (pageBreaks T) - (toolVisibility T) - (rulerVisibility T) - ) -) - -(shapes - (shape - (id 8) - (layer 7) - (type "Rectangle") - (location 76.5 297) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc listener-class}) - ) - (shape - (id 9) - (layer 8) - (type "Rectangle") - (location 202.5 306) - (size 81 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc large-icon?}) - ) - (shape - (id 10) - (layer 9) - (type "Rectangle") - (location 202.5 342) - (size 81 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc small-icon?}) - ) - (shape - (id 11) - (layer 10) - (type "Rectangle") - (location 76.5 324) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc icon*}) - ) - (shape - (id 12) - (layer 11) - (type "Rectangle") - (location 76.5 351) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc display-name*}) - ) - (shape - (id 13) - (layer 12) - (type "Rectangle") - (location 76.5 378) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc description*}) - ) - (shape - (id 14) - (layer 13) - (type "Rectangle") - (location 40.5 414) - (size 63 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc listener*}) - ) - (shape - (id 15) - (layer 14) - (type "Rectangle") - (location 148.5 355.5) - (size 297 153) - (rotation 0) - (locked F) - (style - (filled F) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc }) - ) -) - -(connections - (connection - (id 1) - (layer 0) - (rotation 0) - (textRotation 0) - (locked F) - (end 13) - (points - (18 378) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 2) - (layer 1) - (rotation 0) - (textRotation 0) - (locked F) - (end 12) - (points - (18 351) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 3) - (layer 2) - (rotation 0) - (textRotation 0) - (locked F) - (end 11) - (points - (18 324) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 4) - (layer 3) - (rotation 0) - (textRotation 0) - (locked F) - (end 8) - (points - (18 297) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 5) - (layer 4) - (rotation 0) - (textRotation 0) - (locked F) - (end 4) - (points - (18 405) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 6) - (layer 5) - (rotation 0) - (textRotation 0) - (locked F) - (start 7 1) - (end 9) - (points - (144 306) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 7) - (layer 6) - (rotation 0) - (textRotation 0) - (locked F) - (start 11) - (end 10) - (points - (144 324) - (144 342) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) -) - -(groups -) diff --git a/spec/fm/tld-structure-tag-2_1.vthought b/spec/fm/tld-structure-tag-2_1.vthought deleted file mode 100644 index 565af1b..0000000 --- a/spec/fm/tld-structure-tag-2_1.vthought +++ /dev/null @@ -1,1998 +0,0 @@ -; Visual Thought 1.0 - -(header - (program "vthought") - (version "1.4") - (buildDate "$Date: 1998/07/17 01:33:32 $") - (writeDate "Tue Aug 9, 2005 12:19:49 PM ") - (documentPath "D:\work\jspspec\fm\tld-structure-tag-2_1.vthought") -) - -(document - (palette F) - (layout - (page "Custom") - (pageDescription - (orientation "portrait") - (size 504 576) - (dscPageSize "Letter") - (paperTray "lettertray") - (paperSize "letter") - ) - (units "Inches") - (orientation "portrait") - (numberOfPages 1 1) - (scale 100) - (margins 18 18 18 18) - ) -) - -(views - (view - (location 253 71) - (size 689 874) - (zoom 1) - (documentLocation 0 0) - (gridSnap T) - (gridVisibility F) - (gridSpacing 5) - (pageBreaks T) - (toolVisibility T) - (rulerVisibility T) - ) -) - -(shapes - (shape - (id 1) - (layer 0) - (type "Rectangle") - (location 402 178.5) - (size 144 53) - (rotation 0) - (locked F) - (style - (filled F) - (fillColor 65535 65535 65535) - (stroked F) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "top") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard {\fs22 rtexprvalue can be used -\par jointly with deferred-value -\par or deferred-method} -\par \pard\qc }) - ) - (shape - (id 2) - (layer 1) - (type "Ellipse") - (location 180 140) - (size 18 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 1}}) - ) - (shape - (id 6) - (layer 5) - (type "Rectangle") - (location 265.5 153) - (size 117 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 fragment?}}) - ) - (shape - (id 7) - (layer 6) - (type "Rectangle") - (location 265.5 180) - (size 117 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 (rtexprvalue? type?)}}) - ) - (shape - (id 10) - (layer 9) - (type "Rectangle") - (location 400.5 99) - (size 117 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 method-signature?}}) - ) - (shape - (id 11) - (layer 10) - (type "Rectangle") - (location 400.5 126) - (size 117 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 type?}}) - ) - (shape - (id 12) - (layer 11) - (type "Rectangle") - (location 265.5 99) - (size 117 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 deferred-method?}}) - ) - (shape - (id 13) - (layer 12) - (type "Rectangle") - (location 265.5 126) - (size 117 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 deferred-value?}}) - ) - (shape - (id 36) - (layer 35) - (type "Rectangle") - (location 229.5 207) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 required?}}) - ) - (shape - (id 37) - (layer 36) - (type "Rectangle") - (location 229.5 234) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 name}}) - ) - (shape - (id 38) - (layer 37) - (type "Rectangle") - (location 229.5 261) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 description*}}) - ) - (shape - (id 39) - (layer 38) - (type "Rectangle") - (location 229.5 297) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 scope?}}) - ) - (shape - (id 40) - (layer 39) - (type "Rectangle") - (location 229.5 324) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 declare?}}) - ) - (shape - (id 41) - (layer 40) - (type "Rectangle") - (location 229.5 351) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 variable-class?}}) - ) - (shape - (id 42) - (layer 41) - (type "Rectangle") - (location 243 387) - (size 126 36) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 name-given | name-from-attribute}}) - ) - (shape - (id 43) - (layer 42) - (type "Rectangle") - (location 229.5 423) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 description*}}) - ) - (shape - (id 46) - (layer 45) - (type "Rectangle") - (location 243 27) - (size 126 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 extension-element+}}) - ) - (shape - (id 47) - (layer 46) - (type "Rectangle") - (location 76.5 27) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 tag-extension*}}) - ) - (shape - (id 48) - (layer 47) - (type "Rectangle") - (location 76.5 54) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 example?}}) - ) - (shape - (id 49) - (layer 48) - (type "Rectangle") - (location 90 81) - (size 126 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 dynamic-attributes?}}) - ) - (shape - (id 50) - (layer 49) - (type "Rectangle") - (location 63 243) - (size 72 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 attribute*}}) - ) - (shape - (id 51) - (layer 50) - (type "Rectangle") - (location 76.5 297) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 variable*}}) - ) - (shape - (id 52) - (layer 51) - (type "Rectangle") - (location 76.5 324) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 body-content}}) - ) - (shape - (id 53) - (layer 52) - (type "Rectangle") - (location 76.5 351) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 tei-class?}}) - ) - (shape - (id 54) - (layer 53) - (type "Rectangle") - (location 76.5 378) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 tag-class}}) - ) - (shape - (id 55) - (layer 54) - (type "Rectangle") - (location 76.5 405) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 name}}) - ) - (shape - (id 59) - (layer 58) - (type "Rectangle") - (location 229.5 459) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 large-icon?}}) - ) - (shape - (id 60) - (layer 59) - (type "Rectangle") - (location 229.5 486) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 small-icon?}}) - ) - (shape - (id 61) - (layer 60) - (type "Rectangle") - (location 76.5 432) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 icon*}}) - ) - (shape - (id 62) - (layer 61) - (type "Rectangle") - (location 76.5 459) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 display-name*}}) - ) - (shape - (id 63) - (layer 62) - (type "Rectangle") - (location 76.5 486) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 description*}}) - ) - (shape - (id 64) - (layer 63) - (type "Rectangle") - (location 31.5 513) - (size 45 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 tag*}}) - ) - (shape - (id 66) - (layer 65) - (type "Rectangle") - (location 233.5 272) - (size 467 536) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText F) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - ) -) - -(connections - (connection - (id 3) - (layer 2) - (rotation 0) - (textRotation 0) - (locked F) - (start 4) - (points - (206 154) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 4) - (layer 3) - (rotation 0) - (textRotation 0) - (locked F) - (start 5) - (points - (207 100) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 5) - (layer 4) - (rotation 0) - (textRotation 0) - (locked F) - (start 29 4) - (points - (206 179) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 8) - (layer 7) - (rotation 0) - (textRotation 0) - (locked F) - (points - (324 99) - (342 99) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 9) - (layer 8) - (rotation 0) - (textRotation 0) - (locked F) - (points - (324 126) - (342 126) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 14) - (layer 13) - (rotation 0) - (textRotation 0) - (locked F) - (end 63) - (points - (18 486) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 15) - (layer 14) - (rotation 0) - (textRotation 0) - (locked F) - (end 62) - (points - (18 459) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 16) - (layer 15) - (rotation 0) - (textRotation 0) - (locked F) - (end 61) - (points - (18 432) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 17) - (layer 16) - (rotation 0) - (textRotation 0) - (locked F) - (end 55) - (points - (18 405) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 18) - (layer 17) - (rotation 0) - (textRotation 0) - (locked F) - (end 54) - (points - (18 378) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 19) - (layer 18) - (rotation 0) - (textRotation 0) - (locked F) - (end 53) - (points - (18 351) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 20) - (layer 19) - (rotation 0) - (textRotation 0) - (locked F) - (end 52) - (points - (18 324) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 21) - (layer 20) - (rotation 0) - (textRotation 0) - (locked F) - (end 51) - (points - (18 297) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 22) - (layer 21) - (rotation 0) - (textRotation 0) - (locked F) - (end 50) - (points - (18 243) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 23) - (layer 22) - (rotation 0) - (textRotation 0) - (locked F) - (end 49) - (points - (18 81) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 24) - (layer 23) - (rotation 0) - (textRotation 0) - (locked F) - (end 48) - (points - (18 54) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 25) - (layer 24) - (rotation 0) - (textRotation 0) - (locked F) - (start 44 1) - (end 47) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 26) - (layer 25) - (rotation 0) - (textRotation 0) - (locked F) - (start 29 1) - (end 38) - (points - (162 261) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 27) - (layer 26) - (rotation 0) - (textRotation 0) - (locked F) - (end 37) - (points - (162 234) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 28) - (layer 27) - (rotation 0) - (textRotation 0) - (locked F) - (end 36) - (points - (162 207) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 29) - (layer 28) - (rotation 0) - (textRotation 0) - (locked F) - (start 50) - (points - (162 243) - (162 140) - (162 140) - (180 140) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 30) - (layer 29) - (rotation 0) - (textRotation 0) - (locked F) - (start 35 1) - (end 39) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 31) - (layer 30) - (rotation 0) - (textRotation 0) - (locked F) - (end 40) - (points - (162 324) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 32) - (layer 31) - (rotation 0) - (textRotation 0) - (locked F) - (end 41) - (points - (162 351) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 33) - (layer 32) - (rotation 0) - (textRotation 0) - (locked F) - (end 42) - (points - (162 387) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 34) - (layer 33) - (rotation 0) - (textRotation 0) - (locked F) - (start 35 2) - (end 43) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 35) - (layer 34) - (rotation 0) - (textRotation 0) - (locked F) - (start 51) - (points - (162 297) - (162 423) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 44) - (layer 43) - (rotation 0) - (textRotation 0) - (locked F) - (points - (18 504) - (18 27) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 45) - (layer 44) - (rotation 0) - (textRotation 0) - (locked F) - (start 47) - (end 46) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 56) - (layer 55) - (rotation 0) - (textRotation 0) - (locked F) - (end 59) - (points - (144 459) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 57) - (layer 56) - (rotation 0) - (textRotation 0) - (locked F) - (start 58 2) - (end 60) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 58) - (layer 57) - (rotation 0) - (textRotation 0) - (locked F) - (start 61) - (points - (144 432) - (144 486) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 65) - (layer 64) - (rotation 0) - (textRotation 0) - (locked F) - (start 3) - (points - (206 124) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil Arial medium;}{\f1\fnil Helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\f1 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) -) - -(groups -) diff --git a/spec/fm/tld-structure-tag-file.vthought b/spec/fm/tld-structure-tag-file.vthought deleted file mode 100644 index d9c5f40..0000000 --- a/spec/fm/tld-structure-tag-file.vthought +++ /dev/null @@ -1,726 +0,0 @@ -; Visual Thought 1.0 - -(header - (program "vthought") - (version "1.4") - (buildDate "$Date: 1998/07/17 01:33:32 $") - (writeDate "Wed Apr 30, 2003 12:15:00 PM EDT") - (documentPath "/net/jse/files2/workspace/mroth/jsr152/spec/ws-mroth/src-new/JSP/tld-structure-tag-file.vthought") -) - -(document - (palette F) - (layout - (page "Custom") - (pageDescription - (orientation "portrait") - (size 360 468) - (dscPageSize "Letter") - (paperTray "lettertray") - (paperSize "letter") - ) - (units "Inches") - (orientation "portrait") - (numberOfPages 1 1) - (scale 100) - (margins 18 18 18 18) - ) -) - -(views - (view - (location 471 196) - (size 632 723) - (zoom 1) - (documentLocation 0 0) - (gridSnap T) - (gridVisibility F) - (gridSpacing 9) - (pageBreaks T) - (toolVisibility T) - (rulerVisibility T) - ) -) - -(shapes - (shape - (id 12) - (layer 11) - (type "Rectangle") - (location 225 216) - (size 126 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc extension-element+}) - ) - (shape - (id 13) - (layer 12) - (type "Rectangle") - (location 76.5 216) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc tag-extension*}) - ) - (shape - (id 14) - (layer 13) - (type "Rectangle") - (location 76.5 243) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc example?}) - ) - (shape - (id 15) - (layer 14) - (type "Rectangle") - (location 76.5 270) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc path}) - ) - (shape - (id 16) - (layer 15) - (type "Rectangle") - (location 76.5 297) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc name}) - ) - (shape - (id 17) - (layer 16) - (type "Rectangle") - (location 202.5 306) - (size 81 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc large-icon?}) - ) - (shape - (id 18) - (layer 17) - (type "Rectangle") - (location 202.5 342) - (size 81 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc small-icon?}) - ) - (shape - (id 19) - (layer 18) - (type "Rectangle") - (location 76.5 324) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc icon*}) - ) - (shape - (id 20) - (layer 19) - (type "Rectangle") - (location 76.5 351) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc display-name*}) - ) - (shape - (id 21) - (layer 20) - (type "Rectangle") - (location 76.5 378) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc description*}) - ) - (shape - (id 22) - (layer 21) - (type "Rectangle") - (location 36 414) - (size 54 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc tag-file*}) - ) - (shape - (id 23) - (layer 22) - (type "Rectangle") - (location 148.5 315) - (size 297 234) - (rotation 0) - (locked F) - (style - (filled F) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText F) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - ) -) - -(connections - (connection - (id 1) - (layer 0) - (rotation 0) - (textRotation 0) - (locked F) - (end 21) - (points - (18 378) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 2) - (layer 1) - (rotation 0) - (textRotation 0) - (locked F) - (end 20) - (points - (18 351) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 3) - (layer 2) - (rotation 0) - (textRotation 0) - (locked F) - (end 19) - (points - (18 324) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 4) - (layer 3) - (rotation 0) - (textRotation 0) - (locked F) - (end 16) - (points - (18 297) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 5) - (layer 4) - (rotation 0) - (textRotation 0) - (locked F) - (end 15) - (points - (18 270) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 6) - (layer 5) - (rotation 0) - (textRotation 0) - (locked F) - (end 14) - (points - (18 243) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 7) - (layer 6) - (rotation 0) - (textRotation 0) - (locked F) - (start 8 1) - (end 13) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 8) - (layer 7) - (rotation 0) - (textRotation 0) - (locked F) - (points - (18 405) - (18 216) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 9) - (layer 8) - (rotation 0) - (textRotation 0) - (locked F) - (start 10 1) - (end 17) - (points - (144 306) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 10) - (layer 9) - (rotation 0) - (textRotation 0) - (locked F) - (start 19) - (end 18) - (points - (144 324) - (144 342) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 11) - (layer 10) - (rotation 0) - (textRotation 0) - (locked F) - (start 13) - (end 12) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) -) - -(groups -) diff --git a/spec/fm/tld-structure-tag.vthought b/spec/fm/tld-structure-tag.vthought deleted file mode 100644 index 42f683b..0000000 --- a/spec/fm/tld-structure-tag.vthought +++ /dev/null @@ -1,1615 +0,0 @@ -; Visual Thought 1.0 - -(header - (program "vthought") - (version "1.4") - (buildDate "$Date: 1998/07/17 01:33:32 $") - (writeDate "Mon Sep 8, 2003 12:08:54 PM EDT") - (documentPath "/net/jse/files2/workspace/mroth/jsr152/spec/ws-mroth/src-new/JSP/tld-structure-tag.vthought") -) - -(document - (palette F) - (layout - (page "Custom") - (pageDescription - (orientation "portrait") - (size 360 468) - (dscPageSize "Letter") - (paperTray "lettertray") - (paperSize "letter") - ) - (units "Inches") - (orientation "portrait") - (numberOfPages 1 1) - (scale 100) - (margins 18 18 18 18) - ) -) - -(views - (view - (location 323 11) - (size 632 722) - (zoom 1) - (documentLocation 0 0) - (gridSnap T) - (gridVisibility F) - (gridSpacing 9) - (pageBreaks T) - (toolVisibility T) - (rulerVisibility T) - ) -) - -(shapes - (shape - (id 23) - (layer 22) - (type "Rectangle") - (location 243 63) - (size 126 36) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc (rtexprvalue? type?) | fragment?}) - ) - (shape - (id 24) - (layer 23) - (type "Rectangle") - (location 229.5 99) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc required?}) - ) - (shape - (id 25) - (layer 24) - (type "Rectangle") - (location 229.5 126) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc name}) - ) - (shape - (id 26) - (layer 25) - (type "Rectangle") - (location 229.5 153) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc description*}) - ) - (shape - (id 27) - (layer 26) - (type "Rectangle") - (location 229.5 189) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc scope?}) - ) - (shape - (id 28) - (layer 27) - (type "Rectangle") - (location 229.5 216) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc declare?}) - ) - (shape - (id 29) - (layer 28) - (type "Rectangle") - (location 229.5 243) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc variable-class?}) - ) - (shape - (id 30) - (layer 29) - (type "Rectangle") - (location 243 279) - (size 126 36) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc name-given | name-from-attribute}) - ) - (shape - (id 31) - (layer 30) - (type "Rectangle") - (location 229.5 315) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc description*}) - ) - (shape - (id 34) - (layer 33) - (type "Rectangle") - (location 243 18) - (size 126 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc extension-element+}) - ) - (shape - (id 35) - (layer 34) - (type "Rectangle") - (location 76.5 18) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc tag-extension*}) - ) - (shape - (id 36) - (layer 35) - (type "Rectangle") - (location 76.5 45) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc example?}) - ) - (shape - (id 37) - (layer 36) - (type "Rectangle") - (location 90 72) - (size 126 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc dynamic-attributes?}) - ) - (shape - (id 38) - (layer 37) - (type "Rectangle") - (location 63 135) - (size 72 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc attribute*}) - ) - (shape - (id 39) - (layer 38) - (type "Rectangle") - (location 76.5 189) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc variable*}) - ) - (shape - (id 40) - (layer 39) - (type "Rectangle") - (location 76.5 216) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc body-content}) - ) - (shape - (id 41) - (layer 40) - (type "Rectangle") - (location 76.5 243) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc tei-class?}) - ) - (shape - (id 42) - (layer 41) - (type "Rectangle") - (location 76.5 270) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc tag-class}) - ) - (shape - (id 43) - (layer 42) - (type "Rectangle") - (location 76.5 297) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc name}) - ) - (shape - (id 47) - (layer 46) - (type "Rectangle") - (location 229.5 351) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc large-icon?}) - ) - (shape - (id 48) - (layer 47) - (type "Rectangle") - (location 229.5 378) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc small-icon?}) - ) - (shape - (id 49) - (layer 48) - (type "Rectangle") - (location 76.5 324) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc icon*}) - ) - (shape - (id 50) - (layer 49) - (type "Rectangle") - (location 76.5 351) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc display-name*}) - ) - (shape - (id 51) - (layer 50) - (type "Rectangle") - (location 76.5 378) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc description*}) - ) - (shape - (id 52) - (layer 51) - (type "Rectangle") - (location 31.5 414) - (size 45 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc tag*}) - ) - (shape - (id 53) - (layer 52) - (type "Rectangle") - (location 162 216) - (size 324 432) - (rotation 0) - (locked F) - (style - (filled F) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText F) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - ) -) - -(connections - (connection - (id 1) - (layer 0) - (rotation 0) - (textRotation 0) - (locked F) - (end 51) - (points - (18 378) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 2) - (layer 1) - (rotation 0) - (textRotation 0) - (locked F) - (end 50) - (points - (18 351) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 3) - (layer 2) - (rotation 0) - (textRotation 0) - (locked F) - (end 49) - (points - (18 324) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 4) - (layer 3) - (rotation 0) - (textRotation 0) - (locked F) - (end 43) - (points - (18 297) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 5) - (layer 4) - (rotation 0) - (textRotation 0) - (locked F) - (end 42) - (points - (18 270) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 6) - (layer 5) - (rotation 0) - (textRotation 0) - (locked F) - (end 41) - (points - (18 243) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 7) - (layer 6) - (rotation 0) - (textRotation 0) - (locked F) - (end 40) - (points - (18 216) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 8) - (layer 7) - (rotation 0) - (textRotation 0) - (locked F) - (end 39) - (points - (18 189) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 9) - (layer 8) - (rotation 0) - (textRotation 0) - (locked F) - (end 38) - (points - (18 135) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 10) - (layer 9) - (rotation 0) - (textRotation 0) - (locked F) - (end 37) - (points - (18 72) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 11) - (layer 10) - (rotation 0) - (textRotation 0) - (locked F) - (end 36) - (points - (18 45) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 12) - (layer 11) - (rotation 0) - (textRotation 0) - (locked F) - (start 32 1) - (end 35) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 13) - (layer 12) - (rotation 0) - (textRotation 0) - (locked F) - (start 16 1) - (end 26) - (points - (162 153) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 14) - (layer 13) - (rotation 0) - (textRotation 0) - (locked F) - (end 25) - (points - (162 126) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 15) - (layer 14) - (rotation 0) - (textRotation 0) - (locked F) - (end 24) - (points - (162 99) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 16) - (layer 15) - (rotation 0) - (textRotation 0) - (locked F) - (start 38) - (end 23) - (points - (162 135) - (162 63) - (162 63) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 17) - (layer 16) - (rotation 0) - (textRotation 0) - (locked F) - (start 22 1) - (end 27) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 18) - (layer 17) - (rotation 0) - (textRotation 0) - (locked F) - (end 28) - (points - (162 216) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 19) - (layer 18) - (rotation 0) - (textRotation 0) - (locked F) - (end 29) - (points - (162 243) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 20) - (layer 19) - (rotation 0) - (textRotation 0) - (locked F) - (end 30) - (points - (162 279) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 21) - (layer 20) - (rotation 0) - (textRotation 0) - (locked F) - (start 22 2) - (end 31) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 22) - (layer 21) - (rotation 0) - (textRotation 0) - (locked F) - (start 39) - (points - (162 189) - (162 315) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 32) - (layer 31) - (rotation 0) - (textRotation 0) - (locked F) - (points - (18 405) - (18 18) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 33) - (layer 32) - (rotation 0) - (textRotation 0) - (locked F) - (start 35) - (end 34) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 44) - (layer 43) - (rotation 0) - (textRotation 0) - (locked F) - (end 47) - (points - (144 351) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 45) - (layer 44) - (rotation 0) - (textRotation 0) - (locked F) - (start 46 2) - (end 48) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 46) - (layer 45) - (rotation 0) - (textRotation 0) - (locked F) - (start 49) - (points - (144 324) - (144 378) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) -) - -(groups -) diff --git a/spec/fm/tld-structure.vthought b/spec/fm/tld-structure.vthought deleted file mode 100644 index d57d3a2..0000000 --- a/spec/fm/tld-structure.vthought +++ /dev/null @@ -1,1961 +0,0 @@ -; Visual Thought 1.0 - -(header - (program "vthought") - (version "1.4") - (buildDate "$Date: 1998/07/17 01:33:32 $") - (writeDate "Wed May 14, 2003 10:57:56 PM EDT") - (documentPath "/home/mroth/jsp/spec/ws-mroth/src-new/JSP/tld-structure.vthought") -) - -(document - (palette F) - (layout - (page "Custom") - (pageDescription - (orientation "portrait") - (size 360 468) - (dscPageSize "Letter") - (paperTray "lettertray") - (paperSize "letter") - ) - (units "Inches") - (orientation "portrait") - (numberOfPages 1 1) - (scale 100) - (margins 18 18 18 18) - ) -) - -(views - (view - (location 269 164) - (size 632 723) - (zoom 1) - (documentLocation 0 0) - (gridSnap T) - (gridVisibility F) - (gridSpacing 9) - (pageBreaks T) - (toolVisibility T) - (rulerVisibility T) - ) -) - -(shapes - (shape - (id 1) - (layer 0) - (type "Rectangle") - (location 216 189) - (size 144 18) - (rotation 0) - (locked F) - (style - (filled F) - (fillColor 65535 65535 65535) - (stroked F) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "top") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard {\i See Below...}}) - ) - (shape - (id 3) - (layer 2) - (type "Rectangle") - (location 216 108) - (size 144 18) - (rotation 0) - (locked F) - (style - (filled F) - (fillColor 65535 65535 65535) - (stroked F) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "top") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard {\i See Below...}}) - ) - (shape - (id 4) - (layer 3) - (type "Rectangle") - (location 216 135) - (size 144 18) - (rotation 0) - (locked F) - (style - (filled F) - (fillColor 65535 65535 65535) - (stroked F) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "top") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard {\i See Below...}}) - ) - (shape - (id 5) - (layer 4) - (type "Rectangle") - (location 216 162) - (size 144 18) - (rotation 0) - (locked F) - (style - (filled F) - (fillColor 65535 65535 65535) - (stroked F) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "top") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard {\i See Below...}}) - ) - (shape - (id 14) - (layer 13) - (type "Rectangle") - (location 274.5 198) - (size 81 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc param-value}) - ) - (shape - (id 15) - (layer 14) - (type "Rectangle") - (location 274.5 225) - (size 81 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc param-name}) - ) - (shape - (id 16) - (layer 15) - (type "Rectangle") - (location 274.5 252) - (size 81 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc description*}) - ) - (shape - (id 17) - (layer 16) - (type "Rectangle") - (location 180 252) - (size 72 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc init-param*}) - ) - (shape - (id 18) - (layer 17) - (type "Rectangle") - (location 193.5 279) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc validator-class}) - ) - (shape - (id 19) - (layer 18) - (type "Rectangle") - (location 193.5 306) - (size 99 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc description*}) - ) - (shape - (id 21) - (layer 20) - (type "Rectangle") - (location 207 81) - (size 126 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc extension-element+}) - ) - (shape - (id 41) - (layer 40) - (type "Rectangle") - (location 81 81) - (size 108 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc taglib-extension*}) - ) - (shape - (id 42) - (layer 41) - (type "Rectangle") - (location 72 108) - (size 90 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc function*}) - ) - (shape - (id 43) - (layer 42) - (type "Rectangle") - (location 72 135) - (size 90 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc tag-file*}) - ) - (shape - (id 44) - (layer 43) - (type "Rectangle") - (location 72 162) - (size 90 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc tag*}) - ) - (shape - (id 45) - (layer 44) - (type "Rectangle") - (location 72 189) - (size 90 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc listener*}) - ) - (shape - (id 46) - (layer 45) - (type "Rectangle") - (location 72 216) - (size 90 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc validator?}) - ) - (shape - (id 47) - (layer 46) - (type "Rectangle") - (location 72 243) - (size 90 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc uri?}) - ) - (shape - (id 48) - (layer 47) - (type "Rectangle") - (location 72 270) - (size 90 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc short-name}) - ) - (shape - (id 49) - (layer 48) - (type "Rectangle") - (location 72 297) - (size 90 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc tlib-version}) - ) - (shape - (id 50) - (layer 49) - (type "Rectangle") - (location 184.5 351) - (size 81 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc large-icon?}) - ) - (shape - (id 51) - (layer 50) - (type "Rectangle") - (location 184.5 378) - (size 81 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc small-icon?}) - ) - (shape - (id 52) - (layer 51) - (type "Rectangle") - (location 72 324) - (size 90 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc icon*}) - ) - (shape - (id 53) - (layer 52) - (type "Rectangle") - (location 72 351) - (size 90 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc display-name*}) - ) - (shape - (id 54) - (layer 53) - (type "Rectangle") - (location 72 378) - (size 90 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc description*}) - ) - (shape - (id 55) - (layer 54) - (type "Rectangle") - (location 63 108) - (size 72 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc function}) - ) - (shape - (id 56) - (layer 55) - (type "Rectangle") - (location 63 135) - (size 72 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc tag-file*}) - ) - (shape - (id 57) - (layer 56) - (type "Rectangle") - (location 63 162) - (size 72 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc tag*}) - ) - (shape - (id 58) - (layer 57) - (type "Rectangle") - (location 63 189) - (size 72 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc listener*}) - ) - (shape - (id 59) - (layer 58) - (type "Rectangle") - (location 63 216) - (size 72 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc validator?}) - ) - (shape - (id 60) - (layer 59) - (type "Rectangle") - (location 63 243) - (size 72 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc uri?}) - ) - (shape - (id 61) - (layer 60) - (type "Rectangle") - (location 63 270) - (size 72 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc short-name}) - ) - (shape - (id 62) - (layer 61) - (type "Rectangle") - (location 63 297) - (size 72 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc tlib-version}) - ) - (shape - (id 63) - (layer 62) - (type "Rectangle") - (location 63 324) - (size 72 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc icon*}) - ) - (shape - (id 64) - (layer 63) - (type "Rectangle") - (location 63 378) - (size 72 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc description*}) - ) - (shape - (id 65) - (layer 64) - (type "Rectangle") - (location 31.5 414) - (size 45 18) - (rotation 0) - (locked F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed T) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText T) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc taglib}) - ) - (shape - (id 66) - (layer 65) - (type "Rectangle") - (location 162 247.5) - (size 324 369) - (rotation 0) - (locked F) - (style - (filled F) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (flipHorizontal F) - (flipVertical F) - (showText F) - (textVerticalAlignment "center") - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - ) -) - -(connections - (connection - (id 2) - (layer 1) - (rotation 0) - (textRotation 0) - (locked F) - (points - (117 189) - (144 189) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 6) - (layer 5) - (rotation 0) - (textRotation 0) - (locked F) - (start 8 1) - (end 14) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 7) - (layer 6) - (rotation 0) - (textRotation 0) - (locked F) - (end 15) - (points - (225 225) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 8) - (layer 7) - (rotation 0) - (textRotation 0) - (locked F) - (points - (225 252) - (225 198) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 9) - (layer 8) - (rotation 0) - (textRotation 0) - (locked F) - (start 17) - (end 16) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 10) - (layer 9) - (rotation 0) - (textRotation 0) - (locked F) - (end 17) - (points - (135 252) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 11) - (layer 10) - (rotation 0) - (textRotation 0) - (locked F) - (end 18) - (points - (135 279) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 12) - (layer 11) - (rotation 0) - (textRotation 0) - (locked F) - (start 13 2) - (end 19) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 13) - (layer 12) - (rotation 0) - (textRotation 0) - (locked F) - (start 46) - (points - (135 216) - (135 306) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 20) - (layer 19) - (rotation 0) - (textRotation 0) - (locked F) - (start 41) - (end 21) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 22) - (layer 21) - (rotation 0) - (textRotation 0) - (locked F) - (start 42) - (points - (144 108) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 23) - (layer 22) - (rotation 0) - (textRotation 0) - (locked F) - (start 43) - (points - (144 135) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 24) - (layer 23) - (rotation 0) - (textRotation 0) - (locked F) - (start 44) - (points - (144 162) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 25) - (layer 24) - (rotation 0) - (textRotation 0) - (locked F) - (end 50) - (points - (135 351) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 26) - (layer 25) - (rotation 0) - (textRotation 0) - (locked F) - (start 27 2) - (end 51) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 27) - (layer 26) - (rotation 0) - (textRotation 0) - (locked F) - (start 52) - (points - (135 324) - (135 378) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc Text}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 28) - (layer 27) - (rotation 0) - (textRotation 0) - (locked F) - (start 40 1) - (end 41) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\fs18 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 29) - (layer 28) - (rotation 0) - (textRotation 0) - (locked F) - (end 42) - (points - (18 108) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\fs18 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 30) - (layer 29) - (rotation 0) - (textRotation 0) - (locked F) - (end 43) - (points - (18 135) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\fs18 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 31) - (layer 30) - (rotation 0) - (textRotation 0) - (locked F) - (end 44) - (points - (18 162) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\fs18 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 32) - (layer 31) - (rotation 0) - (textRotation 0) - (locked F) - (end 45) - (points - (18 189) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\fs18 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 33) - (layer 32) - (rotation 0) - (textRotation 0) - (locked F) - (end 46) - (points - (18 216) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\fs18 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 34) - (layer 33) - (rotation 0) - (textRotation 0) - (locked F) - (end 47) - (points - (18 243) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\fs18 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 35) - (layer 34) - (rotation 0) - (textRotation 0) - (locked F) - (end 48) - (points - (18 270) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\fs18 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 36) - (layer 35) - (rotation 0) - (textRotation 0) - (locked F) - (end 49) - (points - (18 297) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\fs18 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 37) - (layer 36) - (rotation 0) - (textRotation 0) - (locked F) - (end 52) - (points - (18 324) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\fs18 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 38) - (layer 37) - (rotation 0) - (textRotation 0) - (locked F) - (end 53) - (points - (18 351) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\fs18 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 39) - (layer 38) - (rotation 0) - (textRotation 0) - (locked F) - (end 54) - (points - (18 378) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\fs18 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) - (connection - (id 40) - (layer 39) - (rotation 0) - (textRotation 0) - (locked F) - (points - (18 405) - (18 81) - ) - (curved F) - (style - (filled T) - (fillColor 65535 65535 65535) - (stroked T) - (strokeColor 0 0 0) - (lineWidth 1) - (shadowed F) - (shadowColor 39321 39321 39321) - ) - (showText F) - (textDistancePercentage 0.5) - (textWidth 72) - (textOffset 0) - (rtfText{\rtf1\ansi\deff0 -{\fonttbl{\f0\fnil helvetica medium;}} -{\colortbl\red0\green0\blue0;} -\cf0\plain\pard\qc {\fs20 Text}}) - (drawStartArrowhead F) - (drawEndArrowhead F) - (startArrowhead "StandardArrow") - (endArrowhead "StandardArrow") - ) -) - -(groups -) diff --git a/spec/pdf/JSP2.3MR.log b/spec/pdf/JSP2.3MR.log deleted file mode 100644 index d476d10..0000000 --- a/spec/pdf/JSP2.3MR.log +++ /dev/null @@ -1,596 +0,0 @@ -%%[ ProductName: Distiller ]%% -%%[Page: 1]%% -%%[Page: 2]%% -%%[Page: 3]%% -%%[Page: 4]%% -%%[Page: 5]%% -%%[Page: 6]%% -%%[Page: 7]%% -%%[Page: 8]%% -%%[Page: 9]%% -%%[Page: 10]%% -%%[Page: 11]%% -%%[Page: 12]%% -%%[Page: 13]%% -%%[Page: 14]%% -%%[Page: 15]%% -%%[Page: 16]%% -%%[Page: 17]%% -%%[Page: 18]%% -%%[Page: 19]%% -%%[Page: 20]%% -%%[Page: 21]%% -%%[Page: 22]%% -%%[Page: 23]%% -%%[Page: 24]%% -%%[Page: 25]%% -%%[Page: 26]%% -%%[Page: 27]%% -%%[Page: 28]%% -%%[Page: 29]%% -%%[Page: 30]%% -%%[Page: 31]%% -%%[Page: 32]%% -%%[Page: 33]%% -%%[Page: 34]%% -%%[Page: 35]%% -%%[Page: 36]%% -%%[Page: 37]%% -%%[Page: 38]%% -%%[Page: 39]%% -%%[Page: 40]%% -%%[Page: 41]%% -%%[Page: 42]%% -%%[Page: 43]%% -%%[Page: 44]%% -%%[Page: 45]%% -%%[Page: 46]%% -%%[Page: 47]%% -%%[Page: 48]%% -%%[Page: 49]%% -%%[Page: 50]%% -%%[Page: 51]%% -%%[Page: 52]%% -%%[Page: 53]%% -%%[Page: 54]%% -%%[Page: 55]%% -%%[Page: 56]%% -%%[Page: 57]%% -%%[Page: 58]%% -%%[Page: 59]%% -%%[Page: 60]%% -%%[Page: 61]%% -%%[Page: 62]%% -%%[Page: 63]%% -%%[Page: 64]%% -%%[Page: 65]%% -%%[Page: 66]%% -%%[Page: 67]%% -%%[Page: 68]%% -%%[Page: 69]%% -%%[Page: 70]%% -%%[Page: 71]%% -%%[Page: 72]%% -%%[Page: 73]%% -%%[Page: 74]%% -%%[Page: 75]%% -%%[Page: 76]%% -%%[Page: 77]%% -%%[Page: 78]%% -%%[Page: 79]%% -%%[Page: 80]%% -%%[Page: 81]%% -%%[Page: 82]%% -%%[Page: 83]%% -%%[Page: 84]%% -%%[Page: 85]%% -%%[Page: 86]%% -%%[Page: 87]%% -%%[Page: 88]%% -%%[Page: 89]%% -%%[Page: 90]%% -%%[Page: 91]%% -%%[Page: 92]%% -%%[Page: 93]%% -%%[Page: 94]%% -%%[Page: 95]%% -%%[Page: 96]%% -%%[Page: 97]%% -%%[Page: 98]%% -%%[Page: 99]%% -%%[Page: 100]%% -%%[Page: 101]%% -%%[Page: 102]%% -%%[Page: 103]%% -%%[Page: 104]%% -%%[Page: 105]%% -%%[Page: 106]%% -%%[Page: 107]%% -%%[Page: 108]%% -%%[Page: 109]%% -%%[Page: 110]%% -%%[Page: 111]%% -%%[Page: 112]%% -%%[Page: 113]%% -%%[Page: 114]%% -%%[Page: 115]%% -%%[Page: 116]%% -%%[Page: 117]%% -%%[Page: 118]%% -%%[Page: 119]%% -%%[Page: 120]%% -%%[Page: 121]%% -%%[Page: 122]%% -%%[Page: 123]%% -%%[Page: 124]%% -%%[Page: 125]%% -%%[Page: 126]%% -%%[Page: 127]%% -%%[Page: 128]%% -%%[Page: 129]%% -%%[Page: 130]%% -%%[Page: 131]%% -%%[Page: 132]%% -%%[Page: 133]%% -%%[Page: 134]%% -%%[Page: 135]%% -%%[Page: 136]%% -%%[Page: 137]%% -%%[Page: 138]%% -%%[Page: 139]%% -%%[Page: 140]%% -%%[Page: 141]%% -%%[Page: 142]%% -%%[Page: 143]%% -%%[Page: 144]%% -%%[Page: 145]%% -%%[Page: 146]%% -%%[Page: 147]%% -%%[Page: 148]%% -%%[Page: 149]%% -%%[Page: 150]%% -%%[Page: 151]%% -%%[Page: 152]%% -%%[Page: 153]%% -%%[Page: 154]%% -%%[Page: 155]%% -%%[Page: 156]%% -%%[Page: 157]%% -%%[Page: 158]%% -%%[Page: 159]%% -%%[Page: 160]%% -%%[Page: 161]%% -%%[Page: 162]%% -%%[Page: 163]%% -%%[Page: 164]%% -%%[Page: 165]%% -%%[Page: 166]%% -%%[Page: 167]%% -%%[Page: 168]%% -%%[Page: 169]%% -%%[Page: 170]%% -%%[Page: 171]%% -%%[Page: 172]%% -%%[Page: 173]%% -%%[Page: 174]%% -%%[Page: 175]%% -%%[Page: 176]%% -%%[Page: 177]%% -%%[Page: 178]%% -%%[Page: 179]%% -%%[Page: 180]%% -%%[Page: 181]%% -%%[Page: 182]%% -%%[Page: 183]%% -%%[Page: 184]%% -%%[Page: 185]%% -%%[Page: 186]%% -%%[Page: 187]%% -%%[Page: 188]%% -%%[Page: 189]%% -%%[Page: 190]%% -%%[Page: 191]%% -%%[Page: 192]%% -%%[Page: 193]%% -%%[Page: 194]%% -%%[Page: 195]%% -%%[Page: 196]%% -%%[Page: 197]%% -%%[Page: 198]%% -%%[Page: 199]%% -%%[Page: 200]%% -%%[Page: 201]%% -%%[Page: 202]%% -%%[Page: 203]%% -%%[Page: 204]%% -%%[Page: 205]%% -%%[Page: 206]%% -%%[Page: 207]%% -%%[Page: 208]%% -%%[Page: 209]%% -%%[Page: 210]%% -%%[Page: 211]%% -%%[Page: 212]%% -%%[Page: 213]%% -%%[Page: 214]%% -%%[Page: 215]%% -%%[Page: 216]%% -%%[Page: 217]%% -%%[Page: 218]%% -%%[Page: 219]%% -%%[Page: 220]%% -%%[Page: 221]%% -%%[Page: 222]%% -%%[Page: 223]%% -%%[Page: 224]%% -%%[Page: 225]%% -%%[Page: 226]%% -%%[Page: 227]%% -%%[Page: 228]%% -%%[Page: 229]%% -%%[Page: 230]%% -%%[Page: 231]%% -%%[Page: 232]%% -%%[Page: 233]%% -%%[Page: 234]%% -%%[Page: 235]%% -%%[Page: 236]%% -%%[Page: 237]%% -%%[Page: 238]%% -%%[Page: 239]%% -%%[Page: 240]%% -%%[Page: 241]%% -%%[Page: 242]%% -%%[Page: 243]%% -%%[Page: 244]%% -%%[Page: 245]%% -%%[Page: 246]%% -%%[Page: 247]%% -%%[Page: 248]%% -%%[Page: 249]%% -%%[Page: 250]%% -%%[Page: 251]%% -%%[Page: 252]%% -%%[Page: 253]%% -%%[Page: 254]%% -%%[Page: 255]%% -%%[Page: 256]%% -%%[Page: 257]%% -%%[Page: 258]%% -%%[Page: 259]%% -%%[Page: 260]%% -%%[Page: 261]%% -%%[Page: 262]%% -%%[Page: 263]%% -%%[Page: 264]%% -%%[Page: 265]%% -%%[Page: 266]%% -%%[Page: 267]%% -%%[Page: 268]%% -%%[Page: 269]%% -%%[Page: 270]%% -%%[Page: 271]%% -%%[Page: 272]%% -%%[Page: 273]%% -%%[Page: 274]%% -%%[Page: 275]%% -%%[Page: 276]%% -%%[Page: 277]%% -%%[Page: 278]%% -%%[Page: 279]%% -%%[Page: 280]%% -%%[Page: 281]%% -%%[Page: 282]%% -%%[Page: 283]%% -%%[Page: 284]%% -%%[Page: 285]%% -%%[Page: 286]%% -%%[Page: 287]%% -%%[Page: 288]%% -%%[Page: 289]%% -%%[Page: 290]%% -%%[Page: 291]%% -%%[Page: 292]%% -%%[Page: 293]%% -%%[Page: 294]%% -%%[Page: 295]%% -%%[Page: 296]%% -%%[Page: 297]%% -%%[Page: 298]%% -%%[Page: 299]%% -%%[Page: 300]%% -%%[Page: 301]%% -%%[Page: 302]%% -%%[Page: 303]%% -%%[Page: 304]%% -%%[Page: 305]%% -%%[Page: 306]%% -%%[Page: 307]%% -%%[Page: 308]%% -%%[Page: 309]%% -%%[Page: 310]%% -%%[Page: 311]%% -%%[Page: 312]%% -%%[Page: 313]%% -%%[Page: 314]%% -%%[Page: 315]%% -%%[Page: 316]%% -%%[Page: 317]%% -%%[Page: 318]%% -%%[Page: 319]%% -%%[Page: 320]%% -%%[Page: 321]%% -%%[Page: 322]%% -%%[Page: 323]%% -%%[Page: 324]%% -%%[Page: 325]%% -%%[Page: 326]%% -%%[Page: 327]%% -%%[Page: 328]%% -%%[Page: 329]%% -%%[Page: 330]%% -%%[Page: 331]%% -%%[Page: 332]%% -%%[Page: 333]%% -%%[Page: 334]%% -%%[Page: 335]%% -%%[Page: 336]%% -%%[Page: 337]%% -%%[Page: 338]%% -%%[Page: 339]%% -%%[Page: 340]%% -%%[Page: 341]%% -%%[Page: 342]%% -%%[Page: 343]%% -%%[Page: 344]%% -%%[Page: 345]%% -%%[Page: 346]%% -%%[Page: 347]%% -%%[Page: 348]%% -%%[Page: 349]%% -%%[Page: 350]%% -%%[Page: 351]%% -%%[Page: 352]%% -%%[Page: 353]%% -%%[Page: 354]%% -%%[Page: 355]%% -%%[Page: 356]%% -%%[Page: 357]%% -%%[Page: 358]%% -%%[Page: 359]%% -%%[Page: 360]%% -%%[Page: 361]%% -%%[Page: 362]%% -%%[Page: 363]%% -%%[Page: 364]%% -%%[Page: 365]%% -%%[Page: 366]%% -%%[Page: 367]%% -%%[Page: 368]%% -%%[Page: 369]%% -%%[Page: 370]%% -%%[Page: 371]%% -%%[Page: 372]%% -%%[Page: 373]%% -%%[Page: 374]%% -%%[Page: 375]%% -%%[Page: 376]%% -%%[Page: 377]%% -%%[Page: 378]%% -%%[Page: 379]%% -%%[Page: 380]%% -%%[Page: 381]%% -%%[Page: 382]%% -%%[Page: 383]%% -%%[Page: 384]%% -%%[Page: 385]%% -%%[Page: 386]%% -%%[Page: 387]%% -%%[Page: 388]%% -%%[Page: 389]%% -%%[Page: 390]%% -%%[Page: 391]%% -%%[Page: 392]%% -%%[Page: 393]%% -%%[Page: 394]%% -%%[Page: 395]%% -%%[Page: 396]%% -%%[Page: 397]%% -%%[Page: 398]%% -%%[Page: 399]%% -%%[Page: 400]%% -%%[Page: 401]%% -%%[Page: 402]%% -%%[Page: 403]%% -%%[Page: 404]%% -%%[Page: 405]%% -%%[Page: 406]%% -%%[Page: 407]%% -%%[Page: 408]%% -%%[Page: 409]%% -%%[Page: 410]%% -%%[Page: 411]%% -%%[Page: 412]%% -%%[Page: 413]%% -%%[Page: 414]%% -%%[Page: 415]%% -%%[Page: 416]%% -%%[Page: 417]%% -%%[Page: 418]%% -%%[Page: 419]%% -%%[Page: 420]%% -%%[Page: 421]%% -%%[Page: 422]%% -%%[Page: 423]%% -%%[Page: 424]%% -%%[Page: 425]%% -%%[Page: 426]%% -%%[Page: 427]%% -%%[Page: 428]%% -%%[Page: 429]%% -%%[Page: 430]%% -%%[Page: 431]%% -%%[Page: 432]%% -%%[Page: 433]%% -%%[Page: 434]%% -%%[Page: 435]%% -%%[Page: 436]%% -%%[Page: 437]%% -%%[Page: 438]%% -%%[Page: 439]%% -%%[Page: 440]%% -%%[Page: 441]%% -%%[Page: 442]%% -%%[Page: 443]%% -%%[Page: 444]%% -%%[Page: 445]%% -%%[Page: 446]%% -%%[Page: 447]%% -%%[Page: 448]%% -%%[Page: 449]%% -%%[Page: 450]%% -%%[Page: 451]%% -%%[Page: 452]%% -%%[Page: 453]%% -%%[Page: 454]%% -%%[Page: 455]%% -%%[Page: 456]%% -%%[Page: 457]%% -%%[Page: 458]%% -%%[Page: 459]%% -%%[Page: 460]%% -%%[Page: 461]%% -%%[Page: 462]%% -%%[Page: 463]%% -%%[Page: 464]%% -%%[Page: 465]%% -%%[Page: 466]%% -%%[Page: 467]%% -%%[Page: 468]%% -%%[Page: 469]%% -%%[Page: 470]%% -%%[Page: 471]%% -%%[Page: 472]%% -%%[Page: 473]%% -%%[Page: 474]%% -%%[Page: 475]%% -%%[Page: 476]%% -%%[Page: 477]%% -%%[Page: 478]%% -%%[Page: 479]%% -%%[Page: 480]%% -%%[Page: 481]%% -%%[Page: 482]%% -%%[Page: 483]%% -%%[Page: 484]%% -%%[Page: 485]%% -%%[Page: 486]%% -%%[Page: 487]%% -%%[Page: 488]%% -%%[Page: 489]%% -%%[Page: 490]%% -%%[Page: 491]%% -%%[Page: 492]%% -%%[Page: 493]%% -%%[Page: 494]%% -%%[Page: 495]%% -%%[Page: 496]%% -%%[Page: 497]%% -%%[Page: 498]%% -%%[Page: 499]%% -%%[Page: 500]%% -%%[Page: 501]%% -%%[Page: 502]%% -%%[Page: 503]%% -%%[Page: 504]%% -%%[Page: 505]%% -%%[Page: 506]%% -%%[Page: 507]%% -%%[Page: 508]%% -%%[Page: 509]%% -%%[Page: 510]%% -%%[Page: 511]%% -%%[Page: 512]%% -%%[Page: 513]%% -%%[Page: 514]%% -%%[Page: 515]%% -%%[Page: 516]%% -%%[Page: 517]%% -%%[Page: 518]%% -%%[Page: 519]%% -%%[Page: 520]%% -%%[Page: 521]%% -%%[Page: 522]%% -%%[Page: 523]%% -%%[Page: 524]%% -%%[Page: 525]%% -%%[Page: 526]%% -%%[Page: 527]%% -%%[Page: 528]%% -%%[Page: 529]%% -%%[Page: 530]%% -%%[Page: 531]%% -%%[Page: 532]%% -%%[Page: 533]%% -%%[Page: 534]%% -%%[Page: 535]%% -%%[Page: 536]%% -%%[Page: 537]%% -%%[Page: 538]%% -%%[Page: 539]%% -%%[Page: 540]%% -%%[Page: 541]%% -%%[Page: 542]%% -%%[Page: 543]%% -%%[Page: 544]%% -%%[Page: 545]%% -%%[Page: 546]%% -%%[Page: 547]%% -%%[Page: 548]%% -%%[Page: 549]%% -%%[Page: 550]%% -%%[Page: 551]%% -%%[Page: 552]%% -%%[Page: 553]%% -%%[Page: 554]%% -%%[Page: 555]%% -%%[Page: 556]%% -%%[Page: 557]%% -%%[Page: 558]%% -%%[Page: 559]%% -%%[Page: 560]%% -%%[Page: 561]%% -%%[Page: 562]%% -%%[Page: 563]%% -%%[Page: 564]%% -%%[Page: 565]%% -%%[Page: 566]%% -%%[Page: 567]%% -%%[Page: 568]%% -%%[Page: 569]%% -%%[Page: 570]%% -%%[Page: 571]%% -%%[Page: 572]%% -%%[Page: 573]%% -%%[Page: 574]%% -%%[Page: 575]%% -%%[Page: 576]%% -%%[Page: 577]%% -%%[Page: 578]%% -%%[Page: 579]%% -%%[Page: 580]%% -%%[Page: 581]%% -%%[Page: 582]%% -%%[Page: 583]%% -%%[Page: 584]%% -%%[Page: 585]%% -%%[Page: 586]%% -%%[Page: 587]%% -%%[Page: 588]%% -%%[Page: 589]%% -%%[Page: 590]%% -%%[Page: 591]%% -%%[Page: 592]%% -%%[Page: 593]%% -%%[Page: 594]%% -%%[LastPage]%% diff --git a/spec/pdf/JSP2.3MR.pdf b/spec/pdf/JSP2.3MR.pdf deleted file mode 100644 index 4936774..0000000 Binary files a/spec/pdf/JSP2.3MR.pdf and /dev/null differ