diff --git a/.gitignore b/.gitignore index abf96970b8..367c54d98f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ profile *.ipr *.iml *.releaseBackup +atlassian-ide-plugin.xml # NB noise nbactions.xml @@ -27,3 +28,4 @@ nb-configuration.xml # Maven plugins noise dependency-reduced-pom.xml +pom.xml.versionsBackup diff --git a/GovernancePolicy.md b/GovernancePolicy.md new file mode 100644 index 0000000000..27768af63b --- /dev/null +++ b/GovernancePolicy.md @@ -0,0 +1,138 @@ + + +The projects within the GlassFish community have a very flat, lightweight governance structure. +Decisions are made in public discussion on public mailing lists. There are few formal roles--an +individual's word carries weight in accordance with their contribution to the project. +Decisions are made by consensus, rather than voting--most decisions are of interest only +to members of the community who will be affected by it. The combination of public mailing lists +and consensus ensures that any person who could be affected by a decision both finds out about it, +and has a voice in the discussion. + +## Roles and Responsibilities + + +There are quite a few ways to participate on projects within the GlassFish community, +and not all of them involve contributing source code to a project! Simply using the software, +participating on mailing lists, or filing bug reports or enhancement requests is an incredibly valuable +form of participation. + +If one were to break down the forms of participation in GlassFish projects into a set of roles, +the result would look something like this: Users, Contributors, Committers, Maintainers, and Project Lead. + +### Users + +Users are the people who use the software. Users are using the software, reporting bugs, +making feature requests and suggestions. This is by far the most important category of people. +Without users, there is no reason for the project. + +How to become one: Download the software and use it to build an application. + +### Contributors + +Contributors are individuals who contribute to a GlassFish project, but do not have write access +to the source tree. Contributions can be in the form of source code patches, new code, or bug reports, +but could also include web site content like articles, FAQs, or screenshots. + +A contributor who has sent in solid, useful source code patches on a project can be elevated +to committer status by the maintainer. + +Integration of a Contributors' submissions is at the discretion of the project maintainer, but this is +an iterative, communicative process. Note that for code to be integrated, a completed +Oracle Contribution Agreement (OCA) is required from each contributor. See the [OCA policy](#oca-policy) +for info. + +How to become one: Contribute in any of the ways described above: either code, examples, +web site updates, tests, bugs, and patches. If you're interested in becoming a Committer to the source base, +get the sources to the project, make an improvement or fix a bug, and send that code +to the developers mailing list or attach it to the bug report in the project issue tracking system. + +### Committers + +Committers have write access to the source tree, either for the individual modules they are working on, +or in some cases global write permissions everywhere in the source code management system. + +A committer must complete and send in a OCA to commit code. See the [OCA policy](#oca-policy) for info. + +Rules for how to commit, once you have commit access, will vary by project and module. Be sure to ask +before you start making changes! + +How to become one: Submit some patches via email, and ask the maintainer of the code you've patched +for commit access. The maintainer will seek consensus before granting Committer access, but their +decisions are final. + +### Maintainers + +Each module has one maintainer, who has check-in permissions (either for that module or globally), +and "manages" a group of Committers. They are responsible for merging contributors' patches, bug fixes, +and new code from the development branch of the source tree into the stable branch. +Maintainers are responsible for making sure that these contributions do not break the build. + +The Maintainer is also responsible for checking that everyone who contributes code has submitted a OCA. +See the [OCA policy](#oca-policy) for info. + +A Maintainer is responsible for their module, and for granting check-in privileges to contributors. +They also act as the "police force" of the module, helping to ensure quality across the build. + +How to become one: Start a module (you need to have written some working code on your project to do this, +you'll also need to talk to the Project Lead). Have responsibility for that module handed over to you +from the current Maintainer. Take over an abandoned project--sometimes someone starts something, +but for one reason or another can't continue to work on it. If it's interesting to you, volunteer! + +### Project Lead + +Each project in the GlassFish community has an overall Project Lead. The Project Leads are currently appointed +by Oracle. They are responsible for managing the entire project, helping to create policies by consensus +that ensure global quality. + +## OCA Policy + +The first step to contributing code or submitting a patch is to sign and return a signed copy of the +[Contributor Agreement][oca-agreement]. Please print this form out, fill in all the necessary detail, +scan it in, and return it via e-mail : `oracle-ca_us [at] oracle [dot] com`. + +The [main OCA page][oca-main] has more information and the list of current signatories. You may also want to read +the [Contributor agreement FAQ][oca-faq]. + +[oca-agreement]: http://oss.oracle.com/oca.pdf +[oca-main]: http://oracle.com/technetwork/goto/oca +[oca-faq]: http://oss.oracle.com/oca-faq.pdf diff --git a/LICENSE.html b/LICENSE.html index d2f0254fcc..72d9fe6926 100644 --- a/LICENSE.html +++ b/LICENSE.html @@ -1,550 +1,200 @@ - - - jersey: Jersey Dual License Header and License Notice GPL v2 and CDDL 1.1 - - - - -

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.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 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) <year> <name of author>
-
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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.

-
  • -

    "CLASSPATH" EXCEPTION TO THE GPL VERSION 2
    -
    - Certain source files distributed by Oracle are subject to the following clarification and special - exception to the GPL Version 2, 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."
    -
    - 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.

    -
  • - - - + + + + + jersey: Jersey Dual License Header and License Notice GPL v2 and CDDL 1.1 + + + + +

    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) <year> <name of author>
    +
    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.txt b/LICENSE.txt index 833a843cfe..80babca1e1 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,274 +1,759 @@ -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)Version 1.1 +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.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.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.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.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.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.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.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.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: + 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; + 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 + 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. + 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.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.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.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. + 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. + 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. + 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. + 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. + 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. + 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. + 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. + 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. + 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. + 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. +------------------------------------------------------------------------ +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 + The GNU General Public License (GPL) Version 2, June 1991 -Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +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. +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. - +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. +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. +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. +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. - One line to give the program's name and a brief idea of what it does. +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. - Copyright (C) + 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 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. + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + 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. - - -"CLASSPATH" EXCEPTION TO THE GPL VERSION 2 - -Certain source files distributed by Oracle are subject to the following clarification and special exception to the GPL Version 2, 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." - -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. +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/NOTICE.txt b/NOTICE.txt new file mode 100644 index 0000000000..911aee2ef3 --- /dev/null +++ b/NOTICE.txt @@ -0,0 +1,803 @@ +This content is produced and maintained by Oracle and/or its affiliates. All rights reserved. + +* Project home: https://jersey.github.io + +== Declared Project Licenses + +This program and the accompanying materials are made available under the terms of dual license of +- COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL - Version 1.1) available at +https://oss.oracle.com/licenses/CDDL+GPL-1.1 +- GNU General Public License (GPL - Version 2, June 1991) with the "Classpath Exception" + +* 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., +* 59 Temple Place, Suite 330, Boston, MA 02111-1307 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. +* +* +* +* "CLASSPATH" EXCEPTION TO THE GPL VERSION 2 +* +* 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. + +== Source Code + +* https://github.com/jersey/jersey.git + +== Copyright Holders + +Copyright (c) 2013-2018 Oracle and/or its affiliates. All rights reserved. + +== Third party technology that may be necessary for use with +this program is identified below and licensed under the terms of +the third party technology license agreement specified and +not under GPLv2 with Classpath Exception or CDDL. + +aopalliance Version 1 +* License: all the source code provided by AOP Alliance is Public Domain. +* Project: http://aopalliance.sourceforge.net +* Copyright: Material in the public domain is not protected by copyright + +CDI API Version 1.1 +* License: Apache License, 2.0 +* Project: http://www.seamframework.org/Weld +* Copyright 2010, Red Hat, Inc., and individual contributors by the @authors tag. + +Google Guava Version 18.0 +* License: Apache License, 2.0 +* Copyright (C) 2009 The Guava Authors + +javax.inject Version: 1 +* License: Apache License, 2.0 +* Copyright (C) 2009 The JSR-330 Expert Group + +Javassist Version 3.22.0-CR2 +* License: Apache License, 2.0 +* Project: http://www.javassist.org/ +* Copyright (C) 1999- Shigeru Chiba. All Rights Reserved. + +Java(TM) EE Interceptors 1.1 API Version 1.0.0.Beta1 +* License: LGPL 2.1 +* Copyright 2005, JBoss Inc., and individual contributors as indicated by the @authors tag. + +JSR-166 Extension - JEP 266 +* License: CC0 +* No copyright +* Written by Doug Lea with assistance from members of JCP JSR-166 +* Expert Group and released to the public domain, as explained at +* http://creativecommons.org/publicdomain/zero/1.0/ +* +* Creative Commons Legal Code +* +* CC0 1.0 Universal +* +* CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE +* LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN +* ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS +* INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES +* REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS +* PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM +* THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED +* HEREUNDER. +* +* Statement of Purpose +* +* The laws of most jurisdictions throughout the world automatically confer +* exclusive Copyright and Related Rights (defined below) upon the creator +* and subsequent owner(s) (each and all, an "owner") of an original work of +* authorship and/or a database (each, a "Work"). +* +* Certain owners wish to permanently relinquish those rights to a Work for +* the purpose of contributing to a commons of creative, cultural and +* scientific works ("Commons") that the public can reliably and without fear +* of later claims of infringement build upon, modify, incorporate in other +* works, reuse and redistribute as freely as possible in any form whatsoever +* and for any purposes, including without limitation commercial purposes. +* These owners may contribute to the Commons to promote the ideal of a free +* culture and the further production of creative, cultural and scientific +* works, or to gain reputation or greater distribution for their Work in +* part through the use and efforts of others. +* +* For these and/or other purposes and motivations, and without any +* expectation of additional consideration or compensation, the person +* associating CC0 with a Work (the "Affirmer"), to the extent that he or she +* is an owner of Copyright and Related Rights in the Work, voluntarily +* elects to apply CC0 to the Work and publicly distribute the Work under its +* terms, with knowledge of his or her Copyright and Related Rights in the +* Work and the meaning and intended legal effect of CC0 on those rights. +* +* 1. Copyright and Related Rights. A Work made available under CC0 may be +* protected by copyright and related or neighboring rights ("Copyright and +* Related Rights"). Copyright and Related Rights include, but are not +* limited to, the following: +* +* i. the right to reproduce, adapt, distribute, perform, display, +* communicate, and translate a Work; +* ii. moral rights retained by the original author(s) and/or performer(s); +* iii. publicity and privacy rights pertaining to a person's image or +* likeness depicted in a Work; +* iv. rights protecting against unfair competition in regards to a Work, +* subject to the limitations in paragraph 4(a), below; +* v. rights protecting the extraction, dissemination, use and reuse of data +* in a Work; +* vi. database rights (such as those arising under Directive 96/9/EC of the +* European Parliament and of the Council of 11 March 1996 on the legal +* protection of databases, and under any national implementation +* thereof, including any amended or successor version of such +* directive); and +* vii. other similar, equivalent or corresponding rights throughout the +* world based on applicable law or treaty, and any national +* implementations thereof. +* +* 2. Waiver. To the greatest extent permitted by, but not in contravention +* of, applicable law, Affirmer hereby overtly, fully, permanently, +* irrevocably and unconditionally waives, abandons, and surrenders all of +* Affirmer's Copyright and Related Rights and associated claims and causes +* of action, whether now known or unknown (including existing as well as +* future claims and causes of action), in the Work (i) in all territories +* worldwide, (ii) for the maximum duration provided by applicable law or +* treaty (including future time extensions), (iii) in any current or future +* medium and for any number of copies, and (iv) for any purpose whatsoever, +* including without limitation commercial, advertising or promotional +* purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +* member of the public at large and to the detriment of Affirmer's heirs and +* successors, fully intending that such Waiver shall not be subject to +* revocation, rescission, cancellation, termination, or any other legal or +* equitable action to disrupt the quiet enjoyment of the Work by the public +* as contemplated by Affirmer's express Statement of Purpose. +* +* 3. Public License Fallback. Should any part of the Waiver for any reason +* be judged legally invalid or ineffective under applicable law, then the +* Waiver shall be preserved to the maximum extent permitted taking into +* account Affirmer's express Statement of Purpose. In addition, to the +* extent the Waiver is so judged Affirmer hereby grants to each affected +* person a royalty-free, non transferable, non sublicensable, non exclusive, +* irrevocable and unconditional license to exercise Affirmer's Copyright and +* Related Rights in the Work (i) in all territories worldwide, (ii) for the +* maximum duration provided by applicable law or treaty (including future +* time extensions), (iii) in any current or future medium and for any number +* of copies, and (iv) for any purpose whatsoever, including without +* limitation commercial, advertising or promotional purposes (the +* "License"). The License shall be deemed effective as of the date CC0 was +* applied by Affirmer to the Work. Should any part of the License for any +* reason be judged legally invalid or ineffective under applicable law, such +* partial invalidity or ineffectiveness shall not invalidate the remainder +* of the License, and in such case Affirmer hereby affirms that he or she +* will not (i) exercise any of his or her remaining Copyright and Related +* Rights in the Work or (ii) assert any associated claims and causes of +* action with respect to the Work, in either case contrary to Affirmer's +* express Statement of Purpose. +* +* 4. Limitations and Disclaimers. +* +* a. No trademark or patent rights held by Affirmer are waived, abandoned, +* surrendered, licensed or otherwise affected by this document. +* b. Affirmer offers the Work as-is and makes no representations or +* warranties of any kind concerning the Work, express, implied, +* statutory or otherwise, including without limitation warranties of +* title, merchantability, fitness for a particular purpose, non +* infringement, or the absence of latent or other defects, accuracy, or +* the present or absence of errors, whether or not discoverable, all to +* the greatest extent permissible under applicable law. +* c. Affirmer disclaims responsibility for clearing rights of other persons +* that may apply to the Work or any use thereof, including without +* limitation any person's Copyright and Related Rights in the Work. +* Further, Affirmer disclaims responsibility for obtaining any necessary +* consents, permissions or other rights required for any use of the +* Work. +* d. Affirmer understands and acknowledges that Creative Commons is not a +* party to this document and has no duty or obligation with respect to +* this CC0 or use of the Work. + +org.objectweb.asm Version 5.0.4 +* License: Modified BSD (http://asm.objectweb.org/license.html) +* Copyright (c) 2000-2011 INRIA, France Telecom. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* 3. Neither the name of the copyright holders nor the names of its +* contributors may be used to endorse or promote products derived from +* this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +* THE POSSIBILITY OF SUCH DAMAGE. + +org.osgi.core version 4.2.0 +* License: Apache License, 2.0 +* Copyright (c) OSGi Alliance (2005, 2008). All Rights Reserved. + +org.glassfish.jersey.server.internal.monitoring.core +* License: Apache License, 2.0 +* Copyright (c) 2015-2017 Oracle and/or its affiliates. All rights reserved. +* Copyright 2010-2013 Coda Hale and Yammer, Inc. +* +* Apache License +* Version 2.0, January 2004 +* http://www.apache.org/licenses/ +* +* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION +* +* 1. Definitions. +* +* "License" shall mean the terms and conditions for use, reproduction, +* and distribution as defined by Sections 1 through 9 of this document. +* +* "Licensor" shall mean the copyright owner or entity authorized by +* the copyright owner that is granting the License. +* +* "Legal Entity" shall mean the union of the acting entity and all +* other entities that control, are controlled by, or are under common +* control with that entity. For the purposes of this definition, +* "control" means (i) the power, direct or indirect, to cause the +* direction or management of such entity, whether by contract or +* otherwise, or (ii) ownership of fifty percent (50%) or more of the +* outstanding shares, or (iii) beneficial ownership of such entity. +* +* "You" (or "Your") shall mean an individual or Legal Entity +* exercising permissions granted by this License. +* +* "Source" form shall mean the preferred form for making modifications, +* including but not limited to software source code, documentation +* source, and configuration files. +* +* "Object" form shall mean any form resulting from mechanical +* transformation or translation of a Source form, including but +* not limited to compiled object code, generated documentation, +* and conversions to other media types. +* +* "Work" shall mean the work of authorship, whether in Source or +* Object form, made available under the License, as indicated by a +* copyright notice that is included in or attached to the work +* (an example is provided in the Appendix below). +* +* "Derivative Works" shall mean any work, whether in Source or Object +* form, that is based on (or derived from) the Work and for which the +* editorial revisions, annotations, elaborations, or other modifications +* represent, as a whole, an original work of authorship. For the purposes +* of this License, Derivative Works shall not include works that remain +* separable from, or merely link (or bind by name) to the interfaces of, +* the Work and Derivative Works thereof. +* +* "Contribution" shall mean any work of authorship, including +* the original version of the Work and any modifications or additions +* to that Work or Derivative Works thereof, that is intentionally +* submitted to Licensor for inclusion in the Work by the copyright owner +* or by an individual or Legal Entity authorized to submit on behalf of +* the copyright owner. For the purposes of this definition, "submitted" +* means any form of electronic, verbal, or written communication sent +* to the Licensor or its representatives, including but not limited to +* communication on electronic mailing lists, source code control systems, +* and issue tracking systems that are managed by, or on behalf of, the +* Licensor for the purpose of discussing and improving the Work, but +* excluding communication that is conspicuously marked or otherwise +* designated in writing by the copyright owner as "Not a Contribution." +* +* "Contributor" shall mean Licensor and any individual or Legal Entity +* on behalf of whom a Contribution has been received by Licensor and +* subsequently incorporated within the Work. +* +* 2. Grant of Copyright License. Subject to the terms and conditions of +* this License, each Contributor hereby grants to You a perpetual, +* worldwide, non-exclusive, no-charge, royalty-free, irrevocable +* copyright license to reproduce, prepare Derivative Works of, +* publicly display, publicly perform, sublicense, and distribute the +* Work and such Derivative Works in Source or Object form. +* +* 3. Grant of Patent License. Subject to the terms and conditions of +* this License, each Contributor hereby grants to You a perpetual, +* worldwide, non-exclusive, no-charge, royalty-free, irrevocable +* (except as stated in this section) patent license to make, have made, +* use, offer to sell, sell, import, and otherwise transfer the Work, +* where such license applies only to those patent claims licensable +* by such Contributor that are necessarily infringed by their +* Contribution(s) alone or by combination of their Contribution(s) +* with the Work to which such Contribution(s) was submitted. If You +* institute patent litigation against any entity (including a +* cross-claim or counterclaim in a lawsuit) alleging that the Work +* or a Contribution incorporated within the Work constitutes direct +* or contributory patent infringement, then any patent licenses +* granted to You under this License for that Work shall terminate +* as of the date such litigation is filed. +* +* 4. Redistribution. You may reproduce and distribute copies of the +* Work or Derivative Works thereof in any medium, with or without +* modifications, and in Source or Object form, provided that You +* meet the following conditions: +* +* (a) You must give any other recipients of the Work or +* Derivative Works a copy of this License; and +* +* (b) You must cause any modified files to carry prominent notices +* stating that You changed the files; and +* +* (c) You must retain, in the Source form of any Derivative Works +* that You distribute, all copyright, patent, trademark, and +* attribution notices from the Source form of the Work, +* excluding those notices that do not pertain to any part of +* the Derivative Works; and +* +* (d) If the Work includes a "NOTICE" text file as part of its +* distribution, then any Derivative Works that You distribute must +* include a readable copy of the attribution notices contained +* within such NOTICE file, excluding those notices that do not +* pertain to any part of the Derivative Works, in at least one +* of the following places: within a NOTICE text file distributed +* as part of the Derivative Works; within the Source form or +* documentation, if provided along with the Derivative Works; or, +* within a display generated by the Derivative Works, if and +* wherever such third-party notices normally appear. The contents +* of the NOTICE file are for informational purposes only and +* do not modify the License. You may add Your own attribution +* notices within Derivative Works that You distribute, alongside +* or as an addendum to the NOTICE text from the Work, provided +* that such additional attribution notices cannot be construed +* as modifying the License. +* +* You may add Your own copyright statement to Your modifications and +* may provide additional or different license terms and conditions +* for use, reproduction, or distribution of Your modifications, or +* for any such Derivative Works as a whole, provided Your use, +* reproduction, and distribution of the Work otherwise complies with +* the conditions stated in this License. +* +* 5. Submission of Contributions. Unless You explicitly state otherwise, +* any Contribution intentionally submitted for inclusion in the Work +* by You to the Licensor shall be under the terms and conditions of +* this License, without any additional terms or conditions. +* Notwithstanding the above, nothing herein shall supersede or modify +* the terms of any separate license agreement you may have executed +* with Licensor regarding such Contributions. +* +* 6. Trademarks. This License does not grant permission to use the trade +* names, trademarks, service marks, or product names of the Licensor, +* except as required for reasonable and customary use in describing the +* origin of the Work and reproducing the content of the NOTICE file. +* +* 7. Disclaimer of Warranty. Unless required by applicable law or +* agreed to in writing, Licensor provides the Work (and each +* Contributor provides its Contributions) on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +* implied, including, without limitation, any warranties or conditions +* of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +* PARTICULAR PURPOSE. You are solely responsible for determining the +* appropriateness of using or redistributing the Work and assume any +* risks associated with Your exercise of permissions under this License. +* +* 8. Limitation of Liability. In no event and under no legal theory, +* whether in tort (including negligence), contract, or otherwise, +* unless required by applicable law (such as deliberate and grossly +* negligent acts) or agreed to in writing, shall any Contributor be +* liable to You for damages, including any direct, indirect, special, +* incidental, or consequential damages of any character arising as a +* result of this License or out of the use or inability to use the +* Work (including but not limited to damages for loss of goodwill, +* work stoppage, computer failure or malfunction, or any and all +* other commercial damages or losses), even if such Contributor +* has been advised of the possibility of such damages. +* +* 9. Accepting Warranty or Additional Liability. While redistributing +* the Work or Derivative Works thereof, You may choose to offer, +* and charge a fee for, acceptance of support, warranty, indemnity, +* or other liability obligations and/or rights consistent with this +* License. However, in accepting such obligations, You may act only +* on Your own behalf and on Your sole responsibility, not on behalf +* of any other Contributor, and only if You agree to indemnify, +* defend, and hold each Contributor harmless for any liability +* incurred by, or claims asserted against, such Contributor by reason +* of your accepting any such warranty or additional liability. +* +* END OF TERMS AND CONDITIONS +* +* APPENDIX: How to apply the Apache License to your work. +* +* To apply the Apache License to your work, attach the following +* boilerplate notice, with the fields enclosed by brackets "[]" +* replaced with your own identifying information. (Don't include +* the brackets!) The text should be enclosed in the appropriate +* comment syntax for the file format. We also recommend that a +* file or class name and description of purpose be included on the +* same "printed page" as the copyright notice for easier +* identification within third-party archives. +* +* Copyright [yyyy] [name of copyright owner] +* +* 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. diff --git a/README.md b/README.md index b31d1d4694..05548ad49f 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,60 @@ -### About Jersey - -Jersey is a REST framework that provides JAX-RS Reference Implementation and more. -Jersey provides its own [APIs][jersey-api] that extend the JAX-RS toolkit with -additional features and utilities to further simplify RESTful service and client -development. Jersey also exposes numerous extension SPIs so that developers may -extend Jersey to best suit their needs. - -Goals of Jersey project can be summarized in the following points: - -* Track the JAX-RS API and provide regular releases of production quality - Reference Implementations that ships with GlassFish; -* Provide APIs to extend Jersey & Build a community of users and developers; - and finally -* Make it easy to build RESTful Web services utilising Java and the - Java Virtual Machine. - -### Licensing and Governance -Jersey is licensed under a dual license - [CDDL 1.1 and GPL 2.0 with Class-path Exception][cddl]. -That means you can choose which one of the two suits your needs better and use it under those terms. - -We use [GlassFish Governance Policy][governance], which means we can only accept contributions under - the terms of [OCA][oca]. - -### More Info on Jersey -Follow [Jersey on Twitter][jersey-twitter] to get JAX-RS and Jersey related updates. -See the [Jersey website][jersey-web] to access Jersey documentation. If you run into any issues or have questions, -ask at [users@jersey.java.net][jersey-users], [StackOverflow][jersey-so] or file an issue in [Jersey JIRA][jersey-jira]. - -[cddl]: http://glassfish.java.net/public/CDDL+GPL_1_1.html -[governance]: http://glassfish.java.net/public/GovernancePolicy.html -[oca]: http://oracle.com/technetwork/goto/oca -[jersey-api]: https://jersey.java.net/apidocs/latest/jersey/index.html -[jersey-jira]: http://java.net/jira/browse/JERSEY -[jersey-so]: http://stackoverflow.com/questions/tagged/jersey -[jersey-twitter]: http://twitter.com/gf_jersey -[jersey-users]: mailto:users@jersey.java.net -[jersey-web]: http://jersey.java.net + +## Jersey is Contributed to Eclipse Foundation + +As you likely have noticed, Oracle is in the process of transitioning Java EE and related projects to the Eclipse Foundation [1]. Jersey is included in this list of projects and we are pleased to announce that the initial contribution has taken place. Jersey is being contributed to Eclipse Foundation as Eclipse Jersey[2]. + +We would like to take this opportunity to thank all of our community members for their effort and dedication to Jersey for these many years. Thank you for your many contributions and assistance improving the quality of the project, the documentation, and identifying issues. + +We intend to transition this Jersey project repository to Archive status -- which will render it "Read Only." All issues will be migrated to the Eclipse Jersey project. All pending PRs will be closed. Any remaining PRs that are still relevant will be migrated to the new Eclipse Jersey project repository at GitHub [3]. + +We hope that you will join us as we continue evolving the new Eclipse Jersey project. Jersey will use the Eclipse developer mailing list for product announcements and updates [4]. If you want to track issues, don't forget to follow Eclipse Jersey at it's new GitHub location. The new process for contributions under Eclipse is described under "Contributing file" at this link [5]. + +We look forward to your continued contributions as part of the Eclipse Foundation. We hope that this transition is easy and smooth. + +Thank you again for making Jersey the best that it can be. + +* [1] https://blogs.oracle.com/theaquarium/ee4j%3a-an-update +* [2] https://projects.eclipse.org/projects/ee4j.jersey +* [3] https://github.com/eclipse-ee4j/jersey +* [4] mailto:jersey-dev[at]eclipse.org, subscribe at https://accounts.eclipse.org/mailing-list/jersey-dev +* [5] https://www.eclipse.org/projects/tools/about.php?id=ee4j.jersey diff --git a/archetypes/jersey-example-java8-webapp/README.MD b/archetypes/jersey-example-java8-webapp/README.MD new file mode 100644 index 0000000000..6639bd6154 --- /dev/null +++ b/archetypes/jersey-example-java8-webapp/README.MD @@ -0,0 +1,75 @@ + + +Jersey (Java8) WebApp Example Archetype. +========================================================== + +This module defines skeleton maven project (archetype) for developing new Java SE-based and Servlet-based examples for Jersey. + +Instructions +------------ + +- install this archetype into your local repository, `maven-archetype-plugin` updates your local `archetype-catalog.xml` +which is located in `.m2` directory. + +> mvn clean install + +- run generation your new project using: + +> mvn archetype:generate -DarchetypeCatalog=local + +- maven provides you a set of your local installed maven archetypes, choose this one +`org.glassfish.jersey.archetypes:jersey-example-java8-webapp` + +- fill in all input fields properly, e.g. + +``` +groupId: org.glassfish.jersey.examples (default value) +artifactId: my-example +version: Just use a release version - e.g. "2.20" +package: Use org.glassfish.jersey.examples.my-example +projectAuthor: Use "Name Surname (name.surname at mycompany.com)" +projectDescription: "My New Example using Jersey." +projectName: "My Jersey Example" +``` + +- confirm the project generation and feel free to start coding! diff --git a/archetypes/jersey-example-java8-webapp/pom.xml b/archetypes/jersey-example-java8-webapp/pom.xml new file mode 100644 index 0000000000..4ce22ba6a0 --- /dev/null +++ b/archetypes/jersey-example-java8-webapp/pom.xml @@ -0,0 +1,66 @@ + + + + + 4.0.0 + + org.glassfish.jersey.archetypes + project + 2.28-SNAPSHOT + + + jersey-example-java8-webapp + maven-archetype + + jersey-example-java8-webapp + Jersey (Java8) WebApp Example Archetype. + + + + + ${basedir}/src/main/resources + true + + + + diff --git a/archetypes/jersey-example-java8-webapp/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetypes/jersey-example-java8-webapp/src/main/resources/META-INF/maven/archetype-metadata.xml new file mode 100644 index 0000000000..6c1dab6367 --- /dev/null +++ b/archetypes/jersey-example-java8-webapp/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -0,0 +1,87 @@ + + + + + + + + org.glassfish.jersey.examples + + + + + + ${version} + + + + + + + + + src/main/java + + **/*.java + + + + src/main/resources + + + src/test/java + + **/*.java + + + + + + README.MD + + + + diff --git a/archetypes/jersey-example-java8-webapp/src/main/resources/archetype-resources/README.MD b/archetypes/jersey-example-java8-webapp/src/main/resources/archetype-resources/README.MD new file mode 100644 index 0000000000..b89448344e --- /dev/null +++ b/archetypes/jersey-example-java8-webapp/src/main/resources/archetype-resources/README.MD @@ -0,0 +1,75 @@ + + +${projectName} +========================================================== + +This example demonstrates how to ... + +Contents +-------- + +The mapping of the URI path space is presented in the following table: + +URI path | Resource class | HTTP methods +------------------------------------------ | ------------------------- | -------------- +**_/resource_** | JerseyResource | GET + +Sample Response +--------------- + +```javascript + +``` + +Running the Example +------------------- + +Run the example using [Grizzly](http://grizzly.java.net/) container as follows: + +> mvn clean compile exec:java + +Run the example using Jetty as follows: + +> mvn clean package jetty:run + +- diff --git a/archetypes/jersey-example-java8-webapp/src/main/resources/archetype-resources/pom.xml b/archetypes/jersey-example-java8-webapp/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 0000000000..b3e9f158ed --- /dev/null +++ b/archetypes/jersey-example-java8-webapp/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,111 @@ + + + 4.0.0 + + + org.glassfish.jersey.examples + webapp-example-parent + ../webapp-example-parent/pom.xml + ${version} + + + + + ${artifactId} + war + ${projectName} + + ${projectDescription} + + + + org.glassfish.jersey.containers + jersey-container-grizzly2-http + + + org.glassfish.jersey.containers + jersey-container-servlet + + + org.glassfish.jersey.inject + jersey-hk2 + + + + + + + org.codehaus.mojo + exec-maven-plugin + + ${package}.App + + + + + org.apache.maven.plugins + maven-compiler-plugin + true + + ${java.version} + ${java.version} + false + false + + + + + + org.eclipse.jetty + jetty-maven-plugin + + 9.2.6.v20141205 + + 5 + 9999 + STOP + + / + .*/.*jersey-[^/]\.jar$ + + + + jetty.port + ${jersey.config.test.container.port} + + + ${project.build.directory}/${project.build.finalName}.war + + + + + + + + release + + + + org.codehaus.mojo + xml-maven-plugin + + + org.apache.maven.plugins + maven-assembly-plugin + + + + + + + + 1.8 + 8080 + + diff --git a/archetypes/jersey-example-java8-webapp/src/main/resources/archetype-resources/src/main/java/App.java b/archetypes/jersey-example-java8-webapp/src/main/resources/archetype-resources/src/main/java/App.java new file mode 100644 index 0000000000..e988977d55 --- /dev/null +++ b/archetypes/jersey-example-java8-webapp/src/main/resources/archetype-resources/src/main/java/App.java @@ -0,0 +1,82 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2015-2017 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://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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 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 ${package}; + +import java.io.IOException; +import java.net.URI; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; + +import org.glassfish.grizzly.http.server.HttpServer; + +/** + * @author ${projectAuthor} + */ +public class App { + + private static final URI BASE_URI = URI.create("http://localhost:8080/base/"); + + public static final String ROOT_PATH = "resource-path"; + + public static void main(String[] args) { + try { + System.out.println("${projectName}"); + + final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, new MyApplication(), false); + Runtime.getRuntime().addShutdownHook(new Thread(server::shutdownNow)); + server.start(); + + System.out.println(String.format( + "Application started.${symbol_escape}n" + + "Try out %s%s${symbol_escape}n" + + "Stop the application using CTRL+C", + BASE_URI, ROOT_PATH)); + + Thread.currentThread().join(); + } catch (IOException | InterruptedException ex) { + Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); + } + } +} diff --git a/archetypes/jersey-example-java8-webapp/src/main/resources/archetype-resources/src/main/java/MyApplication.java b/archetypes/jersey-example-java8-webapp/src/main/resources/archetype-resources/src/main/java/MyApplication.java new file mode 100644 index 0000000000..4a98c6eb47 --- /dev/null +++ b/archetypes/jersey-example-java8-webapp/src/main/resources/archetype-resources/src/main/java/MyApplication.java @@ -0,0 +1,60 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2015-2017 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://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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 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 ${package}; + +import javax.ws.rs.ApplicationPath; + +import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.server.ResourceConfig; + +/** + * @author ${projectAuthor} + */ +@ApplicationPath("/") +public class MyApplication extends ResourceConfig { + + public MyApplication() { + register(LoggingFilter.class); + } + +} diff --git a/archetypes/jersey-heroku-webapp/pom.xml b/archetypes/jersey-heroku-webapp/pom.xml index a6dc6737f0..f7133abb32 100644 --- a/archetypes/jersey-heroku-webapp/pom.xml +++ b/archetypes/jersey-heroku-webapp/pom.xml @@ -3,19 +3,19 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2013-2014 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013-2018 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 - http://glassfish.java.net/public/CDDL+GPL_1_1.html - or packager/legal/LICENSE.txt. See the License for the specific + https://oss.oracle.com/licenses/CDDL+GPL-1.1 + or 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. + file and include the License file at LICENSE.txt. GPL Classpath Exception: Oracle designates this particular file as subject to the "Classpath" @@ -40,13 +40,15 @@ holder. --> + 4.0.0 org.glassfish.jersey.archetypes project - 2.12-SNAPSHOT + 2.28-SNAPSHOT + maven-archetype jersey-heroku-webapp jersey-archetype-heroku-webapp diff --git a/archetypes/jersey-heroku-webapp/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetypes/jersey-heroku-webapp/src/main/resources/META-INF/maven/archetype-metadata.xml index f84f782bda..1cd921f3bb 100644 --- a/archetypes/jersey-heroku-webapp/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/archetypes/jersey-heroku-webapp/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -3,19 +3,19 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013-2017 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 - http://glassfish.java.net/public/CDDL+GPL_1_1.html - or packager/legal/LICENSE.txt. See the License for the specific + https://oss.oracle.com/licenses/CDDL+GPL-1.1 + or 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. + file and include the License file at LICENSE.txt. GPL Classpath Exception: Oracle designates this particular file as subject to the "Classpath" @@ -40,6 +40,7 @@ holder. --> + org.glassfish.jersey.containers jersey-container-servlet + + org.glassfish.jersey.inject + jersey-hk2 + + diff --git a/archetypes/jersey-quickstart-grizzly2/pom.xml b/archetypes/jersey-quickstart-grizzly2/pom.xml index 36ec4a0f20..696b135518 100644 --- a/archetypes/jersey-quickstart-grizzly2/pom.xml +++ b/archetypes/jersey-quickstart-grizzly2/pom.xml @@ -3,19 +3,19 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2010-2014 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2010-2018 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 - http://glassfish.java.net/public/CDDL+GPL_1_1.html - or packager/legal/LICENSE.txt. See the License for the specific + https://oss.oracle.com/licenses/CDDL+GPL-1.1 + or 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. + file and include the License file at LICENSE.txt. GPL Classpath Exception: Oracle designates this particular file as subject to the "Classpath" @@ -40,18 +40,21 @@ holder. --> + org.glassfish.jersey.archetypes project - 2.12-SNAPSHOT + 2.28-SNAPSHOT jersey-quickstart-grizzly2 + maven-archetype 4.0.0 An archetype which contains a quick start Jersey project based on Grizzly container. jersey-archetype-grizzly2 + diff --git a/archetypes/jersey-quickstart-grizzly2/src/main/resources/META-INF/archetype.xml b/archetypes/jersey-quickstart-grizzly2/src/main/resources/META-INF/archetype.xml index e76845789f..40c2e256bb 100644 --- a/archetypes/jersey-quickstart-grizzly2/src/main/resources/META-INF/archetype.xml +++ b/archetypes/jersey-quickstart-grizzly2/src/main/resources/META-INF/archetype.xml @@ -3,19 +3,19 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2010-2017 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 - http://glassfish.java.net/public/CDDL+GPL_1_1.html - or packager/legal/LICENSE.txt. See the License for the specific + https://oss.oracle.com/licenses/CDDL+GPL-1.1 + or 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. + file and include the License file at LICENSE.txt. GPL Classpath Exception: Oracle designates this particular file as subject to the "Classpath" @@ -40,6 +40,7 @@ holder. --> + jersey-quickstart-grizzly2 diff --git a/archetypes/jersey-quickstart-grizzly2/src/main/resources/archetype-resources/pom.xml b/archetypes/jersey-quickstart-grizzly2/src/main/resources/archetype-resources/pom.xml index 3ed325e69a..bacd3bcad6 100644 --- a/archetypes/jersey-quickstart-grizzly2/src/main/resources/archetype-resources/pom.xml +++ b/archetypes/jersey-quickstart-grizzly2/src/main/resources/archetype-resources/pom.xml @@ -26,10 +26,15 @@ org.glassfish.jersey.containers jersey-container-grizzly2-http + + org.glassfish.jersey.inject + jersey-hk2 + + diff --git a/archetypes/jersey-quickstart-webapp/pom.xml b/archetypes/jersey-quickstart-webapp/pom.xml index d8dce05a73..f2c7d6a413 100644 --- a/archetypes/jersey-quickstart-webapp/pom.xml +++ b/archetypes/jersey-quickstart-webapp/pom.xml @@ -3,19 +3,19 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2010-2014 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2010-2018 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 - http://glassfish.java.net/public/CDDL+GPL_1_1.html - or packager/legal/LICENSE.txt. See the License for the specific + https://oss.oracle.com/licenses/CDDL+GPL-1.1 + or 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. + file and include the License file at LICENSE.txt. GPL Classpath Exception: Oracle designates this particular file as subject to the "Classpath" @@ -40,18 +40,21 @@ holder. --> + org.glassfish.jersey.archetypes project - 2.12-SNAPSHOT + 2.28-SNAPSHOT 4.0.0 + maven-archetype An archetype which contains a quick start Jersey-based web application project. jersey-quickstart-webapp jersey-archetype-webapp + diff --git a/archetypes/jersey-quickstart-webapp/src/main/resources/META-INF/archetype.xml b/archetypes/jersey-quickstart-webapp/src/main/resources/META-INF/archetype.xml index ec7955d941..7a1428339c 100644 --- a/archetypes/jersey-quickstart-webapp/src/main/resources/META-INF/archetype.xml +++ b/archetypes/jersey-quickstart-webapp/src/main/resources/META-INF/archetype.xml @@ -3,19 +3,19 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2010-2017 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 - http://glassfish.java.net/public/CDDL+GPL_1_1.html - or packager/legal/LICENSE.txt. See the License for the specific + https://oss.oracle.com/licenses/CDDL+GPL-1.1 + or 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. + file and include the License file at LICENSE.txt. GPL Classpath Exception: Oracle designates this particular file as subject to the "Classpath" @@ -40,6 +40,7 @@ holder. --> + jersey-quickstart-webapp diff --git a/archetypes/jersey-quickstart-webapp/src/main/resources/archetype-resources/pom.xml b/archetypes/jersey-quickstart-webapp/src/main/resources/archetype-resources/pom.xml index bde6e7ccb2..49c9e7dc8d 100644 --- a/archetypes/jersey-quickstart-webapp/src/main/resources/archetype-resources/pom.xml +++ b/archetypes/jersey-quickstart-webapp/src/main/resources/archetype-resources/pom.xml @@ -44,10 +44,14 @@ + + org.glassfish.jersey.inject + jersey-hk2 + diff --git a/archetypes/pom.xml b/archetypes/pom.xml index a7543e262a..ff8e64e18e 100644 --- a/archetypes/pom.xml +++ b/archetypes/pom.xml @@ -3,19 +3,19 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2010-2014 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2010-2018 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 - http://glassfish.java.net/public/CDDL+GPL_1_1.html - or packager/legal/LICENSE.txt. See the License for the specific + https://oss.oracle.com/licenses/CDDL+GPL-1.1 + or 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. + file and include the License file at LICENSE.txt. GPL Classpath Exception: Oracle designates this particular file as subject to the "Classpath" @@ -40,12 +40,13 @@ holder. --> + 4.0.0 org.glassfish.jersey project - 2.12-SNAPSHOT + 2.28-SNAPSHOT org.glassfish.jersey.archetypes @@ -60,8 +61,27 @@ jersey-heroku-webapp jersey-quickstart-grizzly2 jersey-quickstart-webapp + jersey-example-java8-webapp + + + + org.apache.maven.archetype + archetype-packaging + ${archetype.mvn.plugin.version} + + + + + + org.apache.maven.plugins + maven-archetype-plugin + ${archetype.mvn.plugin.version} + + + + release @@ -70,7 +90,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.1 + ${gpg.mvn.plugin.version} sign-artifact diff --git a/bom/pom.xml b/bom/pom.xml index 66c2579411..9cd754a72d 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -3,19 +3,19 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2013-2014 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013-2018 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 - http://glassfish.java.net/public/CDDL+GPL_1_1.html - or packager/legal/LICENSE.txt. See the License for the specific + https://oss.oracle.com/licenses/CDDL+GPL-1.1 + or 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. + file and include the License file at LICENSE.txt. GPL Classpath Exception: Oracle designates this particular file as subject to the "Classpath" @@ -40,6 +40,7 @@ holder. --> + 4.0.0 @@ -48,11 +49,12 @@ net.java jvnet-parent 4 + org.glassfish.jersey jersey-bom - 2.12-SNAPSHOT + 2.28-SNAPSHOT pom jersey-bom @@ -81,33 +83,28 @@ ${project.version} - org.glassfish.jersey.bundles.repackaged - jersey-guava - ${project.version} - - - org.glassfish.jersey.bundles.glassfish.v4_0 - jersey-gfv4_0-core + org.glassfish.jersey.connectors + jersey-apache-connector ${project.version} - org.glassfish.jersey.bundles.glassfish.v4_0 - jersey-gfv4_0-docs-and-examples + org.glassfish.jersey.connectors + jersey-grizzly-connector ${project.version} org.glassfish.jersey.connectors - jersey-apache-connector + jersey-jetty-connector ${project.version} org.glassfish.jersey.connectors - jersey-grizzly-connector + jersey-jdk-connector ${project.version} org.glassfish.jersey.connectors - jersey-jetty-connector + jersey-netty-connector ${project.version} @@ -137,22 +134,22 @@ org.glassfish.jersey.containers - jersey-container-servlet + jersey-container-netty-http ${project.version} org.glassfish.jersey.containers - jersey-container-servlet-core + jersey-container-servlet ${project.version} org.glassfish.jersey.containers - jersey-container-simple-http + jersey-container-servlet-core ${project.version} - org.glassfish.jersey.containers.glassfish - jersey-gf-cdi + org.glassfish.jersey.containers + jersey-container-simple-http ${project.version} @@ -160,11 +157,6 @@ jersey-gf-ejb ${project.version} - - org.glassfish.jersey.containers.glassfish - jersey-gf-cdi-ban-custom-hk2-binding - ${project.version} - org.glassfish.jersey.ext jersey-bean-validation @@ -217,7 +209,7 @@ org.glassfish.jersey.ext - jersey-spring3 + jersey-spring4 ${project.version} @@ -226,14 +218,58 @@ ${project.version} - org.glassfish.jersey.media - html-json + org.glassfish.jersey.ext + jersey-wadl-doclet ${project.version} - - org.glassfish.jersey.ext - jersey-wadl-doclet + org.glassfish.jersey.ext.cdi + jersey-weld2-se + ${project.version} + + + org.glassfish.jersey.ext.cdi + jersey-cdi1x + ${project.version} + + + org.glassfish.jersey.ext.cdi + jersey-cdi1x-transaction + ${project.version} + + + org.glassfish.jersey.ext.cdi + jersey-cdi1x-validation + ${project.version} + + + org.glassfish.jersey.ext.cdi + jersey-cdi1x-servlet + ${project.version} + + + org.glassfish.jersey.ext.cdi + jersey-cdi1x-ban-custom-hk2-binding + ${project.version} + + + org.glassfish.jersey.ext.rx + jersey-rx-client-guava + ${project.version} + + + org.glassfish.jersey.ext.rx + jersey-rx-client-rxjava + ${project.version} + + + org.glassfish.jersey.ext.rx + jersey-rx-client-rxjava2 + ${project.version} + + + org.glassfish.jersey.media + jersey-media-jaxb ${project.version} @@ -256,6 +292,16 @@ jersey-media-json-processing ${project.version} + + org.glassfish.jersey.media + jersey-media-json-binding + ${project.version} + + + org.glassfish.jersey.media + jersey-media-kryo + ${project.version} + org.glassfish.jersey.media jersey-media-moxy @@ -271,6 +317,36 @@ jersey-media-sse ${project.version} + + org.glassfish.jersey.security + oauth1-client + ${project.version} + + + org.glassfish.jersey.security + oauth1-server + ${project.version} + + + org.glassfish.jersey.security + oauth1-signature + ${project.version} + + + org.glassfish.jersey.security + oauth2-client + ${project.version} + + + org.glassfish.jersey.inject + jersey-hk2 + ${project.version} + + + org.glassfish.jersey.inject + jersey-cdi2-se + ${project.version} + org.glassfish.jersey.test-framework jersey-test-framework-core @@ -312,6 +388,11 @@ jersey-test-framework-provider-jetty ${project.version} + + org.glassfish.jersey.test-framework + jersey-test-framework-util + ${project.version} + @@ -358,5 +439,40 @@ + + release + + false + + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + + + default-deploy + deploy + + deploy + + + + + jvnet-nexus-staging + https://maven.java.net/ + + + + + diff --git a/bundles/apidocs/pom.xml b/bundles/apidocs/pom.xml index 1cbc6434b3..3001855f8c 100644 --- a/bundles/apidocs/pom.xml +++ b/bundles/apidocs/pom.xml @@ -3,19 +3,19 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2012-2018 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 - http://glassfish.java.net/public/CDDL+GPL_1_1.html - or packager/legal/LICENSE.txt. See the License for the specific + https://oss.oracle.com/licenses/CDDL+GPL-1.1 + or 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. + file and include the License file at LICENSE.txt. GPL Classpath Exception: Oracle designates this particular file as subject to the "Classpath" @@ -45,7 +45,7 @@ org.glassfish.jersey.bundles project - 2.12-SNAPSHOT + 2.28-SNAPSHOT apidocs diff --git a/bundles/examples/pom.xml b/bundles/examples/pom.xml index c9445eddc3..8fea62605c 100644 --- a/bundles/examples/pom.xml +++ b/bundles/examples/pom.xml @@ -1,43 +1,45 @@ + + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + + Copyright (c) 2013-2018 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://oss.oracle.com/licenses/CDDL+GPL-1.1 + or 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 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. + +--> 4.0.0 @@ -45,7 +47,7 @@ org.glassfish.jersey.bundles project - 2.12-SNAPSHOT + 2.28-SNAPSHOT jersey-examples @@ -137,6 +139,49 @@ project-src zip + + org.glassfish.jersey.examples + declarative-linking + ${project.version} + project-src + zip + + + + + + + + + + + + + + + + + + org.glassfish.jersey.examples + entity-filtering + ${project.version} + project-src + zip + + + org.glassfish.jersey.examples + entity-filtering-security + ${project.version} + project-src + zip + + + org.glassfish.jersey.examples + entity-filtering-selectable + ${project.version} + project-src + zip + org.glassfish.jersey.examples exception-mapping @@ -172,6 +217,13 @@ gf-project-src zip + + org.glassfish.jersey.examples + groovy + ${project.version} + project-src + zip + org.glassfish.jersey.examples helloworld @@ -181,30 +233,30 @@ org.glassfish.jersey.examples - helloworld-programmatic + helloworld-benchmark ${project.version} project-src zip org.glassfish.jersey.examples - helloworld-pure-jax-rs + helloworld-programmatic ${project.version} project-src zip org.glassfish.jersey.examples - helloworld-webapp + helloworld-pure-jax-rs ${project.version} project-src zip org.glassfish.jersey.examples - helloworld-webapp + helloworld-spring-annotations ${project.version} - gf-project-src + project-src zip @@ -223,6 +275,34 @@ zip --> + + org.glassfish.jersey.examples + helloworld-webapp + ${project.version} + project-src + zip + + + org.glassfish.jersey.examples + helloworld-webapp + ${project.version} + gf-project-src + zip + + + org.glassfish.jersey.examples + helloworld-weld + ${project.version} + project-src + zip + + + org.glassfish.jersey.examples + http-patch + ${project.version} + project-src + zip + org.glassfish.jersey.examples http-trace @@ -286,6 +366,13 @@ project-src zip + + org.glassfish.jersey.examples + json-jackson1 + ${project.version} + project-src + zip + org.glassfish.jersey.examples json-jettison @@ -370,6 +457,13 @@ gf-project-src zip + + org.glassfish.jersey.examples + monitoring-webapp + ${project.version} + project-src + zip + org.glassfish.jersey.examples multipart-webapp @@ -384,6 +478,20 @@ gf-project-src zip + + org.glassfish.jersey.examples + oauth-client-twitter + ${project.version} + project-src + zip + + + org.glassfish.jersey.examples + oauth2-client-google-webapp + ${project.version} + project-src + zip + org.glassfish.jersey.examples osgi-helloworld-webapp @@ -405,6 +513,20 @@ project-src zip + + org.glassfish.jersey.examples + rx-client-webapp + ${project.version} + project-src + zip + + + org.glassfish.jersey.examples + rx-client-webapp + ${project.version} + gf-project-src + zip + org.glassfish.jersey.examples server-async @@ -426,6 +548,48 @@ project-src zip + + org.glassfish.jersey.examples + server-sent-events-jersey + ${project.version} + project-src + zip + + + org.glassfish.jersey.examples + server-sent-events-jaxrs + ${project.version} + project-src + zip + + + org.glassfish.jersey.examples + servlet3-webapp + ${project.version} + project-src + zip + + + org.glassfish.jersey.examples + servlet3-webapp + ${project.version} + gf-project-src + zip + + + org.glassfish.jersey.examples + shortener-webapp + ${project.version} + project-src + zip + + + org.glassfish.jersey.examples + shortener-webapp + ${project.version} + gf-project-src + zip + org.glassfish.jersey.examples simple-console @@ -435,14 +599,35 @@ org.glassfish.jersey.examples - sse-item-store-webapp + sparklines ${project.version} project-src zip org.glassfish.jersey.examples - sse-item-store-webapp + sse-item-store-jersey-webapp + ${project.version} + project-src + zip + + + org.glassfish.jersey.examples + sse-item-store-jaxrs-webapp + ${project.version} + project-src + zip + + + org.glassfish.jersey.examples + sse-item-store-jersey-webapp + ${project.version} + gf-project-src + zip + + + org.glassfish.jersey.examples + sse-item-store-jaxrs-webapp ${project.version} gf-project-src zip @@ -461,6 +646,13 @@ project-src zip + + org.glassfish.jersey.examples + tone-generator + ${project.version} + project-src + zip + org.glassfish.jersey.examples xml-moxy @@ -468,6 +660,8 @@ project-src zip + + ${project.artifactId} @@ -520,6 +714,21 @@ ${project.build.directory}/dependency/wls-examples + + unpack-wls1213-examples + process-sources + + unpack-dependencies + + + true + org.glassfish.jersey.examples + wls1213-project-src + zip + false + ${project.build.directory}/dependency/wls1213-examples + + @@ -529,6 +738,7 @@ src/main/assembly/examples-assembly.xml src/main/assembly/gf-examples-assembly.xml src/main/assembly/wls-examples-assembly.xml + src/main/assembly/wls1213-examples-assembly.xml diff --git a/bundles/examples/src/main/assembly/examples-assembly.xml b/bundles/examples/src/main/assembly/examples-assembly.xml index 14730c18e5..b6a37af33a 100644 --- a/bundles/examples/src/main/assembly/examples-assembly.xml +++ b/bundles/examples/src/main/assembly/examples-assembly.xml @@ -2,19 +2,19 @@ + + wls1213 + false + + zip + + + + target/dependency/wls1213-examples + wls1213/jersey/examples + + + **/bookmark/** + **/https-server-glassfish/** + **/managed-beans-webapp/** + **/rx-client-java8-webapp/** + **/default-method-java8-webapp/** + + + + + + ../../LICENSE.txt + . + + + ../../LICENSE.txt + wls1213/jersey + + + diff --git a/bundles/jaxrs-ri/pom.xml b/bundles/jaxrs-ri/pom.xml index aa5670754c..d9797cb108 100644 --- a/bundles/jaxrs-ri/pom.xml +++ b/bundles/jaxrs-ri/pom.xml @@ -3,19 +3,19 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2012-2014 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2012-2018 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 - http://glassfish.java.net/public/CDDL+GPL_1_1.html - or packager/legal/LICENSE.txt. See the License for the specific + https://oss.oracle.com/licenses/CDDL+GPL-1.1 + or 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. + file and include the License file at LICENSE.txt. GPL Classpath Exception: Oracle designates this particular file as subject to the "Classpath" @@ -40,12 +40,13 @@ holder. --> + 4.0.0 org.glassfish.jersey.bundles project - 2.12-SNAPSHOT + 2.28-SNAPSHOT jaxrs-ri @@ -71,14 +72,30 @@ javax.ws.rs-api ${jaxrs.api.impl.version} sources + true + + org.glassfish.jersey.inject + jersey-hk2 + ${project.version} + org.glassfish.jersey.core jersey-common ${project.version} + + org.glassfish.jersey.media + jersey-media-jaxb + ${project.version} + + + org.glassfish.jersey.media + jersey-media-json-binding + ${project.version} + org.glassfish.jersey.core jersey-client @@ -99,37 +116,61 @@ jersey-container-servlet ${project.version} + + org.glassfish.jersey.media + jersey-media-sse + ${project.version} + + + org.glassfish.jersey.inject + jersey-hk2 + ${project.version} + sources + true + org.glassfish.jersey.core jersey-common ${project.version} sources + true + + + org.glassfish.jersey.media + jersey-media-jaxb + ${project.version} + sources + true org.glassfish.jersey.core jersey-client ${project.version} sources + true org.glassfish.jersey.core jersey-server ${project.version} sources + true org.glassfish.jersey.containers jersey-container-servlet-core ${project.version} sources + true org.glassfish.jersey.containers jersey-container-servlet ${project.version} sources + true @@ -143,17 +184,6 @@ hk2-locator provided - - org.ow2.asm - asm-debug-all - true - - - org.glassfish.jersey.bundles.repackaged - jersey-guava - ${project.version} - provided - org.osgi org.osgi.core @@ -212,6 +242,9 @@ false false + + module-info.java + @@ -243,9 +276,10 @@ unpack-dependencies - javax.ws.rs,org.glassfish.jersey.core,org.glassfish.jersey.containers + javax.ws.rs,org.glassfish.jersey.core,org.glassfish.jersey.containers,org.glassfish.jersey.jaxb,org.glassfish.jersey.inject sources ${generated.src.dir} + **/NOTICE.txt @@ -265,17 +299,18 @@ javax.ws.rs.*;version=${jaxrs.api.impl.version}, org.glassfish.jersey.*;version=${project.version}, - com.sun.research.ws.wadl.*;version=${project.version} + com.sun.research.ws.wadl.*;version=${project.version}, + jersey.repackaged.org.objectweb.asm.*;version=${project.version} - - !org.objectweb.asm.*, - javax.servlet.annotation.*;resolution:=optional;version="${range;[==,+);${servlet3.version}}", - javax.servlet.descriptor.*;resolution:=optional;version="${range;[==,+);${servlet3.version}}", - javax.servlet.*;version="[2.4,4.0)", + + ]]> com.sun.research.ws.wadl @@ -287,19 +322,32 @@ org.apache.maven.plugins maven-shade-plugin - - - - org.ow2.asm:asm-debug-all:* - - - - - org.objectweb.asm - ${jersey.repackaged.prefix}.org.objectweb.asm - - - + 3.1.0 + + + package + + shade + + + + + *:* + + META-INF/NOTICE.txt + + + + *:* + + META-INF/DEPENDENCIES.txt + META-INF/LICENSE.txt + + + + + + @@ -333,6 +381,29 @@ + + org.apache.maven.plugins + maven-antrun-plugin + + + xcopy + package + + + + + + + + + + + + run + + + + diff --git a/bundles/jaxrs-ri/src/main/assembly/assembly-bin.xml b/bundles/jaxrs-ri/src/main/assembly/assembly-bin.xml index 2c12ad5bb6..f4764dbcf7 100644 --- a/bundles/jaxrs-ri/src/main/assembly/assembly-bin.xml +++ b/bundles/jaxrs-ri/src/main/assembly/assembly-bin.xml @@ -1,20 +1,21 @@ + binaries diff --git a/bundles/jaxrs-ri/src/main/assembly/assembly-src-licensee.xml b/bundles/jaxrs-ri/src/main/assembly/assembly-src-licensee.xml index 07477760f5..958752e88d 100644 --- a/bundles/jaxrs-ri/src/main/assembly/assembly-src-licensee.xml +++ b/bundles/jaxrs-ri/src/main/assembly/assembly-src-licensee.xml @@ -1,20 +1,21 @@ + src @@ -65,6 +68,7 @@ META-INF/MANIFEST.MF + META-INF/NOTICE.txt diff --git a/bundles/jaxrs-ri/src/main/assembly/assembly-src.xml b/bundles/jaxrs-ri/src/main/assembly/assembly-src.xml index d9d4372d4a..9957fcf96b 100644 --- a/bundles/jaxrs-ri/src/main/assembly/assembly-src.xml +++ b/bundles/jaxrs-ri/src/main/assembly/assembly-src.xml @@ -1,20 +1,21 @@ + src @@ -65,6 +68,7 @@ META-INF/MANIFEST.MF + META-INF/NOTICE.txt diff --git a/bundles/jaxrs-ri/src/main/assembly/common-dependencies.xml b/bundles/jaxrs-ri/src/main/assembly/common-dependencies.xml index 6b6def6a04..023b8b023f 100644 --- a/bundles/jaxrs-ri/src/main/assembly/common-dependencies.xml +++ b/bundles/jaxrs-ri/src/main/assembly/common-dependencies.xml @@ -1,20 +1,21 @@ + @@ -72,5 +75,9 @@ ../../third-party-license-readme.txt jaxrs-ri + + ../../NOTICE.txt + jaxrs-ri + diff --git a/bundles/jaxrs-ri/src/main/resources/build.xml b/bundles/jaxrs-ri/src/main/resources/build.xml index 083bfc22f9..0c2c34de1f 100644 --- a/bundles/jaxrs-ri/src/main/resources/build.xml +++ b/bundles/jaxrs-ri/src/main/resources/build.xml @@ -1,20 +1,21 @@ diff --git a/bundles/pom.xml b/bundles/pom.xml index af4f46bd02..f48f2c474b 100644 --- a/bundles/pom.xml +++ b/bundles/pom.xml @@ -3,19 +3,19 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2012-2014 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2012-2018 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 - http://glassfish.java.net/public/CDDL+GPL_1_1.html - or packager/legal/LICENSE.txt. See the License for the specific + https://oss.oracle.com/licenses/CDDL+GPL-1.1 + or 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. + file and include the License file at LICENSE.txt. GPL Classpath Exception: Oracle designates this particular file as subject to the "Classpath" @@ -40,6 +40,7 @@ holder. --> + 4.0.0 @@ -47,7 +48,7 @@ org.glassfish.jersey project - 2.12-SNAPSHOT + 2.28-SNAPSHOT org.glassfish.jersey.bundles @@ -58,7 +59,6 @@ Jersey bundles providers umbrella project module. - repackaged jaxrs-ri diff --git a/bundles/repackaged/jersey-guava/build.gradle b/bundles/repackaged/jersey-guava/build.gradle deleted file mode 100644 index 3f3ca2a825..0000000000 --- a/bundles/repackaged/jersey-guava/build.gradle +++ /dev/null @@ -1,117 +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 - * http://glassfish.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. - */ - -task generateProGuardConfig << { - // import regexp pattern (strip method name from static imports) (shadedPackage is script parameter) - def pattern = ~/.*(${shadedPackage}(\.[a-z0-9]+)*\.[A-Z][A-Za-z0-9]*)(\.[A-Za-z0-9]+)*.*/ - def classes = [] as Set - - // create module list from core ... - def modules = [] - - ['/core-common', '/core-client', '/core-server'].each { - modules << absolutePath + it - } - - // ... and all projects in connectors, containers, ext and media - ['/connectors', '/containers', '/ext', '/media'].each { - new File(absolutePath + it).listFiles().each { - if (it.isDirectory()) { - modules << it.absolutePath - } - } - } - - // for each module ... - modules.each { - // ... get files in the (sub-)tree ... (absolutePath is script parameter) - fileTree(it + '/src/main/java') - // ... that includes only *.java files ... - .include('**/*.java') - .each { File file -> - - // ... store class from import that match pattern into a set ... - file.eachLine { - def matcher = pattern.matcher(it) - - if(matcher.matches()) { - classes << matcher.group(1) - } - } - } - } - - // ... and create ProGuard configuration file ... (confFile is script parameter) - def conf = new File(confFile) - conf.createNewFile() - - def ln = System.getProperty('line.separator') - - classes.each { - conf << ("-keep public class ${it}${ln}") - conf << ("-keepclassmembers public class ${it} { *; }${ln}") - } -} - -task copyShadedJar(type: Copy) { - def version = project.hasProperty('jerseyVersion') ? jerseyVersion : '' - from ('target') { - include 'jersey-guava-' + version + '-shaded-sources.jar' - } - into 'target' - - rename { - String fileName -> fileName.replace('shaded-sources', 'sources') - } -} - -task deleteShadedJar(type: Delete) { - def version = project.hasProperty('jerseyVersion') ? jerseyVersion : '' - delete ('target/jersey-guava-' + version + '-shaded-sources.jar') -} - -task renameShadedJar(dependsOn: ['copyShadedJar', 'deleteShadedJar']) -deleteShadedJar.mustRunAfter copyShadedJar - -copyShadedJar.onlyIf {project.hasProperty('jerseyVersion')} -deleteShadedJar.onlyIf {project.hasProperty('jerseyVersion')} -renameShadedJar.onlyIf {project.hasProperty('jerseyVersion')} -generateProGuardConfig.onlyIf {!project.hasProperty('jerseyVersion')} - diff --git a/bundles/repackaged/jersey-guava/pom.xml b/bundles/repackaged/jersey-guava/pom.xml deleted file mode 100644 index 3a80c8762b..0000000000 --- a/bundles/repackaged/jersey-guava/pom.xml +++ /dev/null @@ -1,249 +0,0 @@ - - - - - 4.0.0 - - - org.glassfish.jersey.bundles.repackaged - project - 2.12-SNAPSHOT - - - jersey-guava - bundle - jersey-repackaged-guava - - Jersey Guava Repackaged - - - - - org.apache.maven.plugins - maven-shade-plugin - true - - false - true - true - - - com.google.guava:guava:* - - - - - com.google.common - ${shade.package} - - - - - - org.apache.felix - maven-bundle-plugin - true - true - - - osgi-bundle - - manifest - - - - - - - javax.annotation;resolution:=optional;version="[1.2,2)", - javax.inject;resolution:=optional;version="[1.0,2)", - sun.misc.*;resolution:=optional, - * - - - !${jersey.repackaged.prefix}.com.google.common.base.internal, - ${jersey.repackaged.prefix}.com.google.common.* - - <_include>src/main/resources/META-INF/MANIFEST.MF - - true - - - - - - - - release - - false - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - package - - copy - - - - - com.google.code.findbugs - jsr305 - 2.0.1 - jsr305.jar - - - org.glassfish.hk2.external - javax.inject - javax.inject.jar - - - ${project.build.directory}/dependencies - false - true - - - - - - org.fortasoft - gradle-maven-plugin - - - proguard - package - - invoke - - - - generateProGuardConfig - - - -q - -PshadedPackage=${shade.package} - -PabsolutePath=${project.parent.parent.parent.basedir} - -PconfFile=${project.build.directory}/proguard.conf - - - - - renameShaddedJar - integration-test - - invoke - - - - renameShadedJar - - - -PjerseyVersion=${jersey.version} - - - - - - - org.apache.maven.plugins - maven-shade-plugin - true - - ${project.build.directory}/${project.build.finalName}-shade.jar - - - - com.github.wvengen - proguard-maven-plugin - - - proguard - package - - proguard - - - ${project.build.finalName}-shade.jar - ${project.build.finalName}.jar - - ${java.home}/lib/rt.jar - ${java.home}/lib/jsse.jar - ${project.build.directory}/dependencies/jsr305.jar - ${project.build.directory}/dependencies/javax.inject.jar - - - - - - false - ${project.build.directory}/proguard.conf - - - - - - org.apache.felix - maven-bundle-plugin - - - - - - - - - com.google.guava - guava - true - - - - - ${jersey.repackaged.prefix}.com.google.common - - diff --git a/bundles/repackaged/pom.xml b/bundles/repackaged/pom.xml deleted file mode 100644 index 792e2ee5f3..0000000000 --- a/bundles/repackaged/pom.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - 4.0.0 - - - org.glassfish.jersey.bundles - project - 2.12-SNAPSHOT - - - org.glassfish.jersey.bundles.repackaged - project - pom - jersey-repackaged - - Jersey Repackaged Dependencies. - - - jersey-guava - - diff --git a/connectors/apache-connector/pom.xml b/connectors/apache-connector/pom.xml index 057386e6e5..9b2d718f63 100644 --- a/connectors/apache-connector/pom.xml +++ b/connectors/apache-connector/pom.xml @@ -3,19 +3,19 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2011-2014 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2011-2018 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 - http://glassfish.java.net/public/CDDL+GPL_1_1.html - or packager/legal/LICENSE.txt. See the License for the specific + https://oss.oracle.com/licenses/CDDL+GPL-1.1 + or 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. + file and include the License file at LICENSE.txt. GPL Classpath Exception: Oracle designates this particular file as subject to the "Classpath" @@ -40,13 +40,14 @@ holder. --> + 4.0.0 org.glassfish.jersey.connectors project - 2.12-SNAPSHOT + 2.28-SNAPSHOT jersey-apache-connector @@ -101,7 +102,12 @@ org.apache.maven.plugins maven-compiler-plugin + + org.apache.felix + maven-bundle-plugin + true + - \ No newline at end of file + diff --git a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheClientProperties.java b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheClientProperties.java index bc17d93839..dc316751f0 100644 --- a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheClientProperties.java +++ b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheClientProperties.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2013-2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import java.util.Map; @@ -48,25 +49,13 @@ * Configuration options specific to the Client API that utilizes {@link ApacheConnectorProvider}. * * @author jorgeluisw@mac.com - * @author Paul Sandoz (paul.sandoz at oracle.com) + * @author Paul Sandoz * @author Pavel Bucek (pavel.bucek at oracle.com) * @author Arul Dhesiaseelan (aruld at acm.org) */ @PropertiesClass public final class ApacheClientProperties { - /** - * Support for specifying SSL configuration for HTTPS connections. - * Used only when making HTTPS requests. - *

    - * The value MUST be an instance of {@link org.glassfish.jersey.SslConfigurator}. - *

    - * A default value is not set. - *

    - * The name of the configuration property is {@value}. - */ - public static final String SSL_CONFIG = "jersey.config.apache.client.ssl.sslConfig"; - /** * The credential provider that should be used to retrieve * credentials from a user. Credentials needed for proxy authentication @@ -122,8 +111,30 @@ public final class ApacheClientProperties { */ public static final String CONNECTION_MANAGER = "jersey.config.apache.client.connectionManager"; + /** + * A value of {@code true} indicates that configured connection manager should be shared + * among multiple Jersey {@link org.glassfish.jersey.client.ClientRuntime} instances. It means that closing + * a particular {@link org.glassfish.jersey.client.ClientRuntime} instance does not shut down the underlying + * connection manager automatically. In such case, the connection manager life-cycle + * should be fully managed by the application code. To release all allocated resources, + * caller code should especially ensure {@link org.apache.http.conn.HttpClientConnectionManager#shutdown()} gets + * invoked eventually. + *

    + * This property may only be set prior to constructing Apache connector using {@link ApacheConnectorProvider}. + *

    + * The value MUST be an instance of {@link java.lang.Boolean}. + *

    + * The default value is {@code false}. + *

    + * The name of the configuration property is {@value}. + * + * @since 2.18 + */ + public static final String CONNECTION_MANAGER_SHARED = "jersey.config.apache.client.connectionManagerShared"; + /** * Request configuration for the {@link org.apache.http.client.HttpClient}. + * Http parameters which will be used to create {@link org.apache.http.client.HttpClient}. *

    * The value MUST be an instance of {@link org.apache.http.client.config.RequestConfig}. *

    @@ -135,9 +146,17 @@ public final class ApacheClientProperties { */ public static final String REQUEST_CONFIG = "jersey.config.apache.client.requestConfig"; - private ApacheClientProperties() { - // prevents instantiation - } + /** + * HttpRequestRetryHandler which will be used to create {@link org.apache.http.client.HttpClient}. + *

    + * The value MUST be an instance of {@link org.apache.http.client.HttpRequestRetryHandler}. + *

    + * If the property is absent a default retry handler will be used + * ({@link org.apache.http.impl.client.DefaultHttpRequestRetryHandler}). + *

    + * The name of the configuration property is {@value}. + */ + public static final String RETRY_HANDLER = "jersey.config.apache.client.retryHandler"; /** * Get the value of the specified property. @@ -149,11 +168,18 @@ private ApacheClientProperties() { * @param key Name of the property. * @param type Type to retrieve the value as. * @param Type of the property value. - * @return Value of the property or {@code null}. + * @return Value of the property or {@code null}. * * @since 2.8 */ - public static T getValue(Map properties, String key, Class type) { + public static T getValue(final Map properties, final String key, final Class type) { return PropertiesHelper.getValue(properties, key, type, null); } + + /** + * Prevents instantiation. + */ + private ApacheClientProperties() { + throw new AssertionError("No instances allowed."); + } } diff --git a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java index b901196d9d..4cfe1c8b4f 100644 --- a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java +++ b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2010-2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import java.io.BufferedInputStream; @@ -51,21 +52,23 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicLong; import java.util.logging.Level; import java.util.logging.Logger; import javax.ws.rs.ProcessingException; +import javax.ws.rs.client.Client; import javax.ws.rs.core.Configuration; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; +import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocketFactory; -import org.glassfish.jersey.SslConfigurator; import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.ClientRequest; import org.glassfish.jersey.client.ClientResponse; @@ -87,6 +90,7 @@ import org.apache.http.client.CookieStore; import org.apache.http.client.CredentialsProvider; import org.apache.http.client.HttpClient; +import org.apache.http.client.HttpRequestRetryHandler; import org.apache.http.client.config.CookieSpecs; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; @@ -104,7 +108,6 @@ import org.apache.http.conn.socket.PlainConnectionSocketFactory; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.conn.ssl.SSLContexts; -import org.apache.http.conn.ssl.X509HostnameVerifier; import org.apache.http.entity.AbstractHttpEntity; import org.apache.http.entity.BufferedHttpEntity; import org.apache.http.entity.ContentLengthStrategy; @@ -122,8 +125,6 @@ import org.apache.http.util.TextUtils; import org.apache.http.util.VersionInfo; -import jersey.repackaged.com.google.common.util.concurrent.MoreExecutors; - /** * A {@link Connector} that utilizes the Apache HTTP Client to send and receive * HTTP request and responses. @@ -139,7 +140,7 @@ *

  • {@link ClientProperties#PROXY_PASSWORD}
  • *
  • {@link ClientProperties#REQUEST_ENTITY_PROCESSING} - default value is {@link RequestEntityProcessing#CHUNKED}
  • *
  • {@link ApacheClientProperties#PREEMPTIVE_BASIC_AUTHENTICATION}
  • - *
  • {@link ApacheClientProperties#SSL_CONFIG}
  • + *
  • {@link ApacheClientProperties#RETRY_HANDLER}
  • * *

    * This connector uses {@link RequestEntityProcessing#CHUNKED chunked encoding} as a default setting. This can @@ -177,7 +178,7 @@ *

    * * @author jorgeluisw@mac.com - * @author Paul Sandoz (paul.sandoz at oracle.com) + * @author Paul Sandoz * @author Pavel Bucek (pavel.bucek at oracle.com) * @author Arul Dhesiaseelan (aruld at acm.org) * @see ApacheClientProperties#CONNECTION_MANAGER @@ -185,7 +186,7 @@ @SuppressWarnings("deprecation") class ApacheConnector implements Connector { - private final static Logger LOGGER = Logger.getLogger(ApacheConnector.class.getName()); + private static final Logger LOGGER = Logger.getLogger(ApacheConnector.class.getName()); private static final VersionInfo vi; private static final String release; @@ -203,108 +204,93 @@ class ApacheConnector implements Connector { /** * Create the new Apache HTTP Client connector. * + * @param client JAX-RS client instance for which the connector is being created. * @param config client configuration. */ - ApacheConnector(Configuration config) { - Object reqConfig = null; - - if (config != null) { - final Object connectionManager = config.getProperties().get(ApacheClientProperties.CONNECTION_MANAGER); - - if (connectionManager != null) { - if (!(connectionManager instanceof HttpClientConnectionManager)) { - LOGGER.log( - Level.WARNING, - LocalizationMessages.IGNORING_VALUE_OF_PROPERTY( - ApacheClientProperties.CONNECTION_MANAGER, - connectionManager.getClass().getName(), - HttpClientConnectionManager.class.getName()) - ); - } + ApacheConnector(final Client client, final Configuration config) { + final Object connectionManager = config.getProperties().get(ApacheClientProperties.CONNECTION_MANAGER); + if (connectionManager != null) { + if (!(connectionManager instanceof HttpClientConnectionManager)) { + LOGGER.log( + Level.WARNING, + LocalizationMessages.IGNORING_VALUE_OF_PROPERTY( + ApacheClientProperties.CONNECTION_MANAGER, + connectionManager.getClass().getName(), + HttpClientConnectionManager.class.getName()) + ); } + } - reqConfig = config.getProperties().get(ApacheClientProperties.REQUEST_CONFIG); - if (reqConfig != null) { - if (!(reqConfig instanceof RequestConfig)) { - LOGGER.log( - Level.WARNING, - LocalizationMessages.IGNORING_VALUE_OF_PROPERTY( - ApacheClientProperties.REQUEST_CONFIG, - reqConfig.getClass().getName(), - RequestConfig.class.getName()) - ); - reqConfig = null; - } + Object reqConfig = config.getProperties().get(ApacheClientProperties.REQUEST_CONFIG); + if (reqConfig != null) { + if (!(reqConfig instanceof RequestConfig)) { + LOGGER.log( + Level.WARNING, + LocalizationMessages.IGNORING_VALUE_OF_PROPERTY( + ApacheClientProperties.REQUEST_CONFIG, + reqConfig.getClass().getName(), + RequestConfig.class.getName()) + ); + reqConfig = null; } } - final SSLContext sslContext = getSslContext(config); + final SSLContext sslContext = client.getSslContext(); final HttpClientBuilder clientBuilder = HttpClientBuilder.create(); - clientBuilder.setConnectionManager(getConnectionManager(config, sslContext)); + clientBuilder.setConnectionManager(getConnectionManager(client, config, sslContext)); + clientBuilder.setConnectionManagerShared( + PropertiesHelper.getValue(config.getProperties(), ApacheClientProperties.CONNECTION_MANAGER_SHARED, false, null)); clientBuilder.setSslcontext(sslContext); final RequestConfig.Builder requestConfigBuilder = RequestConfig.custom(); - int connectTimeout = 0; - int socketTimeout = 0; - boolean ignoreCookies = false; - if (config != null) { - connectTimeout = ClientProperties.getValue(config.getProperties(), ClientProperties.CONNECT_TIMEOUT, 0); - socketTimeout = ClientProperties.getValue(config.getProperties(), ClientProperties.READ_TIMEOUT, 0); - ignoreCookies = PropertiesHelper.isProperty(config.getProperties(), ApacheClientProperties.DISABLE_COOKIES); - - final Object credentialsProvider = config.getProperty(ApacheClientProperties.CREDENTIALS_PROVIDER); - if (credentialsProvider != null && (credentialsProvider instanceof CredentialsProvider)) { - clientBuilder.setDefaultCredentialsProvider((CredentialsProvider) credentialsProvider); - } + final Object credentialsProvider = config.getProperty(ApacheClientProperties.CREDENTIALS_PROVIDER); + if (credentialsProvider != null && (credentialsProvider instanceof CredentialsProvider)) { + clientBuilder.setDefaultCredentialsProvider((CredentialsProvider) credentialsProvider); + } - Object proxyUri; - proxyUri = config.getProperty(ClientProperties.PROXY_URI); - if (proxyUri != null) { - final URI u = getProxyUri(proxyUri); - final HttpHost proxy = new HttpHost(u.getHost(), u.getPort(), u.getScheme()); - String userName; - userName = ClientProperties.getValue(config.getProperties(), ClientProperties.PROXY_USERNAME, String.class); - if (userName != null) { - String password; - password = ClientProperties.getValue(config.getProperties(), ClientProperties.PROXY_PASSWORD, String.class); - - if (password != null) { - final CredentialsProvider credsProvider = new BasicCredentialsProvider(); - credsProvider.setCredentials( - new AuthScope(u.getHost(), u.getPort()), - new UsernamePasswordCredentials(userName, password) - ); - clientBuilder.setDefaultCredentialsProvider(credsProvider); - } + final Object retryHandler = config.getProperties().get(ApacheClientProperties.RETRY_HANDLER); + if (retryHandler != null && (retryHandler instanceof HttpRequestRetryHandler)) { + clientBuilder.setRetryHandler((HttpRequestRetryHandler) retryHandler); + } + + final Object proxyUri; + proxyUri = config.getProperty(ClientProperties.PROXY_URI); + if (proxyUri != null) { + final URI u = getProxyUri(proxyUri); + final HttpHost proxy = new HttpHost(u.getHost(), u.getPort(), u.getScheme()); + final String userName; + userName = ClientProperties.getValue(config.getProperties(), ClientProperties.PROXY_USERNAME, String.class); + if (userName != null) { + final String password; + password = ClientProperties.getValue(config.getProperties(), ClientProperties.PROXY_PASSWORD, String.class); + + if (password != null) { + final CredentialsProvider credsProvider = new BasicCredentialsProvider(); + credsProvider.setCredentials( + new AuthScope(u.getHost(), u.getPort()), + new UsernamePasswordCredentials(userName, password) + ); + clientBuilder.setDefaultCredentialsProvider(credsProvider); } - clientBuilder.setProxy(proxy); } - - final Boolean preemptiveBasicAuthProperty = (Boolean) config.getProperties() - .get(ApacheClientProperties.PREEMPTIVE_BASIC_AUTHENTICATION); - this.preemptiveBasicAuth = (preemptiveBasicAuthProperty != null) ? preemptiveBasicAuthProperty : false; - } else { - this.preemptiveBasicAuth = false; + clientBuilder.setProxy(proxy); } + final Boolean preemptiveBasicAuthProperty = (Boolean) config.getProperties() + .get(ApacheClientProperties.PREEMPTIVE_BASIC_AUTHENTICATION); + this.preemptiveBasicAuth = (preemptiveBasicAuthProperty != null) ? preemptiveBasicAuthProperty : false; + + final boolean ignoreCookies = PropertiesHelper.isProperty(config.getProperties(), ApacheClientProperties.DISABLE_COOKIES); if (reqConfig != null) { - RequestConfig.Builder reqConfigBuilder = RequestConfig.copy((RequestConfig) reqConfig); - if (connectTimeout > 0) { - reqConfigBuilder.setConnectTimeout(connectTimeout); - } - if (socketTimeout > 0) { - reqConfigBuilder.setSocketTimeout(socketTimeout); - } + final RequestConfig.Builder reqConfigBuilder = RequestConfig.copy((RequestConfig) reqConfig); if (ignoreCookies) { reqConfigBuilder.setCookieSpec(CookieSpecs.IGNORE_COOKIES); } requestConfig = reqConfigBuilder.build(); } else { - requestConfigBuilder.setConnectTimeout(connectTimeout); - requestConfigBuilder.setSocketTimeout(socketTimeout); if (ignoreCookies) { requestConfigBuilder.setCookieSpec(CookieSpecs.IGNORE_COOKIES); } @@ -321,16 +307,9 @@ class ApacheConnector implements Connector { this.client = clientBuilder.build(); } - private SSLContext getSslContext(final Configuration config) { - final SslConfigurator sslConfigurator = ApacheClientProperties.getValue( - config.getProperties(), - ApacheClientProperties.SSL_CONFIG, - SslConfigurator.class); - - return sslConfigurator != null ? sslConfigurator.createSSLContext() : null; - } - - HttpClientConnectionManager getConnectionManager(final Configuration config, final SSLContext sslContext) { + private HttpClientConnectionManager getConnectionManager(final Client client, + final Configuration config, + final SSLContext sslContext) { final Object cmObject = config.getProperties().get(ApacheClientProperties.CONNECTION_MANAGER); // Connection manager from configuration. @@ -350,16 +329,16 @@ HttpClientConnectionManager getConnectionManager(final Configuration config, fin // Create custom connection manager. return createConnectionManager( + client, config, sslContext, - null, false); } private HttpClientConnectionManager createConnectionManager( + final Client client, final Configuration config, final SSLContext sslContext, - X509HostnameVerifier hostnameVerifier, final boolean useSystemProperties) { final String[] supportedProtocols = useSystemProperties ? split( @@ -367,9 +346,7 @@ private HttpClientConnectionManager createConnectionManager( final String[] supportedCipherSuites = useSystemProperties ? split( System.getProperty("https.cipherSuites")) : null; - if (hostnameVerifier == null) { - hostnameVerifier = SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER; - } + HostnameVerifier hostnameVerifier = client.getHostnameVerifier(); final LayeredConnectionSocketFactory sslSocketFactory; if (sslContext != null) { @@ -393,7 +370,7 @@ private HttpClientConnectionManager createConnectionManager( .build(); final Integer chunkSize = ClientProperties.getValue(config.getProperties(), - ClientProperties.CHUNKED_ENCODING_SIZE, 4096, Integer.class); + ClientProperties.CHUNKED_ENCODING_SIZE, ClientProperties.DEFAULT_CHUNK_SIZE, Integer.class); final PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(registry, new ConnectionFactory(chunkSize)); @@ -462,13 +439,20 @@ public ClientResponse apply(final ClientRequest clientRequest) throws Processing authCache.put(getHost(request), basicScheme); context.setAuthCache(authCache); } + + // If a request-specific CredentialsProvider exists, use it instead of the default one + CredentialsProvider credentialsProvider = + clientRequest.resolveProperty(ApacheClientProperties.CREDENTIALS_PROVIDER, CredentialsProvider.class); + if (credentialsProvider != null) { + context.setCredentialsProvider(credentialsProvider); + } + response = client.execute(getHost(request), request, context); - HeaderUtils.checkHeaderChanges(clientHeadersSnapshot, clientRequest.getHeaders(), - this.getClass().getName()); + HeaderUtils.checkHeaderChanges(clientHeadersSnapshot, clientRequest.getHeaders(), this.getClass().getName()); - final Response.StatusType status = response.getStatusLine().getReasonPhrase() == null ? - Statuses.from(response.getStatusLine().getStatusCode()) : - Statuses.from(response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase()); + final Response.StatusType status = response.getStatusLine().getReasonPhrase() == null + ? Statuses.from(response.getStatusLine().getStatusCode()) + : Statuses.from(response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase()); final ClientResponse responseContext = new ClientResponse(status, clientRequest); final List redirectLocations = context.getRedirectLocations(); @@ -482,7 +466,7 @@ public ClientResponse apply(final ClientRequest clientRequest) throws Processing final String headerName = header.getName(); List list = headers.get(headerName); if (list == null) { - list = new ArrayList(); + list = new ArrayList<>(); } list.add(header.getValue()); headers.put(headerName, list); @@ -501,9 +485,8 @@ public ClientResponse apply(final ClientRequest clientRequest) throws Processing } } - try { - responseContext.setEntityStream(new HttpClientResponseInputStream(response)); + responseContext.setEntityStream(new HttpClientResponseInputStream(getInputStream(response))); } catch (final IOException e) { LOGGER.log(Level.SEVERE, null, e); } @@ -516,18 +499,16 @@ public ClientResponse apply(final ClientRequest clientRequest) throws Processing @Override public Future apply(final ClientRequest request, final AsyncConnectorCallback callback) { - return MoreExecutors.sameThreadExecutor().submit(new Runnable() { - @Override - public void run() { - try { - callback.response(apply(request)); - } catch (final ProcessingException ex) { - callback.failure(ex); - } catch (final Throwable t) { - callback.failure(t); - } - } - }); + try { + ClientResponse response = apply(request); + callback.response(response); + return CompletableFuture.completedFuture(response); + } catch (Throwable t) { + callback.failure(t); + CompletableFuture future = new CompletableFuture<>(); + future.completeExceptionally(t); + return future; + } } @Override @@ -549,9 +530,21 @@ private HttpHost getHost(final HttpUriRequest request) { } private HttpUriRequest getUriHttpRequest(final ClientRequest clientRequest) { + final RequestConfig.Builder requestConfigBuilder = RequestConfig.copy(requestConfig); + + final int connectTimeout = clientRequest.resolveProperty(ClientProperties.CONNECT_TIMEOUT, -1); + final int socketTimeout = clientRequest.resolveProperty(ClientProperties.READ_TIMEOUT, -1); + + if (connectTimeout >= 0) { + requestConfigBuilder.setConnectTimeout(connectTimeout); + } + if (socketTimeout >= 0) { + requestConfigBuilder.setSocketTimeout(socketTimeout); + } + final Boolean redirectsEnabled = clientRequest.resolveProperty(ClientProperties.FOLLOW_REDIRECTS, requestConfig.isRedirectsEnabled()); - final RequestConfig config = RequestConfig.copy(requestConfig).setRedirectsEnabled(redirectsEnabled).build(); + requestConfigBuilder.setRedirectsEnabled(redirectsEnabled); final Boolean bufferingEnabled = clientRequest.resolveProperty(ClientProperties.REQUEST_ENTITY_PROCESSING, RequestEntityProcessing.class) == RequestEntityProcessing.BUFFERED; @@ -560,12 +553,11 @@ private HttpUriRequest getUriHttpRequest(final ClientRequest clientRequest) { return RequestBuilder .create(clientRequest.getMethod()) .setUri(clientRequest.getUri()) - .setConfig(config) + .setConfig(requestConfigBuilder.build()) .setEntity(entity) .build(); } - private HttpEntity getHttpEntity(final ClientRequest clientRequest, final boolean bufferingEnabled) { final Object entity = clientRequest.getEntity(); @@ -623,10 +615,11 @@ public boolean isStreaming() { } } - private static Map writeOutBoundHeaders(final MultivaluedMap headers, final HttpUriRequest request) { - Map stringHeaders = HeaderUtils.asStringHeadersSingleValue(headers); + private static Map writeOutBoundHeaders(final MultivaluedMap headers, + final HttpUriRequest request) { + final Map stringHeaders = HeaderUtils.asStringHeadersSingleValue(headers); - for (Map.Entry e : stringHeaders.entrySet()) { + for (final Map.Entry e : stringHeaders.entrySet()) { request.addHeader(e.getKey(), e.getValue()); } return stringHeaders; @@ -634,8 +627,8 @@ private static Map writeOutBoundHeaders(final MultivaluedMap{@link org.glassfish.jersey.client.ClientProperties#REQUEST_ENTITY_PROCESSING} * - default value is {@link org.glassfish.jersey.client.RequestEntityProcessing#CHUNKED} *
  • {@link ApacheClientProperties#PREEMPTIVE_BASIC_AUTHENTICATION}
  • - *
  • {@link ApacheClientProperties#SSL_CONFIG}
  • + *
  • {@link ApacheClientProperties#RETRY_HANDLER}
  • * *

    *

    @@ -104,14 +106,15 @@ * @author Arul Dhesiaseelan (aruld at acm.org) * @author jorgeluisw at mac.com * @author Marek Potociar (marek.potociar at oracle.com) - * @author Paul Sandoz (paul.sandoz at oracle.com) + * @author Paul Sandoz + * @author Maksim Mukosey (mmukosey at gmail.com) * @since 2.5 */ public class ApacheConnectorProvider implements ConnectorProvider { @Override - public Connector getConnector(Client client, Configuration runtimeConfig) { - return new ApacheConnector(runtimeConfig); + public Connector getConnector(final Client client, final Configuration runtimeConfig) { + return new ApacheConnector(client, runtimeConfig); } /** @@ -128,7 +131,28 @@ public Connector getConnector(Client client, Configuration runtimeConfig) { * is not configured to use a {@code ApacheConnectorProvider}. * @since 2.8 */ - public static HttpClient getHttpClient(Configurable component) { + public static HttpClient getHttpClient(final Configurable component) { + return getConnector(component).getHttpClient(); + } + + /** + * Retrieve the underlying Apache {@link CookieStore} instance from + * {@link org.glassfish.jersey.client.JerseyClient} or {@link org.glassfish.jersey.client.JerseyWebTarget} + * configured to use {@code ApacheConnectorProvider}. + * + * @param component {@code JerseyClient} or {@code JerseyWebTarget} instance that is configured to use + * {@code ApacheConnectorProvider}. + * @return underlying Apache {@code CookieStore} instance. + * @throws java.lang.IllegalArgumentException in case the {@code component} is neither {@code JerseyClient} + * nor {@code JerseyWebTarget} instance or in case the component + * is not configured to use a {@code ApacheConnectorProvider}. + * @since 2.16 + */ + public static CookieStore getCookieStore(final Configurable component) { + return getConnector(component).getCookieStore(); + } + + private static ApacheConnector getConnector(final Configurable component) { if (!(component instanceof Initializable)) { throw new IllegalArgumentException( LocalizationMessages.INVALID_CONFIGURABLE_COMPONENT_TYPE(component.getClass().getName())); @@ -142,9 +166,9 @@ public static HttpClient getHttpClient(Configurable component) { } if (connector instanceof ApacheConnector) { - return ((ApacheConnector) connector).getHttpClient(); + return (ApacheConnector) connector; + } else { + throw new IllegalArgumentException(LocalizationMessages.EXPECTED_CONNECTOR_PROVIDER_NOT_USED()); } - - throw new IllegalArgumentException(LocalizationMessages.EXPECTED_CONNECTOR_PROVIDER_NOT_USED()); } } diff --git a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/package-info.java b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/package-info.java index cd9474685f..c987c32d03 100644 --- a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/package-info.java +++ b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/package-info.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + /** * Jersey client {@link org.glassfish.jersey.client.spi.Connector connector} based on the * Apache Http Client. diff --git a/connectors/apache-connector/src/main/resources/org/glassfish/jersey/apache/connector/localization.properties b/connectors/apache-connector/src/main/resources/org/glassfish/jersey/apache/connector/localization.properties index cbcdf2b17e..ded47d6ff5 100644 --- a/connectors/apache-connector/src/main/resources/org/glassfish/jersey/apache/connector/localization.properties +++ b/connectors/apache-connector/src/main/resources/org/glassfish/jersey/apache/connector/localization.properties @@ -1,19 +1,19 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. # -# Copyright (c) 2013-2014 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013-2017 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 -# http://glassfish.java.net/public/CDDL+GPL_1_1.html -# or packager/legal/LICENSE.txt. See the License for the specific +# https://oss.oracle.com/licenses/CDDL+GPL-1.1 +# or 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. +# file and include the License file at LICENSE.txt. # # GPL Classpath Exception: # Oracle designates this particular file as subject to the "Classpath" diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AsyncTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AsyncTest.java index 32a570a136..0317b3611e 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AsyncTest.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AsyncTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2013-2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import java.util.concurrent.Callable; @@ -58,7 +59,7 @@ import javax.ws.rs.core.Response; import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; @@ -168,12 +169,12 @@ private String veryExpensiveOperation() { @Override protected Application configure() { return new ResourceConfig(AsyncResource.class) - .register(new LoggingFilter(LOGGER, true)); + .register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY)); } @Override protected void configureClient(ClientConfig config) { - config.register(new LoggingFilter(LOGGER, true)); + config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY)); config.connectorProvider(new ApacheConnectorProvider()); } @@ -242,7 +243,7 @@ public String call() throws Exception { final int asyncTimeoutMultiplier = getAsyncTimeoutMultiplier(); LOGGER.info("Using async timeout multiplier: " + asyncTimeoutMultiplier); - assertThat("Async processing took too long.", toc - tic, Matchers.lessThan(3 * AsyncResource.OPERATION_DURATION + assertThat("Async processing took too long.", toc - tic, Matchers.lessThan(4 * AsyncResource.OPERATION_DURATION * asyncTimeoutMultiplier)); } diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AuthTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AuthTest.java index 5fae6d3a47..3da55c1ade 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AuthTest.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AuthTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2010-2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import javax.ws.rs.DELETE; @@ -70,7 +71,7 @@ import static org.junit.Assert.assertTrue; /** - * @author Paul Sandoz (paul.sandoz at oracle.com) + * @author Paul Sandoz * @author Arul Dhesiaseelan (aruld at acm.org) */ public class AuthTest extends JerseyTest { @@ -82,6 +83,7 @@ protected Application configure() { @Path("/") public static class PreemptiveAuthResource { + @GET public String get(@Context HttpHeaders h) { String value = h.getRequestHeaders().getFirst("Authorization"); @@ -106,7 +108,8 @@ public void testPreemptiveAuth() { ); ClientConfig cc = new ClientConfig(); - cc.property(ApacheClientProperties.CREDENTIALS_PROVIDER, credentialsProvider).property(ApacheClientProperties.PREEMPTIVE_BASIC_AUTHENTICATION, true); + cc.property(ApacheClientProperties.CREDENTIALS_PROVIDER, credentialsProvider) + .property(ApacheClientProperties.PREEMPTIVE_BASIC_AUTHENTICATION, true); cc.connectorProvider(new ApacheConnectorProvider()); Client client = ClientBuilder.newClient(cc); @@ -135,6 +138,7 @@ public void testPreemptiveAuthPost() { @Path("/test") @Singleton public static class AuthResource { + int requestCount = 0; @GET @@ -143,7 +147,8 @@ public String get(@Context HttpHeaders h) { String value = h.getRequestHeaders().getFirst("Authorization"); if (value == null) { assertEquals(1, requestCount); - throw new WebApplicationException(Response.status(401).header("WWW-Authenticate", "Basic realm=\"WallyWorld\"").build()); + throw new WebApplicationException( + Response.status(401).header("WWW-Authenticate", "Basic realm=\"WallyWorld\"").build()); } else { assertTrue(requestCount > 1); } @@ -156,7 +161,8 @@ public String get(@Context HttpHeaders h) { public String getFilter(@Context HttpHeaders h) { String value = h.getRequestHeaders().getFirst("Authorization"); if (value == null) { - throw new WebApplicationException(Response.status(401).header("WWW-Authenticate", "Basic realm=\"WallyWorld\"").build()); + throw new WebApplicationException( + Response.status(401).header("WWW-Authenticate", "Basic realm=\"WallyWorld\"").build()); } return "GET"; @@ -168,7 +174,8 @@ public String post(@Context HttpHeaders h, String e) { String value = h.getRequestHeaders().getFirst("Authorization"); if (value == null) { assertEquals(1, requestCount); - throw new WebApplicationException(Response.status(401).header("WWW-Authenticate", "Basic realm=\"WallyWorld\"").build()); + throw new WebApplicationException( + Response.status(401).header("WWW-Authenticate", "Basic realm=\"WallyWorld\"").build()); } else { assertTrue(requestCount > 1); } @@ -181,7 +188,8 @@ public String post(@Context HttpHeaders h, String e) { public String postFilter(@Context HttpHeaders h, String e) { String value = h.getRequestHeaders().getFirst("Authorization"); if (value == null) { - throw new WebApplicationException(Response.status(401).header("WWW-Authenticate", "Basic realm=\"WallyWorld\"").build()); + throw new WebApplicationException( + Response.status(401).header("WWW-Authenticate", "Basic realm=\"WallyWorld\"").build()); } return e; @@ -193,7 +201,8 @@ public void delete(@Context HttpHeaders h) { String value = h.getRequestHeaders().getFirst("Authorization"); if (value == null) { assertEquals(1, requestCount); - throw new WebApplicationException(Response.status(401).header("WWW-Authenticate", "Basic realm=\"WallyWorld\"").build()); + throw new WebApplicationException( + Response.status(401).header("WWW-Authenticate", "Basic realm=\"WallyWorld\"").build()); } else { assertTrue(requestCount > 1); } @@ -204,7 +213,8 @@ public void delete(@Context HttpHeaders h) { public void deleteFilter(@Context HttpHeaders h) { String value = h.getRequestHeaders().getFirst("Authorization"); if (value == null) { - throw new WebApplicationException(Response.status(401).header("WWW-Authenticate", "Basic realm=\"WallyWorld\"").build()); + throw new WebApplicationException( + Response.status(401).header("WWW-Authenticate", "Basic realm=\"WallyWorld\"").build()); } } @@ -213,7 +223,8 @@ public void deleteFilter(@Context HttpHeaders h) { public String deleteFilterWithEntity(@Context HttpHeaders h, String e) { String value = h.getRequestHeaders().getFirst("Authorization"); if (value == null) { - throw new WebApplicationException(Response.status(401).header("WWW-Authenticate", "Basic realm=\"WallyWorld\"").build()); + throw new WebApplicationException( + Response.status(401).header("WWW-Authenticate", "Basic realm=\"WallyWorld\"").build()); } return e; @@ -237,6 +248,25 @@ public void testAuthGet() { assertEquals("GET", r.request().get(String.class)); } + @Test + public void testAuthGetWithRequestCredentialsProvider() { + CredentialsProvider credentialsProvider = new org.apache.http.impl.client.BasicCredentialsProvider(); + credentialsProvider.setCredentials( + AuthScope.ANY, + new UsernamePasswordCredentials("name", "password") + ); + + ClientConfig cc = new ClientConfig(); + cc.connectorProvider(new ApacheConnectorProvider()); + Client client = ClientBuilder.newClient(cc); + WebTarget r = client.target(getBaseUri()).path("test"); + + assertEquals("GET", + r.request() + .property(ApacheClientProperties.CREDENTIALS_PROVIDER, credentialsProvider) + .get(String.class)); + } + @Test public void testAuthGetWithClientFilter() { ClientConfig cc = new ClientConfig(); @@ -249,8 +279,8 @@ public void testAuthGetWithClientFilter() { } @Test - @Ignore("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?" + - " Allow repeatable write in jersey?") + @Ignore("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?" + + " Allow repeatable write in jersey?") public void testAuthPost() { CredentialsProvider credentialsProvider = new org.apache.http.impl.client.BasicCredentialsProvider(); credentialsProvider.setCredentials( @@ -321,13 +351,12 @@ public void testAuthInteractiveGet() { WebTarget r = client.target(getBaseUri()).path("test"); - assertEquals("GET", r.request().get(String.class)); } @Test - @Ignore("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?" + - " Allow repeatable write in jersey?") + @Ignore("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?" + + " Allow repeatable write in jersey?") public void testAuthInteractivePost() { CredentialsProvider credentialsProvider = new org.apache.http.impl.client.BasicCredentialsProvider(); credentialsProvider.setCredentials( @@ -341,7 +370,6 @@ public void testAuthInteractivePost() { Client client = ClientBuilder.newClient(cc); WebTarget r = client.target(getBaseUri()).path("test"); - assertEquals("POST", r.request().post(Entity.text("POST"), String.class)); } } diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CookieTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CookieTest.java index 2cdef6efa6..715cdb0246 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CookieTest.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CookieTest.java @@ -1,42 +1,43 @@ /* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. -* -* Copyright (c) 2010-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 -* http://glassfish.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. -*/ + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2010-2017 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://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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 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.jersey.apache.connector; import javax.ws.rs.GET; @@ -64,19 +65,20 @@ import static org.junit.Assert.assertTrue; /** - * @author Paul Sandoz (paul.sandoz at oracle.com) + * @author Paul Sandoz * @author Arul Dhesiaseelan (aruld at acm.org) */ public class CookieTest extends JerseyTest { @Path("/") public static class CookieResource { + @GET public Response get(@Context HttpHeaders h) { Cookie c = h.getCookies().get("name"); String e = (c == null) ? "NO-COOKIE" : c.getValue(); - return Response.ok(e). - cookie(new NewCookie("name", "value")).build(); + return Response.ok(e) + .cookie(new NewCookie("name", "value")).build(); } } @@ -92,7 +94,6 @@ public void testCookieResource() { Client client = ClientBuilder.newClient(cc); WebTarget r = client.target(getBaseUri()); - assertEquals("NO-COOKIE", r.request().get(String.class)); assertEquals("value", r.request().get(String.class)); } diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CustomLoggingFilter.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CustomLoggingFilter.java index 95b56de2f7..f9d524bc38 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CustomLoggingFilter.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/CustomLoggingFilter.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2012-2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import java.io.IOException; @@ -90,4 +91,4 @@ public void filter(ContainerRequestContext context, ContainerResponseContext con assertEquals(context.getProperty("foo"), "bar"); postFilterCalled++; } -} \ No newline at end of file +} diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/DisableContentEncodingTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/DisableContentEncodingTest.java new file mode 100644 index 0000000000..d63579a941 --- /dev/null +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/DisableContentEncodingTest.java @@ -0,0 +1,127 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2015-2017 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://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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 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.jersey.apache.connector; + +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.Path; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Application; + +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.message.GZipEncoder; +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.test.JerseyTest; + +import org.apache.http.client.config.RequestConfig; +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +/** + * @author Ondrej Kosatka (ondrej.kosatka at oracle.com) + */ +public class DisableContentEncodingTest extends JerseyTest { + + @Override + protected Application configure() { + return new ResourceConfig(Resource.class); + } + + @Path("/") + public static class Resource { + + @GET + public String get(@HeaderParam("Accept-Encoding") String enc) { + return enc; + } + } + + @Test + public void testDisabledByRequestConfig() { + ClientConfig cc = new ClientConfig(GZipEncoder.class); + final RequestConfig requestConfig = RequestConfig.custom().setContentCompressionEnabled(false).build(); + cc.property(ApacheClientProperties.REQUEST_CONFIG, requestConfig); + cc.connectorProvider(new ApacheConnectorProvider()); + Client client = ClientBuilder.newClient(cc); + WebTarget r = client.target(getBaseUri()); + + String enc = r.request().get().readEntity(String.class); + assertEquals("", enc); + } + + @Test + public void testEnabledByRequestConfig() { + ClientConfig cc = new ClientConfig(GZipEncoder.class); + final RequestConfig requestConfig = RequestConfig.custom().setContentCompressionEnabled(true).build(); + cc.property(ApacheClientProperties.REQUEST_CONFIG, requestConfig); + cc.connectorProvider(new ApacheConnectorProvider()); + Client client = ClientBuilder.newClient(cc); + WebTarget r = client.target(getBaseUri()); + + String enc = r.request().get().readEntity(String.class); + assertEquals("gzip,deflate", enc); + } + + @Test + public void testDefaultEncoding() { + ClientConfig cc = new ClientConfig(GZipEncoder.class); + cc.connectorProvider(new ApacheConnectorProvider()); + Client client = ClientBuilder.newClient(cc); + WebTarget r = client.target(getBaseUri()); + + String enc = r.request().get().readEntity(String.class); + assertEquals("gzip,deflate", enc); + } + + @Test + public void testDefaultEncodingOverridden() { + ClientConfig cc = new ClientConfig(GZipEncoder.class); + cc.connectorProvider(new ApacheConnectorProvider()); + Client client = ClientBuilder.newClient(cc); + WebTarget r = client.target(getBaseUri()); + + String enc = r.request().acceptEncoding("gzip").get().readEntity(String.class); + assertEquals("gzip", enc); + } + +} diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/FollowRedirectsTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/FollowRedirectsTest.java index 56990e60db..a994a5f6fc 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/FollowRedirectsTest.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/FollowRedirectsTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2012-2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import java.io.IOException; @@ -55,7 +56,7 @@ import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.ClientResponse; -import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; @@ -89,7 +90,7 @@ public Response redirect() { @Override protected Application configure() { ResourceConfig config = new ResourceConfig(RedirectResource.class); - config.register(new LoggingFilter(LOGGER, true)); + config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY)); return config; } diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/GZIPContentEncodingTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/GZIPContentEncodingTest.java index b30768d2c5..b0da2693c1 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/GZIPContentEncodingTest.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/GZIPContentEncodingTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2010-2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import java.util.Arrays; @@ -61,7 +62,7 @@ import static org.junit.Assert.assertTrue; /** - * @author Paul Sandoz (paul.sandoz at oracle.com) + * @author Paul Sandoz * @author Arul Dhesiaseelan (aruld at acm.org) */ public class GZIPContentEncodingTest extends JerseyTest { @@ -73,6 +74,7 @@ protected Application configure() { @Path("/") public static class Resource { + @POST public byte[] post(byte[] content) { return content; @@ -87,7 +89,8 @@ public void testPost() { WebTarget r = client.target(getBaseUri()); byte[] content = new byte[1024 * 1024]; - assertTrue(Arrays.equals(content, r.request().post(Entity.entity(content, MediaType.APPLICATION_OCTET_STREAM_TYPE)).readEntity(byte[].class))); + assertTrue(Arrays.equals(content, + r.request().post(Entity.entity(content, MediaType.APPLICATION_OCTET_STREAM_TYPE)).readEntity(byte[].class))); Response cr = r.request().post(Entity.entity(content, MediaType.APPLICATION_OCTET_STREAM_TYPE)); assertTrue(cr.hasEntity()); @@ -104,7 +107,8 @@ public void testPostChunked() { WebTarget r = client.target(getBaseUri()); byte[] content = new byte[1024 * 1024]; - assertTrue(Arrays.equals(content, r.request().post(Entity.entity(content, MediaType.APPLICATION_OCTET_STREAM_TYPE)).readEntity(byte[].class))); + assertTrue(Arrays.equals(content, + r.request().post(Entity.entity(content, MediaType.APPLICATION_OCTET_STREAM_TYPE)).readEntity(byte[].class))); Response cr = r.request().post(Entity.text("POST")); assertTrue(cr.hasEntity()); diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HelloWorldTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HelloWorldTest.java index fff4b5fe75..3f192b76cb 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HelloWorldTest.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HelloWorldTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2012-2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import java.io.IOException; @@ -65,7 +66,7 @@ import javax.net.ssl.SSLSession; import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; @@ -86,6 +87,7 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.params.HttpParams; import org.apache.http.protocol.HttpContext; +import org.junit.Assert; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -101,6 +103,7 @@ public class HelloWorldTest extends JerseyTest { @Path("helloworld") public static class HelloWorldResource { + public static final String CLICHED_MESSAGE = "Hello World!"; @GET @@ -128,7 +131,8 @@ public Response getError2() { @Override protected Application configure() { ResourceConfig config = new ResourceConfig(HelloWorldResource.class); - config.register(new LoggingFilter(LOGGER, true)); + config.register(new LoggingFeature(LOGGER, Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, + LoggingFeature.DEFAULT_MAX_ENTITY_SIZE)); return config; } @@ -149,6 +153,52 @@ public void testClientStringResponse() { assertEquals(HelloWorldResource.CLICHED_MESSAGE, s); } + @Test + public void testConnectionPoolSharingEnabled() throws Exception { + _testConnectionPoolSharing(true); + } + + @Test + public void testConnectionPoolSharingDisabled() throws Exception { + _testConnectionPoolSharing(false); + } + + public void _testConnectionPoolSharing(final boolean sharingEnabled) throws Exception { + + final HttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); + + final ClientConfig cc = new ClientConfig(); + cc.property(ApacheClientProperties.CONNECTION_MANAGER, connectionManager); + cc.property(ApacheClientProperties.CONNECTION_MANAGER_SHARED, sharingEnabled); + cc.connectorProvider(new ApacheConnectorProvider()); + + final Client clientOne = ClientBuilder.newClient(cc); + WebTarget target = clientOne.target(getBaseUri()).path(ROOT_PATH); + target.request().get(); + clientOne.close(); + + final boolean exceptionExpected = !sharingEnabled; + + final Client clientTwo = ClientBuilder.newClient(cc); + target = clientTwo.target(getBaseUri()).path(ROOT_PATH); + try { + target.request().get(); + if (exceptionExpected) { + Assert.fail("Exception expected"); + } + } catch (Exception e) { + if (!exceptionExpected) { + Assert.fail("Exception not expected"); + } + } finally { + clientTwo.close(); + } + + if (sharingEnabled) { + connectionManager.shutdown(); + } + } + @Test public void testAsyncClientRequests() throws InterruptedException { HttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); @@ -182,7 +232,7 @@ public void failed(Throwable error) { } }); } - latch.await(10 * getAsyncTimeoutMultiplier(), TimeUnit.SECONDS); + assertTrue(latch.await(10 * getAsyncTimeoutMultiplier(), TimeUnit.SECONDS)); final long toc = System.currentTimeMillis(); Logger.getLogger(HelloWorldTest.class.getName()).info("Executed in: " + (toc - tic)); @@ -305,7 +355,7 @@ public void testConfigurationUpdate() { /** * JERSEY-2157 reproducer. - * + *

    * The test ensures that entities of the error responses which cause * WebApplicationException being thrown by a JAX-RS client are buffered * and that the underlying input connections are automatically released diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpHeadersTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpHeadersTest.java index 0dadf1dfeb..b337b40ad3 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpHeadersTest.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpHeadersTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2010-2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import java.io.IOException; @@ -61,7 +62,7 @@ import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.ClientProperties; -import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; import org.glassfish.jersey.test.TestProperties; @@ -71,14 +72,16 @@ import static org.junit.Assert.assertTrue; /** - * @author Paul Sandoz (paul.sandoz at oracle.com) + * @author Paul Sandoz * @author Arul Dhesiaseelan (aruld at acm.org) */ public class HttpHeadersTest extends JerseyTest { + private static final Logger LOGGER = Logger.getLogger(HttpHeadersTest.class.getName()); @Path("/test") public static class HttpMethodResource { + @POST public String post( @HeaderParam("Transfer-Encoding") String transferEncoding, @@ -86,8 +89,9 @@ public String post( @HeaderParam("X-WRITER") String xWriter, String entity) { assertEquals("client", xClient); - if (transferEncoding == null || !transferEncoding.equals("chunked")) + if (transferEncoding == null || !transferEncoding.equals("chunked")) { assertEquals("writer", xWriter); + } return entity; } } @@ -104,7 +108,13 @@ public long getSize(String t, Class type, Type genericType, Annotation[] anno return -1; } - public void writeTo(String t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { + public void writeTo(String t, + Class type, + Type genericType, + Annotation[] annotations, + MediaType mediaType, + MultivaluedMap httpHeaders, + OutputStream entityStream) throws IOException, WebApplicationException { httpHeaders.add("X-WRITER", "writer"); entityStream.write(t.getBytes()); } @@ -116,7 +126,7 @@ protected Application configure() { enable(TestProperties.DUMP_ENTITY); ResourceConfig config = new ResourceConfig(HttpMethodResource.class, HeaderWriter.class); - config.register(new LoggingFilter(LOGGER, true)); + config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY)); return config; } diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpMethodTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpMethodTest.java index bdee1be53e..d75bf7c9aa 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpMethodTest.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpMethodTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2010-2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import java.lang.annotation.ElementType; @@ -70,7 +71,7 @@ import static org.junit.Assert.assertTrue; /** - * @author Paul Sandoz (paul.sandoz at oracle.com) + * @author Paul Sandoz * @author Arul Dhesiaseelan (aruld at acm.org) */ public class HttpMethodTest extends JerseyTest { diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpMethodWithClientFilterTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpMethodWithClientFilterTest.java index c4ff8bf17e..c3c73846be 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpMethodWithClientFilterTest.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/HttpMethodWithClientFilterTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2010-2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,16 +37,17 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.logging.LoggingFeature; /** - * @author Paul Sandoz (paul.sandoz at oracle.com) + * @author Paul Sandoz * @author Arul Dhesiaseelan (aruld at acm.org) */ public class HttpMethodWithClientFilterTest extends HttpMethodTest { @@ -54,7 +55,7 @@ public class HttpMethodWithClientFilterTest extends HttpMethodTest { @Override protected Client createClient() { ClientConfig cc = new ClientConfig() - .register(LoggingFilter.class) + .register(LoggingFeature.class) .connectorProvider(new ApacheConnectorProvider()); return ClientBuilder.newClient(cc); } diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/LargeDataTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/LargeDataTest.java new file mode 100644 index 0000000000..de79d2a529 --- /dev/null +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/LargeDataTest.java @@ -0,0 +1,180 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2017 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://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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 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.jersey.apache.connector; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.logging.Logger; + +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.ServerErrorException; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Application; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.StreamingOutput; + +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.logging.LoggingFeature; +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.test.JerseyTest; + +import org.junit.Assert; +import org.junit.Test; + +/** + * The LargeDataTest reproduces a problem when bytes of large data sent are incorrectly sent. + * As a result, the request body is different than what was sent by the client. + *

    + * In order to be able to inspect the request body, the generated data is a sequence of numbers + * delimited with new lines. Such as + *

    
    + *     1
    + *     2
    + *     3
    + *
    + *     ...
    + *
    + *     57234
    + *     57235
    + *     57236
    + *
    + *     ...
    + * 
    + * It is also possible to send the data to netcat: {@code nc -l 8080} and verify the problem is + * on the client side. + * + * @author Stepan Vavra (stepan.vavra at oracle.com) + * @author Marek Potociar (marek.potociar at oracle.com) + */ +public class LargeDataTest extends JerseyTest { + + private static final Logger LOGGER = Logger.getLogger(LargeDataTest.class.getName()); + private static final int LONG_DATA_SIZE = 1_000_000; // for large set around 5GB, try e.g.: 536_870_912; + private static volatile Throwable exception; + + private static StreamingOutput longData(long sequence) { + return out -> { + long offset = 0; + while (offset < sequence) { + out.write(Long.toString(offset).getBytes()); + out.write('\n'); + offset++; + } + }; + } + + @Override + protected Application configure() { + ResourceConfig config = new ResourceConfig(HttpMethodResource.class); + config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.HEADERS_ONLY)); + return config; + } + + @Override + protected void configureClient(ClientConfig config) { + config.connectorProvider(new ApacheConnectorProvider()); + } + + @Test + public void postWithLargeData() throws Throwable { + WebTarget webTarget = target("test"); + + Response response = webTarget.request().post(Entity.entity(longData(LONG_DATA_SIZE), MediaType.TEXT_PLAIN_TYPE)); + + try { + if (exception != null) { + + // the reason to throw the exception is that IntelliJ gives you an option to compare the expected with the actual + throw exception; + } + + Assert.assertEquals("Unexpected error: " + response.getStatus(), + Status.Family.SUCCESSFUL, + response.getStatusInfo().getFamily()); + } finally { + response.close(); + } + } + + @Path("/test") + public static class HttpMethodResource { + + @POST + public Response post(InputStream content) { + try { + + longData(LONG_DATA_SIZE).write(new OutputStream() { + + private long position = 0; +// private long mbRead = 0; + + @Override + public void write(final int generated) throws IOException { + int received = content.read(); + + if (received != generated) { + throw new IOException("Bytes don't match at position " + position + + ": received=" + received + + ", generated=" + generated); + } + + position++; +// if (position % (1024 * 1024) == 0) { +// mbRead++; +// System.out.println("MB read: " + mbRead); +// } + } + }); + } catch (IOException e) { + exception = e; + throw new ServerErrorException(e.getMessage(), 500, e); + } + + return Response.ok().build(); + } + + } +} diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ManagedClientTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ManagedClientTest.java index 868b58a90c..8ffe02bad6 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ManagedClientTest.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ManagedClientTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import java.io.IOException; @@ -63,7 +64,7 @@ import javax.ws.rs.core.Response; import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.server.ClientBinding; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.Uri; @@ -122,6 +123,7 @@ public static class CustomHeaderFeature implements DynamicFeature { @Documented @Target(ElementType.METHOD) public static @interface Require { + /** * Expected custom header name to be validated by the {@link CustomHeaderFilter}. */ @@ -155,6 +157,7 @@ public void configure(ResourceInfo resourceInfo, FeatureContext context) { * @author Marek Potociar (marek.potociar at oracle.com) */ public static class CustomHeaderFilter implements ContainerRequestFilter, ClientRequestFilter { + private final String headerName; private final String headerValue; @@ -171,7 +174,8 @@ public void filter(ContainerRequestContext ctx) throws IOException { // validate if (!headerValue.equals(ctx.getHeaderString(headerName))) { ctx.abortWith(Response.status(Response.Status.FORBIDDEN) .type(MediaType.TEXT_PLAIN) - .entity(String.format("Expected header '%s' not present or value not equal to '%s'", headerName, headerValue)) + .entity(String + .format("Expected header '%s' not present or value not equal to '%s'", headerName, headerValue)) .build()); } } @@ -205,7 +209,6 @@ public String getB() { } } - /** * A resource that uses managed clients to retrieve values of internal * resources 'A' and 'B', which are protected by a {@link CustomHeaderFilter} @@ -220,6 +223,7 @@ public String getB() { */ @Path("public") public static class PublicResource { + @Uri("a") @ClientA // resolves to /internal/a private WebTarget targetA; @@ -243,23 +247,24 @@ public Response getTargetB(@Uri("internal/b") @ClientB WebTarget targetB) { protected Application configure() { ResourceConfig config = new ResourceConfig(PublicResource.class, InternalResource.class, CustomHeaderFeature.class) .property(ClientA.class.getName() + ".baseUri", this.getBaseUri().toString() + "internal"); - config.register(new LoggingFilter(LOGGER, true)); + config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY)); return config; } public static class MyClientAConfig extends ClientConfig { + public MyClientAConfig() { this.register(new CustomHeaderFilter("custom-header", "a")); } } public static class MyClientBConfig extends ClientConfig { + public MyClientBConfig() { this.register(new CustomHeaderFilter("custom-header", "b")); } } - @Override protected void configureClient(ClientConfig config) { config.connectorProvider(new ApacheConnectorProvider()); @@ -284,5 +289,4 @@ public void testManagedClient() throws Exception { assertEquals("b", response.readEntity(String.class)); } - } diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/NoEntityTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/NoEntityTest.java index fc77e9cf07..c175633564 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/NoEntityTest.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/NoEntityTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2010-2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import java.util.logging.Logger; @@ -50,14 +51,14 @@ import javax.ws.rs.core.Response.Status; import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; import org.junit.Test; /** - * @author Paul Sandoz (paul.sandoz at oracle.com) + * @author Paul Sandoz * @author Arul Dhesiaseelan (aruld at acm.org) */ public class NoEntityTest extends JerseyTest { @@ -78,7 +79,7 @@ public void post(String entity) { @Override protected Application configure() { ResourceConfig config = new ResourceConfig(HttpMethodResource.class); - config.register(new LoggingFilter(LOGGER, true)); + config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY)); return config; } diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/RetryHandlerTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/RetryHandlerTest.java new file mode 100644 index 0000000000..1ee2f08d11 --- /dev/null +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/RetryHandlerTest.java @@ -0,0 +1,132 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2017 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://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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 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.jersey.apache.connector; + +import java.io.IOException; + +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Application; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; + +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.RequestEntityProcessing; +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.test.JerseyTest; + +import org.apache.http.client.HttpRequestRetryHandler; +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +public class RetryHandlerTest extends JerseyTest { + private static final int READ_TIMEOUT_MS = 100; + + @Override + protected Application configure() { + return new ResourceConfig(RetryHandlerResource.class); + } + + @Path("/") + public static class RetryHandlerResource { + private static volatile int postRequestNumber = 0; + private static volatile int getRequestNumber = 0; + + // Cause a timeout on the first GET and POST request + @GET + public String get(@Context HttpHeaders h) { + if (getRequestNumber++ == 0) { + try { + Thread.sleep(READ_TIMEOUT_MS * 10); + } catch (InterruptedException ex) { + // ignore + } + } + return "GET"; + } + + @POST + public String post(@Context HttpHeaders h, String e) { + if (postRequestNumber++ == 0) { + try { + Thread.sleep(READ_TIMEOUT_MS * 10); + } catch (InterruptedException ex) { + // ignore + } + } + return "POST"; + } + } + + @Test + public void testRetryGet() throws IOException { + ClientConfig cc = new ClientConfig(); + cc.connectorProvider(new ApacheConnectorProvider()); + cc.property(ApacheClientProperties.RETRY_HANDLER, + (HttpRequestRetryHandler) (exception, executionCount, context) -> true); + cc.property(ClientProperties.READ_TIMEOUT, READ_TIMEOUT_MS); + Client client = ClientBuilder.newClient(cc); + + WebTarget r = client.target(getBaseUri()); + assertEquals("GET", r.request().get(String.class)); + } + + @Test + public void testRetryPost() throws IOException { + ClientConfig cc = new ClientConfig(); + cc.connectorProvider(new ApacheConnectorProvider()); + cc.property(ApacheClientProperties.RETRY_HANDLER, + (HttpRequestRetryHandler) (exception, executionCount, context) -> true); + cc.property(ClientProperties.READ_TIMEOUT, READ_TIMEOUT_MS); + Client client = ClientBuilder.newClient(cc); + + WebTarget r = client.target(getBaseUri()); + assertEquals("POST", r.request() + .property(ClientProperties.REQUEST_ENTITY_PROCESSING, RequestEntityProcessing.BUFFERED) + .post(Entity.text("POST"), String.class)); + } +} diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/SpecialHeaderTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/SpecialHeaderTest.java index 48e6a1212b..ee3e164da4 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/SpecialHeaderTest.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/SpecialHeaderTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import javax.ws.rs.GET; @@ -47,7 +48,7 @@ import javax.ws.rs.core.Response; import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.message.GZipEncoder; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; @@ -58,12 +59,12 @@ /** * - * @author Miroslav Fuksa (miroslav.fuksa at oracle.com) + * @author Miroslav Fuksa */ public class SpecialHeaderTest extends JerseyTest { @Override protected Application configure() { - return new ResourceConfig(MyResource.class, GZipEncoder.class, LoggingFilter.class); + return new ResourceConfig(MyResource.class, GZipEncoder.class, LoggingFeature.class); } @Path("resource") diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/StreamingTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/StreamingTest.java new file mode 100644 index 0000000000..0cb067577f --- /dev/null +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/StreamingTest.java @@ -0,0 +1,122 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2015-2017 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://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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 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.jersey.apache.connector; + +import java.io.IOException; +import java.io.InputStream; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Application; +import javax.ws.rs.core.MediaType; + +import javax.inject.Singleton; + +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.server.ChunkedOutput; +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.test.JerseyTest; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +/** + * @author Petr Janouch (petr.janouch at oracle.com) + */ +public class StreamingTest extends JerseyTest { + + /** + * Test that a data stream can be terminated from the client side. + */ + @Test + public void clientCloseTest() throws IOException { + // start streaming + InputStream inputStream = target().path("/streamingEndpoint").request().get(InputStream.class); + + WebTarget sendTarget = target().path("/streamingEndpoint/send"); + // trigger sending 'A' to the stream; OK is sent if everything on the server was OK + assertEquals("OK", sendTarget.request().get().readEntity(String.class)); + // check 'A' has been sent + assertEquals('A', inputStream.read()); + // closing the stream should tear down the connection + inputStream.close(); + // trigger sending another 'A' to the stream; it should fail + // (indicating that the streaming has been terminated on the server) + assertEquals("NOK", sendTarget.request().get().readEntity(String.class)); + } + + @Override + protected void configureClient(ClientConfig config) { + config.connectorProvider(new ApacheConnectorProvider()); + } + + @Override + protected Application configure() { + return new ResourceConfig(StreamingEndpoint.class); + } + + @Singleton + @Path("streamingEndpoint") + public static class StreamingEndpoint { + + private final ChunkedOutput output = new ChunkedOutput<>(String.class); + + @GET + @Path("send") + public String sendEvent() { + try { + output.write("A"); + } catch (IOException e) { + return "NOK"; + } + + return "OK"; + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + public ChunkedOutput get() { + return output; + } + } +} diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TimeoutTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TimeoutTest.java index cd3a274203..207110ef5b 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TimeoutTest.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TimeoutTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import java.net.SocketTimeoutException; @@ -50,7 +51,7 @@ import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.ClientProperties; -import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; @@ -58,9 +59,10 @@ import static org.hamcrest.CoreMatchers.instanceOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; /** - * @author Martin Matula (martin.matula at oracle.com) + * @author Martin Matula * @author Arul Dhesiaseelan (aruld at acm.org) */ public class TimeoutTest extends JerseyTest { @@ -78,7 +80,7 @@ public String get() { public String getTimeout() { try { Thread.sleep(2000); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } return "GET"; @@ -87,20 +89,20 @@ public String getTimeout() { @Override protected Application configure() { - ResourceConfig config = new ResourceConfig(TimeoutResource.class); - config.register(new LoggingFilter(LOGGER, true)); + final ResourceConfig config = new ResourceConfig(TimeoutResource.class); + config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY)); return config; } @Override - protected void configureClient(ClientConfig config) { + protected void configureClient(final ClientConfig config) { config.property(ClientProperties.READ_TIMEOUT, 1000); config.connectorProvider(new ApacheConnectorProvider()); } @Test public void testFast() { - Response r = target("test").request().get(); + final Response r = target("test").request().get(); assertEquals(200, r.getStatus()); assertEquals("GET", r.readEntity(String.class)); } @@ -109,9 +111,18 @@ public void testFast() { public void testSlow() { try { target("test/timeout").request().get(); - } catch (ProcessingException e) { + fail("Timeout expected."); + } catch (final ProcessingException e) { assertThat("Unexpected processing exception cause", e.getCause(), instanceOf(SocketTimeoutException.class)); } } + + @Test + public void testPerRequestTimeout() { + final Response r = target("test/timeout").request() + .property(ClientProperties.READ_TIMEOUT, 3000).get(); + assertEquals(200, r.getStatus()); + assertEquals("GET", r.readEntity(String.class)); + } } diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TraceSupportTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TraceSupportTest.java index 1effb7b499..1c73a1812c 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TraceSupportTest.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/TraceSupportTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2011-2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import java.lang.annotation.ElementType; @@ -61,7 +62,7 @@ import javax.ws.rs.core.Response; import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.process.Inflector; import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.ResourceConfig; @@ -113,7 +114,7 @@ public String trace(Request request) { @Override protected Application configure() { ResourceConfig config = new ResourceConfig(TracingResource.class); - config.register(new LoggingFilter(LOGGER, true)); + config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY)); final Resource.Builder resourceBuilder = Resource.builder(ROOT_PATH_PROGRAMMATIC); resourceBuilder.addMethod(TRACE.NAME).handledBy(new Inflector() { @@ -140,7 +141,7 @@ public Response apply(ContainerRequestContext request) { private WebTarget prepareTarget(String path) { final WebTarget target = target(); - target.register(LoggingFilter.class); + target.register(LoggingFeature.class); return target.path(path); } diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/UnderlyingCookieStoreAccessTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/UnderlyingCookieStoreAccessTest.java new file mode 100644 index 0000000000..53ede85f0f --- /dev/null +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/UnderlyingCookieStoreAccessTest.java @@ -0,0 +1,76 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2014-2017 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://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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 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.jersey.apache.connector; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.WebTarget; + +import org.glassfish.jersey.client.ClientConfig; + +import org.apache.http.client.CookieStore; +import org.junit.Test; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; + +/** + * Test of access to the underlying CookieStore instance used by the connector. + * + * @author Maksim Mukosey (mmukosey at gmail.com) + */ +public class UnderlyingCookieStoreAccessTest { + + @Test + public void testCookieStoreInstanceAccess() { + final Client client = ClientBuilder.newClient(new ClientConfig().connectorProvider(new ApacheConnectorProvider())); + final CookieStore csOnClient = ApacheConnectorProvider.getCookieStore(client); + // important: the web target instance in this test must be only created AFTER the client has been pre-initialized + // (see org.glassfish.jersey.client.Initializable.preInitialize method). This is here achieved by calling the + // connector provider's static getCookieStore method above. + final WebTarget target = client.target("http://localhost/"); + final CookieStore csOnTarget = ApacheConnectorProvider.getCookieStore(target); + + assertNotNull("CookieStore instance set on JerseyClient should not be null.", csOnClient); + assertNotNull("CookieStore instance set on JerseyWebTarget should not be null.", csOnTarget); + assertSame("CookieStore instance set on JerseyClient should be the same instance as the one set on JerseyWebTarget" + + "(provided the target instance has not been further configured).", csOnClient, csOnTarget); + } +} diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/UnderlyingHttpClientAccessTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/UnderlyingHttpClientAccessTest.java index eae49268c4..55d90a3ead 100644 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/UnderlyingHttpClientAccessTest.java +++ b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/UnderlyingHttpClientAccessTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.apache.connector; import javax.ws.rs.client.Client; @@ -72,8 +73,8 @@ public void testHttpClientInstanceAccess() { assertNotNull("HTTP client instance set on JerseyClient should not be null.", hcOnClient); assertNotNull("HTTP client instance set on JerseyWebTarget should not be null.", hcOnTarget); - assertSame("HTTP client instance set on JerseyClient should be the same instance as the one set on JerseyWebTarget" + - "(provided the target instance has not been further configured).", + assertSame("HTTP client instance set on JerseyClient should be the same instance as the one set on JerseyWebTarget" + + "(provided the target instance has not been further configured).", hcOnClient, hcOnTarget ); } diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/AuthenticationException.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/AuthenticationException.java deleted file mode 100644 index c672c2fe7a..0000000000 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/AuthenticationException.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2010-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 - * http://glassfish.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.jersey.apache.connector.ssl; - -/** - * A runtime exception representing a failure to provide correct authentication credentials. - * - * @author Pavel Bucek (pavel.bucek at oracle.com) - */ -public class AuthenticationException extends RuntimeException { - - public AuthenticationException(String message, String realm) { - super(message); - this.realm = realm; - } - - private String realm = null; - - public String getRealm() { - return this.realm; - } - -} \ No newline at end of file diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/AuthenticationExceptionMapper.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/AuthenticationExceptionMapper.java deleted file mode 100644 index 3d42572e2e..0000000000 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/AuthenticationExceptionMapper.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2010-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 - * http://glassfish.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.jersey.apache.connector.ssl; - -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; -import javax.ws.rs.ext.ExceptionMapper; -import javax.ws.rs.ext.Provider; - -/** - * Map an authentication exception to an HTTP 401 response, optionally including the realm for a credentials challenge at the client. - * - * @author Pavel Bucek (pavel.bucek at oracle.com) - */ -@Provider -public class AuthenticationExceptionMapper implements ExceptionMapper { - - public Response toResponse(AuthenticationException e) { - if (e.getRealm() != null) { - return Response. - status(Status.UNAUTHORIZED). - header("WWW-Authenticate", "Basic realm=\"" + e.getRealm() + "\""). - type("text/plain"). - entity(e.getMessage()). - build(); - } else { - return Response. - status(Status.UNAUTHORIZED). - type("text/plain"). - entity(e.getMessage()). - build(); - } - } - -} \ No newline at end of file diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/MainTest.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/MainTest.java deleted file mode 100644 index 4034814bac..0000000000 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/MainTest.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2010-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 - * http://glassfish.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.jersey.apache.connector.ssl; - -import java.io.InputStream; - -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.Response; - -import org.glassfish.jersey.SslConfigurator; -import org.glassfish.jersey.apache.connector.ApacheClientProperties; -import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; -import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; -import org.glassfish.jersey.filter.LoggingFilter; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import com.google.common.io.ByteStreams; - -/** - * @author Pavel Bucek (pavel.bucek at oracle.com) - * @author Arul Dhesiaseelan (aruld at acm.org) - */ -public class MainTest { - - @Before - public void setUp() throws Exception { - Server.startServer(); - } - - @After - public void tearDown() throws Exception { - Server.stopServer(); - } - - /** - * Test to see that the correct Http status is returned. - */ - @Test - public void testSSLWithAuth() throws Exception { - final InputStream trustStore = MainTest.class.getResourceAsStream("/truststore_client"); - final InputStream keyStore = MainTest.class.getResourceAsStream("/keystore_client"); - SslConfigurator sslConfig = SslConfigurator.newInstance() - .trustStoreBytes(ByteStreams.toByteArray(trustStore)) - .trustStorePassword("asdfgh") - .keyStoreBytes(ByteStreams.toByteArray(keyStore)) - .keyPassword("asdfgh"); - - ClientConfig cc = new ClientConfig(); - cc.property(ApacheClientProperties.SSL_CONFIG, sslConfig); - cc.connectorProvider(new ApacheConnectorProvider()); - - Client client = ClientBuilder.newClient(cc); - // client basic auth demonstration - client.register(HttpAuthenticationFeature.basic("user", "password")); - - WebTarget target = client.target(Server.BASE_URI); - target.register(new LoggingFilter()); - - final Response response = target.path("/").request().get(Response.class); - - assertEquals(200, response.getStatus()); - } - - /** - * Test to see that HTTP 401 is returned when client tries to GET without - * proper credentials. - */ - @Test - public void testHTTPBasicAuth1() throws Exception { - final InputStream trustStore = MainTest.class.getResourceAsStream("/truststore_client"); - final InputStream keyStore = MainTest.class.getResourceAsStream("/keystore_client"); - SslConfigurator sslConfig = SslConfigurator.newInstance() - .trustStoreBytes(ByteStreams.toByteArray(trustStore)) - .trustStorePassword("asdfgh") - .keyStoreBytes(ByteStreams.toByteArray(keyStore)) - .keyPassword("asdfgh"); - - - ClientConfig cc = new ClientConfig(); - cc.property(ApacheClientProperties.SSL_CONFIG, sslConfig); - cc.connectorProvider(new ApacheConnectorProvider()); - - Client client = ClientBuilder.newClient(cc); - - System.out.println("Client: GET " + Server.BASE_URI); - - WebTarget target = client.target(Server.BASE_URI); - target.register(new LoggingFilter()); - - Response response; - - response = target.path("/").request().get(Response.class); - - assertEquals(401, response.getStatus()); - } - - /** - * Test to see that SSLHandshakeException is thrown when client don't have - * trusted key. - */ - @Test - public void testSSLAuth1() throws Exception { - final InputStream trustStore = MainTest.class.getResourceAsStream("/truststore_client"); - SslConfigurator sslConfig = SslConfigurator.newInstance() - .trustStoreBytes(ByteStreams.toByteArray(trustStore)) - .trustStorePassword("asdfgh"); - - ClientConfig cc = new ClientConfig(); - cc.property(ApacheClientProperties.SSL_CONFIG, sslConfig); - cc.connectorProvider(new ApacheConnectorProvider()); - - Client client = ClientBuilder.newClient(cc); - - System.out.println("Client: GET " + Server.BASE_URI); - - WebTarget target = client.target(Server.BASE_URI); - target.register(new LoggingFilter()); - - boolean caught = false; - - try { - target.path("/").request().get(String.class); - } catch (Exception e) { - caught = true; - } - - assertTrue(caught); - } -} diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/RootResource.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/RootResource.java deleted file mode 100644 index 4b243a5bf0..0000000000 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/RootResource.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2010-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 - * http://glassfish.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.jersey.apache.connector.ssl; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; - -import org.glassfish.jersey.internal.util.Base64; - -/** - * Simple resource demonstrating low level approach of getting user credentials. - * - * Better way would be injecting {@link javax.ws.rs.core.SecurityContext}. - * - * @author Pavel Bucek (pavel.bucek at oracle.com) - */ -@Path("/") -public class RootResource { - - @GET - public String get1(@Context HttpHeaders headers) { - // you can get username form HttpHeaders - System.out.println("Service: GET / User: " + getUser(headers)); - - return Server.CONTENT; - } - - private String getUser(HttpHeaders headers) { - - // this is a very minimalistic and "naive" code; if you plan to use it - // add necessary checks (see org.glassfish.jersey.examples.httpsclientservergrizzly.authservergrizzly.SecurityFilter) - - String auth = headers.getRequestHeader("authorization").get(0); - - auth = auth.substring("Basic ".length()); - String[] values = new String(Base64.decodeAsString(auth)).split(":"); - - // String username = values[0]; - // String password = values[1]; - - return values[0]; - } -} \ No newline at end of file diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/SecurityFilter.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/SecurityFilter.java deleted file mode 100644 index b9b7b60a88..0000000000 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/SecurityFilter.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2010-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 - * http://glassfish.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.jersey.apache.connector.ssl; - -import java.io.IOException; -import java.security.Principal; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerRequestFilter; -import javax.ws.rs.container.PreMatching; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.Request; -import javax.ws.rs.core.SecurityContext; -import javax.ws.rs.core.UriInfo; -import javax.ws.rs.ext.Provider; - -import javax.inject.Inject; - -import org.glassfish.jersey.internal.util.Base64; -import org.glassfish.jersey.server.ContainerRequest; - -/** - * Simple authentication filter. - * - * Returns response with http status 401 when proper authentication is not provided in incoming request. - * - * @author Pavel Bucek (pavel.bucek at oracle.com) - * @see ContainerRequestFilter - */ -@Provider -@PreMatching -public class SecurityFilter implements ContainerRequestFilter { - - @Inject - javax.inject.Provider uriInfo; - public static final String REALM = "HTTPS Example authentication"; - - @Override - public void filter(ContainerRequestContext filterContext) throws IOException { - User user = authenticate(filterContext.getRequest()); - filterContext.setSecurityContext(new Authorizer(user)); - } - - private User authenticate(Request request) { - // Extract authentication credentials - String authentication = ((ContainerRequest) request).getHeaderString(HttpHeaders.AUTHORIZATION); - if (authentication == null) { - throw new AuthenticationException("Authentication credentials are required", REALM); - } - if (!authentication.startsWith("Basic ")) { - return null; - // additional checks should be done here - // "Only HTTP Basic authentication is supported" - } - authentication = authentication.substring("Basic ".length()); - String[] values = Base64.decodeAsString(authentication).split(":"); - if (values.length < 2) { - throw new WebApplicationException(400); - // "Invalid syntax for username and password" - } - String username = values[0]; - String password = values[1]; - if ((username == null) || (password == null)) { - throw new WebApplicationException(400); - // "Missing username or password" - } - - // Validate the extracted credentials - User user; - - if (username.equals("user") && password.equals("password")) { - user = new User("user", "user"); - System.out.println("USER AUTHENTICATED"); - // } else if (username.equals("admin") && password.equals("adminadmin")) { - // user = new User("admin", "admin"); - // System.out.println("ADMIN AUTHENTICATED"); - } else { - System.out.println("USER NOT AUTHENTICATED"); - throw new AuthenticationException("Invalid username or password\r\n", REALM); - } - return user; - } - - public class Authorizer implements SecurityContext { - - private User user; - private Principal principal; - - public Authorizer(final User user) { - this.user = user; - this.principal = new Principal() { - - public String getName() { - return user.username; - } - }; - } - - public Principal getUserPrincipal() { - return this.principal; - } - - public boolean isUserInRole(String role) { - return (role.equals(user.role)); - } - - public boolean isSecure() { - return "https".equals(uriInfo.get().getRequestUri().getScheme()); - } - - public String getAuthenticationScheme() { - return SecurityContext.BASIC_AUTH; - } - } - - public class User { - - public String username; - public String role; - - public User(String username, String role) { - this.username = username; - this.role = role; - } - } -} \ No newline at end of file diff --git a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/Server.java b/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/Server.java deleted file mode 100644 index 331a38ec2f..0000000000 --- a/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ssl/Server.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2010-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 - * http://glassfish.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.jersey.apache.connector.ssl; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.logging.Logger; - -import javax.ws.rs.core.UriBuilder; - -import org.glassfish.jersey.filter.LoggingFilter; -import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; -import org.glassfish.jersey.server.ResourceConfig; - -import org.glassfish.grizzly.http.server.HttpServer; -import org.glassfish.grizzly.ssl.SSLContextConfigurator; -import org.glassfish.grizzly.ssl.SSLEngineConfigurator; - -import com.google.common.io.ByteStreams; - -/** - * @author Pavel Bucek (pavel.bucek at oracle.com) - */ -public class Server { - - private static HttpServer webServer; - - private static final Logger LOGGER = Logger.getLogger(Server.class.getName()); - - public static final URI BASE_URI = getBaseURI(); - public static final String CONTENT = "JERSEY HTTPS EXAMPLE\n"; - - private static URI getBaseURI() { - return UriBuilder.fromUri("https://localhost/").port(getPort(4463)).build(); - } - - private static int getPort(int defaultPort) { - final String port = System.getProperty("jersey.config.test.container.port"); - if (null != port) { - try { - return Integer.parseInt(port); - } catch (NumberFormatException e) { - System.out.println("Value of jersey.config.test.container.port property" + - " is not a valid positive integer [" + port + "]." + - " Reverting to default [" + defaultPort + "]."); - } - } - return defaultPort; - } - - protected static void startServer() throws IOException { - final InputStream trustStore = Server.class.getResourceAsStream("/truststore_server"); - final InputStream keyStore = Server.class.getResourceAsStream("/keystore_server"); - - // Grizzly ssl configuration - SSLContextConfigurator sslContext = new SSLContextConfigurator(); - - // set up security context - sslContext.setKeyStoreBytes(ByteStreams.toByteArray(keyStore)); // contains server keypair - sslContext.setKeyStorePass("asdfgh"); - sslContext.setTrustStoreBytes(ByteStreams.toByteArray(trustStore)); // contains client certificate - sslContext.setTrustStorePass("asdfgh"); - - ResourceConfig rc = new ResourceConfig(); - rc.register(new LoggingFilter(LOGGER, true)); - rc.registerClasses(RootResource.class, SecurityFilter.class, AuthenticationExceptionMapper.class); - - try { - webServer = GrizzlyHttpServerFactory.createHttpServer( - getBaseURI(), - rc, - true, - new SSLEngineConfigurator(sslContext).setClientMode(false).setNeedClientAuth(true) - ); - - // start Grizzly embedded server // - System.out.println("Jersey app started. Try out " + BASE_URI + "\nHit CTRL + C to stop it..."); - webServer.start(); - - } catch (Exception ex) { - System.out.println(ex.getMessage()); - } - } - - protected static void stopServer() { - webServer.shutdownNow(); - } - - @SuppressWarnings("ResultOfMethodCallIgnored") - public static void main(String[] args) throws InterruptedException, IOException { - startServer(); - - System.in.read(); - } -} diff --git a/connectors/grizzly-connector/pom.xml b/connectors/grizzly-connector/pom.xml index 4a6a61777d..9c003c6343 100644 --- a/connectors/grizzly-connector/pom.xml +++ b/connectors/grizzly-connector/pom.xml @@ -3,19 +3,19 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2011-2014 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2011-2018 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 - http://glassfish.java.net/public/CDDL+GPL_1_1.html - or packager/legal/LICENSE.txt. See the License for the specific + https://oss.oracle.com/licenses/CDDL+GPL-1.1 + or 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. + file and include the License file at LICENSE.txt. GPL Classpath Exception: Oracle designates this particular file as subject to the "Classpath" @@ -40,13 +40,14 @@ holder. --> + 4.0.0 org.glassfish.jersey.connectors project - 2.12-SNAPSHOT + 2.28-SNAPSHOT jersey-grizzly-connector @@ -68,6 +69,10 @@ org.glassfish.grizzly grizzly-websockets + + org.glassfish.grizzly + connection-pool + org.glassfish.jersey.test-framework.providers @@ -76,7 +81,6 @@ pom test - diff --git a/connectors/grizzly-connector/src/main/java/org/glassfish/jersey/grizzly/connector/GrizzlyConnector.java b/connectors/grizzly-connector/src/main/java/org/glassfish/jersey/grizzly/connector/GrizzlyConnector.java index e98a4d0b32..7c863e967c 100644 --- a/connectors/grizzly-connector/src/main/java/org/glassfish/jersey/grizzly/connector/GrizzlyConnector.java +++ b/connectors/grizzly-connector/src/main/java/org/glassfish/jersey/grizzly/connector/GrizzlyConnector.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2010-2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.grizzly.connector; import java.io.ByteArrayOutputStream; @@ -46,6 +47,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -86,12 +88,10 @@ import com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider; import com.ning.http.util.ProxyUtils; -import jersey.repackaged.com.google.common.util.concurrent.SettableFuture; - /** * The transport using the AsyncHttpClient. * - * @author Stepan Kopriva (stepan.kopriva at oracle.com) + * @author Stepan Kopriva * @author Marek Potociar (marek.potociar at oracle.com) */ class GrizzlyConnector implements Connector { @@ -122,11 +122,11 @@ class GrizzlyConnector implements Connector { builder = builder.setExecutorService(executorService); - builder.setConnectionTimeoutInMs(ClientProperties.getValue(config.getProperties(), - ClientProperties.CONNECT_TIMEOUT, 0)); + builder.setConnectTimeout(ClientProperties.getValue(config.getProperties(), + ClientProperties.CONNECT_TIMEOUT, 10000)); - builder.setRequestTimeoutInMs(ClientProperties.getValue(config.getProperties(), - ClientProperties.READ_TIMEOUT, 0)); + builder.setRequestTimeout(ClientProperties.getValue(config.getProperties(), + ClientProperties.READ_TIMEOUT, 10000)); Object proxyUri; proxyUri = config.getProperty(ClientProperties.PROXY_URI); @@ -156,7 +156,7 @@ class GrizzlyConnector implements Connector { builder.setExecutorService(executorService); } - builder.setAllowPoolingConnection(true); + builder.setAllowPoolingConnections(true); if (client.getSslContext() != null) { builder.setSSLContext(client.getSslContext()); } @@ -193,15 +193,18 @@ public AsyncHttpClient getGrizzlyClient() { return grizzlyClient; } - /* - * Sends the {@link javax.ws.rs.core.Request} via Grizzly transport and returns the {@link javax.ws.rs.core.Response}. - */ + /** + * Sends the {@link javax.ws.rs.core.Request} via Grizzly transport and returns the {@link javax.ws.rs.core.Response}. + * + * @param request Jersey client request to be sent. + * @return received response. + */ @Override public ClientResponse apply(final ClientRequest request) { final Request connectorRequest = translate(request); final Map clientHeadersSnapshot = writeOutBoundHeaders(request.getHeaders(), connectorRequest); - final SettableFuture responseFuture = SettableFuture.create(); + final CompletableFuture responseFuture = new CompletableFuture<>(); final ByteBufferInputStream entityStream = new ByteBufferInputStream(); final AtomicBoolean futureSet = new AtomicBoolean(false); @@ -222,9 +225,9 @@ public STATE onHeadersReceived(HttpResponseHeaders headers) throws Exception { } HeaderUtils.checkHeaderChanges(clientHeadersSnapshot, request.getHeaders(), - GrizzlyConnector.this.getClass().getName()); + GrizzlyConnector.this.getClass().getName()); - responseFuture.set(translate(request, this.status, headers, entityStream)); + responseFuture.complete(translate(request, this.status, headers, entityStream)); return STATE.CONTINUE; } @@ -246,14 +249,12 @@ public void onThrowable(Throwable t) { if (futureSet.compareAndSet(false, true)) { t = t instanceof IOException ? new ProcessingException(t.getMessage(), t) : t; - responseFuture.setException(t); + responseFuture.completeExceptionally(t); } } }); return responseFuture.get(); - } catch (IOException ex) { - throw new ProcessingException(ex.getMessage(), ex.getCause()); } catch (ExecutionException ex) { Throwable e = ex.getCause() == null ? ex : ex.getCause(); throw new ProcessingException(e.getMessage(), e); @@ -288,8 +289,13 @@ public STATE onHeadersReceived(HttpResponseHeaders headers) throws Exception { HeaderUtils.checkHeaderChanges(clientHeadersSnapshot, request.getHeaders(), GrizzlyConnector.this.getClass().getName()); - - callback.response(translate(request, this.status, headers, entityStream)); + // hand-off to grizzly's application thread pool for response processing + processResponse(new Runnable() { + @Override + public void run() { + callback.response(translate(request, status, headers, entityStream)); + } + }); return STATE.CONTINUE; } @@ -315,8 +321,6 @@ public void onThrowable(Throwable t) { } } }); - } catch (IOException ex) { - failure = new ProcessingException(ex.getMessage(), ex.getCause()); } catch (Throwable t) { failure = t; } @@ -324,9 +328,9 @@ public void onThrowable(Throwable t) { if (callbackInvoked.compareAndSet(false, true)) { callback.failure(failure); } - final SettableFuture errorFuture = SettableFuture.create(); - errorFuture.setException(failure); - return errorFuture; + CompletableFuture future = new CompletableFuture<>(); + future.completeExceptionally(failure); + return future; } @Override @@ -383,12 +387,11 @@ private com.ning.http.client.Request translate(final ClientRequest requestContex if (entityProcessing == RequestEntityProcessing.BUFFERED) { byte[] entityBytes = bufferEntity(requestContext); builder = builder.setBody(entityBytes); - } else if (entityProcessing == RequestEntityProcessing.CHUNKED) { + } else { final FeedableBodyGenerator bodyGenerator = new FeedableBodyGenerator(); - final Integer chunkSize = requestContext.resolveProperty(ClientProperties.CHUNKED_ENCODING_SIZE, 0); - if (chunkSize > 0) { - bodyGenerator.setMaxPendingBytes(chunkSize); - } + final Integer chunkSize = requestContext.resolveProperty( + ClientProperties.CHUNKED_ENCODING_SIZE, ClientProperties.DEFAULT_CHUNK_SIZE); + bodyGenerator.setMaxPendingBytes(chunkSize); final FeedableBodyGenerator.Feeder feeder = new FeedableBodyGenerator.SimpleFeeder(bodyGenerator) { @Override public void flush() throws IOException { @@ -404,8 +407,6 @@ public OutputStream getOutputStream(int contentLength) throws IOException { }); bodyGenerator.setFeeder(feeder); builder.setBody(bodyGenerator); - } else { - builder.setBody(getEntityWriter(requestContext)); } } @@ -419,6 +420,15 @@ public OutputStream getOutputStream(int contentLength) throws IOException { return builder.build(); } + /** + * Submits the response processing on Grizzly client's application thread pool. + * + * @param responseTask task to be processed on application thread pool. + */ + private void processResponse(Runnable responseTask) { + this.grizzlyClient.getConfig().executorService().submit(responseTask); + } + /** * Utility OutputStream implementation that can feed Grizzly chunk-encoded body generator. */ @@ -486,22 +496,6 @@ private static Map writeOutBoundHeaders(final MultivaluedMap * Send 3 async POST requests and wait to receive the responses. Check the response content and * assert that the operation did not take more than twice as long as a single long operation duration * (this ensures async request execution). diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/CustomizersTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/CustomizersTest.java index 391808d5b2..813b414861 100644 --- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/CustomizersTest.java +++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/CustomizersTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.grizzly.connector; import javax.ws.rs.HeaderParam; diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/FollowRedirectsTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/FollowRedirectsTest.java index 5fee8483d8..cbebbb815c 100644 --- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/FollowRedirectsTest.java +++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/FollowRedirectsTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2012-2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.grizzly.connector; import java.io.IOException; diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/HttpHeadersTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/HttpHeadersTest.java index 4b0a454e48..f287cd3474 100644 --- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/HttpHeadersTest.java +++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/HttpHeadersTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2010-2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.grizzly.connector; import javax.ws.rs.HeaderParam; @@ -56,7 +57,7 @@ /** * Tests the headers. * - * @author Stepan Kopriva (stepan.kopriva at oracle.com) + * @author Stepan Kopriva */ public class HttpHeadersTest extends JerseyTest{ @Path("/test") diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/HugeEntityTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/HugeEntityTest.java deleted file mode 100644 index 4c01745e6f..0000000000 --- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/HugeEntityTest.java +++ /dev/null @@ -1,202 +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 - * http://glassfish.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.jersey.grizzly.connector; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; -import java.util.concurrent.Future; - -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.Application; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.MessageBodyWriter; - -import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.client.ClientProperties; -import org.glassfish.jersey.client.RequestEntityProcessing; -import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.test.JerseyTest; - -import org.junit.Test; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.MatcherAssert.assertThat; - -/** - * Test to make sure huge entity gets chunk-encoded. - * - * @author Jakub Podlesak (jakub.podlesak at oracle.com) - */ -public class HugeEntityTest extends JerseyTest { - - private static final int BUFFER_LENGTH = 1024 * 1024; // 1M - private static final long HUGE_DATA_LENGTH = 20l*1024l*1024l*1024l; // 20G seems sufficient - - /** - * JERSEY-2337 reproducer. The resource is used to check the right amount of data - * is being received from the client and also gives us ability to check we receive - * correct data. - */ - @Path("/") - public static class ConsumerResource { - - /** - * Return back the count of bytes received. - * This way, we should be able to consume a huge amount of data. - */ - @POST - @Path("size") - public String post(InputStream in) throws IOException { - - long totalBytesRead = 0l; - - byte[] buffer = new byte[BUFFER_LENGTH]; - int read = -1; - do { - read = in.read(buffer); - if (read > 0) { - totalBytesRead += read; - } - } while (read != -1); - - return String.valueOf(totalBytesRead); - } - - @POST - @Path("echo") - public String echo(String s) { - return s; - } - } - - @Override - protected Application configure() { - return new ResourceConfig(ConsumerResource.class); - } - - @Override - protected void configureClient(ClientConfig config) { - config.register(TestEntityWriter.class); - config.property(ClientProperties.REQUEST_ENTITY_PROCESSING, RequestEntityProcessing.CHUNKED); - config.connectorProvider(new GrizzlyConnectorProvider()); - } - - public static class TestEntity { - final long size; - - public TestEntity(long size) { - this.size = size; - } - } - - /** - * Utility writer that generates that many zero bytes as given by the input entity size field. - */ - public static class TestEntityWriter implements MessageBodyWriter { - - @Override - public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { - return type == TestEntity.class; - } - - @Override - public long getSize(TestEntity t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { - return -1; // no matter what we return here, the output will get chunk-encoded - } - - @Override - public void writeTo(TestEntity t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { - - final byte[] buffer = new byte[BUFFER_LENGTH]; - final long bufferCount = t.size / BUFFER_LENGTH; - final int remainder = (int)(t.size % BUFFER_LENGTH); - - for (long b=0; b 0) { - entityStream.write(buffer, 0, remainder); - } - } - } - - /** - * JERSEY-2337 reproducer. We are going to send huge amount of data over the wire. - * Should not the data have been chunk-encoded, we would easily run out of memory. - * - * @throws Exception in case of a test error. - */ - @Test - public void testPost() throws Exception { - Response response = target("/size").request().post(Entity.entity(new TestEntity(HUGE_DATA_LENGTH), MediaType.APPLICATION_OCTET_STREAM_TYPE)); - String content = response.readEntity(String.class); - assertThat(Long.parseLong(content), equalTo(HUGE_DATA_LENGTH)); - - // just to check the right data have been transfered. - response = target("/echo").request().post(Entity.text("Hey Sync!")); - assertThat(response.readEntity(String.class), equalTo("Hey Sync!")); - } - - /** - * JERSEY-2337 reproducer. We are going to send huge amount of data over the wire. This time in an async fashion. - * Should not the data have been chunk-encoded, we would easily run out of memory. - * - * @throws Exception in case of a test error. - */ - @Test - public void testAsyncPost() throws Exception { - Future response = target("/size").request().async().post(Entity.entity(new TestEntity(HUGE_DATA_LENGTH), MediaType.APPLICATION_OCTET_STREAM_TYPE)); - final String content = response.get().readEntity(String.class); - assertThat(Long.parseLong(content), equalTo(HUGE_DATA_LENGTH)); - - // just to check the right data have been transfered. - response = target("/echo").request().async().post(Entity.text("Hey Async!")); - assertThat(response.get().readEntity(String.class), equalTo("Hey Async!")); - } -} \ No newline at end of file diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/MethodTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/MethodTest.java deleted file mode 100644 index efdbed82e2..0000000000 --- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/MethodTest.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2010-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 - * http://glassfish.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.jersey.grizzly.connector; - -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.Application; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.test.JerseyTest; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -/** - * Tests the Http methods. - * - * @author Stepan Kopriva (stepan.kopriva at oracle.com) - */ -public class MethodTest extends JerseyTest { - - private static final String PATH = "test"; - - @Path("/test") - public static class HttpMethodResource { - @GET - public String get() { - return "GET"; - } - - @POST - public String post(String entity) { - return entity; - } - - @PUT - public String put(String entity) { - return entity; - } - - @DELETE - public String delete() { - return "DELETE"; - } - } - - @Override - protected Application configure() { - return new ResourceConfig(HttpMethodResource.class); - } - - @Override - protected void configureClient(ClientConfig config) { - config.connectorProvider(new GrizzlyConnectorProvider()); - } - - @Test - public void testGet() { - Response response = target(PATH).request().get(); - assertEquals("GET", response.readEntity(String.class)); - } - - @Test - public void testPost() { - Response response = target(PATH).request().post(Entity.entity("POST",MediaType.TEXT_PLAIN)); - assertEquals("POST", response.readEntity(String.class)); - } - - @Test - public void testPut() { - Response response = target(PATH).request().put(Entity.entity("PUT", MediaType.TEXT_PLAIN)); - assertEquals("PUT", response.readEntity(String.class)); - } - - @Test - public void testDelete() { - Response response = target(PATH).request().delete(); - assertEquals("DELETE", response.readEntity(String.class)); - } -} diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/NoEntityTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/NoEntityTest.java index f1b0894216..55912752d6 100644 --- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/NoEntityTest.java +++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/NoEntityTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.grizzly.connector; import java.util.logging.Logger; @@ -50,14 +51,14 @@ import javax.ws.rs.core.Response.Status; import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; import org.junit.Test; /** - * @author Paul Sandoz (paul.sandoz at oracle.com) + * @author Paul Sandoz * @author Arul Dhesiaseelan (aruld at acm.org) * @author Marek Potociar (marek.potociar at oracle.com) */ @@ -79,7 +80,7 @@ public void post(String entity) { @Override protected Application configure() { ResourceConfig config = new ResourceConfig(HttpMethodResource.class); - config.register(new LoggingFilter(LOGGER, true)); + config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY)); return config; } diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/ParallelTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/ParallelTest.java index cc5ebb6805..802cba38bf 100644 --- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/ParallelTest.java +++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/ParallelTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2010-2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.grizzly.connector; import java.util.concurrent.BrokenBarrierException; @@ -68,7 +69,7 @@ /** * Tests the parallel execution of multiple requests. * - * @author Stepan Kopriva (stepan.kopriva at oracle.com) + * @author Stepan Kopriva */ public class ParallelTest extends JerseyTest { private static final Logger LOGGER = Logger.getLogger(ParallelTest.class.getName()); diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TimeoutTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TimeoutTest.java index 8d6166f29e..fa595917e8 100644 --- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TimeoutTest.java +++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TimeoutTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2012-2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.grizzly.connector; import java.util.concurrent.TimeoutException; @@ -56,9 +57,10 @@ import static org.hamcrest.CoreMatchers.instanceOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; /** - * @author Martin Matula (martin.matula at oracle.com) + * @author Martin Matula */ public class TimeoutTest extends JerseyTest { @Path("/test") @@ -102,6 +104,7 @@ public void testFast() { public void testSlow() { try { target("test/timeout").request().get(); + fail("Timeout expected."); } catch (ProcessingException e) { assertThat("Unexpected processing exception cause", e.getCause(), instanceOf(TimeoutException.class)); diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TraceSupportTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TraceSupportTest.java index 20afb5a9e3..58c999e242 100644 --- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TraceSupportTest.java +++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/TraceSupportTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.grizzly.connector; import java.lang.annotation.ElementType; @@ -61,7 +62,7 @@ import javax.ws.rs.core.Response; import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.process.Inflector; import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.ResourceConfig; @@ -113,7 +114,7 @@ public String trace(Request request) { @Override protected Application configure() { ResourceConfig config = new ResourceConfig(TracingResource.class); - config.register(new LoggingFilter(LOGGER, true)); + config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY)); final Resource.Builder resourceBuilder = Resource.builder(ROOT_PATH_PROGRAMMATIC); resourceBuilder.addMethod(TRACE.NAME).handledBy(new Inflector() { @@ -140,7 +141,7 @@ public Response apply(ContainerRequestContext request) { private WebTarget prepareTarget(String path) { final WebTarget target = target(); - target.register(LoggingFilter.class); + target.register(LoggingFeature.class); return target.path(path); } diff --git a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/UnderlyingHttpClientAccessTest.java b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/UnderlyingHttpClientAccessTest.java index aea5e1ec14..9aa33dea72 100644 --- a/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/UnderlyingHttpClientAccessTest.java +++ b/connectors/grizzly-connector/src/test/java/org/glassfish/jersey/grizzly/connector/UnderlyingHttpClientAccessTest.java @@ -1,19 +1,19 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014-2017 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 - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific + * https://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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. + * file and include the License file at LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ + package org.glassfish.jersey.grizzly.connector; import javax.ws.rs.client.Client; @@ -73,8 +74,8 @@ public void testHttpClientInstanceAccess() { assertNotNull("HTTP client instance set on JerseyClient should not be null.", hcOnClient); assertNotNull("HTTP client instance set on JerseyWebTarget should not be null.", hcOnTarget); - assertSame("HTTP client instance set on JerseyClient should be the same instance as the one set on JerseyWebTarget" + - "(provided the target instance has not been further configured).", + assertSame("HTTP client instance set on JerseyClient should be the same instance as the one set on JerseyWebTarget" + + "(provided the target instance has not been further configured).", hcOnClient, hcOnTarget ); } diff --git a/connectors/jdk-connector/pom.xml b/connectors/jdk-connector/pom.xml new file mode 100644 index 0000000000..79a54842cc --- /dev/null +++ b/connectors/jdk-connector/pom.xml @@ -0,0 +1,103 @@ + + + + + 4.0.0 + + + org.glassfish.jersey.connectors + project + 2.28-SNAPSHOT + + + jersey-jdk-connector + jar + jersey-connectors-jdk + + Jersey Client Transport via JDK connector + + + UTF-8 + + + + + org.glassfish.jersey.containers + jersey-container-grizzly2-http + ${project.version} + test + + + + org.glassfish.jersey.test-framework.providers + jersey-test-framework-provider-grizzly2 + ${project.version} + test + + + + + + + com.sun.istack + maven-istack-commons-plugin + true + + + org.codehaus.mojo + build-helper-maven-plugin + true + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.felix + maven-bundle-plugin + true + + + + + diff --git a/connectors/jdk-connector/src/main/java/org/glassfish/jersey/jdk/connector/JdkConnectorProperties.java b/connectors/jdk-connector/src/main/java/org/glassfish/jersey/jdk/connector/JdkConnectorProperties.java new file mode 100644 index 0000000000..f209945849 --- /dev/null +++ b/connectors/jdk-connector/src/main/java/org/glassfish/jersey/jdk/connector/JdkConnectorProperties.java @@ -0,0 +1,172 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2017 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://oss.oracle.com/licenses/CDDL+GPL-1.1 + * or 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 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.jersey.jdk.connector; + +import java.net.CookiePolicy; +import java.util.Map; + +import org.glassfish.jersey.internal.util.PropertiesClass; +import org.glassfish.jersey.internal.util.PropertiesHelper; + +/** + * Configuration options specific to {@link org.glassfish.jersey.jdk.connector.internal.JdkConnector}. + * + * @author Adam Lindenthal (adam.lindenthal at oracle.com) + */ +@PropertiesClass +public final class JdkConnectorProperties { + + /** + * Configuration of the connector thread pool. + *

    + * An instance of {@link org.glassfish.jersey.jdk.connector.internal.ThreadPoolConfig} is expected. + */ + public static final String WORKER_THREAD_POOL_CONFIG = "jersey.config.client.JdkConnectorProvider.workerThreadPoolConfig"; + + /** + * Container idle timeout in milliseconds ({@link Integer} value). + *

    + * When the timeout elapses, the shared thread pool will be destroyed. + *

    + * The default value is {@value #DEFAULT_CONNECTION_CLOSE_WAIT} + */ + public static final String CONTAINER_IDLE_TIMEOUT = "jersey.config.client.JdkConnectorProvider.containerIdleTimeout"; + + /** + * A configurable property of HTTP parser. It defines the maximal acceptable size of HTTP response initial line, + * each header and chunk header. + *

    + * The default value is {@value #DEFAULT_MAX_HEADER_SIZE} + */ + public static final String MAX_HEADER_SIZE = "jersey.config.client.JdkConnectorProvider.maxHeaderSize"; + + /** + * The maximal number of redirects during single request. + *

    + * Value is expected to be positive {@link Integer}. Default value is {@value #DEFAULT_MAX_REDIRECTS}. + *

    + * HTTP redirection must be enabled by property {@link org.glassfish.jersey.client.ClientProperties#FOLLOW_REDIRECTS}, + * otherwise {@code MAX_HEADER_SIZE} is not applied. + * + * @see org.glassfish.jersey.client.ClientProperties#FOLLOW_REDIRECTS + * @see org.glassfish.jersey.jdk.connector.internal.RedirectException + */ + public static final String MAX_REDIRECTS = "jersey.config.client.JdkConnectorProvider.maxRedirects"; + + /** + * To set the cookie policy of this cookie manager. + *

    + * The default value is ACCEPT_ORIGINAL_SERVER. + * + * @see java.net.CookieManager + */ + public static final String COOKIE_POLICY = "jersey.config.client.JdkConnectorProvider.cookiePolicy"; + + /** + * A maximal number of open connection to each destination. A destination is determined by the following triple: + *